Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
132678: schemachanger: disable dsc zone config by default r=rafiss a=annrpom

This patch disables zone config statements in the declarative schema changer by default.

Release note: None
Epic: None

132701: opt: prevent stack overflow when deriving computed column filters r=mgartner a=mgartner

#### opt: add max-stack opttest option

This commit adds the `max-stack` option for opttests, allowing tests to
alter the maximum stack size for the goroutine that optimizes the query.

Release note: None

#### opt: prevent stack overflow when deriving computed column filters

Previously, a filter of the form `col IN (elem0, elem1, ..., elemN)`
could result in a stack overflow in the optimizer when `N` is very
large, e.g., 1.6 million or more . The problem would occur when trying
to derive constraints for indexes on computed column, specifically when
those computed columns are dependent on the column in the filter, e.g.,
`col` in the example.

The current implementation builds an `OrExpr` tree with depth equal to
the length of the `IN` list. It then constructs a `FiltersItem` with the
`OrExpr` tree as the condition, causing logical properties to be built
for the expression. When building logical properties, the `OrExpr` tree
is traversed recursively, which causes the stack to overflow when the
tree is very deep.

Now, an `OrExpr` tree is never built. Instead,
`CombineComputedColFilters` returns a slice of `ScalarExpr`s that
represents a disjunction of expressions. This effectively eliminates the
possibility of stack overflows in code that recursively traverses the
derived expressions. It also simplified the logic.

Fixes cockroachdb#132669

Release note (bug fix): A bug in the query optimizer which could cause
CockroachDB nodes to crash in rare cases has been fixed. The bug could
occur when a query contains a filter in the form
`col IN (elem0, elem1, ..., elemN)` only when `N` is very large, e.g.,
1.6+ million, and when `col` exists in a hash-sharded index or exists a
table with an indexed, computed column dependent on `col`.


132849: go.mod: bump Pebble to c6b097e7e6a0 r=dt a=jbowens

Changes:

 * [`c6b097e7`](cockroachdb/pebble@c6b097e7) sstable: add jemalloc size classes to tests
 * [`b07f0b23`](cockroachdb/pebble@b07f0b23) db: fix Options.Parse handling of unrecognized comparer
 * [`9f164613`](cockroachdb/pebble@9f164613) db: fix a few instances of the wrong table format
 * [`dd26bf0e`](cockroachdb/pebble@dd26bf0e) db: delete compactions output in case of late cancellation
 * [`1ed55247`](cockroachdb/pebble@1ed55247) block: rewrite block flush logic
 * [`887598ae`](cockroachdb/pebble@887598ae) sstable: set w.indexBlockSize in colBlkWriter
 * [`030afd26`](cockroachdb/pebble@030afd26) colblk: use UnsafeOffsets.At2 in another instance
 * [`b3993ff6`](cockroachdb/pebble@b3993ff6) db: persist Experimental.EnableColumnarBlocks in OPTIONS file
 * [`c719c4e5`](cockroachdb/pebble@c719c4e5) db: support multiple KeySchemas

Release note: none.
Epic: none.

Co-authored-by: Annie Pompa <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: Jackson Owens <[email protected]>
  • Loading branch information
4 people committed Oct 17, 2024
4 parents ea879f3 + 4683889 + a3d27e8 + e89aab6 commit e59f52b
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 57 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1818,10 +1818,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch",
],
sha256 = "c18276fb68bfeff93edfbc563ed2f07d4956e2627ba9461d26830720ed3e03d7",
strip_prefix = "github.com/cockroachdb/[email protected]20241016162652-8b6d64f23a33",
sha256 = "7136fa698f76055d99e3cf1055026d3fc00fc0cd6c65f7c27ef202ca769ea10f",
strip_prefix = "github.com/cockroachdb/[email protected]20241017141447-c6b097e7e6a0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20241016162652-8b6d64f23a33.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20241017141447-c6b097e7e6a0.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 @@ -345,7 +345,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.19.0.zip": "c4d516bcfe8c07b6fc09b8a9a07a95065b36c2855627cb3514e40c98f872b69e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20230118201751-21c54148d20b.zip": "ca7776f47e5fecb4c495490a679036bfc29d95bd7625290cfdb9abb0baf97476",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/metamorphic/com_github_cockroachdb_metamorphic-v0.0.0-20231108215700-4ba948b56895.zip": "28c8cf42192951b69378cf537be5a9a43f2aeb35542908cc4fe5f689505853ea",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20241016162652-8b6d64f23a33.zip": "c18276fb68bfeff93edfbc563ed2f07d4956e2627ba9461d26830720ed3e03d7",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20241017141447-c6b097e7e6a0.zip": "7136fa698f76055d99e3cf1055026d3fc00fc0cd6c65f7c27ef202ca769ea10f",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.5.zip": "11b30528eb0dafc8bc1a5ba39d81277c257cbe6946a7564402f588357c164560",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/returncheck/com_github_cockroachdb_returncheck-v0.0.0-20200612231554-92cdbca611dd.zip": "ce92ba4352deec995b1f2eecf16eba7f5d51f5aa245a1c362dfe24c83d31f82b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/stress/com_github_cockroachdb_stress-v0.0.0-20220803192808-1806698b1b7b.zip": "3fda531795c600daf25532a4f98be2a1335cd1e5e182c72789bca79f5f69fcc1",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ require (
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
github.com/cockroachdb/gostdlib v1.19.0
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b
github.com/cockroachdb/pebble v0.0.0-20241016162652-8b6d64f23a33
github.com/cockroachdb/pebble v0.0.0-20241017141447-c6b097e7e6a0
github.com/cockroachdb/redact v1.1.5
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
github.com/cockroachdb/stress v0.0.0-20220803192808-1806698b1b7b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZe
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895 h1:XANOgPYtvELQ/h4IrmPAohXqe2pWA8Bwhejr3VQoZsA=
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895/go.mod h1:aPd7gM9ov9M8v32Yy5NJrDyOcD8z642dqs+F0CeNXfA=
github.com/cockroachdb/pebble v0.0.0-20241016162652-8b6d64f23a33 h1:Hm0YVnLKeO1UNY8aEZKSX7iTbEwRB+B1Y5d/gyb4j7g=
github.com/cockroachdb/pebble v0.0.0-20241016162652-8b6d64f23a33/go.mod h1:XmS8uVDd9YFw/1R7J0J/CmTUANwT7iGnBRxH9AyDA90=
github.com/cockroachdb/pebble v0.0.0-20241017141447-c6b097e7e6a0 h1:bxW1ydleLzHAb6u55RvwOgeOfrhXOF9iaGQ3cjWzvtM=
github.com/cockroachdb/pebble v0.0.0-20241017141447-c6b097e7e6a0/go.mod h1:XmS8uVDd9YFw/1R7J0J/CmTUANwT7iGnBRxH9AyDA90=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/event_log
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ ALTER INDEX a@bar CONFIGURE ZONE USING gc.ttlseconds = 15000
# verify zone config changes are logged
##################
skipif config 3node-tenant-default-configs
skipif config local-mixed-24.1
query IT
SELECT "reportingID", "info"::JSONB - 'Timestamp' - 'DescriptorID' - 'Statement'
FROM system.eventlog
Expand Down
7 changes: 7 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/zone_config
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ onlyif config local-legacy-schema-changer
statement error pq: user root does not have CREATE or ZONECONFIG privilege on relation columns
ALTER TABLE information_schema.columns CONFIGURE ZONE USING gc.ttlseconds = 100000

# TODO(annie): remove this override once CONFIGURE ZONE is enabled by default in the DSC
statement ok
SET CLUSTER SETTING sql.schema.force_declarative_statements = "+CONFIGURE ZONE"

skipif config local-mixed-24.1
skipif config local-legacy-schema-changer
statement error pq: pg_type is a system catalog
Expand All @@ -313,6 +317,9 @@ skipif config local-legacy-schema-changer
statement error pq: columns is a virtual object and cannot be modified
ALTER TABLE information_schema.columns CONFIGURE ZONE USING gc.ttlseconds = 100000

