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

kvserver: re-evaluate raft log truncation heuristics #75802

Open
tbg opened this issue Feb 1, 2022 · 2 comments
Open

kvserver: re-evaluate raft log truncation heuristics #75802

tbg opened this issue Feb 1, 2022 · 2 comments
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team

Comments

@tbg
Copy link
Member

tbg commented Feb 1, 2022

Is your feature request related to a problem? Please describe.

The raft log truncation heuristics date back to a world in which we were very aggressive about truncations (since the log needed to be included in snapshots and could make them very large) while simultaneously being very defensive (if a snapshot is in flight, we will never cut it off from the log).

We just saw (internal link) that these heuristics could be problematic, and that some of the thresholds were not adjusted when we changed our default range size from 64mb to 512mb.

We should revisit all of these heuristics and, through thought and experimentation, adjust them with the goal of avoiding pathological build-up of raft log as well as "unnecessary" rejection of snapshots

Additional context

#36262 also proposes allowing followers to truncate "locally" (i.e. without being prompted to truncated by the leader), in which case they would use different (simpler) heuristics than the leader.

Jira issue: CRDB-12843

Epic CRDB-39898

@tbg tbg added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Feb 1, 2022
@erikgrinaker
Copy link
Contributor

Additionally, #75793 adds a raftLogTruncationClearRangeThreshold constant that controls the number of entries beyond which log truncation switches from dropping Pebble point tombstones to range tombstones. This is set very conservatively (100000), and is unlikely to trigger even with lagging followers and hitting RaftLogTruncationThreshold (16 MB), due to concerns that dropping too many range tombstones may be detrimental to Pebble.

A setting of e.g. 1000 appears more reasonable here, but this needs to be tuned in concert with e.g. RaftLogTruncationThreshold and other parameters, and benchmarked to make sure the range tombstones are an improvement rather than a detriment in most or all realistic circumstances. Also related to cockroachdb/pebble#1295.

Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team
Projects
No open projects
Status: Incoming
Development

No branches or pull requests

2 participants