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

release-22.2: roachtest: ignore duplicated events in fingerprint validator #89535

Merged
merged 2 commits into from
Oct 10, 2022

Conversation

blathers-crl[bot]
Copy link

@blathers-crl blathers-crl bot commented Oct 6, 2022

Backport 2/2 commits from #89332 on behalf of @renatolabs.

/cc @cockroachdb/release


This commit updates the fingerprint validator (and its use in the
cdc/mixed-versions test) to ignore duplicated events received by the
validator.

A previously implicit assumption of the validator is that any events
that it receives are either not duplicated, or -- if they are
duplicated -- they are within the previous resolved timestamp and the
current resolved timestamp. However, that assumption is not justified
by the changefeed guarantees and depends on how frequently resolved
events are emitted and how often the changefeed checkpoints.

In the specific case of the cdc/mixed-versions roachtest, it was
possible for the changefeed to start from an old checkpoint (older
than the last received resolved timestamp), causing it to re-emit
old events that happened way before the previously observed resolved
event. As a consequence, when the validator applies the update
associated with that event, there is a mismatch with state of the
original table as of the update's timestamp, as the fingerprint
validator relies on the fact that updates are applied in order.

To fix the issue, we now skip events that happen before the timestamp
of the previous resolved event received. In addition, the caller can
also tell the validator to verify that such out-of-order messages
received by the validator have indeed been previously seen; if not,
that would represent a violation of the changefeed's guarantees.

Fixes: #87251.

Release note: None


Release justification: fix for roachtest

To handle mixed-version CDC tests, the fingerprint validator had
previously been updated to handle retries internally; this complicates
the validator as the retry logic is only ever used in the
mixed-version roachtests.

This commit removes the retry logic from the validator and instead
allows the caller to pass a `DBFunc` to be called whenever a database
connection is needed after initialization. By passing a custom DBFunc,
tests that need it (such as the mixed-versions roachtest) can pass a
function that accounts for temporary unavailability of nodes.
Specifically, we pass a function that blocks while nodes are being
upgraded, to simplify reasoning of this test's behavior.

In order to support that, we also change the signature of
`NewFingerprintValidator` to return the actual concrete
validator (which is now made public) instead of the `Validator`
interface, following the generally-good approach of "accept
interfaces, return structs" in Go.

Release note: None
This commit updates the fingerprint validator (and its use in the
`cdc/mixed-versions` test) to ignore duplicated events received by the
validator.

A previously implicit assumption of the validator is that any events
that it receives are either not duplicated, or -- if they are
duplicated -- they are within the previous resolved timestamp and the
current resolved timestamp. However, that assumption is not justified
by the changefeed guarantees and depends on how frequently `resolved`
events are emitted and how often the changefeed checkpoints.

In the specific case of the `cdc/mixed-versions` roachtest, it was
possible for the changefeed to start from an old checkpoint (older
than the last received `resolved` timestamp), causing it to re-emit
old events that happened way before the previously observed resolved
event. As a consequence, when the validator applies the update
associated with that event, there is a mismatch with state of the
original table as of the update's timestamp, as the fingerprint
validator relies on the fact that updates are applied in order.

To fix the issue, we now skip events that happen before the timestamp
of the previous `resolved` event received. In addition, the caller can
also tell the validator to verify that such out-of-order messages
received by the validator have indeed been previously seen; if not,
that would represent a violation of the changefeed's guarantees.

Fixes: #87251.

Release note: None
@blathers-crl blathers-crl bot requested a review from a team as a code owner October 6, 2022 21:35
@blathers-crl blathers-crl bot requested review from shermanCRL and removed request for a team October 6, 2022 21:35
@blathers-crl blathers-crl bot force-pushed the blathers/backport-release-22.2-89332 branch from 27027c8 to 8c4336d Compare October 6, 2022 21:35
@blathers-crl
Copy link
Author

blathers-crl bot commented Oct 6, 2022

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Patches should only be created for serious issues or test-only changes.
  • Patches should not break backwards-compatibility.
  • Patches should change as little code as possible.
  • Patches should not change on-disk formats or node communication protocols.
  • Patches should not add new functionality.
  • Patches must not add, edit, or otherwise modify cluster versions; or add version gates.
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters.
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.

Add a brief release justification to the body of your PR to justify this backport.

Some other things to consider:

  • What did we do to ensure that a user that doesn’t know & care about this backport, has no idea that it happened?
  • Will this work in a cluster of mixed patch versions? Did we test that?
  • If a user upgrades a patch version, uses this feature, and then downgrades, what happens?

@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Oct 6, 2022
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@srosenberg srosenberg merged commit c06e560 into release-22.2 Oct 10, 2022
@srosenberg srosenberg deleted the blathers/backport-release-22.2-89332 branch October 10, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants