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

workload/schemachange: improve error screening #56379

Merged

Conversation

jayshrivastava
Copy link
Contributor

@jayshrivastava jayshrivastava commented Nov 6, 2020

workload/schemachange: improve error screening

Several ops will be updated to screen for errors (#56119):

  • dropTable
  • dropView
  • createSequence
  • renameSequence
  • dropSequence
  • insertRow

Sequences were also updated to have more interesting cases: non-existing sequences can randomly be returned and sequences can be owned by columns.

Furthermore, this change fixes a bug where non-existing tables were getting returned instead of existing ones.

Finally, error screening logic is updated to ignore transaction retry errors. This fixes one of the issues in #56230.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jayshrivastava jayshrivastava changed the title Screen errors in schemachange wl 2 workload/schemachange: improve error screening Nov 6, 2020
@jayshrivastava jayshrivastava force-pushed the screen-errors-in-schemachange-wl-2 branch 2 times, most recently from 5c687e0 to f8b23c8 Compare November 12, 2020 22:06
@jayshrivastava jayshrivastava force-pushed the screen-errors-in-schemachange-wl-2 branch from f8b23c8 to 6da2c61 Compare November 16, 2020 01:25
@jayshrivastava jayshrivastava marked this pull request as ready for review November 16, 2020 14:29
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

just little things

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, 2 of 2 files at r5, 1 of 1 files at r6, 1 of 1 files at r7, 3 of 3 files at r8.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @jayshrivastava)


pkg/workload/schemachange/error_screening.go, line 228 at r8 (raw file):

		previousRows := map[string]bool{}

		for _, row := range rows {

this logic could be refactored to be more readable. Consider factoring out a helper per row, constraint tuple. I also wonder if you could rework this to be one query per constraint.


pkg/workload/schemachange/operation_generator.go, line 361 at r4 (raw file):

	}

	ifNotExists := og.randIntn(2) == 0

nit: propagate some configuration of this rate lest we forget that we have control?


pkg/workload/schemachange/operation_generator.go, line 1283 at r4 (raw file):

}

// randTable returns a sequence qualified by a schema

nit: randSequence


pkg/workload/schemachange/operation_generator.go, line 381 at r5 (raw file):

	// Randomly decide if the sequence should be owned by a column. If so, it can
	// set set using the tree.SeqOptOwnedBy sequence option.
	if og.randIntn(2) == 0 {

same nit about control.


pkg/workload/schemachange/operation_generator.go, line 1030 at r6 (raw file):

	}

	srcSequenceExists, err := sequenceExists(tx, srcSequenceName)

I wonder if we're going to want to eventually put a transaction scoped cache on this sort of information. Just food for thought.

The intention here is to return the table name which was fetched from
the previous query. Previously, a new, unique name was being returned.

Release note: None
@jayshrivastava jayshrivastava force-pushed the screen-errors-in-schemachange-wl-2 branch from 6da2c61 to 153605e Compare November 25, 2020 21:24
@jayshrivastava jayshrivastava force-pushed the screen-errors-in-schemachange-wl-2 branch from 153605e to bd086d8 Compare November 25, 2020 22:05
Previously sequences would only be attached to the public
schema by default. This commit enhances the workload by allowing
sequences to belong to other schemas. Furthermore, this commit
adds the possibility that a sequence can be owned by a column
in a table which belongs to a different schema.

Release note: None
@jayshrivastava jayshrivastava force-pushed the screen-errors-in-schemachange-wl-2 branch from bd086d8 to 868a286 Compare November 25, 2020 22:13
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r17, 1 of 1 files at r18.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@jayshrivastava
Copy link
Contributor Author

bors r=ajwerner

@craig
Copy link
Contributor

craig bot commented Dec 3, 2020

Build succeeded:

@craig craig bot merged commit ac6463f into cockroachdb:master Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants