Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-10696. Fix test failure caused by empty snapshot installation #6659

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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.protocol.RaftPeer;
import org.apache.ratis.protocol.RaftPeerId;
Expand Down Expand Up @@ -184,7 +183,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 = Paths.get(getSnapshotsParentDir()).getParent();
Copy link
Contributor

Choose a reason for hiding this comment

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

@hemantk-12 , Why the parentDir of the getSnapshotsParentDir is the snapshotDir? Is it a typo?

Copy link
Contributor Author

@hemantk-12 hemantk-12 May 8, 2024

Choose a reason for hiding this comment

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

Yes, it is the naming issue in getSnapshotsParentDir.
I renamed and changed the function to return snapshotDir path directly.
I also added a comment explaining it.

Please take another look.

if (!processDir(snapshotDir, copyFiles, hardLinkFiles, sstFilesToExclude,
snapshotPaths, excluded, copySize, null)) {
return false;
Expand Down Expand Up @@ -635,6 +635,12 @@ private OzoneConfiguration getConf() {
.getConfiguration();
}

private String getSnapshotsParentDir() {
OzoneManager om = (OzoneManager) getServletContext().getAttribute(OzoneConsts.OM_CONTEXT_ATTRIBUTE);
RDBStore store = (RDBStore) om.getMetadataManager().getStore();
return store.getSnapshotsParentDir();
}

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