[ 
https://issues.apache.org/jira/browse/IGNITE-20005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Lapin updated IGNITE-20005:
-------------------------------------
    Description: 
h3. Motivation

Please check the context in https://issues.apache.org/jira/browse/IGNITE-20033 
and https://issues.apache.org/jira/browse/IGNITE-20034

After implemention writeIntentResolution coordinator path it'll be nessessary 
to move commitTimestamp generation to the txn coordinator side.
h3. Definition of Done
 * Easy-breezy, calculate commitTimestamp as coordinator.now().

h3. Implementation Notes

Nothing to update on the "client" side, we already have everything we need.
{code:java}
public CompletableFuture<Void> finish() {
    ...
    HybridTimestamp commitTimestamp = commit ? clock.now() : null;

    TxFinishReplicaRequest req = FACTORY.txFinishReplicaRequest()
             ...
            .commitTimestampLong(hybridTimestampToLong(commitTimestamp)) // 2
   ...
} {code}
On the "server" side, we will adjust and simplify code in 
org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#finishTransaction
{code:java}
private CompletableFuture<Object> finishTransaction(List<TablePartitionId> 
aggregatedGroupIds, UUID txId, boolean commit) {
    // TODO: IGNITE-17261 Timestamp from request is not using until the issue 
has not been fixed (request.commitTimestamp())
    var fut = new CompletableFuture<TxMeta>();

    txTimestampUpdateMap.put(txId, fut);

    HybridTimestamp currentTimestamp = hybridClock.now();
    HybridTimestamp commitTimestamp = commit ? currentTimestamp : null; {code}

  was:
h3. Motivation

It's possible that commit partition primary replica lease will expire in the 
following phases:
 * Before txnState change

 * During txnState change. Meaning that it's actually before or after, however 
we don't know an actual state before interaction.
 * After txnState change.

Last part is covered with https://issues.apache.org/jira/browse/IGNITE-20002 
and https://issues.apache.org/jira/browse/IGNITE-20004 So, given ticket is 
about lease expiration during first and second phases. In both cases it's 
required to send rollback that will change txnState to ABORTED if it wasn't 
already setted to terminal state previously and return actual terminal state. 
Meaning that it's possible to send rollback to a previously committed 
transaction, and that rollback won't have any effect, but will return COMMITED 
to the TxCoordinator and thus client.
h3. Definition of Done
 * It's required to verify that we properly handle commit partition primary 
replica expiration and commit partition primary replica failure by sending 
rollback request to the new commit partition primary.
 * It's required to slightly adjust 
org.apache.ignite.internal.tx.impl.TxManagerImpl#finish along with 
corresponding internals that will return actual txnState. Meaning that we 
should complete user's commit successfully if we send inner rollback after 
unnoticeable previous commit.

 


> Move commitTimestamp generation to the txn coordinator side.
> ------------------------------------------------------------
>
>                 Key: IGNITE-20005
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20005
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Alexander Lapin
>            Priority: Major
>              Labels: ignite-3, transaction, transaction3_recovery
>
> h3. Motivation
> Please check the context in 
> https://issues.apache.org/jira/browse/IGNITE-20033 and 
> https://issues.apache.org/jira/browse/IGNITE-20034
> After implemention writeIntentResolution coordinator path it'll be nessessary 
> to move commitTimestamp generation to the txn coordinator side.
> h3. Definition of Done
>  * Easy-breezy, calculate commitTimestamp as coordinator.now().
> h3. Implementation Notes
> Nothing to update on the "client" side, we already have everything we need.
> {code:java}
> public CompletableFuture<Void> finish() {
>     ...
>     HybridTimestamp commitTimestamp = commit ? clock.now() : null;
>     TxFinishReplicaRequest req = FACTORY.txFinishReplicaRequest()
>              ...
>             .commitTimestampLong(hybridTimestampToLong(commitTimestamp)) // 2
>    ...
> } {code}
> On the "server" side, we will adjust and simplify code in 
> org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#finishTransaction
> {code:java}
> private CompletableFuture<Object> finishTransaction(List<TablePartitionId> 
> aggregatedGroupIds, UUID txId, boolean commit) {
>     // TODO: IGNITE-17261 Timestamp from request is not using until the issue 
> has not been fixed (request.commitTimestamp())
>     var fut = new CompletableFuture<TxMeta>();
>     txTimestampUpdateMap.put(txId, fut);
>     HybridTimestamp currentTimestamp = hybridClock.now();
>     HybridTimestamp commitTimestamp = commit ? currentTimestamp : null; {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to