statement ok
RESET CLUSTER SETTING sql.schema.force_declarative_statements

statement ok
CREATE TABLE roachie(i int)

Expand Down
18 changes: 9 additions & 9 deletions pkg/sql/opt/idxconstraint/index_constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,22 +641,22 @@ func (c *indexConstraintCtx) makeSpansForExpr(
// Attempt to convert the constraint into a disjunction of ANDed IS
// predicates, with additional derived IS conjuncts on computed
// columns based on columns in the constraint spans.
// TODO(msirek/mgartner): Modify CombineComputedColFilters to build a
// `Constraint` or `constraint.Set` directly instead of building a
// filter and calling `makeSpansForExpr`.
computedColumnFilters := norm.CombineComputedColFilters(
// TODO(mgartner): Modify CombineComputedColFilters to build a
// `Constraint` or `constraint.Set` directly instead of building
// a filter and calling `makeSpansForExpr`.
disjunctions := norm.CombineComputedColFilters(
c.computedCols,
c.keyCols,
c.colsInComputedColsExpressions,
constraints.Constraint(0),
c.factory,
)
if len(computedColumnFilters) == 1 {
// All predicates in `computedColumnFilters[0].Condition` fully
// represent the original condition plus derived predicates, so we
// only have to make spans on the new condition.
if len(disjunctions) > 0 {
// All disjunctions fully represent the original condition
// plus derived predicates, so we only have to make spans on
// the list of disjunctions.
c.skipComputedColPredDerivation = true
localTight := c.makeSpansForExpr(offset, computedColumnFilters[0].Condition, out)
localTight := c.binaryMergeSpansForOr(offset, disjunctions, out)
c.skipComputedColPredDerivation = false
return localTight
}
Expand Down
52 changes: 16 additions & 36 deletions pkg/sql/opt/norm/general_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/util/arith"
"github.com/cockroachdb/cockroach/pkg/util/intsets"
"github.com/cockroachdb/errors"
)

Expand Down Expand Up @@ -1036,7 +1035,9 @@ func (c *CustomFuncs) tryFoldComputedCol(
// which seeks to fold computed column expressions using values from single-key
// constraint spans in order to build new predicates on those computed columns
// and AND them with predicates built from the constraint span key used to
// compute the computed column value.
// compute the computed column value. If successful, it returns a list of
// expressions representing disjunctions, with a length equal to the number of
// spans in the constraint. If unsuccessful, nil is returned.
//
// New derived keys cannot be saved for the filters as a whole, for later
// processing, because a given combination of span key values is only applicable
Expand Down Expand Up @@ -1090,22 +1091,19 @@ func CombineComputedColFilters(
colsInComputedColsExpressions opt.ColSet,
cons *constraint.Constraint,
f *Factory,
) memo.FiltersExpr {
) (disjunctions []opt.ScalarExpr) {
if len(computedCols) == 0 {
return nil
}
if !f.evalCtx.SessionData().OptimizerUseImprovedComputedColumnFiltersDerivation {
return nil
}
var combinedComputedColFilters memo.FiltersExpr
var orOp opt.ScalarExpr
if !cons.Columns.ColSet().Intersects(colsInComputedColsExpressions) {
// If this constraint doesn't involve any columns used to construct a
// computed column value, no need to process it further.
return nil
}
for k := 0; k < cons.Spans.Count(); k++ {
filterAdded := false
span := cons.Spans.Get(k)
if !span.HasSingleKey(f.ctx, f.evalCtx) {
// If we don't have a single value, or combination of single values
Expand All @@ -1119,40 +1117,22 @@ func CombineComputedColFilters(
if !ok {
return nil
}
var newOp opt.ScalarExpr
// Build a new ANDed predicate involving the computed column and columns in
// the computed column expression.
newOp, filterAdded =
buildConjunctionOfEqualityPredsOnComputedAndNonComputedCols(
initialConjunction, computedCols, constFilterCols, indexKeyCols, f)
// Only build a new disjunct if terms were derived for this span.
if filterAdded {
if orOp == nil {
// The case of the first span or only one span.
orOp = newOp
} else {
// The spans in a constraint represent a disjunction, so OR them
// together.
constructOr := func() {
orOp = f.ConstructOr(orOp, newOp)
}
var disabledRules intsets.Fast
// Disable this rule as it disallows finding tight constraints in
// some cases when a conjunct can be factored out, e.g.,
// `(a=3 AND b=4) OR (a=3 AND b=6)` --> `a=3 AND (b=4 OR b=6)`
disabledRules.Add(int(opt.ExtractRedundantConjunct))
f.DisableOptimizationRulesTemporarily(disabledRules, constructOr)
}
} else {
// Build a new ANDed predicate involving the computed column and columns
// in the computed column expression.
conjunct, ok := buildConjunctionOfEqualityPredsOnComputedAndNonComputedCols(
initialConjunction, computedCols, constFilterCols, indexKeyCols, f,
)
if !ok {
// If we failed to build any of the disjuncts, we must give up.
return nil
}
if disjunctions == nil {
// Lazily allocate the slice of disjunctions.
disjunctions = make([]opt.ScalarExpr, 0, cons.Spans.Count())
}
disjunctions = append(disjunctions, conjunct)
}
if orOp != nil {
combinedComputedColFilters =
append(combinedComputedColFilters, f.ConstructFiltersItem(orOp))
}
return combinedComputedColFilters
return disjunctions
}

// buildConstColsMapFromConstraint converts a constraint on one or more columns
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/testutils/opttester/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ go_library(
"@com_github_cockroachdb_datadriven//:datadriven",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_errors//oserror",
"@com_github_dustin_go_humanize//:go-humanize",
"@com_github_pmezard_go_difflib//difflib",
],
)
Expand Down
24 changes: 24 additions & 0 deletions pkg/sql/opt/testutils/opttester/opt_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"os"
"path/filepath"
"runtime"
"runtime/debug"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -69,6 +70,7 @@ import (
"github.com/cockroachdb/datadriven"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/errors/oserror"
"github.com/dustin/go-humanize"
"github.com/pmezard/go-difflib/difflib"
)

Expand Down Expand Up @@ -265,6 +267,10 @@ type Flags struct {

// TxnIsoLevel is the isolation level to plan for.
TxnIsoLevel isolation.Level

// MaxStackBytes specifies the number of bytes to limit the stack size to.
// If it is zero, the stack size has the default Go limit.
MaxStackBytes int
}

// New constructs a new instance of the OptTester for the given SQL statement.
Expand Down Expand Up @@ -555,6 +561,9 @@ func New(catalog cat.Catalog, sqlStr string) *OptTester {
// full path or a relative path to testdata.
//
// - isolation: sets the isolation level to plan for.
//
// - max-stack: sets the maximum stack size for the goroutine that optimizes
// the query. See debug.SetMaxStack.
func (ot *OptTester) RunCommand(tb testing.TB, d *datadriven.TestData) string {
// Allow testcases to override the flags.
for _, a := range d.CmdArgs {
Expand All @@ -578,6 +587,11 @@ func (ot *OptTester) RunCommand(tb testing.TB, d *datadriven.TestData) string {
ot.evalCtx.Placeholders = nil
ot.evalCtx.TxnIsoLevel = ot.Flags.TxnIsoLevel

if ot.Flags.MaxStackBytes > 0 {
originalMaxStack := debug.SetMaxStack(ot.Flags.MaxStackBytes)
defer debug.SetMaxStack(originalMaxStack)
}

switch d.Cmd {
case "exec-ddl":
testCatalog, ok := ot.catalog.(*testcat.Catalog)
Expand Down Expand Up @@ -1164,6 +1178,16 @@ func (f *Flags) Set(arg datadriven.CmdArg) error {
}
f.TxnIsoLevel = isolation.Level(level)

case "max-stack":
if len(arg.Vals) != 1 {
return fmt.Errorf("max-stack requires one argument")
}
bytes, err := humanize.ParseBytes(arg.Vals[0])
if err != nil {
return err
}
f.MaxStackBytes = int(bytes)

default:
return fmt.Errorf("unknown argument: %s", arg.Key)
}
Expand Down
50 changes: 50 additions & 0 deletions pkg/sql/opt/xform/testdata/rules/select
Original file line number Diff line number Diff line change
Expand Up @@ -2806,6 +2806,56 @@ project
└── filters
└── a:2 = b:3 [outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)]

# Regression test for #132669. Deriving computed column constraints should not
# cause the stack to grow excessively.
exec-ddl
CREATE TABLE t132669 (
a INT,
b INT NOT NULL AS (mod(a, 16)) VIRTUAL,
INDEX (b, a)
)
----

# Optimize the query with a significantly reduced max stack size. This allows
# unnecessary recursion to trigger a stack overflow without having to make the
# `IN` list below huge - triggering a stack overflow with Go's default max stack
# size requires a list of ~1.6 million elements.
opt max-stack=50KB format=hide-all
SELECT * FROM t132669
WHERE a IN (
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
191, 192, 193, 194, 195, 196, 197, 198, 199, 200
)
----
project
├── select
│ ├── scan t132669
│ │ └── computed column expressions
│ │ └── b
│ │ └── mod(a, 16)
│ └── filters
│ └── a IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200)
└── projections
└── mod(a, 16)

# --------------------------------------------------
# GenerateInvertedIndexScans
# --------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var supportedStatements = map[reflect.Type]supportedStatement{
reflect.TypeOf((*tree.CreateSchema)(nil)): {fn: CreateSchema, statementTags: []string{tree.CreateSchemaTag}, on: true, checks: nil},
reflect.TypeOf((*tree.CreateSequence)(nil)): {fn: CreateSequence, statementTags: []string{tree.CreateSequenceTag}, on: true, checks: isV241Active},
reflect.TypeOf((*tree.CreateDatabase)(nil)): {fn: CreateDatabase, statementTags: []string{tree.CreateDatabaseTag}, on: true, checks: isV241Active},
reflect.TypeOf((*tree.SetZoneConfig)(nil)): {fn: SetZoneConfig, statementTags: []string{tree.ConfigureZoneTag}, on: true, checks: isV242Active},
reflect.TypeOf((*tree.SetZoneConfig)(nil)): {fn: SetZoneConfig, statementTags: []string{tree.ConfigureZoneTag}, on: false, checks: isV242Active},
reflect.TypeOf((*tree.CreateTrigger)(nil)): {fn: CreateTrigger, statementTags: []string{tree.CreateTriggerTag}, on: true, checks: isV243Active},
reflect.TypeOf((*tree.DropTrigger)(nil)): {fn: DropTrigger, statementTags: []string{tree.DropTriggerTag}, on: true, checks: isV243Active},
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,9 +825,10 @@ const MinimumSupportedFormatVersion = pebble.FormatSyntheticPrefixSuffix
// DefaultPebbleOptions returns the default pebble options.
func DefaultPebbleOptions() *pebble.Options {
opts := &pebble.Options{
Comparer: EngineComparer,
FS: vfs.Default,
KeySchema: keySchema,
Comparer: EngineComparer,
FS: vfs.Default,
KeySchema: keySchema.Name,
KeySchemas: sstable.MakeKeySchemas(keySchema),
// A value of 2 triggers a compaction when there is 1 sub-level.
L0CompactionThreshold: 2,
L0StopWritesThreshold: 1000,
Expand Down
1 change: 1 addition & 0 deletions pkg/storage/pebble_key_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
)

var keySchema = colblk.KeySchema{
Name: "crdb1",
ColumnTypes: []colblk.DataType{
cockroachColRoachKey: colblk.DataTypePrefixBytes,
cockroachColMVCCWallTime: colblk.DataTypeUint,
Expand Down

0 comments on commit e59f52b

Please sign in to comment.