Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cockroachdb: add v23.1.13 #76

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cockroach/23.1.13/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM cockroachdb/cockroach:v23.1.13
COPY prisma_init.sql /docker-entrypoint-initdb.d/prisma_init.sql
31 changes: 31 additions & 0 deletions cockroach/23.1.13/prisma_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE USER prisma;
GRANT admin TO prisma;

-- Testing only configuration for CockroachDB

-- Frequent table create/drop creates extra ranges, which we want to merge quickly. In real usage, range merges are rate limited because they require rebalancing
SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms';

-- Setting improves performance by not syncing data to disk. Data is lost if a node crashes. This matches another recommendation to use cockroach start-single-node --store-type=mem.
SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = true;

-- More schema changes create more jobs, which affects job queries performance. We don’t need to retain jobs during testing so can set a more aggressive delete policy.
SET CLUSTER SETTING jobs.retention_time = '15s';

-- This is one example of an internal task that queries the jobs table. For testing, the default is too fast.
SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';

-- CockroachDB executes queries that scan the jobs table. More schema changes creates more jobs, which we can delete faster to make job queries faster.
SET CLUSTER SETTING jobs.registry.interval.gc = '30s';

-- Automatics statistics contribute to table contention alongside schema changes. A schema change triggers an asynchronous auto stats job.
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;

-- tl;dr we want to quickly discard ranges on DROP DATABASE.
-- longer version: By default we prevent ranges being merged within 5mins as there is usually thrashing if we merge ranges sooner. However, if we want ranges to be disposed quickly (e.g. in CI), we want this much lower so that we can discard dropped database objects quicker.
SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';

-- Faster descriptor cleanup.
ALTER RANGE default CONFIGURE ZONE USING gc.ttlseconds = '5';
-- Faster jobs table cleanup.
ALTER DATABASE system CONFIGURE ZONE USING gc.ttlseconds = '5';