Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
131208: sql/catalog/bootstrap: don't call PrefixEnd on tenant start key r=jeffswenson,fqazi a=stevendanna

KVServer expects that split keys have a valid tenant prefix. Calling PrefixEnd() on the start key to a tenant does not produce a valid key as the tenant ID is encoded as a varint.

Epic: none
Release note: None

Co-authored-by: Steven Danna <[email protected]>
  • Loading branch information
craig[bot] and stevendanna committed Sep 24, 2024
2 parents d26f61d + 43c52e2 commit 539917e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/sql/catalog/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ func TestRoundTripInitialValuesStringRepresentation(t *testing.T) {
roundTripInitialValuesStringRepresentation(t, 0 /* tenantID */)
})
t.Run("tenant", func(t *testing.T) {
const dummyTenantID = 54321
const dummyTenantID = 109
roundTripInitialValuesStringRepresentation(t, dummyTenantID)
})
t.Run("tenants", func(t *testing.T) {
const dummyTenantID1, dummyTenantID2 = 54321, 12345
const dummyTenantID1, dummyTenantID2 = 109, 255
require.Equal(t,
InitialValuesToString(makeMetadataSchema(dummyTenantID1)),
InitialValuesToString(makeMetadataSchema(dummyTenantID2)),
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/catalog/bootstrap/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func InitialValuesFromString(
}
// Add back the filtered out tenant end key.
if !codec.ForSystemTenant() {
splits = append(splits, roachpb.RKey(p.PrefixEnd()))
splits = append(splits, roachpb.RKey(codec.TenantEndKey()))
}
return kvs, splits, nil
}
Expand Down

0 comments on commit 539917e

Please sign in to comment.