-
Notifications
You must be signed in to change notification settings - Fork 4.1k
workload/schemachange: update rule for DDL after write #58141
Description
Describe the problem
The workload expects an error whenever a schema change is performed after a write. This logic is incorrect because the following succeeds:
root@localhost:26257/defaultdb OPEN> create table foo (i int, j int);
CREATE TABLE
root@localhost:26257/defaultdb OPEN> create table bar (j int);
CREATE TABLE
root@localhost:26257/defaultdb> begin;
BEGIN
root@localhost:26257/defaultdb OPEN> alter table bar drop column j;
ALTER TABLE
root@localhost:26257/defaultdb OPEN> insert into foo values (1,2);
INSERT 1
# This DML succeeds even though the previous statement was a write.
root@localhost:26257/defaultdb OPEN> create table t();
CREATE TABLE
root@localhost:26257/defaultdb OPEN> commit;
COMMIT
Expected behavior
As long the first DDL precedes the first write in a txn, then you are allowed to perform schema changes after writes in the txn. The workload should be updated to follow this rule instead of simply expecting an error for every DDL that occurs after a DML.
Additional data / screenshots
This error has shown up in these roachtest/schemachange/random-load failures:
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56081 (comment)
#56235 (comment)
#56230 (comment)
#56081 (comment)
#56081 (comment)
#56235 (comment)
#56230 (comment)
#56081 (comment)
#56081 (comment)
#56230 (comment)
Jira issue: CRDB-3428