[SPARK-57052][SS] Add state row format validation to multiGet in RocksDBStateStoreProvider#56097
Open
yadavay-amzn wants to merge 1 commit into
Open
[SPARK-57052][SS] Add state row format validation to multiGet in RocksDBStateStoreProvider#56097yadavay-amzn wants to merge 1 commit into
yadavay-amzn wants to merge 1 commit into
Conversation
…sDBStateStoreProvider ### What changes were proposed in this pull request? Add `validateStateRowFormat` to `multiGet()` in `RocksDBStateStoreProvider`, consistent with existing validation in `get()`, `iterator()`, `prefixScan()`, and `rangeScan()`. ### Why are the changes needed? `multiGet()` decodes values via `kvEncoder._2.decodeValue` but never calls `validateStateRowFormat`. If a stateful operator evolves its schema between restarts, `multiGet()` will silently return corrupted data instead of failing fast with `StateStoreValueRowFormatValidationFailure`. All other read-path methods that decode rows already perform this validation. `multiGet()` is the only inconsistency. ### Does this PR introduce _any_ user-facing change? No. The validation is gated behind the existing `spark.sql.streaming.stateStore.formatValidation.enabled` config (default: true in testing mode). ### How was this patch tested? Added test in `RocksDBStateStoreSuite` that writes data with one schema, reopens with a mismatched schema, and verifies `multiGet()` throws `StateStoreValueRowFormatValidationFailure`. The test follows the same pattern as the existing SPARK-56539 tests for `prefixScan` and `rangeScan`. ### Was this patch authored or co-authored using generative AI tooling? Yes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Add
validateStateRowFormattomultiGet()inRocksDBStateStoreProvider, consistent with existing validation inget(),iterator(),prefixScan(), andrangeScan().Why are the changes needed?
multiGet()decodes values viakvEncoder._2.decodeValuebut never callsvalidateStateRowFormat. If a stateful operator evolves its schema between restarts,multiGet()will silently return corrupted data instead of failing fast withStateStoreValueRowFormatValidationFailure.All other read-path methods that decode rows already perform this validation.
multiGet()is the only inconsistency:get()iterator()prefixScan()rangeScan()multiGet()Does this PR introduce any user-facing change?
No. The validation is gated behind the existing
spark.sql.streaming.stateStore.formatValidation.enabledconfig (default: true in testing mode).How was this patch tested?
Added test in
RocksDBStateStoreSuitethat writes data with one schema, reopens with a mismatched schema, and verifiesmultiGet()throwsStateStoreValueRowFormatValidationFailure. The test follows the same pattern as the existing SPARK-56539 tests forprefixScanandrangeScan.multiGet()silently returns corrupted rowsStateStoreValueRowFormatValidationFailurethrown on first decoded valueWas this patch authored or co-authored using generative AI tooling?
Generated by: Claude Opus 4.7