Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hemantk-12 committed Aug 28, 2024
1 parent f044b8a commit dd542ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.apache.hadoop.ozone.client.OzoneClient;
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.helpers.SnapshotInfo;
Expand Down Expand Up @@ -278,8 +277,6 @@ private void createFileKey(OzoneBucket bucket, String keyName)
}
}



/**
* This is to simulate HDDS-11152 scenario. In which a follower's doubleBuffer is lagging and accumulates purgeKey
* and purgeSnapshot in same batch.
Expand Down Expand Up @@ -354,10 +351,7 @@ private void createSnapshot(String volName, String buckName, String snapName) th
store.createSnapshot(volName, buckName, snapName);

String tableKey = SnapshotInfo.getTableKey(volName, buckName, snapName);
SnapshotInfo snapshotInfo = cluster.getOMLeader().getMetadataManager()
.getSnapshotInfoTable()
.get(tableKey);

SnapshotInfo snapshotInfo = SnapshotUtils.getSnapshotInfo(cluster.getOMLeader(), tableKey);
String fileName = getSnapshotPath(cluster.getOMLeader().getConfiguration(), snapshotInfo);
File snapshotDir = new File(fileName);
if (!RDBCheckpointUtils.waitForCheckpointDirectoryExist(snapshotDir)) {
Expand All @@ -369,9 +363,7 @@ private void checkSnapshotIsPurgedFromDB(OzoneManager ozoneManager, String snaps
throws InterruptedException, TimeoutException {
GenericTestUtils.waitFor(() -> {
try {
OMMetadataManager metadataManager = ozoneManager.getMetadataManager();
SnapshotInfo snapshotInfo = metadataManager.getSnapshotInfoTable().get(snapshotTableKey);
return snapshotInfo == null;
return ozoneManager.getMetadataManager().getSnapshotInfoTable().get(snapshotTableKey) == null;
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SNAPSHOT_DIFF_REPORT_MAX_PAGE_SIZE;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SNAPSHOT_DIFF_REPORT_MAX_PAGE_SIZE_DEFAULT;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.INVALID_KEY_NAME;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.KEY_NOT_FOUND;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.INVALID_SNAPSHOT_ERROR;
import static org.apache.hadoop.ozone.om.snapshot.SnapshotDiffManager.getSnapshotRootPath;
import static org.apache.hadoop.ozone.om.snapshot.SnapshotUtils.checkSnapshotActive;
import static org.apache.hadoop.ozone.om.snapshot.SnapshotUtils.dropColumnFamilyHandle;
Expand Down Expand Up @@ -685,7 +685,9 @@ public ReferenceCounted<OmSnapshot> getSnapshot(UUID snapshotId) throws IOExcept

/**
* Returns snapshotInfo from cache if it is present in cache, otherwise it checks RocksDB and return value from there.
* This should be used by SnapshotCache only.
* #################################################
* NOTE: THIS SHOULD BE USED BY SNAPSHOT CACHE ONLY.
* #################################################
* Sometimes, the follower OM node may be lagging that it gets purgeKeys or snapshotMoveDeletedKeys from a Snapshot,
* and purgeSnapshot for the same Snapshot one after another. And purgeSnapshot's validateAndUpdateCache gets
* executed before doubleBuffer flushes purgeKeys or snapshotMoveDeletedKeys from that Snapshot.
Expand All @@ -702,7 +704,7 @@ private SnapshotInfo getSnapshotInfo(String snapshotKey) throws IOException {
snapshotInfo = ozoneManager.getMetadataManager().getSnapshotInfoTable().getSkipCache(snapshotKey);
}
if (snapshotInfo == null) {
throw new OMException("Snapshot '" + snapshotKey + "' is not found.", KEY_NOT_FOUND);
throw new OMException("Snapshot '" + snapshotKey + "' is not found.", INVALID_SNAPSHOT_ERROR);
}
return snapshotInfo;
}
Expand Down

0 comments on commit dd542ba

Please sign in to comment.