Skip to content

Range created by Split may conflict with Range created by multiraft #1644

Closed
@es-chow

Description

@es-chow

For a normal range split, Range struct in memory created by Split will be created first before a Raft message is received.
2015-07-07 10 20 35
But there are some corner cases Range created by Split may conflict with Range created by multiraft when receiving a Raft message.

  1. Before A EndTransactionRequest(split_trigger) is applied, a Raft message from other node had been received, then a Range struct will be created by multiraft calling Store.GroupStorage such as the node 3 in the following picture.

2015-07-07 10 22 18

2. Before a EndTransactionRequest(split_trigger) is applied, multiple Raft message include MsgSnap from other node had been received, then this Range will failed in Range.ApplySnapshot as the key space is conflict with existing key space in the store such as the node 3 in the following picture.

2015-07-07 10 22 27

3. As the Applying Raft command is asynchorous with writing into storage, so some Raft messages may delayed in applying even it's a Raft leader. This also cause key space conflicting such as the node 3.

2015-07-07 10 22 38

One way to resolve case 1 and 2 is intercepting the MsgVote, MsgApp message if a multiraft group cannot be found in multiraft and delay the group and range creating until a MsgSnap is received and the RangeDescriptor inside is not conflict the key space in the store, if conflict, then a multiraft group and range will not be created to wait the EndTransaction(split_trigger) to finish. But this is not work with case 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions