Skip to content

Commit 72341d3

Browse files
craig[bot]Xiang-Guitsbilal
committed
107224: compose: Deflake testComposeCompare r=Xiang-Gu a=Xiang-Gu We identified the fixed the following issues concerning test testComposeCompare: 1. Disallow several functions because they're not supported in Postgist 2. Disable random generation of `OID` type because it's natural to have the same OIDs assigned to different objects between CRDB and Postgist. 3. Disable using index hints because Postgist does not support this feature. 4. Disable locales because Postgist requires them to be double-quoted and it's not feasible to change locale name formatting to be double-quoted. 5. Fixed a test bug where we'd mistakenly allow generation of stmts like `CREATE TABLE t (... inverted index (...))` in our test against Postgist. 6. Make this test a "enormous" test which has an 1-hour timeout because it executes two subtests sequentially for 10m each. Inform cockroachdb#82867 Epic: None Release note: None 107301: storage,clusterversion: Bump pebble FormatMajorVersion for VSSTs r=dt a=itsbilal This change bumps Pebble's FormatMajorVersion used with CockroachDB to ExperimentalFormatVirtualSSTables. This doesn't do anything right off the bat, however it enables future work to land that will create virtual sstables (eg. disaggregated storage, online restore, ingest-time splits). Epic: none Release note: None Co-authored-by: Xiang Gu <[email protected]> Co-authored-by: Bilal Akhtar <[email protected]>
3 parents a2cf594 + 76ba0b9 + 193d9fb commit 72341d3

File tree

10 files changed

+69
-13
lines changed

10 files changed

+69
-13
lines changed

docs/generated/settings/settings-for-tenants.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,4 @@ trace.opentelemetry.collector string address of an OpenTelemetry trace collecto
303303
trace.snapshot.rate duration 0s if non-zero, interval at which background trace snapshots are captured tenant-rw
304304
trace.span_registry.enabled boolean true if set, ongoing traces can be seen at https://<ui>/#/debug/tracez tenant-rw
305305
trace.zipkin.collector string the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used. tenant-rw
306-
version version 1000023.1-14 set the active cluster version in the format '<major>.<minor>' tenant-rw
306+
version version 1000023.1-16 set the active cluster version in the format '<major>.<minor>' tenant-rw

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,6 @@
259259
<tr><td><div id="setting-trace-span-registry-enabled" class="anchored"><code>trace.span_registry.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if set, ongoing traces can be seen at https://&lt;ui&gt;/#/debug/tracez</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
260260
<tr><td><div id="setting-trace-zipkin-collector" class="anchored"><code>trace.zipkin.collector</code></div></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as &lt;host&gt;:&lt;port&gt;. If no port is specified, 9411 will be used.</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
261261
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1]</td><td>Dedicated/Self-Hosted</td></tr>
262-
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000023.1-14</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
262+
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000023.1-16</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
263263
</tbody>
264264
</table>

