Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
128843: roachtest: fix `admission-control/disk-bandwidth-limiter` on azure r=sumeerbhola a=aadityasondhi

The CRDB data mount is different on azure when compared to AWS and GCE. We use `sda1` instead of `data1` in this case.

Fixes: #128364.

Release note: None

128932: catalog: rename ByID to ByIDWithoutLeased r=rafiss a=rafiss

This makes the function name much more clear. Previously, it would be easy to assume that ByID would also include leased descriptors.

fixes #99506
Release note: None

128985: kvflowcontrolpb,kvserverpb: add AdmittedResponseForRange r=kvoli a=sumeerbhola

For piggybacking a MsgAppResp message from a follower to the leader, to advance admitted. Also, RaftMessageRequest.AdmittedResponse contains these piggybacked messages

Informs #128309

Epic: CRDB-37515

Release note: None

128988: sql/randgen: do not generate expressions of type FLOAT4 r=mgartner a=mgartner

There are several known issues with the `FLOAT4` type. Our randomized
tests commonly fail due to these issues. They are not trivially fixed,
so for now we'll stop generating columns and expressions of type
`FLOAT4` in randomized tests.

Informs #128296

Release note: None


Co-authored-by: Aaditya Sondhi <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
Co-authored-by: sumeerbhola <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
  • Loading branch information
