Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
78254: streamingccl: skip flaky TestPartitionedStreamReplicationClient test r=meridional a=meridional

Release note: None

78256: logictest: clean up disabling of auto stats r=yuzefovich a=yuzefovich

All logic test configs currently override the auto stats collection to
be disabled, and this commit makes it explicit. Additionally, it removes
the explicit statements from the tests themselves for disabling the
stats collection.

Release note: None

78258: clusterversion: fix datestyle/intervalstyle migration key r=rafiss a=rafiss

I noticed this while reviewing the backport. Seems like a typo that made
it through when rewriting logic tests.

The 22.1 branch is not affected.

Release note: None

Co-authored-by: Ye Ji <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
4 people committed Mar 22, 2022
4 parents e1e6f39 + 7b05a18 + a5a6618 + 415c265 commit e02793d
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 126 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings-for-tenants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ trace.jaeger.agent string the address of a Jaeger agent to receive traces using
trace.opentelemetry.collector string address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as <host>:<port>. If no port is specified, 4317 will be used.
trace.span_registry.enabled boolean true if set, ongoing traces can be seen at https://<ui>/#/debug/tracez
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.
version version 22.1-94 set the active cluster version in the format '<major>.<minor>'
version version 21.2-94 set the active cluster version in the format '<major>.<minor>'
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,6 @@
<tr><td><code>trace.opentelemetry.collector</code></td><td>string</td><td><code></code></td><td>address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as <host>:<port>. If no port is specified, 4317 will be used.</td></tr>
<tr><td><code>trace.span_registry.enabled</code></td><td>boolean</td><td><code>true</code></td><td>if set, ongoing traces can be seen at https://<ui>/#/debug/tracez</td></tr>
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used.</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>22.1-94</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>21.2-94</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
</tbody>
</table>
4 changes: 2 additions & 2 deletions pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ select crdb_internal.get_vmodule()
query T
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
----
22.1
21.2

query ITTT colnames
select node_id, component, field, regexp_replace(regexp_replace(value, '^\d+$', '<port>'), e':\\d+', ':<port>') as value from crdb_internal.node_runtime_info
Expand Down Expand Up @@ -448,7 +448,7 @@ select * from crdb_internal.gossip_alerts
query T
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
----
22.1
21.2

