-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: recompute raft log size in Raft log queue when zero
When a node starts, it has no knowledge of the true size of its replicas' Raft logs. However, without this knowledge, log truncations on replicas that have no regular write activity will not take place (unless the log is too long). This doesn't matter in most circumstances (though it wastes a bit of space) but if it does (reliably hit by users) it can be problematic since snapshots contain the historical Raft log, and snapshots are refused when they contain a large amount of logs. In particular in conjunction with IMPORT/RESTORE (which reliably creates log entries weighing in at 25mb each) this often resulted in ranges that were unable to rebalance until somehow convinced to truncate their logs. More generally, any workload in which ~100 entries could combine to a size of more than 16mb would trigger this problem if a node was restarted and became leaseholder after the restart while retaining such a log. We are planning to omit the historical log from snapshots in the near future (solving this problem), but in the interim, add a mechanism that recomputes the raft log size if it is zero (and thus definitely unknown). Fixes #33071. Release note (bug fix): Prevent a situation in which snapshots would be refused repeatedly over long periods of time, with error messages such as "aborting snapshot because raft log is too large" appearing in the logs, and often accompanied by under-replicated ranges in the UI.
- Loading branch information
Showing
7 changed files
with
231 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters