[FLINK-23886][runtime] Fix null column family handle in RocksDBFullRestoreOperation #27584
+377
−7
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 is the purpose of the change
During full snapshot restore,
RocksDBFullRestoreOperation.restoreKVStateData()did not check for null after looking up aColumnFamilyHandlebykvStateId. If the checkpoint stream contained an unknownkvStateId, data would be written to a null handle, causing silent data corruption where ListState data could land in timer column families, leading toEOFExceptionduring deserialization.This adds a null check that throws
IllegalStateExceptionwith diagnostic info (kvStateId, registered state count, state names/types), mirroring the pattern already used inRocksDBHeapTimersFullRestoreOperation. Also improves the error message in the sibling class to include the same diagnostic detail.Additionally enhances
RocksDBCachingPriorityQueueSet.deserializeElement()with payload length validation and detailed error messages (byte lengths, hex dump, corruption hint) to make deserialization failures easier to diagnose.Brief change log
ColumnFamilyHandleinRocksDBFullRestoreOperation.restoreKVStateData()that throwsIllegalStateExceptionwith diagnostic contextRocksDBHeapTimersFullRestoreOperation.restoreKVStateData()to include the same diagnostic detail (state id, count, registered state names/types)RocksDBCachingPriorityQueueSet.deserializeElement()before deserializationVerifying this change
This change added tests and can be verified as follows:
RocksDBFullRestoreOperationTest.testFullSnapshotRestorePreservesStateIsolation-- creates a backend with both ValueState and timer priority queue, takes a full snapshot, restores, and verifies each state's data is correctly isolated in its own column familyRocksDBFullRestoreOperationTest.testSnapshotRestoreSnapshotRoundTrip-- double snapshot-restore round-trip to catch latent corruption that may not surface until the second checkpoint cycleRocksDBRecoveryTesttests pass with no regressionsDoes this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation