Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
87533: sqlliveness: add timeouts to heartbeats r=ajwerner a=aadityasondhi

Previously, sqlliveness heartbeat operations could block on the transactions that were involved. This change introduces some timeouts of the length of the heartbeat during the create and refresh operations.

Resolves #85541

Release note: None

Release justification: low-risk bugfix to existing functionality

88293: backupccl: elide expensive ShowCreate call in SHOW BACKUP r=stevendanna a=adityamaru

In #88376 we see the call to `ShowCreate` taking ~all the time on a cluster with
2.5K empty tables. In all cases except `SHOW BACKUP SCHEMAS` we do not
need to construct the SQL representation of the table's schema. This
results in a marked improvement in the performance of `SHOW BACKUP`
as can be seen in #88376 (comment).

Fixes: #88376

Release note (performance improvement): `SHOW BACKUP` on a backup containing
several table descriptors is now more performant

88471: sql/schemachanger: plumb context, check for cancelation sometimes r=ajwerner a=ajwerner

Fixes #87246

This will also improve tracing.

Release note: None

88557: testserver: add ShareMostTestingKnobsWithTenant option r=msbutler a=stevendanna

The new ShareMostTestingKnobs copies nearly all of the testing knobs specified for a TestServer to any tenant started for that server.

The goal here is to make it easier to write tests that depend on testing hooks that work under probabilistic tenant testing.

Release justification: non-production code change

Release note: None

88562: upgrade grpc to v.1.49.0 r=erikgrinaker a=pavelkalinnikov

Fixes #81881
Touches #72083

Release note: upgraded grpc to v1.49.0 to fix a few panics that the old version caused

88568: sql: fix panic due to missing schema r=ajwerner a=ajwerner

A schema might not exist because it has been dropped. We need to mark the lookup as required.

Fixes #87895

Release note (bug fix): Fixed a bug in pg_catalog tables which could result in an internal error if a schema is concurrently dropped.

Co-authored-by: David Hartunian <[email protected]>
Co-authored-by: Aaditya Sondhi <[email protected]>
Co-authored-by: adityamaru <[email protected]>
Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: Steven Danna <[email protected]>
Co-authored-by: Pavel Kalinnikov <[email protected]>
  • Loading branch information
