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

Alexander Lapin updated IGNITE-17968:
-------------------------------------
    Description: 
Following test will work
{code:java}
@Test
public void testReadOnlyGetWriteIntentResolutionUpdate() {
    accounts.recordView().upsert(null, makeValue(1, 100.));

    // Pending tx
    Transaction tx = igniteTransactions.begin();
    accounts.recordView().upsert(tx, makeValue(1, 300.));

    // Update
    Transaction readOnlyTx = igniteTransactions.readOnly().begin();
    assertEquals(100., accounts.recordView().get(readOnlyTx, 
makeKey(1)).doubleValue("balance"));
}{code}
And following won't
{code:java}
@Test
public void testReadOnlyGetWriteIntentResolutionRemoveTmp() {
    accounts.recordView().upsert(null, makeValue(1, 100.));

    // Pending tx
    Transaction tx = igniteTransactions.begin();
    accounts.recordView().delete(tx, makeKey(1));

    // Remove.
    Transaction readOnlyTx = igniteTransactions.readOnly().begin();
    assertEquals(100., accounts.recordView().get(readOnlyTx, 
makeKey(1)).doubleValue("balance"));
} {code}
Internally mvDataStorage.scan(readTimestamp) in 
PartitionReplicaListener#processReadOnlyMultiEntryAction will skip such pending 
removed entries.

Please pay attention that writeIntetns that contain data (update pending 
modification instead of remove one) works propertly. See 
ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionUpdate and 
ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedTmp for more 
details.

*Reproducers:*

ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionRemoveTmp

ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedCombinedTmp

  was:
Following test will work

 
{code:java}
    @Test
    public void testReadOnlyPendingWriteIntentSkipped() {
        accounts.recordView().upsert(null, makeValue(1, 100.));
        accounts.recordView().upsert(null, makeValue(2, 200.));

        // Pending tx
        Transaction tx = igniteTransactions.begin();
//        accounts.recordView().delete(tx, makeKey(1));
        accounts.recordView().upsert(tx, makeValue(2, 300.));

        Transaction readOnlyTx = igniteTransactions.readOnly().begin();
        Collection<Tuple> retrievedKeys = 
accounts.recordView().getAll(readOnlyTx, List.of(makeKey(1), makeKey(2)));
        validateBalance(retrievedKeys, 100., 200.);
    } {code}
And following won't

 
    @Test
    public void testReadOnlyPendingWriteIntentSkipped() \{
        accounts.recordView().upsert(null, makeValue(1, 100.));
        accounts.recordView().upsert(null, makeValue(2, 200.));

        // Pending tx
        Transaction tx = igniteTransactions.begin();
        accounts.recordView().delete(tx, makeKey(1));
        accounts.recordView().upsert(tx, makeValue(2, 300.));

        Transaction readOnlyTx = igniteTransactions.readOnly().begin();
        Collection<Tuple> retrievedKeys = 
accounts.recordView().getAll(readOnlyTx, List.of(makeKey(1), makeKey(2)));
        validateBalance(retrievedKeys, 100., 200.);
    }
Internally mvDataStorage.scan(readTimestamp) in 
PartitionReplicaListener#processReadOnlyMultiEntryAction will skip such pending 
removed entries.

It also worth to mention that writeIntetns that contain data (update pending 
modification instead of remove one) works propertly. See 
ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionUpdate and 
ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedTmp for more 
details.

*Reproducers:*

ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionRemoveTmp

ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedCombinedTmp


> Seems that mvDataStorage.scan doesn't return pending removed value as 
> writeIntent
> ---------------------------------------------------------------------------------
>
>                 Key: IGNITE-17968
>                 URL: https://issues.apache.org/jira/browse/IGNITE-17968
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Alexander Lapin
>            Priority: Major
>              Labels: transaction3_ro
>
> Following test will work
> {code:java}
> @Test
> public void testReadOnlyGetWriteIntentResolutionUpdate() {
>     accounts.recordView().upsert(null, makeValue(1, 100.));
>     // Pending tx
>     Transaction tx = igniteTransactions.begin();
>     accounts.recordView().upsert(tx, makeValue(1, 300.));
>     // Update
>     Transaction readOnlyTx = igniteTransactions.readOnly().begin();
>     assertEquals(100., accounts.recordView().get(readOnlyTx, 
> makeKey(1)).doubleValue("balance"));
> }{code}
> And following won't
> {code:java}
> @Test
> public void testReadOnlyGetWriteIntentResolutionRemoveTmp() {
>     accounts.recordView().upsert(null, makeValue(1, 100.));
>     // Pending tx
>     Transaction tx = igniteTransactions.begin();
>     accounts.recordView().delete(tx, makeKey(1));
>     // Remove.
>     Transaction readOnlyTx = igniteTransactions.readOnly().begin();
>     assertEquals(100., accounts.recordView().get(readOnlyTx, 
> makeKey(1)).doubleValue("balance"));
> } {code}
> Internally mvDataStorage.scan(readTimestamp) in 
> PartitionReplicaListener#processReadOnlyMultiEntryAction will skip such 
> pending removed entries.
> Please pay attention that writeIntetns that contain data (update pending 
> modification instead of remove one) works propertly. See 
> ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionUpdate and 
> ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedTmp for 
> more details.
> *Reproducers:*
> ItTxDistributedTestSingleNode#testReadOnlyGetWriteIntentResolutionRemoveTmp
> ItTxDistributedTestSingleNode#testReadOnlyPendingWriteIntentSkippedCombinedTmp



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

Reply via email to