[persist/source] Fixups and cleanups for the persist source write optimization #34285
+22
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in the flag check... we'd previously only enable write-time validation when that and the read-time validation flag were both enabled, but the code intended the opposite. (The effect of the old definition was that as soon as you relaxed the read-time checks, the behaviour of the writer would immediately change... not ideal!)
I think this was likely caused by the various "double negatives" in this code, so I made some small followup changes to avoid inverting booleans more than necessary and improving the docs a bit.
Motivation
Discovered while working on the rollout for https://github.com/MaterializeInc/database-issues/issues/9275 - I started seeing the behaviour change as soon as I flipped the read flag.
Tips for reviewer
Another odd thing is that we don't see any errors in the parallel workload: the code as written should error if the validations are ever disabled (allowing the new kind of writes) and then re-enabled (validating that no such writes exist).
I'm going to try and repro that case more reliably... but it's taking a minute, so I may follow up with any changes there.I've repro'd and fixed this in the last couple commits.