Skip to content

chore: add cockroachdb 26.1 to the matrix and modify version parsing#2907

Merged
tstirrat15 merged 1 commit intomainfrom
test-against-crdb-26.1
Feb 27, 2026
Merged

chore: add cockroachdb 26.1 to the matrix and modify version parsing#2907
tstirrat15 merged 1 commit intomainfrom
test-against-crdb-26.1

Conversation

@tstirrat15
Copy link
Contributor

@tstirrat15 tstirrat15 commented Feb 18, 2026

Description

Cockroach 26.1 has been released and we want to make sure that SpiceDB plays nice with it. This moves the matrix so that we test against 26.1.

We found that Cockroach now restricts access to its internal table, so we can't grab the version object directly. This changes the logic so that we rely on string parsing. This is less safe/direct, but it also works with v26.1.

We also found that checkpointing behavior changed in 26.1, so we updated min_checkpoint_interval.

We also

Changes

  • Move matrix so that we test against 26.1
  • Add a test for version checking behavior
  • Fix version checking behavior for 26.1
  • Fix an issue with min_checkpoint_interval in 26.1

Testing

Review. See that tests pass.

@tstirrat15 tstirrat15 marked this pull request as ready for review February 18, 2026 23:52
@tstirrat15 tstirrat15 requested a review from a team as a code owner February 18, 2026 23:52
@github-actions github-actions bot added the area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) label Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.54%. Comparing base (68bc889) to head (e132103).

❌ Your project check has failed because the head coverage (74.54%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2907      +/-   ##
==========================================
+ Coverage   73.57%   74.54%   +0.98%     
==========================================
  Files         489      489              
  Lines       60373    60365       -8     
==========================================
+ Hits        44414    44995     +581     
+ Misses      12798    12218     -580     
+ Partials     3161     3152       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 2 times, most recently from 128c01f to 05fdf9e Compare February 19, 2026 00:26
@tstirrat15 tstirrat15 changed the title chore: add cockroachdb 26.1 to the matrix chore: add cockroachdb 26.1 to the matrix and modify version parsing Feb 19, 2026
@github-actions github-actions bot added the area/datastore Affects the storage system label Feb 19, 2026
@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 2 times, most recently from 0af5c22 to 22651c5 Compare February 19, 2026 00:32
@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 3 times, most recently from ae66de5 to 3406d66 Compare February 20, 2026 19:49
@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch from 3406d66 to 6500d9b Compare February 20, 2026 20:38
WithAcquireTimeout(5*time.Second),
))

t.Run("TestVersionReading", createDatastoreTest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wrap VersionReadingTest at all with createDatastoreTest? just write it as a normal test func TestVersionReading(t *testing.T) { .. }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the createDatastoreTest is parametrized over CRDB versions and takes care of setting up the datastore. I want to be sure that we're correctly reading the version for all CRDB versions that we're testing against.

const (
readMaxConns = 10
)
// Set up a raw connection to the DB
Copy link
Contributor

@miparnisari miparnisari Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to what DB? where was the DB created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DB instance in the test? Or are you wanting a more descriptive comment?

Copy link
Contributor

@miparnisari miparnisari Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the DB is created in createDatastoreTest, and the url that we hardcoded in line 986 just... works? is that it?

i wonder if we could structure this better. e.g. if the DB created points to port 5433, this test will break.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so - I copied this test from the structure of a preceding test. I haven't dug into how they work internally. I kinda wonder if this is something with a pgx test connection or a detail of how we're using test containers.

@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 3 times, most recently from 4e0383b to 16f487e Compare February 25, 2026 18:20
@tstirrat15
Copy link
Contributor Author

Maybe refactor to use SHOW CLUSTER SETTING version; instead; this should give major.minor

@tstirrat15
Copy link
Contributor Author

^ That would require admin, which would probably break OSS users of CRDB, so we won't go that route.

@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 6 times, most recently from e3c3f0d to 7f82bf5 Compare February 26, 2026 20:08
Copy link
Contributor Author

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the salient changes.

require.Equal(t, float64(readMaxConns), poolReadMetric.GetGauge().GetValue()) //nolint:testifylint // we expect exact values
}

func VersionReadingTest(t *testing.T, _ datastore.Datastore) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a net-new integration test that asserts that the version requested by the env var is correctly parsed by the internal logic.


// RevisionQuantizationTest tests whether or not the requirements for revisions hold
// for a particular datastore.
// TODO: rewrite using synctest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this TODO because I figured out that this is interacting with an external database whose time state can't be captured by a synctest bubble.

Comment on lines +203 to +204
// assert that recent call to head revision is also valid, even after a GC window cycle without writes elapsed
require.NoError(ds.CheckRevision(ctx, head), "expected freshly obtained head revision to be valid")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this up, since we don't want the length of time that the namespace reads to cause this assertion to flap (which is what was happening to me locally)

Comment on lines +206 to +208
// TODO: these reads are taking a significant amount of time on CRDB, on the order
// of 100ms for a row read. We need to ascertain whether this is a test artifact
// or a performance regression.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that we should figure out but isn't related to the changes in this PR.

@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch 10 times, most recently from 99244b9 to 04d02af Compare February 27, 2026 21:48
Comment on lines +74 to +76
// This should mean that we can wait until the checkpoint is emitted and then
// make our writes.
// CheckpointInterval: 1*time.Second,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This should mean that we can wait until the checkpoint is emitted and then
// make our writes.
// CheckpointInterval: 1*time.Second,

@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch from 04d02af to 82b9711 Compare February 27, 2026 21:55
@tstirrat15 tstirrat15 force-pushed the test-against-crdb-26.1 branch from 82b9711 to 1f55937 Compare February 27, 2026 21:56
@tstirrat15 tstirrat15 enabled auto-merge (squash) February 27, 2026 22:32
@tstirrat15 tstirrat15 merged commit a01eddc into main Feb 27, 2026
43 checks passed
@tstirrat15 tstirrat15 deleted the test-against-crdb-26.1 branch February 27, 2026 22:34
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants