cockroachdb / cockroachdb/cockroach
kvserver/batcheval: unexpected special case in TestIsSpanEmpty when pointed to a secondary tenant
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Over in #110008 we are checking that KV operations work "the same" when run from a secondary tenant.
As part of this work, when we made TestIsSpanEmpty run over a secondary tenant we had to introduce this special case:
```diff
@@ -95,7 +102,13 @@ func TestIsSpanEmpty(t *testing.T) {
require.Equal(t, delta, atomic.LoadInt64(&sentIsSpanEmptyRequests)-before)
}
checkIsCalled(t, false, 2, mkKey(""), mkKey("").PrefixEnd())
- checkIsCalled(t, false, 4, mkKey(""), mkKey("").PrefixEnd())
+ expectedCalls := int64(4)
+ if srv.TenantController().StartedDefaultTestTenant() {
+ // TODO(kv): investigate why there is one more call to IsSpanEmpty
+ // when the request is routed through a secondary tenant.
+ expectedCalls = 5
+ }
+ checkIsCalled(t, false, expectedCalls, mkKey(""), mkKey("").PrefixEnd())
}
```
**Expected behavior**
Naively, one should expect the number of expected calls to be the same. Why is it different?
To resolve this issue, we expect an investigation then:
- either this is a bug (should be fixed)
- the behavior is expected, in which case remove the TODO in code and replace by a comment that explains what is going on.
Epic: CRDB-26687
Jira issue: CRDB-31344
Contributor guide
Assessment
This issue has not been assessed yet.