Skip to content

Conversation

@hemantk-12
Copy link
Contributor

@hemantk-12 hemantk-12 commented Aug 1, 2024

What changes were proposed in this pull request?

In HDDS-10590, we introduce the locks to achieve synchronization among snapshot purge, set snapshot property, and SSTFilteringService because SSTFilteringService was directly updating the snapshotInfo table and might be causing the snapshot chain corruption.

In HDDS-11068, we found that the snapshot chain corruption issue still exists even after the locks. And the actual reason is that SSTFilteringService directly updates the DB and persists it. More details in HDDS-11068.

In a fix #6965 for HDDS-11068, we removed the logic to persist sstFiltered flag in snapshotInfoTable. Now we create a touch file in snapshot dir which is local to OM node.
Since all the other operations updating snapshotInfoTable go through Ratis, we can rely on OM state machine for the synchronization and remove the unnecessary locking.

What is the link to the Apache JIRA

HDDS-11137

How was this patch tested?

Existing tests.

@hemantk-12 hemantk-12 added the snapshot https://issues.apache.org/jira/browse/HDDS-6517 label Aug 1, 2024
@hemantk-12 hemantk-12 force-pushed the HDDS-11137 branch 3 times, most recently from e85485d to 343a702 Compare August 6, 2024 21:49
@hemantk-12 hemantk-12 marked this pull request as ready for review August 7, 2024 06:11
@swamirishi
Copy link
Contributor

But it wouldn't hurt to have the locking right? Since future changes could still impact this right? Any particular reason why we are removing the locks?

@hemantk-12
Copy link
Contributor Author

hemantk-12 commented Aug 14, 2024

But it wouldn't hurt to have the locking right? Any particular reason why we are removing the locks?

Yes, it is not causing any issues. But these locks are unnecessary right now and are just increasing the complexity.

As mentioned in the description, these locks were added mainly because SSTFilteringService was updating SnapshotInfoTable directly, HDDS-10590. But, in HDDS-11068, we figured that even after adding the locks, it didn't solve the problem and the snapshot chain corruption issue persisted if OM crashed and the double buffer was not flushed.

Since future changes could still impact this right?

As long as any update to SnapshotInfoTable goes through Ratis, we don't need these locks.

Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @hemantk-12 The patch looks good to me. Do you think we can add some sort of test case here for this change?

@hemantk-12
Copy link
Contributor Author

Do you think we can add some sort of test case here for this change?

Can't think of anything on top of my head but I can create a follow up task for it?

@hemantk-12 hemantk-12 merged commit ad7b8db into apache:master Aug 15, 2024
xichen01 pushed a commit to xichen01/ozone that referenced this pull request Sep 16, 2024
@hemantk-12 hemantk-12 deleted the HDDS-11137 branch October 28, 2024 18:40
ptlrs pushed a commit to ptlrs/ozone that referenced this pull request Mar 8, 2025
…e#134)

* CDPD-72019. HDDS-11137. Removed locks from SnapshotPurge and SnapshotSetProperty APIs. (apache#7018)

(cherry picked from commit ad7b8db)

* CDPD-60647. HDDS-9198. Maintain local cache in OMSnapshotPurgeRequest to get updated snapshotInfo and pass the same to OMSnapshotPurgeResponse (apache#7045)

(cherry picked from commit be34303)

* CDPD-72076. HDDS-11152. OMDoubleBuffer error when handling snapshot's background operations (apache#7112)

(cherry picked from commit 23f3e5b)

---------

Co-authored-by: Hemant Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants