Skip to content

Commit bfdd9d4

Browse files
committed
kv/bulk: add debug setting to discard SSTs
When debugging performance of various bulk operations, sometimes it is useful to focus on the performance of the parts of the operation that produce data to be ingested without the ingestion of said data complicating the picture or applying a form of backpressure on the production process that changes its performance. This setting is strictly for debugging/development use and as such is locked with the unsafe setting interlock. Release note: none. Epic: none.
1 parent 58b1fd6 commit bfdd9d4

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pkg/kv/bulk/sst_batcher.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ func (b *SSTBatcher) syncFlush() error {
628628
return flushErr
629629
}
630630

631+
var debugDropSSTOnFlush = settings.RegisterBoolSetting(
632+
settings.ApplicationLevel,
633+
"bulkio.ingest.unsafe_debug.drop_sst_on_flush.enabled",
634+
"if set, the SSTBatcher will simply discard data instead of flushing it (destroys data; for performance debugging experiments only)",
635+
false,
636+
settings.WithUnsafe,
637+
)
638+
631639
// startFlush starts a flush of the current batch. If it encounters any errors
632640
// the errors are reported by the call to `syncFlush`.
633641
//
@@ -817,9 +825,13 @@ func (b *SSTBatcher) startFlush(ctx context.Context, reason int) {
817825
b.asyncAddSSTs.GoCtx(func(ctx context.Context) error {
818826
defer res.Release()
819827
defer b.mem.Shrink(ctx, reserved)
820-
results, err := b.adder.AddSSTable(ctx, batchTS, start, end, data, mvccStats, performanceStats)
821-
if err != nil {
822-
return err
828+
829+
var results []addSSTResult
830+
if !debugDropSSTOnFlush.Get(&b.settings.SV) {
831+
results, err = b.adder.AddSSTable(ctx, batchTS, start, end, data, mvccStats, performanceStats)
832+
if err != nil {
833+
return err
834+
}
823835
}
824836

825837
// Now that we have completed ingesting the SSTables we take a lock and

0 commit comments

Comments
 (0)