mapContext.isRestarted

Property Description

Indicates whether the map(mapContext) function has been invoked previously for the current key-value pair.

For an overview of events that can cause a restart, see System Response After a Map/Reduce Interruption.

When the map function is restarted for a key-value pair, data previously written by the incomplete function is deleted. However, some of the function’s logic might have been executed before the function invocation was interrupted. For that reason, if the mapContext.isRestarted value is true, your script should take the necessary actions to avoid duplicate processing. For examples, see Adding Logic to Handle Map/Reduce Restarts.

Related properties include mapContext.executionNo and mapContext.errors.

Type

boolean

Since

2016.1

Syntax

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see Map/Reduce Script Samples.

          // Add additional code.
...
function map(context) {
    if (context.isRestarted)
    {
        // Add logic designed to assess how much processing was completed for this key-value pair and react accordingly. 
    }
    else
    {
        // Let full processing continue for the key-value pair.
    }
  ...
// Add additional code. 

        

Related Topics

mapContext
mapContext.executionNo
mapContext.errors
mapContext.key
mapContext.value
mapContext.write(options)

General Notices