5 people committed Aug 14, 2024
5 parents 9421149 + 954c5e1 + 79f28f5 + 375d615 + b33e5e8 commit b6c7012
Show file tree
Hide file tree
Showing 74 changed files with 188 additions and 139 deletions.
10 changes: 5 additions & 5 deletions pkg/ccl/backupccl/restore_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ func createImportingDescriptors(
// to the new tables being restored.
for _, table := range mutableTables {
// Collect all types used by this table.
dbDesc, err := descsCol.ByID(txn.KV()).WithoutDropped().Get().Database(ctx, table.GetParentID())
dbDesc, err := descsCol.ByIDWithoutLeased(txn.KV()).WithoutDropped().Get().Database(ctx, table.GetParentID())
if err != nil {
return err
}
Expand Down Expand Up @@ -1412,7 +1412,7 @@ func createImportingDescriptors(
if details.DescriptorCoverage != tree.AllDescriptors {
for _, table := range tableDescs {
if lc := table.GetLocalityConfig(); lc != nil {
desc, err := descsCol.ByID(txn.KV()).WithoutDropped().Get().Database(ctx, table.ParentID)
desc, err := descsCol.ByIDWithoutLeased(txn.KV()).WithoutDropped().Get().Database(ctx, table.ParentID)
if err != nil {
return err
}
Expand Down Expand Up @@ -3018,12 +3018,12 @@ func setGCTTLForDroppingTable(
log.VInfof(ctx, 2, "lowering TTL for table %q (%d)", tableToDrop.GetName(), tableToDrop.GetID())
// We get a mutable descriptor here because we are going to construct a
// synthetic descriptor collection in which they are online.
dbDesc, err := descsCol.ByID(txn.KV()).Get().Database(ctx, tableToDrop.GetParentID())
dbDesc, err := descsCol.ByIDWithoutLeased(txn.KV()).Get().Database(ctx, tableToDrop.GetParentID())
if err != nil {
return err
}

schemaDesc, err := descsCol.ByID(txn.KV()).Get().Schema(ctx, tableToDrop.GetParentSchemaID())
schemaDesc, err := descsCol.ByIDWithoutLeased(txn.KV()).Get().Schema(ctx, tableToDrop.GetParentSchemaID())
if err != nil {
return err
}
Expand Down Expand Up @@ -3090,7 +3090,7 @@ func (r *restoreResumer) removeExistingTypeBackReferences(
return typ, nil
}

dbDesc, err := descsCol.ByID(txn).WithoutDropped().Get().Database(ctx, tbl.GetParentID())
dbDesc, err := descsCol.ByIDWithoutLeased(txn).WithoutDropped().Get().Database(ctx, tbl.GetParentID())
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/ccl/backupccl/restore_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func remapSchemas(
} else {
// If we found an existing schema, then we need to remap all references
// to this schema to the existing one.
desc, err := col.ByID(txn.KV()).Get().Schema(ctx, id)
desc, err := col.ByIDWithoutLeased(txn.KV()).Get().Schema(ctx, id)
if err != nil {
return false, err
}
Expand Down Expand Up @@ -406,7 +406,7 @@ func remapTables(
}

// Check privileges.
parentDB, err := col.ByID(txn.KV()).Get().Database(ctx, parentID)
parentDB, err := col.ByIDWithoutLeased(txn.KV()).Get().Database(ctx, parentID)
if err != nil {
return false, errors.Wrapf(err,
"failed to lookup parent DB %d", errors.Safe(parentID))
Expand Down Expand Up @@ -490,7 +490,7 @@ func remapTypes(
targetDB, typ.Name)
}
// Check privileges on the parent DB.
parentDB, err := col.ByID(txn.KV()).Get().Database(ctx, parentID)
parentDB, err := col.ByIDWithoutLeased(txn.KV()).Get().Database(ctx, parentID)
if err != nil {
return false, errors.Wrapf(err,
"failed to lookup parent DB %d", errors.Safe(parentID))
Expand Down Expand Up @@ -900,7 +900,7 @@ func getDatabaseIDAndDesc(
return dbID, nil, errors.Errorf("a database named %q needs to exist", targetDB)
}
// Check privileges on the parent DB.
dbDesc, err = col.ByID(txn).Get().Database(ctx, dbID)
dbDesc, err = col.ByIDWithoutLeased(txn).Get().Database(ctx, dbID)
if err != nil {
return 0, nil, errors.Wrapf(err,
"failed to lookup parent DB %d", errors.Safe(dbID))
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func checkMultiRegionCompatible(
// For REGION BY TABLE IN <region> tables, allow the restore if the
// database has the region.
regionEnumID := database.GetRegionConfig().RegionEnumID
typeDesc, err := col.ByID(txn).Get().Type(ctx, regionEnumID)
typeDesc, err := col.ByIDWithoutLeased(txn).Get().Type(ctx, regionEnumID)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/changefeed_dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func fetchTableDescriptors(
// and lie within the primary index span. Deduplication is important
// here as requesting the same span twice will deadlock.
return targets.EachTableID(func(id catid.DescID) error {
tableDesc, err := descriptors.ByID(txn.KV()).WithoutNonPublic().Get().Table(ctx, id)
tableDesc, err := descriptors.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Table(ctx, id)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/changefeedccl/changefeed_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1480,11 +1480,11 @@ func getQualifiedTableNameObj(
ctx context.Context, execCfg *sql.ExecutorConfig, txn *kv.Txn, desc catalog.TableDescriptor,
) (tree.TableName, error) {
col := execCfg.CollectionFactory.NewCollection(ctx)
db, err := col.ByID(txn).Get().Database(ctx, desc.GetParentID())
db, err := col.ByIDWithoutLeased(txn).Get().Database(ctx, desc.GetParentID())
if err != nil {
return tree.TableName{}, err
}
sc, err := col.ByID(txn).Get().Schema(ctx, desc.GetParentSchemaID())
sc, err := col.ByIDWithoutLeased(txn).Get().Schema(ctx, desc.GetParentSchemaID())
if err != nil {
return tree.TableName{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/fetch_table_bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func getTableDesc(
) (catalog.TableDescriptor, error) {
var desc catalog.TableDescriptor
f := func(ctx context.Context, txn descs.Txn) error {
tableDesc, err := txn.Descriptors().ByID(txn.KV()).WithoutNonPublic().Get().Table(ctx, tableID)
tableDesc, err := txn.Descriptors().ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Table(ctx, tableID)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/schemafeed/schema_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (tf *schemaFeed) primeInitialTableDescs(ctx context.Context) error {
}
// Note that all targets are currently guaranteed to be tables.
return tf.targets.EachTableID(func(id descpb.ID) error {
tableDesc, err := descriptors.ByID(txn.KV()).WithoutNonPublic().Get().Table(ctx, id)
tableDesc, err := descriptors.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Table(ctx, id)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/crosscluster/logical/logical_replication_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ func (p *logicalReplicationPlanner) generateInitialPlanWithInfo(
srcTableDesc := plan.DescriptorMap[pair.SrcDescriptorID]

// Look up fully qualified destination table name
dstTableDesc, err := descriptors.ByID(txn.KV()).WithoutNonPublic().Get().Table(ctx, descpb.ID(pair.DstDescriptorID))
dstTableDesc, err := descriptors.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Table(ctx, descpb.ID(pair.DstDescriptorID))
if err != nil {
return errors.Wrapf(err, "failed to look up table descriptor %d", pair.DstDescriptorID)
}
dbDesc, err := descriptors.ByID(txn.KV()).WithoutNonPublic().Get().Database(ctx, dstTableDesc.GetParentID())
dbDesc, err := descriptors.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Database(ctx, dstTableDesc.GetParentID())
if err != nil {
return errors.Wrapf(err, "failed to look up database descriptor for table %d", pair.DstDescriptorID)
}
scDesc, err := descriptors.ByID(txn.KV()).WithoutNonPublic().Get().Schema(ctx, dstTableDesc.GetParentSchemaID())
scDesc, err := descriptors.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Schema(ctx, dstTableDesc.GetParentSchemaID())
if err != nil {
return errors.Wrapf(err, "failed to look up schema descriptor for table %d", pair.DstDescriptorID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func newRandomStreamClient(streamURL *url.URL, db descs.DB) (streamclient.Client
c.streamURL = streamURL
if c.config.existingTableID > 0 {
if err := db.DescsTxn(context.Background(), func(ctx context.Context, txn descs.Txn) error {
c.tableDesc, err = txn.Descriptors().ByID(txn.KV()).Get().Table(ctx, c.config.existingTableID)
c.tableDesc, err = txn.Descriptors().ByIDWithoutLeased(txn.KV()).Get().Table(ctx, c.config.existingTableID)
return err
}); err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ func registerDiskBandwidthOverload(r registry.Registry) {

// TODO(aaditya): This function shares some of the logic with roachtestutil.DiskStaller. Consider merging the two.
setBandwidthLimit := func(nodes option.NodeListOption, rw string, bw int, max bool) error {
res, err := c.RunWithDetailsSingleNode(context.TODO(), t.L(), option.WithNodes(nodes[:1]), "lsblk | grep /mnt/data1 | awk '{print $2}'")
dataMount := "/mnt/data1"
if c.Cloud() == spec.Azure {
dataMount = "sda1"
}
res, err := c.RunWithDetailsSingleNode(context.TODO(), t.L(), option.WithNodes(nodes[:1]),
fmt.Sprintf("lsblk | grep %s | awk '{print $2}'", dataMount),
)
if err != nil {
t.Fatalf("error when determining block device: %s", err)
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ proto_library(
srcs = ["kvflowcontrol.proto"],
strip_import_prefix = "/pkg",
visibility = ["//visibility:public"],
deps = ["@com_github_gogo_protobuf//gogoproto:gogo_proto"],
deps = [
"//pkg/raft/raftpb:raftpb_proto",
"@com_github_gogo_protobuf//gogoproto:gogo_proto",
],
)

go_proto_library(
Expand All @@ -17,6 +20,7 @@ go_proto_library(
proto = ":kvflowcontrolpb_proto",
visibility = ["//visibility:public"],
deps = [
"//pkg/raft/raftpb",
"//pkg/roachpb", # keep
"@com_github_gogo_protobuf//gogoproto",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ func (a AdmittedRaftLogEntries) SafeFormat(w redact.SafePrinter, _ rune) {
w.Printf("admitted-entries (r%s s%s pri=%s up-to-%s)",
a.RangeID, a.StoreID, admissionpb.WorkPriority(a.AdmissionPriority), a.UpToRaftLogPosition)
}

func (a AdmittedResponseForRange) String() string {
return redact.StringWithoutMarkers(a)
}

func (a AdmittedResponseForRange) SafeFormat(w redact.SafePrinter, _ rune) {
w.Printf("admitted-response (s%s r%s %s)", a.LeaderStoreID, a.RangeID, a.Msg.String())
}
23 changes: 23 additions & 0 deletions pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb/kvflowcontrol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package cockroach.kv.kvserver.kvflowcontrol.kvflowcontrolpb;
option go_package = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb";

import "gogoproto/gogo.proto";
import "raft/raftpb/raft.proto";

// RaftAdmissionMeta contains information used by admission control for the
// select raft commands that use replication admission control. It contains a
Expand Down Expand Up @@ -77,6 +78,8 @@ message RaftAdmissionMeta {
// small write sizes). The ideas above are too complicated.
}

// AdmittedRaftLogEntries is only used by RACv1.
//
// AdmittedRaftLogEntries represents a set of raft log entries that were
// admitted below raft. These are identified by:
// - the range ID (there's one per raft group);
Expand Down Expand Up @@ -126,3 +129,23 @@ message RaftLogPosition {
uint64 term = 1;
uint64 index = 2;
}

// AdmittedResponseForRange is only used in RACv2. It contains a MsgAppResp
// from a follower to a leader, that was generated to advance the admitted
// vector for that follower, maintained by the leader.
message AdmittedResponseForRange {
option (gogoproto.goproto_stringer) = false;

// LeaderStoreID is used to route the request when this message is received
// at the leader node.
uint64 leader_store_id = 1 [(gogoproto.customname) = "LeaderStoreID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID"];

// RangeID of the raft group to which the MsgAppResp is directed. Used for
// routing at the leader node.
int64 range_id = 2 [(gogoproto.customname) = "RangeID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID"];

// Msg is the MsgAppResp containing the admitted vector.
raftpb.Message msg = 3 [(gogoproto.nullable) = false];
}
4 changes: 4 additions & 0 deletions pkg/kv/kvserver/kvserverpb/raft.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ message RaftMessageRequest {
// priority of the Entries in the Message are overridden to be
// raftpb.LowPri.
bool low_priority_override = 13;

// AdmittedResponse is used in RACv2, for piggybacking MsgAppResp messages
// from a follower to a leader, that advance admitted for a follower.
repeated kv.kvserver.kvflowcontrol.kvflowcontrolpb.AdmittedResponseForRange admitted_response = 14 [(gogoproto.nullable) = false];
reserved 10;
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/server/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func TestUpgradeHappensAfterMigrations(t *testing.T) {

internalDB := s.ApplicationLayer().InternalDB().(descs.DB)
err := internalDB.DescsTxn(ctx, func(ctx context.Context, txn descs.Txn) error {
systemDBDesc, err := txn.Descriptors().ByID(txn.KV()).Get().Database(ctx, keys.SystemDatabaseID)
systemDBDesc, err := txn.Descriptors().ByIDWithoutLeased(txn.KV()).Get().Database(ctx, keys.SystemDatabaseID)
if err != nil {
return err
}
Expand Down Expand Up @@ -409,7 +409,7 @@ SELECT version = crdb_internal.node_executable_version()
// - reminder to bump SystemDatabaseSchemaBootstrapVersion.
// - ensure that upgrades have run and updated the system database version.
err = internalDB.DescsTxn(ctx, func(ctx context.Context, txn descs.Txn) error {
systemDBDesc, err := txn.Descriptors().ByID(txn.KV()).Get().Database(ctx, keys.SystemDatabaseID)
systemDBDesc, err := txn.Descriptors().ByIDWithoutLeased(txn.KV()).Get().Database(ctx, keys.SystemDatabaseID)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2883,7 +2883,7 @@ func (s *systemStatusServer) HotRangesV2(
if err = s.sqlServer.distSQLServer.DB.DescsTxn(
ctx, func(ctx context.Context, txn descs.Txn) error {
col := txn.Descriptors()
desc, err := col.ByID(txn.KV()).WithoutNonPublic().Get().Table(ctx, descpb.ID(tableID))
desc, err := col.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Table(ctx, descpb.ID(tableID))
if err != nil {
return errors.Wrapf(err, "cannot get table descriptor with tableID: %d, %s", tableID, r.Desc)
}
Expand All @@ -2901,13 +2901,13 @@ func (s *systemStatusServer) HotRangesV2(
}
}

if dbDesc, err := col.ByID(txn.KV()).WithoutNonPublic().Get().Database(ctx, desc.GetParentID()); err != nil {
if dbDesc, err := col.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Database(ctx, desc.GetParentID()); err != nil {
log.Warningf(ctx, "cannot get database by descriptor ID: %s: %v", r.Desc, err)
} else {
dbName = dbDesc.GetName()
}

if schemaDesc, err := col.ByID(txn.KV()).WithoutNonPublic().Get().Schema(ctx, desc.GetParentSchemaID()); err != nil {
if schemaDesc, err := col.ByIDWithoutLeased(txn.KV()).WithoutNonPublic().Get().Schema(ctx, desc.GetParentSchemaID()); err != nil {
log.Warningf(ctx, "cannot get schema name for range descriptor: %s: %v", r.Desc, err)
} else {
schemaName = schemaDesc.GetName()
Expand Down
2 changes: 1 addition & 1 deletion pkg/spanconfig/spanconfigreconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ func (r *incrementalReconciler) filterForMissingTableIDs(
continue // nothing to do
}

desc, err := descsCol.ByID(txn).Get().Desc(ctx, descriptorUpdate.ID)
desc, err := descsCol.ByIDWithoutLeased(txn).Get().Desc(ctx, descriptorUpdate.ID)

considerAsMissing := false
if errors.Is(err, catalog.ErrDescriptorNotFound) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/spanconfig/spanconfigsqltranslator/sqltranslator.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (s *SQLTranslator) generateSpanConfigurations(
}

// We're dealing with a SQL object.
desc, err := s.txn.Descriptors().ByID(s.txn.KV()).Get().Desc(ctx, id)
desc, err := s.txn.Descriptors().ByIDWithoutLeased(s.txn.KV()).Get().Desc(ctx, id)
if err != nil {
if errors.Is(err, catalog.ErrDescriptorNotFound) {
return nil, nil // the descriptor has been deleted; nothing to do here
Expand Down Expand Up @@ -501,7 +501,7 @@ func (s *SQLTranslator) findDescendantLeafIDs(
func (s *SQLTranslator) findDescendantLeafIDsForDescriptor(
ctx context.Context, id descpb.ID,
) (descpb.IDs, error) {
desc, err := s.txn.Descriptors().ByID(s.txn.KV()).Get().Desc(ctx, id)
desc, err := s.txn.Descriptors().ByIDWithoutLeased(s.txn.KV()).Get().Desc(ctx, id)
if err != nil {
if errors.Is(err, catalog.ErrDescriptorNotFound) {
return nil, nil // the descriptor has been deleted; nothing to do here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (s *Tenant) LookupTableDescriptorByID(
ctx context.Context, txn isql.Txn, descsCol *descs.Collection,
) error {
var err error
desc, err = descsCol.ByID(txn.KV()).Get().Table(ctx, id)
desc, err = descsCol.ByIDWithoutLeased(txn.KV()).Get().Table(ctx, id)
return err
}))
return desc
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/alter_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (p *planner) checkCanDropSystemDatabaseRegion(ctx context.Context, region t
return err
}
typeIDsToFetch := typeIDsToFetchSet.Ordered()
dbTypes, err := p.Descriptors().ByID(p.txn).Get().Descs(ctx, typeIDsToFetch)
dbTypes, err := p.Descriptors().ByIDWithoutLeased(p.txn).Get().Descs(ctx, typeIDsToFetch)
if err != nil {
return errors.Wrapf(err, "failed to fetch multi-region enums while attempting to drop"+
" system database region %s", &region)
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/alter_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (n *alterFunctionRenameNode) startExec(params runParams) error {
// this one.
var dependentFuncs []string
for _, dep := range fnDesc.GetDependedOnBy() {
desc, err := params.p.Descriptors().ByID(params.p.Txn()).Get().Desc(params.ctx, dep.ID)
desc, err := params.p.Descriptors().ByIDWithoutLeased(params.p.Txn()).Get().Desc(params.ctx, dep.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -387,7 +387,7 @@ func (n *alterFunctionSetSchemaNode) startExec(params runParams) error {
// this one.
var dependentFuncs []string
for _, dep := range fnDesc.GetDependedOnBy() {
desc, err := params.p.Descriptors().ByID(params.p.Txn()).Get().Desc(params.ctx, dep.ID)
desc, err := params.p.Descriptors().ByIDWithoutLeased(params.p.Txn()).Get().Desc(params.ctx, dep.ID)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/sql/alter_table_locality.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (p *planner) AlterTableLocality(
}

// Ensure that the database is multi-region enabled.
dbDesc, err := p.Descriptors().ByID(p.txn).WithoutNonPublic().Get().Database(ctx, tableDesc.GetParentID())
dbDesc, err := p.Descriptors().ByIDWithoutLeased(p.txn).WithoutNonPublic().Get().Database(ctx, tableDesc.GetParentID())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -119,7 +119,7 @@ func (n *alterTableSetLocalityNode) alterTableLocalityGlobalToRegionalByTable(
)
}

dbDesc, err := params.p.Descriptors().ByID(params.p.txn).WithoutNonPublic().Get().Database(params.ctx, n.tableDesc.ParentID)
dbDesc, err := params.p.Descriptors().ByIDWithoutLeased(params.p.txn).WithoutNonPublic().Get().Database(params.ctx, n.tableDesc.ParentID)
if err != nil {
return err
}
Expand Down Expand Up @@ -181,7 +181,7 @@ func (n *alterTableSetLocalityNode) alterTableLocalityRegionalByTableToRegionalB
)
}

dbDesc, err := params.p.Descriptors().ByID(params.p.txn).WithoutNonPublic().Get().Database(params.ctx, n.tableDesc.ParentID)
dbDesc, err := params.p.Descriptors().ByIDWithoutLeased(params.p.txn).WithoutNonPublic().Get().Database(params.ctx, n.tableDesc.ParentID)
if err != nil {
return err
}
Expand Down Expand Up @@ -652,7 +652,7 @@ func setNewLocalityConfig(
kvTrace bool,
) error {
getMultiRegionTypeDesc := func() (*typedesc.Mutable, error) {
dbDesc, err := descsCol.ByID(txn).WithoutNonPublic().Get().Database(ctx, desc.GetParentID())
dbDesc, err := descsCol.ByIDWithoutLeased(txn).WithoutNonPublic().Get().Database(ctx, desc.GetParentID())
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit b6c7012

Please sign in to comment.