[ https://issues.apache.org/jira/browse/IGNITE-18497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Denis Chudov updated IGNITE-18497: ---------------------------------- Fix Version/s: 3.0.0-beta2 > Read only get returns a first one value getting from primary index > ------------------------------------------------------------------ > > Key: IGNITE-18497 > URL: https://issues.apache.org/jira/browse/IGNITE-18497 > Project: Ignite > Issue Type: Bug > Reporter: Vladislav Pyatkov > Assignee: Denis Chudov > Priority: Major > Labels: ignite-3 > Fix For: 3.0.0-beta2 > > Time Spent: 10m > Remaining Estimate: 0h > > *Motivation* > Indexes store all value associated with different versions of one entry. By > the reason, for getting value by primary index, we scan the index with the > specific key. If we insert, delete and again insert an entry with the same > indexed fields, the entry can resolve in versioned storage for different row > ids. But only one resolution should return not empty value, because only one > entry can exist by the unique index. > *Implementation notes* > The resolution happens here: > {code:java} > PartitionReplicaListener#resolveRowByPk(BinaryRow, HybridTimestamp){code} > But in case when a read result is resolved to null, need to continue the > loop, because the actual value associated with the key may be removed (this > is the null value, but it is not actual) and inserted again. > > h3. upd 1: > # Seems that it's rather simple in case of primary index (and given ticket > is about primary index) because keys are unmodifiable, so it's only possible > to have multiple entries for particular search key only in case of creation-> > removal -> creation. That means that we can have one and only one non empty > readResult for any read timestamp for the given key. Which in turn means that > if we found non empty readResult during PK index iteration we can proceed > with readResult resolution and stop the iteration, oterwise, in case of empty > read result we should continue the iteration as Vlad told. So basically we > should add > {code:java} > if (readResult.isEmpty()) {continue;}{code} > after > {code:java} > ReadResult readResult = mvDataStorage.read(rowId, ts);{code} > # We should probably fix PartitionReplicaListener#resolveReadResult instead > of returning null in case of null readResult we should complete future with > null. > {code:java} > private CompletableFuture<BinaryRow> resolveReadResult( > ReadResult readResult, > @Nullable UUID txId, > @Nullable HybridTimestamp timestamp, > @Nullable Supplier<BinaryRow> lastCommitted > ) { > if (readResult == null) { > return null; > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)