Repository navigation
HDDS-16880. Recon should not retain incomplete OM DB checkpoint - #11563
Conversation
…eckpoint untar, so its retry from the same OM leader builds a DB with a truncated SST Co-Authored-By: Claude <noreply@anthropic.com>
smengcl
left a comment
There was a problem hiding this comment.
+1. Thanks @ArafatKhan2198 for the patch.
|
Thanks @ArafatKhan2198 for posting this. |
|
@smengcl @ArafatKhan2198 I wanted to have a review of this PR, so added myself as reviewer. So here are 2 points:
Example The leader's DB has 10 SST files, 1 GB each: F1 … F10. The leader stops sending in the middle of F4. First attempt:
Recon's candidate dir now holds F1, F2, F3. Retry on the next sync cycle:
So resume saves 3 GB of the 10 GB. Why I called it "a little"
IMO, For this case, resume saves some download time, depending on where the cut happened. For the more likely case, Recon's disk filling up, it saves almost nothing and keeps the space in use. That's why I'd still go with wiping on failure for Recon as it works in OM today or else if we still think, we can save some transfer with best case of cut, we should change in base method of OM rather specifically override for Recon. Keeping the OM and Recon logic as was before PR is recommended, so that logic doesn't drift for same OM db snapshot transfer either by OM follower or by Recon. No need to have separate overridden logic. |
|
@devmadhuu Agreed. Addendum PR opened: #11624 |
What changes were proposed in this pull request?
Problem
Recon fetches the OM DB by downloading a tar file from the OM leader and unpacking it into a candidate dir (
om.snapshot.db.candidate). If the unpacking fails halfway, for example because the disk fills up or the leader sends a tar that is cut short (HDDS-16864), tar leaves a partially written SST file in the candidate dir.Since HDDS-15766, Recon keeps the candidate dir after a failed fetch, so the retry can resume: it tells the leader which files it already has, and the leader skips them. That list is built from file names only, so the truncated SST is on it too, and the leader does not send it again. Recon then builds the new OM DB with the truncated SST, and RocksDB refuses to open it. The retry is wasted, and a corrupt
om.snapshot.db_<ts>is left on disk.Fix
The fix keeps the resume behaviour of HDDS-15766 and makes sure only complete files are ever kept in the candidate dir.
ReconRDBSnapshotProvidernow overridesuntarContentsOfTarball. It extracts each file to<name>.tmpand renames it to its real name only after all its bytes are written. If the untar fails partway, the.tmpfile is deleted. It uses the existingArchiverhelpers, which Recon already uses to unpack the SCM DB.RDBSnapshotProvider.untarContentsOfTarballis changed fromprivatetoprotectedso that Recon can override it. The OM follower is unchanged.OzoneManagerServiceProviderImpl.getOzoneManagerDBSnapshotsaid keeping the dir "matches how the OM follower handles a failed download". That is wrong:OzoneManager.installSnapshotFromLeaderdeletes the candidate dir after a failed download. The comment now says that the dir only holds fully extracted files.Only master is affected: HDDS-15766 is not in any release. OM is not affected.
Related: HDDS-15766 (introduced resuming from the candidate dir), HDDS-16882 (Recon reports the failed open of such a DB as success), HDDS-16864 (a failed untar also leaves the downloaded tarball behind, which is not changed here).
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16880
How was this patch tested?
testPartiallyUntarredFileNotReportedOnRetrywas added toTestOzoneManagerServiceProviderImpl. The download returns a tar that holds one complete SST (000009.sst) and ends in the middle of a second one (000010.sst), so the untar fails. The test checks that the retry lists only000009.sstas already received, and that the candidate dir holds only that file, at its full size.[[], ["000010.sst", "000009.sst"]]: the truncated file is listed.[[], []]: nothing is resumed.TestOzoneManagerServiceProviderImpl,TestReconRDBSnapshotProvider,TestTriggerDBSyncEndpointandTestRDBSnapshotProviderpass (24 tests), and checkstyle is clean. The reproduction test attached to the Jira fails without the fix and passes with it: the retry builds a complete OM DB that Recon opens.