Skip to content

Commit

Permalink
HDDS-10696. Fix test failure caused by empty snapshot installation (a…
Browse files Browse the repository at this point in the history
…pache#6659)

(cherry picked from commit 3f1a7ed)
  • Loading branch information
hemantk-12 authored and xichen01 committed Jul 18, 2024
1 parent 8792c9a commit a747f10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.StringUtils;
import org.apache.ozone.test.GenericTestUtils;
import org.apache.ozone.test.tag.Flaky;
import org.apache.ratis.grpc.server.GrpcLogAppender;
import org.apache.ratis.server.leader.FollowerInfo;
import org.junit.Assert;
Expand Down Expand Up @@ -174,7 +173,6 @@ private List<String> testBootstrapOMs(int numNewOMs) throws Exception {
* OM.
*/
@Test
@Flaky("HDDS-7880")
public void testBootstrap() throws Exception {
setupCluster(1);
OzoneManager oldOM = cluster.getOzoneManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hadoop.hdds.utils.DBCheckpointServlet;
import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
import org.apache.hadoop.hdds.utils.db.RDBCheckpointUtils;
import org.apache.hadoop.hdds.utils.db.RDBStore;
import org.apache.hadoop.hdds.utils.db.Table;
import org.apache.hadoop.hdds.utils.db.TableIterator;
import org.apache.hadoop.ozone.OzoneConsts;
Expand Down Expand Up @@ -317,8 +318,7 @@ private boolean getFilesForArchive(DBCheckpoint checkpoint,

// Get the snapshot files.
Set<Path> snapshotPaths = waitForSnapshotDirs(checkpoint);
Path snapshotDir = Paths.get(OMStorage.getOmDbDir(getConf()).toString(),
OM_SNAPSHOT_DIR);
Path snapshotDir = getSnapshotDir();
if (!processDir(snapshotDir, copyFiles, hardLinkFiles, sstFilesToExclude,
snapshotPaths, excluded, copySize, null)) {
return false;
Expand Down Expand Up @@ -635,6 +635,15 @@ private OzoneConfiguration getConf() {
.getConfiguration();
}

private Path getSnapshotDir() {
OzoneManager om = (OzoneManager) getServletContext().getAttribute(OzoneConsts.OM_CONTEXT_ATTRIBUTE);
RDBStore store = (RDBStore) om.getMetadataManager().getStore();
// store.getSnapshotsParentDir() returns path to checkpointState (e.g. <om-data-dir>/db.snapshots/checkpointState)
// But we need to return path till db.snapshots which contains checkpointState and diffState.
// So that whole snapshots and compaction information can be transferred to follower.
return Paths.get(store.getSnapshotsParentDir()).getParent();
}

@Override
public BootstrapStateHandler.Lock getBootstrapStateLock() {
return lock;
Expand Down

0 comments on commit a747f10

Please sign in to comment.