Skip to content

Commit

Permalink
Merge #78519 #83421
Browse files Browse the repository at this point in the history
78519: admission: introduce soft slots for speculative concurrency r=bananabrick a=sumeerbhola

This is for using additional theads for Pebble compaction compression
and later for adjusting the number of concurrent compactions.

Since these slots are not acquired or released in a very fine grained
manner, we've chosen to model these in way that allows for
over-commitment. The SoftSlotGranter should be used for acquiring
and releasing such slots, instead of WorkQueue, since there is no
queueing for such slots.

Release note: None

83421: sql: fix error log spam from SHOW CREATE r=ajwerner a=rafiss

fixes #83351

Since the fix in #82763,
the error that was previously ignored started showing up in logs.

This fix updates the visit function used by
crdb_internal.create_statements so it doesn't result in errors.

Release note: None

Co-authored-by: sumeerbhola <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
3 people committed Jul 6, 2022
3 parents 7cfa5d4 + 3f1b12b + 66a849f commit 264cd04
Show file tree
Hide file tree
Showing 5 changed files with 730 additions and 124 deletions.
46 changes: 26 additions & 20 deletions pkg/sql/show_create_clauses.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,30 +213,36 @@ func formatViewQueryTypesForDisplay(
desc catalog.TableDescriptor,
) (string, error) {
replaceFunc := func(expr tree.Expr) (recurse bool, newExpr tree.Expr, err error) {
// We need to resolve the type to check if it's user-defined. If not,
// no other work is needed.
var typRef tree.ResolvableTypeReference
switch n := expr.(type) {
case *tree.AnnotateTypeExpr, *tree.CastExpr:
texpr, err := tree.TypeCheck(ctx, n, semaCtx, types.Any)
if err != nil {
return false, expr, err
}
if !texpr.ResolvedType().UserDefined() {
return true, expr, nil
}

formattedExpr, err := schemaexpr.FormatExprForDisplay(
ctx, desc, expr.String(), semaCtx, sessionData, tree.FmtParsable,
)
if err != nil {
return false, expr, err
}
newExpr, err = parser.ParseExpr(formattedExpr)
if err != nil {
return false, expr, err
}
return false, newExpr, nil
case *tree.CastExpr:
typRef = n.Type
case *tree.AnnotateTypeExpr:
typRef = n.Type
default:
return true, expr, nil
}
var typ *types.T
typ, err = tree.ResolveType(ctx, typRef, semaCtx.TypeResolver)
if err != nil {
return false, expr, err
}
if !typ.UserDefined() {
return true, expr, nil
}
formattedExpr, err := schemaexpr.FormatExprForDisplay(
ctx, desc, expr.String(), semaCtx, sessionData, tree.FmtParsable,
)
if err != nil {
return false, expr, err
}
newExpr, err = parser.ParseExpr(formattedExpr)
if err != nil {
return false, expr, err
}
return false, newExpr, nil
}

viewQuery := desc.GetViewQuery()
Expand Down
2 changes: 2 additions & 0 deletions pkg/ts/catalog/chart_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,8 @@ var charts = []sectionDescription{
Metrics: []string{
"admission.granter.total_slots.kv",
"admission.granter.used_slots.kv",
"admission.granter.total_moderate_slots.kv",
"admission.granter.used_soft_slots.kv",
"admission.granter.used_slots.sql-leaf-start",
"admission.granter.used_slots.sql-root-start",
},
Expand Down
Loading

0 comments on commit 264cd04

Please sign in to comment.