-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
A-kv-replicationRelating to Raft, consensus, and coordination.Relating to Raft, consensus, and coordination.C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.T-kvKV TeamKV Teambranch-masterFailures and bugs on the master branch.Failures and bugs on the master branch.
Description
Snapshots can be applied to a Replica
storage in two ways:
IngestAndExciseFiles
excises a span and applies an arbitrary number of "regular", shared and external SSTs.ConvertFilesToBatchAndCommit
is a fast-path for small/simple snapshot ingestions (containing only "regular" SSTs and not exceeding 100 KiB).
The decision is made shortly before applying the snapshot. The fast-path (2) needs to read back the SST files that the MultiSSTWriter has already written/synced to storage.
However, the information needed for this decision (the total SST size, and the number of shared/external SSTs) is known way earlier at the sender (upd). If we pass this information in the snapshot header/handshake (we already have at least a proxy for that: size, shared/external), the receiver can avoid the MultiSSTWriter
and the conversion step (2), instead generating the batch directly. This would result in faster small snapshots.
Other benefits of this approach:
- The slightly redundant tracking of cleared spans in the snapshot preparation code can be removed.
- Eliminating
ConvertFilesToBatchAndCommit
(which is a rather ad-hoc API and can change) removes the need for this special case to leak into storage (we need to persist ingestion call parameters into WAG). This one probably can be addressed independently: convert to batch and store this batch to the WAG, instead of the call parameters.
Jira issue: CRDB-55413
Metadata
Metadata
Assignees
Labels
A-kv-replicationRelating to Raft, consensus, and coordination.Relating to Raft, consensus, and coordination.C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.T-kvKV TeamKV Teambranch-masterFailures and bugs on the master branch.Failures and bugs on the master branch.