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:
@ -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;
|
||||
}
|
||||
|
||||
@ -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());
|
||||
|
||||
Reference in New Issue
Block a user