[
https://issues.apache.org/jira/browse/IGNITE-19428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Lapin updated IGNITE-19428:
-------------------------------------
Description:
h3. Motivation
In order to implement RW part of tx protocol it's required to check whether we
touch same primary replica that was previously enlisted and await primary
replica appearance on group readiness. Currently it's implemented using same
raft-leader check on top of retry logic with throttling which is inefficient
and doesn't support overall idea of hiding replication protocol details under
replicas umbrella.
h3. Definition of done
Long story short, it's required to implement following API (exact one or
similar)
{code:java}
/**
* Returns a future for the primary replica for the specified replication
group whose expiration time (the right border of the
* corresponding lease interval) is greater than or equal to the timestamp
passed as a parameter. Please pay attention that there are
* no restriction on the lease start time (left border), it can either be
less or greater than or equal to proposed timestamp.
* Given method will await for an appropriate primary replica appearance if
there's no already existing one. Such awaiting logic is
* unbounded, so it's mandatory to use explicit await termination like
{@code orTimeout}.
*
* @param replicationGroupId Replication group id.
* @param timestamp Timestamp reference value.
* @return Primary replica future.
*/
public CompletableFuture<ReplicaMeta>
awaitPrimaryReplica(ReplicationGroupId replicationGroupId, HybridTimestamp
timestamp) {
return CompletableFuture.completedFuture(null);
}
/**
* Same as {@link
PlacementDriverManager#awaitPrimaryReplica(ReplicationGroupId,
HybridTimestamp)} despite the fact that given method
* won't await for an appropriate primary replica appearance if there's no
already existing one, in that case null will be returned.
*
* @param replicationGroupId Replication group id.
* @param timestamp Timestamp reference value.
* @return Primary replica future.
*/
public CompletableFuture<ReplicaMeta> getPrimaryReplica(ReplicationGroupId
replicationGroupId, HybridTimestamp timestamp) {
return CompletableFuture.completedFuture(null);
} {code}
h3. Implementation Notes
Seems reasonable to reuse PendingComparableValuesTracker logic in order to
implement aforementioned API. Some PendingComparableValuesTracker enhancement
are required though, see https://issues.apache.org/jira/browse/IGNITE-18859 for
more details.
was:
h3. Motivation
In order to implement RW part of tx protocol it's required to check whether we
touch same primary replica that was previously enlisted and await primary
replica appearance on group readiness. Currently it's implemented using same
raft-leader check on top of retry logic with throttling which is inefficient
and doesn't support overall idea of hiding replication protocol details under
replicas umbrella.
h3. Definition of done
Long story short, it's required to implement following API (exact one or
similar)
{code:java}
/**
* Returns a future for the primary replica for the specified replication
group whose expiration time (the right border of the
* corresponding lease interval) is greater than or equal to the timestamp
passed as a parameter. Please pay attention that there are
* no restriction on the lease start time (left border), it can either be
less or greater than or equal to proposed timestamp.
* Given method will await for an appropriate primary replica appearance if
there's no already existing one. Such awaiting logic is
* unbounded, so it's mandatory to use explicit await termination like
{@code orTimeout}.
*
* @param replicationGroupId Replication group id.
* @param timestamp Timestamp reference value.
* @return Primary replica future.
*/
public CompletableFuture<ReplicaMeta>
awaitPrimaryReplica(ReplicationGroupId replicationGroupId, HybridTimestamp
timestamp) {
return CompletableFuture.completedFuture(null);
}
/**
* Same as {@link
PlacementDriverManager#awaitPrimaryReplica(ReplicationGroupId,
HybridTimestamp)} despite the fact that given method
* won't await for an appropriate primary replica appearance if there's no
already existing one, in that case null will be returned.
*
* @param replicationGroupId Replication group id.
* @param timestamp Timestamp reference value.
* @return Primary replica future.
*/
public CompletableFuture<ReplicaMeta> getPrimaryReplica(ReplicationGroupId
replicationGroupId, HybridTimestamp timestamp) {
return CompletableFuture.completedFuture(null);
} {code}
> Implement placement driver API
> ------------------------------
>
> Key: IGNITE-19428
> URL: https://issues.apache.org/jira/browse/IGNITE-19428
> Project: Ignite
> Issue Type: Improvement
> Reporter: Alexander Lapin
> Priority: Major
> Labels: ignite-3
>
> h3. Motivation
> In order to implement RW part of tx protocol it's required to check whether
> we touch same primary replica that was previously enlisted and await primary
> replica appearance on group readiness. Currently it's implemented using same
> raft-leader check on top of retry logic with throttling which is inefficient
> and doesn't support overall idea of hiding replication protocol details under
> replicas umbrella.
> h3. Definition of done
> Long story short, it's required to implement following API (exact one or
> similar)
> {code:java}
> /**
> * Returns a future for the primary replica for the specified replication
> group whose expiration time (the right border of the
> * corresponding lease interval) is greater than or equal to the
> timestamp passed as a parameter. Please pay attention that there are
> * no restriction on the lease start time (left border), it can either be
> less or greater than or equal to proposed timestamp.
> * Given method will await for an appropriate primary replica appearance
> if there's no already existing one. Such awaiting logic is
> * unbounded, so it's mandatory to use explicit await termination like
> {@code orTimeout}.
> *
> * @param replicationGroupId Replication group id.
> * @param timestamp Timestamp reference value.
> * @return Primary replica future.
> */
> public CompletableFuture<ReplicaMeta>
> awaitPrimaryReplica(ReplicationGroupId replicationGroupId, HybridTimestamp
> timestamp) {
> return CompletableFuture.completedFuture(null);
> }
> /**
> * Same as {@link
> PlacementDriverManager#awaitPrimaryReplica(ReplicationGroupId,
> HybridTimestamp)} despite the fact that given method
> * won't await for an appropriate primary replica appearance if there's
> no already existing one, in that case null will be returned.
> *
> * @param replicationGroupId Replication group id.
> * @param timestamp Timestamp reference value.
> * @return Primary replica future.
> */
> public CompletableFuture<ReplicaMeta>
> getPrimaryReplica(ReplicationGroupId replicationGroupId, HybridTimestamp
> timestamp) {
> return CompletableFuture.completedFuture(null);
> } {code}
> h3. Implementation Notes
> Seems reasonable to reuse PendingComparableValuesTracker logic in order to
> implement aforementioned API. Some PendingComparableValuesTracker
> enhancement are required though, see
> https://issues.apache.org/jira/browse/IGNITE-18859 for more details.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)