Skip to content

Commit cea1aa3

Browse files
committed
address comments
1 parent ab9fa54 commit cea1aa3

1 file changed

Lines changed: 5 additions & 75 deletions

File tree

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,12 @@ public void testInstallSnapshotWithClientRead() throws Exception {
877877

878878
// Start the inactive OM. Checkpoint installation will happen spontaneously.
879879
cluster.startInactiveOM(followerNodeId);
880+
OzoneManager.setTestInstallSnapshot(true);
880881
LogCapturer logCapture = LogCapturer.captureLogs(OzoneManager.class);
882+
assertLogCapture(logCapture, "OzoneManager is not in running state");
883+
assertLogCapture(logCapture, "Abort install snapshot from Leader");
884+
GenericTestUtils.waitFor(followerOM::isRunning, 100, 30_000);
885+
OzoneManager.setTestInstallSnapshot(false);
881886

882887
// Continuously read keys
883888
ExecutorService executor = Executors.newFixedThreadPool(1);
@@ -933,81 +938,6 @@ public void testInstallSnapshotWithClientRead() throws Exception {
933938
assertLogCapture(logCapture, "Install Checkpoint is finished");
934939
}
935940

936-
@Test
937-
public void testInstallSnapshotOzoneManagerNotInRunningState() throws Exception {
938-
// Get the leader OM
939-
final String leaderOMNodeId = OmTestUtil.getCurrentOmProxyNodeId(objectStore);
940-
941-
OzoneManager leaderOM = cluster.getOzoneManager(leaderOMNodeId);
942-
OzoneManagerRatisServer leaderRatisServer = leaderOM.getOmRatisServer();
943-
944-
// Find the inactive OM
945-
String followerNodeId = leaderOM.getPeerNodes().get(0).getNodeId();
946-
if (cluster.isOMActive(followerNodeId)) {
947-
followerNodeId = leaderOM.getPeerNodes().get(1).getNodeId();
948-
}
949-
OzoneManager followerOM = cluster.getOzoneManager(followerNodeId);
950-
951-
// Do some transactions so that the log index increases
952-
List<String> keys = writeKeysToIncreaseLogIndex(leaderRatisServer, 200);
953-
954-
// Get transaction Index
955-
TransactionInfo transactionInfo =
956-
TransactionInfo.readTransactionInfo(leaderOM.getMetadataManager());
957-
TermIndex leaderOMTermIndex =
958-
TermIndex.valueOf(transactionInfo.getTerm(),
959-
transactionInfo.getTransactionIndex());
960-
long leaderOMSnapshotIndex = leaderOMTermIndex.getIndex();
961-
long leaderOMSnapshotTermIndex = leaderOMTermIndex.getTerm();
962-
963-
// Start the inactive OM. Checkpoint installation will happen spontaneously.
964-
cluster.startInactiveOM(followerNodeId);
965-
OzoneManager.setTestInstallSnapshot(true);
966-
LogCapturer logCapture = LogCapturer.captureLogs(OzoneManager.class);
967-
assertLogCapture(logCapture, "OzoneManager is not in running state");
968-
OzoneManager.setTestInstallSnapshot(false);
969-
970-
// The recently started OM should be lagging behind the leader OM.
971-
// Wait & for follower to update transactions to leader snapshot index.
972-
// Timeout error if follower does not load update within 3s
973-
GenericTestUtils.waitFor(() -> {
974-
return followerOM.getOmRatisServer().getLastAppliedTermIndex().getIndex()
975-
>= leaderOMSnapshotIndex - 1;
976-
}, 100, 30_000);
977-
978-
long followerOMLastAppliedIndex =
979-
followerOM.getOmRatisServer().getLastAppliedTermIndex().getIndex();
980-
assertThat(followerOMLastAppliedIndex).isGreaterThanOrEqualTo(leaderOMSnapshotIndex - 1);
981-
982-
// After the new checkpoint is installed, the follower OM
983-
// lastAppliedIndex must >= the snapshot index of the checkpoint. It
984-
// could be great than snapshot index if there is any conf entry from ratis.
985-
followerOMLastAppliedIndex = followerOM.getOmRatisServer()
986-
.getLastAppliedTermIndex().getIndex();
987-
assertThat(followerOMLastAppliedIndex).isGreaterThanOrEqualTo(leaderOMSnapshotIndex);
988-
assertThat(followerOM.getOmRatisServer().getLastAppliedTermIndex()
989-
.getTerm()).isGreaterThanOrEqualTo(leaderOMSnapshotTermIndex);
990-
991-
// Verify that the follower OM's DB contains the transactions which were
992-
// made while it was inactive.
993-
OMMetadataManager followerOMMetaMngr = followerOM.getMetadataManager();
994-
assertNotNull(followerOMMetaMngr.getVolumeTable().get(
995-
followerOMMetaMngr.getVolumeKey(volumeName)));
996-
assertNotNull(followerOMMetaMngr.getBucketTable().get(
997-
followerOMMetaMngr.getBucketKey(volumeName, bucketName)));
998-
for (String key : keys) {
999-
assertNotNull(followerOMMetaMngr.getKeyTable(
1000-
TEST_BUCKET_LAYOUT)
1001-
.get(followerOMMetaMngr.getOzoneKey(volumeName, bucketName, key)));
1002-
}
1003-
1004-
// Wait installation finish
1005-
Thread.sleep(5000);
1006-
// Verify checkpoint installation was happened.
1007-
assertLogCapture(logCapture, "Reloaded OM state");
1008-
assertLogCapture(logCapture, "Install Checkpoint is finished");
1009-
}
1010-
1011941
@Test
1012942
public void testInstallOldCheckpointFailure() throws Exception {
1013943
// Get the leader OM

0 commit comments

Comments
 (0)