Skip to content

Commit 6eb06ac

Browse files
craig[bot]wenyihu6sjbaragkooroshrafiss
committed
107696: asim: ensure consistent sequencing of changes applied to ranges r=kvoli a=wenyihu6 **asim: ensure consistent sequencing of changes applied to a range** Upon investigating, we identified the non-deterministic behavior was due to the sequence of changes applied on the ranges within one tick. Changes within a tick are applied in one go. But the changes are stored in a map, and map iteration order is non-deterministic. Thus, the sequence of events applied and published via gossip could vary and could result in different event states. This patch resolves the issue by changing the storage of changes to be applied from a map to an array, ensuring consistent iteration and sequence of events. Note the shift to an array doesn't pose any issues since all changes need to be applied anyway. With this fix, the test `TestAsimDeterministic` fails only under race. This is less concerning since the simulator should run on a single goroutine without concurrency. Although the cause of the test failure in race conditions in unclear, fixing this is not a priority. Part Of: cockroachdb#105904 Release Note: None ---- **asim: add tests for constraints validation, asim determinism** This patch adds an asim datadriven test case which sets up zone constraints and ensures its proper application and validation of these constraints. Part Of: cockroachdb#105904 Release Note: None ---- **asim: sort map by key when iterating** While investigating cockroachdb#105904, we found that the bug's cause is due to the simulator's iteration over an unordered map, leading to non-determinism. There are other occurrences in the simulator's code where unordered map iteration takes place. To make the code less error-prone, this patch checks the simulator's code and sorts unordered maps by key when iterating. While it's uncertain whether this change will solve any underlying non-determinism or pinpoint exactly where in the code non-determinism might occur, there is no harm in making the system less error-prone. Part Of:cockroachdb#105904 Release Note: None ---- Each test were stressed with [runs](https://github.com/cockroachdb/cockroach/blob/cb4f59df66852e24546067d4904a4c981b0cc92e/pkg/kv/kvserver/asim/asim_test.go#L49) set to 10 and with --count = 100. TestAsimDeterministic (with --count = 5 due to test wait time): <img width="1053" alt="Screenshot 2023-07-27 at 8 09 50 AM" src="https://github.com/cockroachdb/cockroach/assets/56973754/24870322-0419-4646-9ca5-edf2dd76dd47"> TestAsimDeterministicZoneConf: <img width="1056" alt="Screenshot 2023-07-27 at 8 08 48 AM" src="https://github.com/cockroachdb/cockroach/assets/56973754/4d4b7918-3318-4535-a82e-2e98f172040c"> TestAsimDeterministicDiskFull: <img width="1006" alt="Screenshot 2023-07-27 at 8 08 19 AM" src="https://github.com/cockroachdb/cockroach/assets/56973754/fdbc7d77-2b40-432f-a599-cfc1eb3e1575"> example_zone_config: <img width="992" alt="Screenshot 2023-07-27 at 8 13 19 AM" src="https://github.com/cockroachdb/cockroach/assets/56973754/8b0f018f-9892-4268-a016-634c4ff8f26c"> example_fulldisk: <img width="1042" alt="Screenshot 2023-07-27 at 8 18 36 AM" src="https://github.com/cockroachdb/cockroach/assets/56973754/fe0fd3cc-1505-4510-8592-3c9b3ea759dc"> 107840: ci,ui: always install dependencies with pnpm r=nathanstilwell a=sjbarag Previously, the 'cluster-ui-release' and 'cluster-ui-release-next' GitHub Actions workflows would fail when no new version needed to be published. When setup-node performs its post-run actions, it attempts to cache the global pnpm store. Unfortunately, that caching step fails when no global pnpm store exists, like during a cache-miss when `pnpm install` never ran. This caused the entire workflow to be marked as failed, adding needless noise to anyone who changed a file in `pkg/ui/workspaces/cluster-ui` without bumping the package version. Always run `pnpm install`, so that the global pnpm store is always populated and cacheable. Release note: None Epic: none 107870: sql: fix TestSQLStatsCompactor flaky test r=koorosh a=koorosh This patch disables auto split and merge of ranges for the test because it causes extra wide scan to be counted by `kvInterceptor`. Also, it is defined to run test on system tenant only to have an access to `kv` specific cluster setting and because it should have an access to store level. Release note: None Resolves: cockroachdb#107067 107964: go.mod: bump datadriven to e384cf455877 r=kvoli,irfansharif a=wenyihu6 ``` e384cf4 Merge pull request cockroachdb#45 from wenyihu6/add-float64arr f4b8e52 add scan implementation for float64, time.Duration, and []float64 ``` Release Note: None Epic: None 107979: roachtest: improve flake detection for typeorm test r=rafiss a=rafiss fixes cockroachdb#100705 fixes cockroachdb#103182 fixes cockroachdb#103175 fixes cockroachdb#103172 Release note: None 107981: changefeedccl: remove two usages of disableDeclarativeSchemaChangesForTest r=miretskiy a=jayshrivastava This change removes two usages of `disableDeclarativeSchemaChangesForTest` from tests and replaces them with `maybeDisableDeclarativeSchemaChangesForTest` which will use the legacy schema changer 10% of the time. Release note: None Informs: cockroachdb#106906 Epic: None Co-authored-by: wenyihu6 <[email protected]> Co-authored-by: Sean Barag <[email protected]> Co-authored-by: Andrii Vorobiov <[email protected]> Co-authored-by: Rafi Shamim <[email protected]> Co-authored-by: Jayant Shrivastava <[email protected]>
7 parents 54a3a38 + 08917ff + d866b94 + 06b8fa9 + 54e6ccb + 119af15 + 9c9b6dc commit 6eb06ac