7 people committed Sep 23, 2022
7 parents 6971977 + 59a70ba + cc68174 + 8778f63 + 11b7ea9 + 883883f + 5ae96bd commit 2c18ed3
Show file tree
Hide file tree
Showing 28 changed files with 350 additions and 95 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9304,10 +9304,10 @@ def go_deps():
name = "org_golang_google_grpc",
build_file_proto_mode = "disable_global",
importpath = "google.golang.org/grpc",
sha256 = "30dde2a858d77414c283994f1ace3dd52f2fa75e43a9b13057d458525808917f",
strip_prefix = "google.golang.org/grpc@v1.47.0",
sha256 = "bd07e8767218f67342fe6e673754db022d85a62167638791da477fad3f4a868f",
strip_prefix = "google.golang.org/grpc@v1.49.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.47.0.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.49.0.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/genproto/org_golang_google_genproto-v0.0.0-20220505152158-f39f71e6c8f3.zip": "8aa446ba7fe5a28d398eceefdad569b604bd4f9c0f86662db0d35fbf61d316cf",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/cmd/protoc-gen-go-grpc/org_golang_google_grpc_cmd_protoc_gen_go_grpc-v1.1.0.zip": "13877d86cbfa30bde4d62fef2bc58dd56377dcb502c16cf78197f6934193009a",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/examples/org_golang_google_grpc_examples-v0.0.0-20210324172016-702608ffae4d.zip": "f5cad7b05a93557c91864a02890a35c6bc5c394897222978cff2b880a78f7a11",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.47.0.zip": "30dde2a858d77414c283994f1ace3dd52f2fa75e43a9b13057d458525808917f",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.49.0.zip": "bd07e8767218f67342fe6e673754db022d85a62167638791da477fad3f4a868f",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.1.zip": "bf386bcd36987f898e70c8330c6f7ada03e5112909f0a92b7510961403bf61da",
"https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/DataDog/dd-trace-go.v1/in_gopkg_datadog_dd_trace_go_v1-v1.17.0.zip": "2ebcc818df0b2d560a61037da4492ae7effbaed67de94339a1d3a72728d2cb09",
"https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/airbrake/gobrake.v2/in_gopkg_airbrake_gobrake_v2-v2.0.9.zip": "2db903664908e5a9afafefba94821b9579bbf271e2929c1f0b7b1fdd23f7bbcf",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ require (
golang.org/x/tools v0.1.11
google.golang.org/api v0.80.0
google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3
google.golang.org/grpc v1.47.0
google.golang.org/grpc v1.49.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3084,8 +3084,8 @@ google.golang.org/grpc v1.41.0-dev.0.20210907181116-2f3355d2244e/go.mod h1:U3l9u
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d h1:CJP00gEaaYNJuaTXEg456rWNC1oUOfiAiUjuwyAhEmM=
google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE=
Expand Down
6 changes: 6 additions & 0 deletions pkg/base/test_server_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ type TestServerArgs struct {
// or if some of the functionality being tested is not accessible from
// within tenants.
DisableDefaultTestTenant bool

// ShareMostTestingKnobsWithTenant should be set by tests that want their
// testing knobs shared with the any DefaultTestTenant that the server starts.
// See (*testserver).TestingKnobsForTenant for details on which knobs aren't
// shared.
ShareMostTestingKnobsWithTenant bool
}

// TestClusterArgs contains the parameters one can set when creating a test
Expand Down
56 changes: 38 additions & 18 deletions pkg/ccl/backupccl/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ func backupShowerDefault(

var rows []tree.Datums
for layer, manifest := range info.manifests {
ctx, sp := tracing.ChildSpan(ctx, "backupccl.backupShowerDefault.fn.layer")

// Map database ID to descriptor name.
dbIDToName := make(map[descpb.ID]string)
schemaIDToName := make(map[descpb.ID]string)
Expand All @@ -692,11 +694,12 @@ func backupShowerDefault(
}
}
}

var fileSizes []int64
if len(info.fileSizes) > 0 {
fileSizes = info.fileSizes[layer]
}
tableSizes, err := getTableSizes(manifest.Files, fileSizes)
tableSizes, err := getTableSizes(ctx, manifest.Files, fileSizes)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -772,18 +775,23 @@ func backupShowerDefault(
rowCountDatum = tree.NewDInt(tree.DInt(tableSize.rowCount.Rows))
fileSizeDatum = tree.NewDInt(tree.DInt(tableSize.fileSize))

displayOptions := sql.ShowCreateDisplayOptions{
FKDisplayMode: sql.OmitMissingFKClausesFromCreate,
IgnoreComments: true,
}
createStmt, err := p.ShowCreate(ctx, dbName, manifest.Descriptors,
tabledesc.NewBuilder(desc.TableDesc()).BuildImmutableTable(), displayOptions)
if err != nil {
// We expect that we might get an error here due to X-DB
// references, which were possible on 20.2 betas and rcs.
log.Errorf(ctx, "error while generating create statement: %+v", err)
// Only resolve the table schemas if running `SHOW BACKUP SCHEMAS`.
// In all other cases we discard these results and so it is wasteful
// to construct the SQL representation of the table's schema.
if showSchemas {
displayOptions := sql.ShowCreateDisplayOptions{
FKDisplayMode: sql.OmitMissingFKClausesFromCreate,
IgnoreComments: true,
}
createStmt, err := p.ShowCreate(ctx, dbName, manifest.Descriptors,
tabledesc.NewBuilder(desc.TableDesc()).BuildImmutableTable(), displayOptions)
if err != nil {
// We expect that we might get an error here due to X-DB
// references, which were possible on 20.2 betas and rcs.
log.Errorf(ctx, "error while generating create statement: %+v", err)
}
createStmtDatum = nullIfEmpty(createStmt)
}
createStmtDatum = nullIfEmpty(createStmt)
default:
descriptorType = "unknown"
}
Expand All @@ -805,7 +813,7 @@ func backupShowerDefault(
row = append(row, createStmtDatum)
}
if _, shouldShowPrivileges := opts[backupOptWithPrivileges]; shouldShowPrivileges {
row = append(row, tree.NewDString(showPrivileges(descriptor)))
row = append(row, tree.NewDString(showPrivileges(ctx, descriptor)))
owner := desc.GetPrivileges().Owner().SQLIdentifier()
row = append(row, tree.NewDString(owner))
}
Expand Down Expand Up @@ -867,6 +875,7 @@ func backupShowerDefault(
}
rows = append(rows, row)
}
sp.Finish()
}
return rows, nil
},
Expand All @@ -881,7 +890,11 @@ type descriptorSize struct {
// getLogicalSSTSize gets the total logical bytes stored in each SST. Note that a
// BackupManifest_File identifies a span in an SST and there can be multiple
// spans stored in an SST.
func getLogicalSSTSize(files []backuppb.BackupManifest_File) map[string]int64 {
func getLogicalSSTSize(ctx context.Context, files []backuppb.BackupManifest_File) map[string]int64 {
ctx, span := tracing.ChildSpan(ctx, "backupccl.getLogicalSSTSize")
defer span.Finish()
_ = ctx

sstDataSize := make(map[string]int64)
for _, file := range files {
sstDataSize[file.Path] += file.EntryCounts.DataSize
Expand All @@ -898,8 +911,11 @@ func approximateSpanPhysicalSize(

// getTableSizes gathers row and size count for each table in the manifest
func getTableSizes(
files []backuppb.BackupManifest_File, fileSizes []int64,
ctx context.Context, files []backuppb.BackupManifest_File, fileSizes []int64,
) (map[descpb.ID]descriptorSize, error) {
ctx, span := tracing.ChildSpan(ctx, "backupccl.getTableSizes")
defer span.Finish()

tableSizes := make(map[descpb.ID]descriptorSize)
if len(files) == 0 {
return tableSizes, nil
Expand All @@ -910,7 +926,7 @@ func getTableSizes(
}
showCodec := keys.MakeSQLCodec(tenantID)

logicalSSTSize := getLogicalSSTSize(files)
logicalSSTSize := getLogicalSSTSize(ctx, files)

for i, file := range files {
// TODO(dan): This assumes each file in the backup only
Expand Down Expand Up @@ -985,7 +1001,11 @@ func showRegions(typeDesc catalog.TypeDescriptor, dbname string) (string, error)
return regionsStringBuilder.String(), nil
}

func showPrivileges(descriptor *descpb.Descriptor) string {
func showPrivileges(ctx context.Context, descriptor *descpb.Descriptor) string {
ctx, span := tracing.ChildSpan(ctx, "backupccl.showPrivileges")
defer span.Finish()
_ = ctx // ctx is currently unused, but this new ctx should be used below in the future.

var privStringBuilder strings.Builder

b := descbuilder.NewBuilder(descriptor)
Expand Down Expand Up @@ -1173,7 +1193,7 @@ func backupShowerFileSetup(inCol tree.StringOrPlaceholderOptList) backupShower {
backupType = "incremental"
}

logicalSSTSize := getLogicalSSTSize(manifest.Files)
logicalSSTSize := getLogicalSSTSize(ctx, manifest.Files)
for j, file := range manifest.Files {
filePath := file.Path
if inCol != nil {
Expand Down
27 changes: 13 additions & 14 deletions pkg/ccl/multitenantccl/tenantcostclient/tenant_side_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (ts *testState) request(
return ""
}

func (ts *testState) externalIngress(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) externalIngress(t *testing.T, _ *datadriven.TestData, args cmdArgs) string {
usage := multitenant.ExternalIOUsage{IngressBytes: args.bytes}
if err := ts.controller.OnExternalIOWait(context.Background(), usage); err != nil {
t.Errorf("OnExternalIOWait error: %s", err)
Expand All @@ -341,12 +341,12 @@ func (ts *testState) externalEgress(t *testing.T, d *datadriven.TestData, args c
return ""
}

func (ts *testState) enableRUAccounting(t *testing.T, _ *datadriven.TestData, _ cmdArgs) string {
func (ts *testState) enableRUAccounting(_ *testing.T, _ *datadriven.TestData, _ cmdArgs) string {
tenantcostclient.ExternalIORUAccountingMode.Override(context.Background(), &ts.settings.SV, "on")
return ""
}

func (ts *testState) disableRUAccounting(t *testing.T, _ *datadriven.TestData, _ cmdArgs) string {
func (ts *testState) disableRUAccounting(_ *testing.T, _ *datadriven.TestData, _ cmdArgs) string {
tenantcostclient.ExternalIORUAccountingMode.Override(context.Background(), &ts.settings.SV, "off")
return ""
}
Expand Down Expand Up @@ -424,7 +424,7 @@ func (ts *testState) advance(t *testing.T, d *datadriven.TestData, args cmdArgs)

// waitForEvent waits until the tenant controller reports the given event
// type(s), at the current time.
func (ts *testState) waitForEvent(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) waitForEvent(t *testing.T, d *datadriven.TestData, _ cmdArgs) string {
typs := make(map[string]tenantcostclient.TestEventType)
for ev, evStr := range eventTypeStr {
typs[evStr] = ev
Expand All @@ -444,7 +444,7 @@ func (ts *testState) waitForEvent(t *testing.T, d *datadriven.TestData, args cmd

// unblockRequest resumes a token bucket request that was blocked by the
// "blockRequest" configuration option.
func (ts *testState) unblockRequest(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) unblockRequest(t *testing.T, _ *datadriven.TestData, _ cmdArgs) string {
ts.provider.unblockRequest(t)
return ""
}
Expand All @@ -461,7 +461,7 @@ func (ts *testState) unblockRequest(t *testing.T, d *datadriven.TestData, args c
// ----
// 00:00:01.000
// 00:00:02.000
func (ts *testState) timers(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) timers(t *testing.T, d *datadriven.TestData, _ cmdArgs) string {
// If we are rewriting the test, just sleep a bit before returning the
// timers.
if d.Rewrite {
Expand Down Expand Up @@ -491,7 +491,7 @@ func timesToString(times []time.Time) string {
}

// configure the test provider.
func (ts *testState) configure(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) configure(t *testing.T, d *datadriven.TestData, _ cmdArgs) string {
var cfg testProviderConfig
if err := yaml.UnmarshalStrict([]byte(d.Input), &cfg); err != nil {
d.Fatalf(t, "failed to parse request yaml: %v", err)
Expand All @@ -501,13 +501,13 @@ func (ts *testState) configure(t *testing.T, d *datadriven.TestData, args cmdArg
}

// tokenBucket dumps the current state of the tenant's token bucket.
func (ts *testState) tokenBucket(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) tokenBucket(*testing.T, *datadriven.TestData, cmdArgs) string {
return tenantcostclient.TestingTokenBucketString(ts.controller)
}

// cpu adds CPU usage which will be observed by the controller on the next main
// loop tick.
func (ts *testState) cpu(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) cpu(t *testing.T, d *datadriven.TestData, _ cmdArgs) string {
duration, err := time.ParseDuration(d.Input)
if err != nil {
d.Fatalf(t, "error parsing cpu duration: %v", err)
Expand All @@ -518,7 +518,7 @@ func (ts *testState) cpu(t *testing.T, d *datadriven.TestData, args cmdArgs) str

// pgwire adds PGWire egress usage which will be observed by the controller on the next
// main loop tick.
func (ts *testState) pgwireEgress(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) pgwireEgress(t *testing.T, d *datadriven.TestData, _ cmdArgs) string {
bytes, err := strconv.Atoi(d.Input)
if err != nil {
d.Fatalf(t, "error parsing pgwire bytes value: %v", err)
Expand All @@ -529,7 +529,7 @@ func (ts *testState) pgwireEgress(t *testing.T, d *datadriven.TestData, args cmd

// usage prints out the latest consumption. Callers are responsible for
// triggering calls to the token bucket provider and waiting for responses.
func (ts *testState) usage(t *testing.T, d *datadriven.TestData, args cmdArgs) string {
func (ts *testState) usage(*testing.T, *datadriven.TestData, cmdArgs) string {
c := ts.provider.consumption()
return fmt.Sprintf(""+
"RU: %.2f\n"+
Expand Down Expand Up @@ -695,7 +695,7 @@ func (tp *testProvider) unblockRequest(t *testing.T) {

// TokenBucket implements the kvtenant.TokenBucketProvider interface.
func (tp *testProvider) TokenBucket(
ctx context.Context, in *roachpb.TokenBucketRequest,
_ context.Context, in *roachpb.TokenBucketRequest,
) (*roachpb.TokenBucketResponse, error) {
tp.mu.Lock()
defer tp.mu.Unlock()
Expand Down Expand Up @@ -930,7 +930,7 @@ func TestSQLLivenessExemption(t *testing.T) {
// Make the tenant heartbeat like crazy.
ctx := context.Background()
//slinstance.DefaultTTL.Override(ctx, &st.SV, 20*time.Millisecond)
slinstance.DefaultHeartBeat.Override(ctx, &st.SV, time.Millisecond)
slinstance.DefaultHeartBeat.Override(ctx, &st.SV, 50*time.Millisecond)

_, tenantDB := serverutils.StartTenant(t, hostServer, base.TestTenantArgs{
TenantID: tenantID,
Expand Down Expand Up @@ -960,7 +960,6 @@ func TestSQLLivenessExemption(t *testing.T) {

// Verify that heartbeats can go through and update the expiration time.
val := livenessValue()
time.Sleep(2 * time.Millisecond)
testutils.SucceedsSoon(
t,
func() error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/declarative_corpus.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ a given corpus file.
return jobID
},
}
_, err := scplan.MakePlan(*state, params)
_, err := scplan.MakePlan(cmd.Context(), *state, params)
if err != nil {
fmt.Printf("failed to validate %s with error %v\n", name, err)
} else {
Expand Down
19 changes: 17 additions & 2 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ func (ts *TestServer) TestingKnobs() *base.TestingKnobs {
return nil
}

// TestingKnobsForTenant returns a TestingKnobs that is used when starting Test
// Tenants. These knobs are a copy of the Server's TestingKnobs with any knobs
// that have been found to be problematic to share by default removed.
func (ts *TestServer) TestingKnobsForTenant() base.TestingKnobs {
knobs := *ts.TestingKnobs()
// TODO(ssd): We don't share the Server knobs the testcluster setup code
// installed an RPC listener that is inappropriate for the tenant.
knobs.Server = nil
return knobs
}

// TenantStatusServer returns the TenantStatusServer used by the TestServer.
func (ts *TestServer) TenantStatusServer() interface{} {
return ts.status
Expand Down Expand Up @@ -546,10 +557,14 @@ func (ts *TestServer) maybeStartDefaultTestTenant(ctx context.Context) error {
UseDatabase: ts.params.UseDatabase,
SSLCertsDir: ts.params.SSLCertsDir,
AllowSettingClusterSettings: true,
}
if ts.params.ShareMostTestingKnobsWithTenant {
params.TestingKnobs = ts.TestingKnobsForTenant()
} else {
// These settings are inherited from the SQL server creation in
// logicTest.newCluster, and are required to run the logic test suite
// successfully.
TestingKnobs: base.TestingKnobs{
params.TestingKnobs = base.TestingKnobs{
SQLExecutor: &sql.ExecutorTestingKnobs{
DeterministicExplain: true,
UseTransactionalDescIDGenerator: useTransactionalDescIDGenerator,
Expand All @@ -558,7 +573,7 @@ func (ts *TestServer) maybeStartDefaultTestTenant(ctx context.Context) error {
AOSTClause: "AS OF SYSTEM TIME '-1us'",
},
RangeFeed: ts.TestingKnobs().RangeFeed,
},
}
}

tenant, err := ts.StartTenant(ctx, params)
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/catalog/descs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ go_library(
"//pkg/util/log",
"//pkg/util/mon",
"//pkg/util/retry",
"//pkg/util/tracing",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_redact//:redact",
"@com_github_lib_pq//oid",
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/catalog/descs/hydrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
)

// hydrateDescriptors installs user defined type metadata in all types.T present
Expand Down Expand Up @@ -151,6 +152,9 @@ func makeImmutableTypeLookupFunc(
// HydrateCatalog installs type metadata in the type.T objects present for all
// objects referencing them in the catalog.
func HydrateCatalog(ctx context.Context, c nstree.MutableCatalog) error {
ctx, sp := tracing.ChildSpan(ctx, "descs.HydrateCatalog")
defer sp.Finish()

fakeLookupFunc := func(_ context.Context, id descpb.ID) (catalog.Descriptor, error) {
return nil, catalog.WrapDescRefErr(id, catalog.ErrDescriptorNotFound)
}
Expand Down
Loading

0 comments on commit 2c18ed3

Please sign in to comment.