From 5ec42e32fe4139e5edb4f3aff869a4090ed891d4 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Thu, 19 Dec 2024 17:39:31 -0800 Subject: [PATCH] WIP remove the only usage of InitPut with FailOnTombstones --- pkg/sql/sqlliveness/slstorage/slstorage.go | 2 +- pkg/sql/sqlliveness/slstorage/slstorage_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/sql/sqlliveness/slstorage/slstorage.go b/pkg/sql/sqlliveness/slstorage/slstorage.go index 245860c12575..234b16519abb 100644 --- a/pkg/sql/sqlliveness/slstorage/slstorage.go +++ b/pkg/sql/sqlliveness/slstorage/slstorage.go @@ -529,7 +529,7 @@ func (s *Storage) Insert( } v := encodeValue(expiration) - batch.InitPut(k, &v, true) + batch.InitPut(k, &v, false /* failOnTombstones */) return txn.CommitInBatch(ctx, batch) }); err != nil { diff --git a/pkg/sql/sqlliveness/slstorage/slstorage_test.go b/pkg/sql/sqlliveness/slstorage/slstorage_test.go index e31b9e400a7f..fb2e942a227b 100644 --- a/pkg/sql/sqlliveness/slstorage/slstorage_test.go +++ b/pkg/sql/sqlliveness/slstorage/slstorage_test.go @@ -269,6 +269,10 @@ func TestStorage(t *testing.T) { require.False(t, exists) require.Equal(t, int64(1), metrics.WriteFailures.Count()) } + // Ensure it cannot be inserted again. + { + require.Error(t, storage.Insert(ctx, id, exp)) + } }) t.Run("test-jitter", func(t *testing.T) { // We want to test that the GC runs a number of times but is jitterred.