File tree

20 files changed

+218
-36
lines changed

20 files changed

+218
-36
lines changed

.github/workflows/cluster-ui-release-next.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ jobs:
4242
env:
4343
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4444

45+
# Always install node dependencies. It seems silly to do if we're not
46+
# going to actually use them, but setup-node's post-run action attempts
47+
# to save dependencies to a cache shared between GitHub actions. If the
48+
# pnpm store directory doesn't exist (e.g. during a cache miss), that
49+
# cache-saving step will fail and the entire job will be marked "failed"
50+
# as a result. Installing dependencies is the canonical way to seed the
51+
# pnpm store from-scratch.
52+
- name: Install dependencies
53+
run: pnpm install --frozen-lockfile
54+
4555
- name: Check if version is published
4656
id: version-check
4757
shell: bash
@@ -62,7 +72,6 @@ jobs:
6272
- name: Build Cluster UI
6373
if: steps.version-check.outputs.published == 'no'
6474
run: |
65-
pnpm install --frozen-lockfile
6675
bazel build //pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client
6776
cp ../../../../_bazel/bin/pkg/ui/workspaces/db-console/src/js/protos.* ../db-console/src/js/
6877
pnpm build

.github/workflows/cluster-ui-release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ jobs:
4242
env:
4343
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4444

45+
# Always install node dependencies. It seems silly to do if we're not
46+
# going to actually use them, but setup-node's post-run action attempts
47+
# to save dependencies to a cache shared between GitHub actions. If the
48+
# pnpm store directory doesn't exist (e.g. during a cache miss), that
49+
# cache-saving step will fail and the entire job will be marked "failed"
50+
# as a result. Installing dependencies is the canonical way to seed the
51+
# pnpm store from-scratch.
52+
- name: Install dependencies
53+
run: pnpm install --frozen-lockfile
54+
4555
- name: Check if version is published
4656
id: version-check
4757
shell: bash
@@ -67,7 +77,6 @@ jobs:
6777
- name: Build Cluster UI
6878
if: steps.version-check.outputs.published == 'no'
6979
run: |
70-
pnpm install --frozen-lockfile
7180
bazel build //pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client
7281
cp ../../../../_bazel/bin/pkg/ui/workspaces/db-console/src/js/protos.* ../db-console/src/js/
7382
pnpm build

