From dad8211709f633fa160961ca2adebb72107647cf Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 31 Aug 2022 11:50:48 -0500 Subject: [PATCH] fix silly math typo For arbitrary mod values m, greater than zero, (x%m + 1) != 0 is always true What we almost certainly meant was x%(m+1) == 0 which would give you all the bits in row 0, half the bits in row 1, etcetera. Also, we drop to doing a quarter-shard because why not. --- delete_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/delete_test.go b/delete_test.go index df6249ca9..2b4e7035f 100644 --- a/delete_test.go +++ b/delete_test.go @@ -55,15 +55,20 @@ func TestExecutor_DeleteRecords(t *testing.T) { t.Helper() fieldName := "setfield" c.CreateField(t, indexName, pilosa.IndexOptions{TrackExistence: true}, fieldName) - rows := make([][2]uint64, ShardWidth*Rows) - for columnID := uint64(0); columnID < ShardWidth; columnID++ { + // we don't need to populate the whole thing, just enough to get a sample of it + width := uint64(ShardWidth / 4) + rows := make([][2]uint64, width*Rows) + n := 0 + // populate rows with decreasing density + for columnID := uint64(0); columnID < width; columnID++ { for rowID := uint64(0); rowID < Rows; rowID++ { - if rowID == 0 || (columnID%rowID+1) != 0 { - rows[rowID] = [2]uint64{rowID, columnID} + if (columnID % (rowID + 1)) == 0 { + rows[n] = [2]uint64{rowID, columnID} + n++ } } } - c.ImportBits(t, indexName, "setfield", rows) + c.ImportBits(t, indexName, "setfield", rows[:n]) } setupKeys := func(t *testing.T, r *require.Assertions, c *test.Cluster) { @@ -257,7 +262,6 @@ func TestExecutor_DeleteRecords(t *testing.T) { require.NoError(err, "restart cluster DeleteRecordsBig") err = c.AwaitState(disco.ClusterStateNormal, 10*time.Second) require.NoError(err, "backToNormal") - }) }