Livia Zhu created SPARK-54389:
---------------------------------

             Summary: Fix RocksDB State Store Invalid Stamp error when task is 
marked as failed during initialization
                 Key: SPARK-54389
                 URL: https://issues.apache.org/jira/browse/SPARK-54389
             Project: Spark
          Issue Type: Improvement
          Components: Structured Streaming
    Affects Versions: 4.2.0
            Reporter: Livia Zhu


Invalid stamp error will be thrown in the following situation:
 # Stateful task begins, begins initializing state store and grabs a stamp

 # Another task sets {{markTaskFailed}} for the stateful task

 # StateStore is initialized, 
[setting|https://sourcegraph.prod.databricks-corp.com/databricks-eng/runtime/-/blob/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDBStateStoreProvider.scala?L192]
 the taskCompletion and taskFailure listeners. Since the task was marked as 
failed, these listeners are invoked immediately, releasing the stamp. However, 
since no failure is thrown, the StateStore initialization completes.

 # Stateful task continues to call the {{iterator}} method on the returned 
StateStore. Since the stamp is invalid, {{StateStoreErrors.invalidStamp}} is 
thrown.

To prevent this error, we should check if the task is failed after setting the 
listeners and fail the StateStore initialization if so.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to