DomGarguilo commented on code in PR #4466:
URL: https://github.com/apache/accumulo/pull/4466#discussion_r1596898614
##########
test/src/main/java/org/apache/accumulo/test/compaction/CompactionPriorityQueueMetricsIT.java:
##########
@@ -401,10 +413,109 @@ public void testQueueMetrics() throws Exception {
}
}
}
- UtilWaitThread.sleep(3500);
+
UtilWaitThread.sleep(TestStatsDRegistryFactory.pollingFrequency.toMillis());
}
+ }
- shutdownTailer.set(true);
- thread.join();
+ /**
+ * Test that the compaction queue is cleared when compactions no longer need
to happen.
+ */
+ @Test
+ public void testCompactionQueueClearedWhenNotNeeded() throws Exception {
+ ServerContext context = getCluster().getServerContext();
+ try (AccumuloClient c =
Accumulo.newClient().from(getClientProps()).build()) {
+
+ String dir = getDir("/testBulkFile-");
+ FileSystem fs = getCluster().getFileSystem();
+ fs.mkdirs(new Path(dir));
+
+ // Create splits so there are two groupings of tablets with similar file
counts.
+ String splitString = "500 1000 1500 2000 3750 5500 7250 9000";
+ addSplits(c, tableName, splitString);
+
+ for (int i = 0; i < 100; i++) {
+ writeData(dir + "/f" + i + ".", aconf, i * 100, (i + 1) * 100 - 1);
+ }
+ c.tableOperations().importDirectory(dir).to(tableName).load();
+
+ try (TabletsMetadata tm =
context.getAmple().readTablets().forTable(tableId).build()) {
+ // Get each tablet's file sizes
+ for (TabletMetadata tablet : tm) {
+ long fileSize = tablet.getFiles().size();
+ log.debug("Number of files in tablet {}: {}",
tablet.getExtent().toString(), fileSize);
+ }
+ }
+ verifyData(c, tableName, 0, 100 * 100 - 1, false);
+ }
+
+ final long sleepMillis =
TestStatsDRegistryFactory.pollingFrequency.toMillis();
+
+ Wait.waitFor(() -> {
+ while (!queueMetrics.isEmpty()) {
+ var qm = queueMetrics.take();
+ if
(qm.getName().contains(MetricsProducer.METRICS_COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_QUEUED)
+ && qm.getTags().containsValue(QUEUE1_METRIC_LABEL)) {
+ if (Integer.parseInt(qm.getValue()) > 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }, 60_000, sleepMillis, "did not see Q1 metrics");
+
+ Wait.waitFor(() -> {
Review Comment:
I realized I pulled in a lot of unneeded stuff from the other test case
while developing the changes for this PR. In 9a63f3e I removed a lot so that
its easier to track whats going on and only kept whats necessary to test what
we are trying to test here.
--
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]