Search code examples
tikv

What would happen raft-log-gc-size-limit is larger than region-split-size in TiKV


I have a TiKV setup it has a region-split-size as 96MB, which is the default and raft-log-gc-size-limit is 144MB. How does it impact the tikv cluster. Since it is mentioned that raft-log-gc-size-limit should be 3/4th of region-split-size.


Solution

  • You may waste space for storing raft logs and waste network traffic to restore Raft state.

    A Region is managed by a Raft group, and it splits when it's data exceeds region-max-size, eg, Region [a,e) may be split into several Regions [a,b), [b,c), [c,d), [d,e) and the size of [a,b), [b,c), [c,d) are around the region-split-size. So TiKV assumes size of a snapshot is around the region-split-size too.

    An out of date peer restores state either by snapshot or by raft logs. Raft logs are always preferred. There are two possible outcomes if we store too many raft logs (> region-spilt-size):

    1. Waste network traffic to restore state,
    2. Waste space to store raft logs, older raft logs may never be fetched and sent.