DEPS.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,10 +1532,10 @@ def go_deps():
15321532
name = "com_github_cockroachdb_datadriven",
15331533
build_file_proto_mode = "disable_global",
15341534
importpath = "github.com/cockroachdb/datadriven",
1535-
sha256 = "f6de9c180e1ea80c602d98247b8e8fe89f491648ab1425417b9aca082697cbc0",
1536-
strip_prefix = "github.com/cockroachdb/[email protected].20230413201302-be42291fc80f",
1535+
sha256 = "3f1ac51e496ac26ae297c9846bb78eb416fd50b7566b892fb7087af9273766fe",
1536+
strip_prefix = "github.com/cockroachdb/[email protected].20230801171734-e384cf455877",
15371537
urls = [
1538-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.3-0.20230413201302-be42291fc80f.zip",
1538+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.3-0.20230801171734-e384cf455877.zip",
15391539
],
15401540
)
15411541
go_repository(

build/bazelutil/distdir_files.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ DISTDIR_FILES = {
315315
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/cmux/com_github_cockroachdb_cmux-v0.0.0-20170110192607-30d10be49292.zip": "88f6f9cf33eb535658540b46f6222f029398e590a3ff9cc873d7d561ac6debf0",
316316
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/cockroach-go/v2/com_github_cockroachdb_cockroach_go_v2-v2.3.5.zip": "70860a2615f3df73f7d00b4801b1fffe30a3306ae1cda1e9bf5245bb74e86d9a",
317317
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/crlfmt/com_github_cockroachdb_crlfmt-v0.0.0-20221214225007-b2fc5c302548.zip": "fedc01bdd6d964da0425d5eaac8efadc951e78e13f102292cc0774197f09ab63",
318-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.3-0.20230413201302-be42291fc80f.zip": "f6de9c180e1ea80c602d98247b8e8fe89f491648ab1425417b9aca082697cbc0",
318+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.3-0.20230801171734-e384cf455877.zip": "3f1ac51e496ac26ae297c9846bb78eb416fd50b7566b892fb7087af9273766fe",
319319
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/errors/com_github_cockroachdb_errors-v1.9.2-0.20230612103643-126c21918793.zip": "d0ec6421e334689c9d023b8c27940c7a72c3110d90b3aa82267a101aa9858a9a",
320320
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-test-teamcity/com_github_cockroachdb_go_test_teamcity-v0.0.0-20191211140407-cff980ad0a55.zip": "bac30148e525b79d004da84d16453ddd2d5cd20528e9187f1d7dac708335674b",
321321
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.19.0.zip": "c4d516bcfe8c07b6fc09b8a9a07a95065b36c2855627cb3514e40c98f872b69e",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ require (
111111
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292
112112
github.com/cockroachdb/cockroach-go/v2 v2.3.5
113113
github.com/cockroachdb/crlfmt v0.0.0-20221214225007-b2fc5c302548
114-
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f
114+
github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877
115115
github.com/cockroachdb/errors v1.9.2-0.20230612103643-126c21918793
116116
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
117117
github.com/cockroachdb/gostdlib v1.19.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ github.com/cockroachdb/crlfmt v0.0.0-20221214225007-b2fc5c302548 h1:i0bnjanlWAvM
481481
github.com/cockroachdb/crlfmt v0.0.0-20221214225007-b2fc5c302548/go.mod h1:qtkxNlt5i3rrdirfJE/bQeW/IeLajKexErv7jEIV+Uc=
482482
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
483483
github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
484-
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
485-
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
484+
github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o=
485+
github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
486486
github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk=
487487
github.com/cockroachdb/errors v1.9.2-0.20230612103643-126c21918793 h1:2w2ycVjd8yt4G1rbU0K1OFYz4F/6iY9289KbDwSnRb0=
488488
github.com/cockroachdb/errors v1.9.2-0.20230612103643-126c21918793/go.mod h1:Ga5uDQye4MhjOl+lyfGROE0uNdhcImhW+qYVMsysmJk=

pkg/ccl/changefeedccl/alter_changefeed_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,19 @@ func TestAlterChangefeedAddTargetsDuringSchemaChangeError(t *testing.T) {
11021102
defer leaktest.AfterTest(t)()
11031103
defer log.Scope(t).Close(t)
11041104

1105-
rnd, _ := randutil.NewPseudoRand()
1105+
rnd, seed := randutil.NewPseudoRand()
1106+
t.Logf("random seed: %d", seed)
11061107

11071108
testFn := func(t *testing.T, s TestServerWithSystem, f cdctest.TestFeedFactory) {
11081109
sqlDB := sqlutils.MakeSQLRunner(s.DB)
1109-
disableDeclarativeSchemaChangesForTest(t, sqlDB)
1110+
usingLegacySchemaChanger := maybeDisableDeclarativeSchemaChangesForTest(t, sqlDB, rnd)
1111+
// NB: For the `ALTER TABLE foo ADD COLUMN ... DEFAULT` schema change,
1112+
// the expected boundary is different depending on if we are using the
1113+
// legacy schema changer or not.
1114+
expectedBoundaryType := jobspb.ResolvedSpan_RESTART
1115+
if usingLegacySchemaChanger {
1116+
expectedBoundaryType = jobspb.ResolvedSpan_BACKFILL
1117+
}
11101118

11111119
knobs := s.TestingKnobs.
11121120
DistSQL.(*execinfra.TestingKnobs).
@@ -1181,10 +1189,9 @@ func TestAlterChangefeedAddTargetsDuringSchemaChangeError(t *testing.T) {
11811189
return true, nil
11821190
}
11831191

1184-
// A backfill begins when the backfill resolved event arrives, which has a
1185-
// timestamp such that all backfill spans have a timestamp of
1186-
// timestamp.Next()
1187-
if r.BoundaryType == jobspb.ResolvedSpan_BACKFILL {
1192+
// A backfill begins when the associated resolved event arrives, which has a
1193+
// timestamp such that all backfill spans have a timestamp of timestamp.Next().
1194+
if r.BoundaryType == expectedBoundaryType {
11881195
backfillTimestamp = r.Timestamp
11891196
return false, nil
11901197
}

pkg/ccl/changefeedccl/changefeed_test.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,8 @@ func TestChangefeedSchemaChangeBackfillCheckpoint(t *testing.T) {
18661866
defer leaktest.AfterTest(t)()
18671867
defer log.Scope(t).Close(t)
18681868

1869-
rnd, _ := randutil.NewPseudoRand()
1869+
rnd, seed := randutil.NewPseudoRand()
1870+
t.Logf("random seed: %d", seed)
18701871

18711872
// This test asserts that a second checkpoint made after resumption does its
18721873
// best to not lose information from the first checkpoint, therefore the
@@ -1876,7 +1877,14 @@ func TestChangefeedSchemaChangeBackfillCheckpoint(t *testing.T) {
18761877

18771878
testFn := func(t *testing.T, s TestServerWithSystem, f cdctest.TestFeedFactory) {
18781879
sqlDB := sqlutils.MakeSQLRunner(s.DB)
1879-
disableDeclarativeSchemaChangesForTest(t, sqlDB)
1880+
usingLegacySchemaChanger := maybeDisableDeclarativeSchemaChangesForTest(t, sqlDB, rnd)
1881+
// NB: For the `ALTER TABLE foo ADD COLUMN ... DEFAULT` schema change,
1882+
// the expected boundary is different depending on if we are using the
1883+
// legacy schema changer or not.
1884+
expectedBoundaryType := jobspb.ResolvedSpan_RESTART
1885+
if usingLegacySchemaChanger {
1886+
expectedBoundaryType = jobspb.ResolvedSpan_BACKFILL
1887+
}
18801888

18811889
knobs := s.TestingKnobs.
18821890
DistSQL.(*execinfra.TestingKnobs).
@@ -1957,10 +1965,10 @@ func TestChangefeedSchemaChangeBackfillCheckpoint(t *testing.T) {
19571965
return true, nil
19581966
}
19591967

1960-
// A backfill begins when the backfill resolved event arrives, which has a
1968+
// A backfill begins when the associated resolved event arrives, which has a
19611969
// timestamp such that all backfill spans have a timestamp of
1962-
// timestamp.Next()
1963-
if r.BoundaryType == jobspb.ResolvedSpan_BACKFILL {
1970+
// timestamp.Next().
1971+
if r.BoundaryType == expectedBoundaryType {
19641972
backfillTimestamp = r.Timestamp
19651973
return false, nil
19661974
}

pkg/ccl/changefeedccl/helpers_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ import (
5858

5959
var testSinkFlushFrequency = 100 * time.Millisecond
6060

61+
// disableDeclarativeSchemaChangesForTest will disable the declarative schema
62+
// changer with a probability of 10% using the provided SQL DB connection. This
63+
// returns true if the declarative schema changer is disabled.
64+
func maybeDisableDeclarativeSchemaChangesForTest(
65+
t testing.TB, sqlDB *sqlutils.SQLRunner, rnd *rand.Rand,
66+
) bool {
67+
disable := rnd.Float32() < 0.1
68+
if disable {
69+
t.Log("using legacy schema changer")
70+
sqlDB.Exec(t, "SET use_declarative_schema_changer='off'")
71+
sqlDB.Exec(t, "SET CLUSTER SETTING sql.defaults.use_declarative_schema_changer='off'")
72+
}
73+
return disable
74+
}
75+
6176
// disableDeclarativeSchemaChangesForTest tests that are disabled due to differences
6277
// in changefeed behaviour and are tracked by issue #80545.
6378
func disableDeclarativeSchemaChangesForTest(t testing.TB, sqlDB *sqlutils.SQLRunner) {

pkg/cmd/roachtest/tests/knex.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/stretchr/testify/require"
2323
)
2424

25-
const supportedKnexTag = "2.0.0"
25+
const supportedKnexTag = "2.5.1"
2626

2727
// This test runs one of knex's test suite against a single cockroach
2828
// node.

0 commit comments

Comments
 (0)