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

RFC: Support user-specific log index #281

Open
TennyZhuang opened this issue Sep 1, 2019 · 4 comments
Open

RFC: Support user-specific log index #281

TennyZhuang opened this issue Sep 1, 2019 · 4 comments
Labels
Feature Related to a major feature.

Comments

@TennyZhuang
Copy link

TennyZhuang commented Sep 1, 2019

Background

In the original raft algorithm, log index is an increasing consequent integer generated by term leader, and is not exported to raft library user. After introducing follower reader, it's reasonable to allow client read by a specific old version (from MVCC) instead of latest entry. This feature will introduce a large latency improvement for large OLAP transaction. The learner need not to keep latest for every read request in a large transaction.

Implementation

To implement this feature, we need maintain the mapping from MVCC version to raft log index, which is heavy to implementation. An alternative solution is allow client to specific an increasing log index in propose request. Client should ensure the user-specific index is unique and increasing in order (For TiKV, the user-specific index is version generated in PD, these properties is already guaranteed in MVCC). Then we can implement follower-read-by-specific-version easily.

TBD

  1. Log Index for some raft internal operation (conf change) still needs a log index, how to generate it?
  2. The user-specific index is guaranteed to be increasing and unique, but not consequent. This will break some raft optimization that allow gap in log such as Parallel raft in PolarFS.

This is a very early idea, and I have not found it in any other implementation or publication.

@Fullstop000
Copy link
Member

Can you provide a more specific scenario for this feature? I think the MVCC style of reading could be more easily achieved out of the raft lib.

@TennyZhuang
Copy link
Author

TennyZhuang commented Sep 2, 2019 via email

@TennyZhuang
Copy link
Author

TennyZhuang commented Sep 2, 2019 via email

@Fullstop000
Copy link
Member

Fullstop000 commented Sep 2, 2019

It seems that now the follower read have to wait the follower keep latest with leader.

Is the key point that we don't have a mapping like index => version where the version is an application layer abstract?
What about maintaining the mapping applied index => version in the state machine so that when you want an old version reading you can just check the applied index.

Maybe I misunderstand your description.

@hicqu hicqu added the Feature Related to a major feature. label Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Related to a major feature.
Projects
None yet
Development

No branches or pull requests

3 participants