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

release-21.1: bulk: add pre-flush delay setting #73757

Merged
merged 1 commit into from Dec 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions pkg/kv/bulk/sst_batcher.go
Expand Up @@ -36,6 +36,13 @@ var (
"size below which a 'bulk' write will be performed as a normal write instead",
400*1<<10, // 400 Kib
)

ingestDelay = settings.RegisterDurationSetting(
"bulkio.ingest.flush_delay",
"amount of time to wait before sending a file to the KV/Storage layer to ingest",
0,
settings.NonNegativeDuration,
)
)

type sz int64
Expand Down Expand Up @@ -264,6 +271,17 @@ func (b *SSTBatcher) doFlush(ctx context.Context, reason int, nextKey roachpb.Ke
}
b.flushCounts.total++

if delay := ingestDelay.Get(&b.settings.SV); delay != 0 {
if delay > time.Second || log.V(1) {
log.Infof(ctx, "delaying %s before flushing ingestion buffer...", delay)
}
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(delay):
}
}

hour := hlc.Timestamp{WallTime: timeutil.Now().Add(time.Hour).UnixNano()}

start := roachpb.Key(append([]byte(nil), b.batchStartKey...))
Expand Down