cockroachdb / cockroachdb/cockroach

workload: Add DRT operation for ALTER COLUMN TYPE

Open
#141,712 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We want to add a new DRT operation to stress-test ALTER COLUMN TYPE. The key requirement for this operation is to avoid modifying existing column types, as that could disrupt ongoing queries. Instead, we will select a column from a table, clone it using ADD COLUMN, and then alter the type of the cloned column. By using an existing column as a reference, we ensure the cloned column contains meaningful data rather than just a single default value.

Steps for the operation:
1. Select a random table.
2. Add a new column (the "cloned column") to the table with a BOOL type and a NULL default value.
3. Select a random column from the table.
4. Alter the type of the cloned column to match the selected column's type, using the USING expression to copy its contents.
5. Alter the cloned column's type again, this time using a change that doesn’t require a rewrite. Example mappings:
INTX -> INTY
TEXT -> VARCHAR(N)
VARCHAR(N) -> TEXT
6. Pause for a while to allow other operations to interact with the column.
7. Drop the cloned column.

Jira issue: CRDB-47971

Epic CRDB-44826

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.