Skip to content

memtx: track index:random reads and clarify result#7683

Merged
alyapunov merged 1 commit intotarantool:masterfrom
CuriousGeorgiy:gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency
Sep 23, 2022
Merged

memtx: track index:random reads and clarify result#7683
alyapunov merged 1 commit intotarantool:masterfrom
CuriousGeorgiy:gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency

Conversation

@CuriousGeorgiy
Copy link
Member

TREE (HASH) index implements random method: if random returns nothing, i.e. the space is empty, add gap tracking of whole range (full scan tracking), since this result is equivalent to index:select{}, otherwise clarify result.

Closes #7670

@CuriousGeorgiy CuriousGeorgiy added bug Something isn't working memtx teamC mvcc labels Sep 14, 2022
@CuriousGeorgiy CuriousGeorgiy self-assigned this Sep 14, 2022
@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency branch from 9edb664 to 28366e3 Compare September 14, 2022 08:08
@drewdzzz drewdzzz assigned CuriousGeorgiy and unassigned drewdzzz Sep 21, 2022
@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency branch 3 times, most recently from 210c7ad to 3c428ee Compare September 22, 2022 10:14
@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency branch from 3c428ee to 5575144 Compare September 22, 2022 10:35
}

do {
uint32_t k = light_index_random(hash_table, rnd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must increment rnd each time, otherwise you'll get the same k each time.

Copy link
Member Author

@CuriousGeorgiy CuriousGeorgiy Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, missed that, my test was broken and it didn't catch this out, sorry.

Thanks for pointing this out!

@drewdzzz drewdzzz self-requested a review September 22, 2022 12:46
@drewdzzz drewdzzz assigned CuriousGeorgiy and unassigned alyapunov and drewdzzz Sep 22, 2022
TREE (HASH) index implements `random` method: if the space is empty from
the transaction's perspective, which means we have to return nothing, add
gap tracking of whole range (full scan
tracking), since this result is equivalent to `index:select{}`, otherwise
repeatedly call `random` and clarify result, until we get a non-empty one.
We do not care about performance here, since all operations in context of
transaction management currently have O(number of dirty tuples)
complexity.

Closes tarantool#7670

NO_DOC=bugfix
@CuriousGeorgiy CuriousGeorgiy force-pushed the gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency branch from 5575144 to ca79e14 Compare September 23, 2022 07:50
@drewdzzz drewdzzz removed their assignment Sep 23, 2022
@alyapunov alyapunov added the full-ci Enables all tests for a pull request label Sep 23, 2022
@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 84.301% when pulling ca79e14 on CuriousGeorgiy:gh-7670-memtx-tx-manager-tree-hash-idx-rand-inconsistency into 8ee0e43 on tarantool:master.

@alyapunov alyapunov merged commit 1b82beb into tarantool:master Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working full-ci Enables all tests for a pull request memtx mvcc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

memtx TREE and HASH index random transaction management inconsistency

4 participants