Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Motivation
In order to implement placement driver API that will add an ability to await and get primary replicas in seems reasonable to reuse PendingComparableValuesTracker just because given class provides most of required functionality.
/** * Tracker that stores comparable value internally, this value can grow when {@link #update(Comparable)} method is called. The tracker gives * ability to wait for certain value, see {@link #waitFor(Comparable)}. */ public class PendingComparableValuesTracker<T extends Comparable<T>> implements ManuallyCloseable {
However some upgrades are needed - see the definition of done section.
Definition of done
- It's required to have an ability to complete pending waiter with specific value propagated to an PendingComparableValuesTracker#update() method.
- It's required to support multiple independent waiters associated with same waiter key.
Implementation notes
It make sense to extend PendingComparableValuesTracker with a new class that will store multiple independent waiters instead of single one, in other words
private final ConcurrentSkipListMap<T, Set<CompletableFuture<R>>> valueFutures = new ConcurrentSkipListMap<>();
instead of
private final ConcurrentSkipListMap<T, CompletableFuture<R>> valueFutures = new ConcurrentSkipListMap<>();
In addition to that it makes sense to overload
public void update(T newValue)
with
public void update(T newValue, @Nullable R futureResult)
in order to retrieve CompletableFuture<R> from PendingComparableValuesTracker#waitFor() instead of CompletableFuture<Void>. Of course it's valid to have Void as R.
Attachments
Issue Links
- blocks
-
IGNITE-19428 Implement placement driver API
- Resolved
- links to