Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8pt] Describe iterator stability guarantees #2102

Open
8 tasks
Totktonada opened this issue Apr 23, 2021 · 5 comments
Open
8 tasks

[8pt] Describe iterator stability guarantees #2102

Totktonada opened this issue Apr 23, 2021 · 5 comments
Labels
add details [nature] More details needed, some info missing. Documentation is incomplete. customer Reported by paying customers server [area] Task relates to Tarantool's server (core) functionality

Comments

@Totktonada
Copy link
Member

Totktonada commented Apr 23, 2021

Describe iterator stability guarantees

Product: Tarantool
Since: 1.7.4-420-g2160e4cbd
Audience/target: application / module developers.
Root document: TBD (a new article to be created)
SME: @alyapunov

Details

(Am I miss something? Maybe we have some article that answers all my questions?)

I want to know how exactly I can use index iterators. The motivating question is the following: if I'll open an iterator once for traversing the whole space what details I should keep in the mind? Whether the answer varies depending on an index type (tree/hash/rtree/bitset)? Depending on a space engine (memtx / vinyl)?

In fact, I unable to give a checklist. Let's consider the issue as request for such checklist.

Some examples I have in the mind. Say, if I open ALL iterator and then add a tuple that is minimal by given index, will I receive it from the iterator? Or, if I have [[1], [3]] space and open GT iterator with the key [1], fetch the first tuple ([1]), insert tuple [2] and fetch a next tuple from the iterator (will it return [2] or [3])? Are there incorrect actions that may lead to an undefined behaviour? Whether a vinyl index iterator is stable in the same sense and in the same way as a memtx tree iterator?

Please, take me right. I have partial information about those guarantees and constantly in doubt that I'm missing something. I would want to have a source of truth here: an article from an expert in the area or at least approved by the expert (from the point of comprehensiveness and correctness).

Maybe we can describe an index iterator algorithm in simple words and the description will answer all such questions.

Relevant links:

Definition of done

I highlighted points that're important for me. Feel free to add more if necessary.

  • General guarantees.
  • The list of cases one should take care about.
  • (optional) Simple test cases that show the actual behaviour.
  • Index types differences.
  • Space engines differences.
  • Tarantool versions differences.
  • Approve of comprehensiveness from the expert.
  • Approve of correctness from the expert.

(I guess it should be a kind of a separate article (user guide?), but don't know for sure.)

@Totktonada Totktonada added the server [area] Task relates to Tarantool's server (core) functionality label Apr 23, 2021
@NickVolynkin NickVolynkin added this to the Estimate [@NickVolynkin] milestone Apr 28, 2021
@veod32 veod32 added the add details [nature] More details needed, some info missing. Documentation is incomplete. label Jun 2, 2021
@veod32
Copy link
Collaborator

veod32 commented Jun 2, 2021

@Totktonada
Regarding the index iterators, we have only this as far as I can see:
https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_index/pairs/

Can you please check if some of your points are covered there?
After that, we can decide what kind of content should be written additionally and where to put it.

@Totktonada
Copy link
Member Author

The paragraph that starts from the 'To understand consistency of tuples' words looks more or less relevant. I propose the mental experiment here: can you answer questions above after reading it? For me the answer is 'no' (for all questions). What also doubts me: I'm not sure that the wording is perfectly correct in context of vinyl / MVCC.

@Totktonada
Copy link
Member Author

I think the ideal solution would be an article (a separate page), where we'll collect all knowledge on the topic. The article will be referenced from the API documentation. Even if the article will duplicate information that spread across the documentation here and there in explicit or implicit way, there is no problem: it just presents this topic in the convenient way.

ArtDu added a commit to tarantool/expirationd that referenced this issue Jun 22, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
ArtDu added a commit to tarantool/expirationd that referenced this issue Jun 25, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
ArtDu added a commit to tarantool/expirationd that referenced this issue Jun 30, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
ArtDu added a commit to tarantool/expirationd that referenced this issue Jul 2, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
ArtDu added a commit to tarantool/expirationd that referenced this issue Jul 5, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
ligurio pushed a commit to tarantool/expirationd that referenced this issue Jul 6, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
@veod32 veod32 removed their assignment Aug 27, 2021
ligurio pushed a commit to tarantool/expirationd that referenced this issue Sep 22, 2021
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: #50
@veod32 veod32 changed the title [0pt] Describe iterator stability guarantees [5pt] Describe iterator stability guarantees Oct 15, 2021
@veod32 veod32 changed the title [5pt] Describe iterator stability guarantees [8pt] Describe iterator stability guarantees Oct 15, 2021
@veod32 veod32 removed this from the Estimate [@veod32] milestone Dec 24, 2021
@Totktonada
Copy link
Member Author

NB: Take care to the point in tarantool versions, where functional indexes became stable. See tarantool/tarantool#6786 for details.

ArtDu added a commit to ArtDu/expirationd that referenced this issue May 10, 2022
The vinyl and memtx tree index have the same iteration logic using
pairs. This is confirmed by the stability of iterators, see
tarantool/doc#2102

Needed for: tarantool#50
@patiencedaur
Copy link
Contributor

Related: #766

@patiencedaur patiencedaur added the customer Reported by paying customers label Jul 6, 2022
@veod32 veod32 removed the 8sp label Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add details [nature] More details needed, some info missing. Documentation is incomplete. customer Reported by paying customers server [area] Task relates to Tarantool's server (core) functionality
Projects
None yet
Development

No branches or pull requests

4 participants