sadanand48 commented on code in PR #4249:
URL: https://github.com/apache/ozone/pull/4249#discussion_r1098772534
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -302,14 +303,19 @@ protected OmMetadataManagerImpl() {
}
// metadata constructor for snapshots
- private OmMetadataManagerImpl(OzoneConfiguration conf, String
snapshotDirName)
- throws IOException {
+ private OmMetadataManagerImpl(OzoneConfiguration conf, String
snapshotDirName,
+ boolean isSnapshotInCache) throws IOException {
lock = new OmReadOnlyLock();
omEpoch = 0;
String snapshotDir = OMStorage.getOmDbDir(conf) +
OM_KEY_PREFIX + OM_SNAPSHOT_DIR;
- setStore(loadDB(conf, new File(snapshotDir),
- OM_DB_NAME + snapshotDirName, true));
+ File metaDir = new File(snapshotDir);
+ String dbName = OM_DB_NAME + snapshotDirName;
+ if (isSnapshotInCache) {
+ File checkpoint = Paths.get(metaDir.toPath().toString(),
dbName).toFile();
+ RDBCheckpointManager.waitForCheckpointDirectoryExist(checkpoint);
Review Comment:
One more idea is to create the checkpoint in
OmCreateSnapshotCreateRequest#validateAndUpdateCache inside the bucket lock,
but the problem here is that if OM crashes/shuts down during the time the entry
is in cache and not flushed to DB, a waste checkpoint will be created since it
won't be accessed anymore, i.e a failed createSnapshotRequest will create
checkpoints and adds up to the space.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]