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

Vyacheslav Koptilin updated IGNITE-19570:
-----------------------------------------
    Description: 
*Motivation*
Currently, RW transaction resolves only write intents by itself. If RW 
transaction steps on a write intent from another transaction, an assertion 
error will appear.
{code:java}
        // Should never happen, currently, locks prevent reading another 
transaction intents during RW requests.
    throw new AssertionError("Mismatched transaction id, expectedTxId={" + txId 
+ "},"
            + " actualTxId={" + retrievedResultTxId + '}');
{code}
Really, we will be able to leave write intent in case when node restarted 
before it can handle cleanup message. Now, we workaround the case by scanning 
storage for logging for write intent and commit them on start:
{code:java}
        try (PartitionTimestampCursor cursor = 
partitionDataStorage.scan(HybridTimestamp.MAX_VALUE)) {
            while (cursor.hasNext()) {
                ReadResult readResult = cursor.next();

                if (readResult.isWriteIntent()) {
                    
txsPendingRowIds.computeIfAbsent(readResult.transactionId(), key -> new 
TreeSet<>()).add(readResult.rowId());
                }
            }
        }
{code}
But this is very time-consuming.

  was:
*Motivation*
Currently, RW transaction resolves only write intents by itself. If RW 
transaction steps on a write intent from another transaction, an assertion 
error will appear.
{code}
        // Should never happen, currently, locks prevent reading another 
transaction intents during RW requests.
    throw new AssertionError("Mismatched transaction id, expectedTxId={" + txId 
+ "},"
            + " actualTxId={" + retrievedResultTxId + '}');
{code}
Really, we will be able to leave write intent in case when node restarted 
before is can handle cleanup message. Now, we workaround the case by scanning 
storage for logging for write intent and commit them on start:
{code}
        try (PartitionTimestampCursor cursor = 
partitionDataStorage.scan(HybridTimestamp.MAX_VALUE)) {
            while (cursor.hasNext()) {
                ReadResult readResult = cursor.next();

                if (readResult.isWriteIntent()) {
                    
txsPendingRowIds.computeIfAbsent(readResult.transactionId(), key -> new 
TreeSet<>()).add(readResult.rowId());
                }
            }
        }
{code}
But this is very time-consuming.


> Write intent resolution for RW transactions
> -------------------------------------------
>
>                 Key: IGNITE-19570
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19570
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-3
>
> *Motivation*
> Currently, RW transaction resolves only write intents by itself. If RW 
> transaction steps on a write intent from another transaction, an assertion 
> error will appear.
> {code:java}
>       // Should never happen, currently, locks prevent reading another 
> transaction intents during RW requests.
>     throw new AssertionError("Mismatched transaction id, expectedTxId={" + 
> txId + "},"
>             + " actualTxId={" + retrievedResultTxId + '}');
> {code}
> Really, we will be able to leave write intent in case when node restarted 
> before it can handle cleanup message. Now, we workaround the case by scanning 
> storage for logging for write intent and commit them on start:
> {code:java}
>         try (PartitionTimestampCursor cursor = 
> partitionDataStorage.scan(HybridTimestamp.MAX_VALUE)) {
>             while (cursor.hasNext()) {
>                 ReadResult readResult = cursor.next();
>                 if (readResult.isWriteIntent()) {
>                     
> txsPendingRowIds.computeIfAbsent(readResult.transactionId(), key -> new 
> TreeSet<>()).add(readResult.rowId());
>                 }
>             }
>         }
> {code}
> But this is very time-consuming.



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

Reply via email to