You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "shuwenwei (via GitHub)" <gi...@apache.org> on 2024/12/24 11:19:18 UTC
[PR] Compaction task can not stopped when abort compaction [iotdb]
shuwenwei opened a new pull request, #14538:
URL: https://github.com/apache/iotdb/pull/14538
## Description
Compaction task can not stopped when abort compaction
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Compaction task can not stopped when abort compaction [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 merged PR #14538:
URL: https://github.com/apache/iotdb/pull/14538
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Compaction task can not stopped when abort compaction [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #14538:
URL: https://github.com/apache/iotdb/pull/14538#discussion_r1897139997
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/CompactionWorkerTest.java:
##########
@@ -261,4 +266,30 @@ public void testFailedToCheckValidInInnerTask() throws InterruptedException {
thread.interrupt();
thread.join();
}
+
+ @Test
+ public void testAbortCompactionTask() {
+ AtomicReference<CompactionWorker.CompactionTaskFuture> compactionTaskSummary =
+ new AtomicReference<>();
+ AtomicBoolean isInterrupted = new AtomicBoolean(false);
+ Phaser phaser = new Phaser(2);
+ Thread t =
+ new Thread(
+ () -> {
+ compactionTaskSummary.set(
+ new CompactionWorker.CompactionTaskFuture(new CompactionTaskSummary()));
+ phaser.arriveAndAwaitAdvance();
+ try {
+ Thread.sleep(10000);
Review Comment:
This can be unstable. If the test is hung up for 10s or there is a clock problem in the test machine, this test is likely to fail.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java:
##########
@@ -286,6 +286,19 @@ private void compactNonAlignedSeries(
throw (StopReadTsFileByInterruptException) cause;
}
throw new IOException("[Compaction] SubCompactionTask meet errors ", e);
+ } catch (InterruptedException e) {
+ abortAllSubTasks(futures);
+ throw e;
+ }
+ }
+ }
+
+ private void abortAllSubTasks(List<Future<Void>> futures) {
+ for (Future<Void> future : futures) {
+ future.cancel(true);
+ try {
+ future.get();
+ } catch (Exception ignored) {
}
}
Review Comment:
Maybe we can cancel them all first and then wait for them.
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org