-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-51724][SS] RocksDB StateStore's lineage manager should be synchronized #50520
Conversation
lineage = lineage :+ item | ||
} | ||
|
||
def resetLineage(newLineage: Array[LineageItem]): Unit = { | ||
def truncateFromVersion(versionToKeep: Long): Unit = synchronized { | ||
resetLineage(getLineageForCurrVersion().filter(i => i.version >= versionToKeep)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any other places where these 2 operations were split ?
@@ -1467,8 +1467,7 @@ class RocksDB( | |||
// This is relative aggressive because that even if the uploading succeeds, | |||
// it is not necessarily the one written to the commit log. But we can always load lineage | |||
// from commit log so it is fine. | |||
lineageManager.resetLineage(lineageManager.getLineageForCurrVersion() | |||
.filter(i => i.version >= snapshot.version)) | |||
lineageManager.truncateFromVersion(snapshot.version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess its not easily possible. But any way to add a test to verify correctness across threads here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
It seems OK with handling the above comments as post review if these are addressable. Thanks! Merging to master/4.0. |
…hronized ### Why are the changes needed? RocksDB State Store's Lineage Manager currently isn't synchronized, but it can be accessed by both DB loading and maintenance thread. In theory, it can cause wrong lineage: 1. maintenance thread get current lineage 2. task commit() adds a lineage from the lienage 3. maintenance thread does the truncation and store it back In this case, the new lineage added by 2. is lost. It should be fixed by simply synchronizing those operations. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Run existing unit tests ### Was this patch authored or co-authored using generative AI tooling? No. Closes #50520 from siying/lineagemanagerrace. Authored-by: Siying Dong <[email protected]> Signed-off-by: Jungtaek Lim <[email protected]> (cherry picked from commit 187adb8) Signed-off-by: Jungtaek Lim <[email protected]>
Why are the changes needed?
RocksDB State Store's Lineage Manager currently isn't synchronized, but it can be accessed by both DB loading and maintenance thread. In theory, it can cause wrong lineage:
In this case, the new lineage added by 2. is lost.
It should be fixed by simply synchronizing those operations.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Run existing unit tests
Was this patch authored or co-authored using generative AI tooling?
No.