Skip to content

Commit 35973fd

Browse files
craig[bot]iskettanehspilchen
committed
158612: kvserver: deflake TestTenantCtx r=iskettaneh a=iskettaneh The test waits for a scan request and fails if the tenantID of the request (for a perticular key) didn't equal the tenantID created in the test. However, upon inspecting the scan request. It was a Meta2 scan, which doesn't seem to carry the tenantID in its context. This commit skips this check for meta2 requests. Fixes: #158493 Release note: none 158633: sst: fix warnings in .proto files r=spilchen a=spilchen This fixes the following warnings for fields recently added for the distributed merge work: ``` WARNING: field SSTFileInfo.StartKey is a non-nullable bytes type, nullable=false has no effect WARNING: field SSTFileInfo.EndKey is a non-nullable bytes type, nullable=false has no effect WARNING: field SSTFiles.RowSamples is a repeated non-nullable native type, nullable=false has no effect ``` Epic: CRDB-48845 Release notes: none Co-authored-by: Ibrahim Kettaneh <ibrahim.kettaneh@cockroachlabs.com> Co-authored-by: Matt Spilchen <matt.spilchen@cockroachlabs.com>
3 parents 8f079ba + 5a00f38 + 4f99430 commit 35973fd

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

pkg/kv/kvserver/client_tenant_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,17 @@ func TestTenantCtx(t *testing.T) {
417417
// context looks as expected, and signal their channels.
418418

419419
tenID, isTenantRequest := roachpb.ClientTenantFromContext(ctx)
420-
keyRecognized := strings.Contains(ba.Requests[0].GetInner().Header().Key.String(), magicKey)
420+
key := ba.Requests[0].GetInner().Header().Key
421+
keyRecognized := strings.Contains(key.String(), magicKey)
421422
if !keyRecognized {
422423
return nil
423424
}
424425

426+
// Skip meta2 range lookups as they don't carry tenant context.
427+
if bytes.HasPrefix(key, keys.Meta2Prefix) {
428+
return nil
429+
}
430+
425431
var scanReq *kvpb.ScanRequest
426432
var pushReq *kvpb.PushTxnRequest
427433
if isSingleScan := ba.IsSingleRequest() && ba.Requests[0].GetInner().Method() == kvpb.Scan; isSingleScan {
@@ -431,6 +437,9 @@ func TestTenantCtx(t *testing.T) {
431437
pushReq = ba.Requests[0].GetInner().(*kvpb.PushTxnRequest)
432438
}
433439

440+
t.Logf("received request with key: %s, isTenantRequest: %t, tenID: %d",
441+
key.String(), isTenantRequest, tenID)
442+
434443
switch {
435444
case scanReq != nil:
436445
var err error

pkg/sql/bulksst/sst_info.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import "gogoproto/gogo.proto";
1111

1212
message SSTFileInfo {
1313
required string uri = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "URI"];;
14-
required bytes start_key = 2 [(gogoproto.nullable) = false, (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.Key"];
15-
required bytes end_key = 3 [(gogoproto.nullable) = false, (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.Key"];
14+
required bytes start_key = 2 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.Key"];
15+
required bytes end_key = 3 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.Key"];
1616
required uint64 file_size = 4 [(gogoproto.nullable) = false];
1717
optional bytes row_sample = 5 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.Key"];
1818
}
1919

2020
message SSTFiles {
2121
repeated SSTFileInfo sst = 1 [(gogoproto.customname) = "SST"];
22-
repeated string row_samples = 2 [(gogoproto.nullable) = false];
22+
repeated string row_samples = 2;
2323
required uint64 total_size = 3 [(gogoproto.nullable) = false];
2424
}

0 commit comments

Comments
 (0)