ArafatKhan2198 commented on code in PR #5159:
URL: https://github.com/apache/ozone/pull/5159#discussion_r1303209774
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconWithOzoneManagerFSO.java:
##########
@@ -171,4 +306,90 @@ private void addKeys(int start, int end, String dirPrefix)
throws Exception {
writeKeys("vol" + i, "bucket" + i, dirPrefix + i + "/key" + i);
}
}
+
+ /**
+ * This method is designed to create a series of keys with incremental
indices
+ * and associate them with a given directory. The keys are added to a
+ * specified volume and bucket.
+ */
+ private void addKeysToDirectory(int startIndex, int endIndex, String dirName)
+ throws Exception {
+ store.createVolume("vol");
+ OzoneVolume volume = store.getVolume("vol");
+ volume.createBucket("bucket");
+ for (int i = startIndex; i <= endIndex; i++) {
+ writeTestData("vol", "bucket", dirName + "/key" + i);
+ }
+ }
+
+ /**
+ * This method is designed to delete a series of keys with incremental
indices
+ * and associate them with a given directory. The keys are deleted from a
+ * specified volume and bucket.
+ */
+ private void deleteKeysFromDirectory(int startIndex, int endIndex,
+ String dirName)
+ throws Exception {
+ for (int i = startIndex; i <= endIndex; i++) {
+ deleteKey("vol", "bucket", dirName + "/key" + i);
+ }
+ }
+
+ /**
+ * Helper method to assert the row count of a given table in the OM metadata.
+ * This method waits for a specific period of time for the row count of the
+ * specified table to match the expected count.
+ */
+ private void assertOmTableRowCount(Table<String, ?> table, int count)
+ throws TimeoutException, InterruptedException {
+ GenericTestUtils.waitFor(() -> assertOmTableRowCount(count, table), 1000,
+ 120000); // 2 minutes
+ }
+
+ private boolean assertOmTableRowCount(int expectedCount,
+ Table<String, ?> table) {
+ long count = 0L;
+ try {
+ count = cluster.getOzoneManager().getMetadataManager()
+ .countRowsInTable(table);
+ LOG.info("{} actual row count={}, expectedCount={}", table.getName(),
+ count, expectedCount);
+ } catch (IOException ex) {
+ fail("testDoubleBuffer failed with: " + ex);
+ }
+ return count == expectedCount;
+ }
+
+ /**
+ * Helper method to assert the row count of a given table in the Recon
+ * metadata. This method waits for a specific period of time for the row
count
+ * of the specified table to match the expected count.
+ */
+ private void assertReconTableRowCount(Table<String, ?> table, int count)
+ throws TimeoutException, InterruptedException {
+ GenericTestUtils.waitFor(() -> assertReconTableRowCount(count, table),
1000,
+ 120000); // 2 minutes
+ }
+
+ private boolean assertReconTableRowCount(int expectedCount,
Review Comment:
Done!
--
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]