branch-2.1: [fix](catalog) Fix mark handling for failed tasks to maintain getLeftMarks #46205 (#46256)

cherry pick from #46205
This commit is contained in:
walter
2025-01-02 16:39:43 +08:00
committed by GitHub
parent f6d98a6061
commit 2c7e5cae9a
3 changed files with 11 additions and 3 deletions

View File

@ -28,11 +28,13 @@ import java.util.concurrent.CountDownLatch;
public class MarkedCountDownLatch<K, V> extends CountDownLatch {
private Multimap<K, V> marks;
private Multimap<K, V> failedMarks;
private Status st = Status.OK;
public MarkedCountDownLatch(int count) {
super(count);
marks = HashMultimap.create();
failedMarks = HashMultimap.create();
}
public synchronized void addMark(K key, V value) {
@ -54,7 +56,13 @@ public class MarkedCountDownLatch<K, V> extends CountDownLatch {
st = status;
}
if (marks.remove(key, value)) {
// Since marks are used to determine whether a task is completed, we should not remove
// a mark if the task has failed rather than finished. To maintain the idempotency of
// this method, we store failed marks in a separate map.
//
// Search `getLeftMarks` for details.
if (!failedMarks.containsEntry(key, value)) {
failedMarks.put(key, value);
super.countDown();
return true;
}

View File

@ -647,7 +647,7 @@ public class MasterImpl {
}
AlterInvertedIndexTask alterInvertedIndexTask = (AlterInvertedIndexTask) task;
LOG.info("beigin finish AlterInvertedIndexTask: {}, tablet: {}, toString: {}",
LOG.info("begin finish AlterInvertedIndexTask: {}, tablet: {}, toString: {}",
alterInvertedIndexTask.getSignature(),
alterInvertedIndexTask.getTabletId(),
alterInvertedIndexTask.toString());