user root

Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/streamingccl/streamclient/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ go_test(
"//pkg/sql/catalog/desctestutils",
"//pkg/streaming",
"//pkg/testutils/serverutils",
"//pkg/testutils/skip",
"//pkg/testutils/testcluster",
"//pkg/util/ctxgroup",
"//pkg/util/hlc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/sql/catalog/desctestutils"
"github.com/cockroachdb/cockroach/pkg/streaming"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/ctxgroup"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
Expand All @@ -50,6 +51,7 @@ func (f *subscriptionFeedSource) Close(ctx context.Context) {}

func TestPartitionedStreamReplicationClient(t *testing.T) {
defer leaktest.AfterTest(t)()
skip.UnderRaceWithIssue(t, 77916, "flaky test")
defer log.Scope(t).Close(t)

h, cleanup := streamingtest.NewReplicationHelper(t, base.TestServerArgs{
Expand Down
2 changes: 1 addition & 1 deletion pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ var versionsSingleton = keyedVersions{
},
{
Key: DateStyleIntervalStyleCastRewrite,
Version: roachpb.Version{Major: 22, Minor: 1, Internal: 94},
Version: roachpb.Version{Major: 21, Minor: 2, Internal: 94},
},

// *************************************************
Expand Down
109 changes: 40 additions & 69 deletions pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,6 @@ type testClusterConfig struct {
overrideDistSQLMode string
// if non-empty, overrides the default vectorize mode.
overrideVectorize string
// if non-empty, overrides the default automatic statistics mode.
overrideAutoStats string
// if non-empty, overrides the default experimental DistSQL planning mode.
overrideExperimentalDistSQLPlanning string
// if set, queries using distSQL processors or vectorized operators that can
Expand Down Expand Up @@ -680,20 +678,17 @@ var logicTestConfigs = []testClusterConfig{
name: "local",
numNodes: 1,
overrideDistSQLMode: "off",
overrideAutoStats: "false",
},
{
name: "local-vec-off",
numNodes: 1,
overrideDistSQLMode: "off",
overrideAutoStats: "false",
overrideVectorize: "off",
},
{
name: "[email protected]",
numNodes: 1,
overrideDistSQLMode: "off",
overrideAutoStats: "false",
bootstrapVersion: roachpb.Version{Major: 1},
binaryVersion: roachpb.Version{Major: 1, Minor: 1},
disableUpgrade: true,
Expand All @@ -702,30 +697,26 @@ var logicTestConfigs = []testClusterConfig{
name: "local-spec-planning",
numNodes: 1,
overrideDistSQLMode: "off",
overrideAutoStats: "false",
overrideExperimentalDistSQLPlanning: "on",
},
{
name: "fakedist",
numNodes: 3,
useFakeSpanResolver: true,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
},
{
name: "fakedist-vec-off",
numNodes: 3,
useFakeSpanResolver: true,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
overrideVectorize: "off",
},
{
name: "fakedist-metadata",
numNodes: 3,
useFakeSpanResolver: true,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
distSQLMetadataTestEnabled: true,
skipShort: true,
},
Expand All @@ -734,7 +725,6 @@ var logicTestConfigs = []testClusterConfig{
numNodes: 3,
useFakeSpanResolver: true,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
sqlExecUseDisk: true,
skipShort: true,
},
Expand All @@ -743,36 +733,31 @@ var logicTestConfigs = []testClusterConfig{
numNodes: 3,
useFakeSpanResolver: true,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
overrideExperimentalDistSQLPlanning: "on",
},
{
name: "5node",
numNodes: 5,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
},
{
name: "5node-metadata",
numNodes: 5,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
distSQLMetadataTestEnabled: true,
skipShort: true,
},
{
name: "5node-disk",
numNodes: 5,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
sqlExecUseDisk: true,
skipShort: true,
},
{
name: "5node-spec-planning",
numNodes: 5,
overrideDistSQLMode: "on",
overrideAutoStats: "false",
overrideExperimentalDistSQLPlanning: "on",
},
{
Expand All @@ -781,23 +766,19 @@ var logicTestConfigs = []testClusterConfig{
// logictest command.
// To run a logic test with this config as a directive, run:
// make test PKG=./pkg/ccl/logictestccl TESTS=TestTenantLogic//<test_name>
name: threeNodeTenantConfigName,
numNodes: 3,
// overrideAutoStats will disable automatic stats on the cluster this tenant
// is connected to.
overrideAutoStats: "false",
useTenant: true,
isCCLConfig: true,
name: threeNodeTenantConfigName,
numNodes: 3,
useTenant: true,
isCCLConfig: true,
},
// Regions and zones below are named deliberately, and contain "-"'s to be reflective
// of the naming convention in public clouds. "-"'s are handled differently in SQL
// (they're double double quoted) so we explicitly test them here to ensure that
// the multi-region code handles them correctly.

{
name: "multiregion-invalid-locality",
numNodes: 3,
overrideAutoStats: "false",
name: "multiregion-invalid-locality",
numNodes: 3,
localities: map[int]roachpb.Locality{
1: {
Tiers: []roachpb.Tier{
Expand All @@ -817,9 +798,8 @@ var logicTestConfigs = []testClusterConfig{
},
},
{
name: "multiregion-3node-3superlongregions",
numNodes: 3,
overrideAutoStats: "false",
name: "multiregion-3node-3superlongregions",
numNodes: 3,
localities: map[int]roachpb.Locality{
1: {
Tiers: []roachpb.Tier{
Expand All @@ -839,36 +819,31 @@ var logicTestConfigs = []testClusterConfig{
},
},
{
name: "multiregion-9node-3region-3azs",
numNodes: 9,
overrideAutoStats: "false",
localities: multiregion9node3region3azsLocalities,
name: "multiregion-9node-3region-3azs",
numNodes: 9,
localities: multiregion9node3region3azsLocalities,
},
{
name: "multiregion-9node-3region-3azs-tenant",
numNodes: 9,
overrideAutoStats: "false",
localities: multiregion9node3region3azsLocalities,
useTenant: true,
name: "multiregion-9node-3region-3azs-tenant",
numNodes: 9,
localities: multiregion9node3region3azsLocalities,
useTenant: true,
},
{
name: "multiregion-9node-3region-3azs-vec-off",
numNodes: 9,
overrideAutoStats: "false",
localities: multiregion9node3region3azsLocalities,
overrideVectorize: "off",
},
{
name: "multiregion-15node-5region-3azs",
numNodes: 15,
overrideAutoStats: "false",
localities: multiregion15node5region3azsLocalities,
name: "multiregion-15node-5region-3azs",
numNodes: 15,
localities: multiregion15node5region3azsLocalities,
},
{
name: "local-mixed-21.2-22.1",
numNodes: 1,
overrideDistSQLMode: "off",
overrideAutoStats: "false",
bootstrapVersion: roachpb.Version{Major: 21, Minor: 2},
binaryVersion: roachpb.Version{Major: 22, Minor: 1},
disableUpgrade: true,
Expand Down Expand Up @@ -1752,32 +1727,28 @@ func (t *logicTest) newCluster(serverArgs TestServerArgs, opts []clusterOpt) {
}
}

if cfg.overrideAutoStats != "" {
if _, err := conn.Exec(
"SET CLUSTER SETTING sql.stats.automatic_collection.enabled = $1::bool", cfg.overrideAutoStats,
); err != nil {
t.Fatal(err)
}
} else {
// Background stats collection is enabled by default, but we've seen tests
// flake with it on. When the issue manifests, it seems to be around a
// schema change transaction getting pushed, which causes it to increment a
// table ID twice instead of once, causing non-determinism.
//
// In the short term, we disable auto stats by default to avoid the flakes.
//
// In the long run, these tests should be running with default settings as
// much as possible, so we likely want to address this. Two options are
// either making schema changes more resilient to being pushed or possibly
// making auto stats avoid pushing schema change transactions. There might
// be other better alternatives than these.
//
// See #37751 for details.
if _, err := conn.Exec(
"SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false",
); err != nil {
t.Fatal(err)
}
// We disable the automatic stats collection in order to have
// deterministic tests.
//
// We've also seen tests flake with it on. When the issue manifests, it
// seems to be around a schema change transaction getting pushed, which
// causes it to increment a table ID twice instead of once, causing
// non-determinism.
//
// In the short term, we disable auto stats by default to avoid the
// flakes.
//
// In the long run, these tests should be running with default settings
// as much as possible, so we likely want to address this. Two options
// are either making schema changes more resilient to being pushed or
// possibly making auto stats avoid pushing schema change transactions.
// There might be other better alternatives than these.
//
// See #37751 for details.
if _, err := conn.Exec(
"SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false",
); err != nil {
t.Fatal(err)
}

if cfg.overrideExperimentalDistSQLPlanning != "" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ select crdb_internal.get_vmodule()
query T
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
----
22.1
21.2

query ITTT colnames
select node_id, component, field, regexp_replace(regexp_replace(value, '^\d+$', '<port>'), e':\\d+', ':<port>') as value from crdb_internal.node_runtime_info
Expand Down Expand Up @@ -688,7 +688,7 @@ select * from crdb_internal.node_inflight_trace_spans
query T
select regexp_replace(crdb_internal.node_executable_version()::string, '(-\d+)?$', '');
----
22.1
21.2

user root

Expand Down
4 changes: 0 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/delete
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ COMMIT

subtest regression_33361

# Disable automatic stats to avoid flakiness (sometimes causes retry errors).
statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false

statement ok
CREATE TABLE t33361(x INT PRIMARY KEY, y INT UNIQUE, z INT); INSERT INTO t33361 VALUES (1, 2, 3)

Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/distsql_event_log
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# CREATE STATISTICS
###################

statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false

# This test verifies that events are posted for table statistics creation.
statement ok
SET CLUSTER SETTING sql.stats.post_events.enabled = TRUE
Expand Down
5 changes: 1 addition & 4 deletions pkg/sql/logictest/testdata/logic_test/distsql_stats
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# LogicTest: 5node 5node-metadata

# Disable automatic stats.
statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false

# Disable histogram collection.
statement ok
SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false

Expand Down
1 change: 0 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/index_join
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# tests.

statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
CREATE TABLE lineitem
(
l_orderkey int PRIMARY KEY,
Expand Down
4 changes: 0 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/inv_stats
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Tests that verify we retrieve the stats correctly. Note that we can't create
# statistics if distsql mode is OFF.

# Disable automatic stats to prevent flakes if auto stats run.
statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false

statement ok
CREATE TABLE t (j JSON, g GEOMETRY);
CREATE INVERTED INDEX ON t (j);
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/logictest/testdata/logic_test/partial_index
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ DELETE from u
subtest join

statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
CREATE TABLE join_small (m INT, n INT);
CREATE TABLE join_large (i INT, s STRING, INDEX (i) WHERE s IN ('foo', 'bar', 'baz'));
ALTER TABLE join_small INJECT STATISTICS '[
Expand Down
Loading

0 comments on commit e02793d

Please sign in to comment.