Manno15 commented on a change in pull request #2240:
URL: https://github.com/apache/accumulo/pull/2240#discussion_r700283904
##########
File path:
test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -159,6 +165,80 @@ public void testBadSelector() throws Exception {
}
}
+ @Test
+ public void testDeleteTableAbortsCompaction() throws Exception {
+ try (AccumuloClient c =
Accumulo.newClient().from(getClientProps()).build()) {
+ final String tableName = getUniqueNames(1)[0];
+ NewTableConfiguration ntc = new NewTableConfiguration()
+ .setProperties(Map.of(Property.TABLE_MAJC_RATIO.getKey(), "5.0"));
+ c.tableOperations().create(tableName, ntc);
+ FileSystem fs = getFileSystem();
+ Path root = new Path(cluster.getTemporaryPath(), getClass().getName());
+ fs.deleteOnExit(root);
+ Path testrf = new Path(root, "testrf");
+ fs.deleteOnExit(testrf);
+ FunctionalTestUtils.createRFiles(c, fs, testrf.toString(), 500000, 59,
4);
+
c.tableOperations().importDirectory(testrf.toString()).to(tableName).load();
+ int beforeCount = countFiles(c);
+
+ final AtomicBoolean fail = new AtomicBoolean(false);
+ final int THREADS = 5;
+ for (int count = 0; count < THREADS; count++) {
+ ExecutorService executor = Executors.newFixedThreadPool(THREADS);
+ final int span = 500000 / 59;
+ for (int i = 0; i < 500000; i += 500000 / 59) {
+ final int finalI = i;
+ Runnable r = () -> {
+ try {
+ VerifyParams params = new VerifyParams(getClientProps(),
tableName, span);
+ params.startRow = finalI;
+ params.random = 56;
+ params.dataSize = 50;
+ params.cols = 1;
+ VerifyIngest.verifyIngest(c, params);
+ } catch (Exception ex) {
+ log.warn("Got exception verifying data", ex);
+ fail.set(true);
+ }
+ };
+ executor.execute(r);
+ }
+ executor.shutdown();
+ executor.awaitTermination(defaultTimeoutSeconds(), TimeUnit.SECONDS);
+ assertFalse("Failed to successfully run all threads, Check the test
output for error",
+ fail.get());
+ }
+
+ final CyclicBarrier latch = new CyclicBarrier(2);
+ Thread t = new Thread(() -> {
+ try {
+ latch.await();
+ c.tableOperations().delete(tableName);
+ } catch (AccumuloException | AccumuloSecurityException |
TableNotFoundException e) {
+ fail("Table not found");
+ } catch (InterruptedException | BrokenBarrierException e) {
+ fail("Interrupted or BrokenBarrierException: " + e.getMessage());
+ }
+ });
+ t.start();
+ latch.await();
+ c.tableOperations().compact(tableName, new
CompactionConfig().setWait(true));
+
+ int finalCount = countFiles(c);
+ assertTrue(finalCount < beforeCount);
+ try {
+ getClusterControl().adminStopAll();
+ } finally {
+ // Make sure the internal state in the cluster is reset (e.g.
processes in MAC)
+ getCluster().stop();
+ if (getClusterType() == ClusterType.STANDALONE) {
+ // Then restart things for the next test if it's a standalone
+ getCluster().start();
+ }
+ }
+ }
+ }
+
@Test
public void test() throws Exception {
Review comment:
Unrelated to these changes specifically but I think this test could now
use a more explicit name (not sure what that should be though).
--
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]