From 25cefa4e2bda63778e14e101e9f8dab11e87a886 Mon Sep 17 00:00:00 2001 From: Annie Pompa Date: Mon, 30 Dec 2024 18:39:37 +0000 Subject: [PATCH] ccl/multiregionccl: deflake TestRegionLivenessProberForLeases In our `TestingRequestFilter`, we should ensure that the length of our delete request key is at least the same length as the prefix key; otherwise, we risk indexing out of bounds during our prefix key check. Epic: none Fixes: #138058 Release note: None --- pkg/ccl/multiregionccl/regionliveness_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ccl/multiregionccl/regionliveness_test.go b/pkg/ccl/multiregionccl/regionliveness_test.go index fcdfa04b7264..9a35bfaa853b 100644 --- a/pkg/ccl/multiregionccl/regionliveness_test.go +++ b/pkg/ccl/multiregionccl/regionliveness_test.go @@ -281,7 +281,9 @@ func TestRegionLivenessProberForLeases(t *testing.T) { keyToBlockMu.Lock() keyPrefix := keyToBlock keyToBlockMu.Unlock() - if keyPrefix == nil || !deleteRequest.Key[:len(keyPrefix)].Equal(keyPrefix) { + isPrefixToDelReq := len(deleteRequest.Key) >= len(keyPrefix) && + !deleteRequest.Key[:len(keyPrefix)].Equal(keyPrefix) + if keyPrefix == nil || isPrefixToDelReq { return nil } recoveryStart <- struct{}{}