pkg/clusterversion/cockroach_versions.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,10 @@ const (
553553
// DeleteSized operations.
554554
V23_2_UseSizedPebblePointTombstones
555555

556+
// V23_2_PebbleFormatVirtualSSTables upgrades Pebble's format major version to
557+
// FormatVirtualSSTables, allowing use of virtual sstables in Pebble.
558+
V23_2_PebbleFormatVirtualSSTables
559+
556560
// *************************************************
557561
// Step (1) Add new versions here.
558562
// Do not add new versions to a patch release.
@@ -962,6 +966,10 @@ var rawVersionsSingleton = keyedVersions{
962966
Key: V23_2_UseSizedPebblePointTombstones,
963967
Version: roachpb.Version{Major: 23, Minor: 1, Internal: 14},
964968
},
969+
{
970+
Key: V23_2_PebbleFormatVirtualSSTables,
971+
Version: roachpb.Version{Major: 23, Minor: 1, Internal: 16},
972+
},
965973

966974
// *************************************************
967975
// Step (2): Add new versions here.

pkg/compose/BUILD.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ go_library(
99

1010
go_test(
1111
name = "compose_test",
12+
size = "enormous",
1213
srcs = ["compose_test.go"],
13-
args = ["-test.timeout=295s"],
14+
args = select({
15+
"//build/toolchains:use_ci_timeouts": ["-test.timeout=895s"],
16+
"//conditions:default": ["-test.timeout=3595s"],
17+
}),
1418
data = [
1519
"//c-deps:libgeos",
1620
"//pkg/compose:compare/docker-compose.yml",

pkg/compose/compose_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import (
3232
)
3333

3434
var (
35+
// flagEach controls how long we are going to run each compose test. Ensure bazel BUILD file
36+
// of compose tests has a longer timeout.
3537
flagEach = flag.Duration("each", 10*time.Minute, "individual test timeout")
3638
flagTests = flag.String("tests", ".", "tests within docker compose to run")
3739
flagArtifacts = flag.String("artifacts", "", "artifact directory")

pkg/internal/sqlsmith/scalar.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ func getColRef(s *Smither, typ *types.T, refs colRefs) (tree.TypedExpr, *colRef,
233233
if s.disableDecimals && col.typ.Family() == types.DecimalFamily {
234234
return nil, nil, false
235235
}
236+
if s.disableOIDs && col.typ.Family() == types.OidFamily {
237+
return nil, nil, false
238+
}
236239
return col.typedExpr(), col, true
237240
}
238241

pkg/internal/sqlsmith/sqlsmith.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ type Smither struct {
105105
disableInsertSelect bool
106106
disableDivision bool
107107
disableDecimals bool
108+
disableOIDs bool
108109
disableUDFs bool
109110

110111
bulkSrv *httptest.Server
@@ -508,6 +509,11 @@ var DisableDecimals = simpleOption("disable decimals", func(s *Smither) {
508509
s.disableDecimals = true
509510
})
510511

512+
// DisableOIDs disables use of OID types in the query.
513+
var DisableOIDs = simpleOption("disable OIDs", func(s *Smither) {
514+
s.disableOIDs = true
515+
})
516+
511517
// DisableUDFs causes the Smither to disable user-defined functions.
512518
var DisableUDFs = simpleOption("disable udfs", func(s *Smither) {
513519
s.disableUDFs = true
@@ -536,6 +542,12 @@ var PostgresMode = multiOption(
536542
simpleOption("postgres", func(s *Smither) {
537543
s.postgres = true
538544
})(),
545+
// Postgres does not support index hinting.
546+
DisableIndexHints(),
547+
// CockroachDB supports OID type but the same OID value might be assigned to
548+
// different objects from Postgres, and we thus disable using OID types in
549+
// randomly generated queries.
550+
DisableOIDs(),
539551

540552
// Some func impls differ from postgres, so skip them here.
541553
// #41709
@@ -559,6 +571,9 @@ var PostgresMode = multiOption(
559571
IgnoreFNs("^postgis_.*build_date"),
560572
IgnoreFNs("^postgis_.*version"),
561573
IgnoreFNs("^postgis_.*scripts"),
574+
IgnoreFNs("hlc_to_timestamp"),
575+
IgnoreFNs("st_s2covering"),
576+
IgnoreFNs("sum_int"),
562577
)
563578

564579
// MutatingMode causes the Smither to generate mutation statements in the same

pkg/internal/sqlsmith/type.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ func (s *Smither) pickAnyType(typ *types.T) *types.T {
4747
if s.disableDecimals {
4848
typ = s.randType()
4949
}
50+
case types.OidFamily:
51+
if s.disableOIDs {
52+
typ = s.randType()
53+
}
5054
}
5155
return typ
5256
}
@@ -58,11 +62,14 @@ func (s *Smither) randScalarType() *types.T {
5862
if s.types != nil {
5963
scalarTypes = s.types.scalarTypes
6064
}
61-
typ := randgen.RandTypeFromSlice(s.rnd, scalarTypes)
62-
if s.disableDecimals {
63-
for typ.Family() == types.DecimalFamily {
64-
typ = randgen.RandTypeFromSlice(s.rnd, scalarTypes)
65+
var typ *types.T
66+
for {
67+
typ = randgen.RandTypeFromSlice(s.rnd, scalarTypes)
68+
if (s.disableDecimals && typ.Family() == types.DecimalFamily) ||
69+
(s.disableOIDs && typ.Family() == types.OidFamily) {
70+
continue
6571
}
72+
break
6673
}
6774
return typ
6875
}
@@ -91,11 +98,14 @@ func (s *Smither) randType() *types.T {
9198
if s.types != nil {
9299
seedTypes = s.types.seedTypes
93100
}
94-
typ := randgen.RandTypeFromSlice(s.rnd, seedTypes)
95-
if s.disableDecimals {
96-
for typ.Family() == types.DecimalFamily {
97-
typ = randgen.RandTypeFromSlice(s.rnd, seedTypes)
101+
var typ *types.T
102+
for {
103+
typ = randgen.RandTypeFromSlice(s.rnd, seedTypes)
104+
if s.disableDecimals && typ.Family() == types.DecimalFamily ||
105+
(s.disableOIDs && typ.Family() == types.OidFamily) {
106+
continue
98107
}
108+
break
99109
}
100110
return typ
101111
}

pkg/sql/randgen/mutator.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,20 @@ func postgresCreateTableMutator(
742742
for _, def := range stmt.Defs {
743743
switch def := def.(type) {
744744
case *tree.ColumnTableDef:
745-
colTypes[string(def.Name)] = tree.MustBeStaticallyKnownType(def.Type)
745+
colType := tree.MustBeStaticallyKnownType(def.Type)
746+
// Disable locales because CRDB random generator generates
747+
// locales without double-quotes, and they are unknown to
748+
// Postgres (e.g. `i TEXT COLLATE de_DE` won't work with
749+
// Postgres).
750+
if colType.Family() == types.CollatedStringFamily {
751+
colType = types.String
752+
}
753+
colTypes[string(def.Name)] = colType
746754
}
747755
}
748756

757+
// Exclude `INDEX` and `UNIQUE` table defs and hoist them into separate
758+
// `CREATE INDEX` and `CREATE UNIQUE INDEX` statements.
749759
var newdefs tree.TableDefs
750760
for _, def := range stmt.Defs {
751761
switch def := def.(type) {
@@ -774,6 +784,8 @@ func postgresCreateTableMutator(
774784
break
775785
}
776786
def.Columns = newCols
787+
// Hoist this IndexTableDef into a separate CreateIndex.
788+
changed = true
777789
// TODO(rafi): Postgres supports inverted indexes with a different
778790
// syntax than Cockroach. Maybe we could add it later.
779791
// The syntax is `CREATE INDEX name ON table USING gin(column)`.
@@ -786,7 +798,6 @@ func postgresCreateTableMutator(
786798
Storing: def.Storing,
787799
// Postgres doesn't support NotVisible Index, so NotVisible is not populated here.
788800
})
789-
changed = true
790801
}
791802
case *tree.UniqueConstraintTableDef:
792803
var newCols tree.IndexElemList

pkg/storage/pebble.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,9 @@ func (p *Pebble) SetMinVersion(version roachpb.Version) error {
21682168
var formatVers pebble.FormatMajorVersion
21692169
// Cases are ordered from newer to older versions.
21702170
switch {
2171+
case !version.Less(clusterversion.ByKey(clusterversion.V23_2_PebbleFormatVirtualSSTables)):
2172+
formatVers = pebble.ExperimentalFormatVirtualSSTables
2173+
21712174
case !version.Less(clusterversion.ByKey(clusterversion.V23_2_PebbleFormatDeleteSizedAndObsolete)):
21722175
formatVers = pebble.ExperimentalFormatDeleteSizedAndObsolete
21732176

0 commit comments

Comments
 (0)