From 0cb16f0cf4f42c7725497728448aa31ad361fbd4 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Fri, 9 Dec 2022 17:30:10 -0600 Subject: [PATCH] Remove trackExistence check in batch (i.e. always build _exists) data. (#2348) (cherry picked from commit 5110405f2fc8b0fba60a11f415574a2172bd859f) --- batch/batch.go | 21 ++++++++------------- importer.go | 4 ---- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/batch/batch.go b/batch/batch.go index 42455c872..fc729f807 100644 --- a/batch/batch.go +++ b/batch/batch.go @@ -1313,20 +1313,15 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments shardWidth := b.shardWidth() emptyClearRows := make(map[int]uint64) - // create _exists fragments if needed - // TODO(tlt): maybe make this a separate flag for backward compatibility? - // (because dax.Table doesn't have this). - //if b.index.Options.TrackExistence { - if true { - var curBM *roaring.Bitmap - curShard := ^uint64(0) // impossible sentinel value for shard. - for _, col := range b.ids { - if col/shardWidth != curShard { - curShard = col / shardWidth - curBM = frags.GetOrCreate(curShard, "_exists", "") - } - curBM.DirectAdd(col % shardWidth) + // create _exists fragments + var curBM *roaring.Bitmap + curShard := ^uint64(0) // impossible sentinel value for shard. + for _, col := range b.ids { + if col/shardWidth != curShard { + curShard = col / shardWidth + curBM = frags.GetOrCreate(curShard, "_exists", "") } + curBM.DirectAdd(col % shardWidth) } for i, rowIDs := range b.rowIDs { diff --git a/importer.go b/importer.go index 645e3deea..390f3cd81 100644 --- a/importer.go +++ b/importer.go @@ -66,10 +66,6 @@ func (i *onPremImporter) ImportRoaringShard(ctx context.Context, tid dax.TableID return i.api.ImportRoaringShard(ctx, string(tid), shard, request) } -// EncodeImportValues is kind of weird. We're trying to mimic what the client -// does here (because the Importer interface was originally based off of the -// client methods). So we end up generating a protobuf-encode byte slice. And we -// don't really use path. func (i *onPremImporter) EncodeImportValues(ctx context.Context, tid dax.TableID, fld *dax.Field, shard uint64, vals []int64, ids []uint64, clear bool) (path string, data []byte, err error) { // This intentionally no-ops. See comment on struct. return "", nil, nil