System Response After a Map/Reduce Interruption
A map/reduce script can be interrupted at any time. For example, an application server disruption immediately stops the script. An uncaught error also stops the current function invocation, even if it's incomplete.
For more details, review the following sections:
Regardless of the script configuration, include logic to check for restarts. If the script has been restarted, prevent duplicate processing. For details, see Adding Logic to Handle Map/Reduce Restarts.
System Response After an Application-Server Disruption
An application disruption can happen due to a NetSuite update, maintenance, or execution environment failure. After the application server restarts, the script restarts, resuming the same stage it was in when interrupted.
When an application server restart interrupts the map or reduce stage, the system writes the SSS_APP_SERVER_RESTART error code to the relevant iterators. This error code is displayed with any uncaught error codes that were thrown.
For more details, see the following table.
Stage where interruption occurred |
Script behavior |
SSS_APP_SERVER_RESTART error code written to |
---|---|---|
getInputData |
The script stops executing when disrupted. The system restarts the function after the application server restarts. |
— |
map |
The script stops executing when disrupted. Any data that was saved during the previous invocation by using the context.write() method is discarded. Afterward, the response is as follows:
|
|
reduce |
|
|
summarize |
When the disruption occurs, the entire script stops executing. After the application server restarts, the system restarts the function. |
— |
System Response After an Uncaught Error
An uncaught error doesn't necessarily stop the script, but it can disrupt its work. Some of this behavior can be configured. For details, see the following table.
Stage where error occurred |
Script behavior |
Errors written to |
---|---|---|
getInputData |
The script ends the function invocation and exits the stage. It goes directly to the summarize stage. This behavior cannot be configured. |
|
map |
The function invocation ends when an error occurs, even if incomplete. Any data that was saved during the invocation by using the context.write() method is discarded. Afterward, the system responds as follows:
|
|
reduce |
|
|
summarize |
The script stops executing. This behavior cannot be configured. |
— |
This table describes the behavior for the majority of errors, but a few errors result in different behavior. For example, if one of the jobs being processed in the map or reduce stage fails on SSS_USAGE_LIMIT_EXCEEDED, other jobs in Processing status are normally finished and their executions are not interrupted, but jobs in Pending status are canceled immediately. For details, see Hard Limits on Total Persisted Data.