-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
crosscluster/logical: prevent data looping via OriginID session variable #126404
Merged
craig
merged 1 commit into
cockroachdb:master
from
msbutler:butler-prevent-data-looping-origin-id
Jul 1, 2024
Merged
crosscluster/logical: prevent data looping via OriginID session variable #126404
craig
merged 1 commit into
cockroachdb:master
from
msbutler:butler-prevent-data-looping-origin-id
Jul 1, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msbutler
force-pushed
the
butler-prevent-data-looping-origin-id
branch
3 times, most recently
from
July 1, 2024 14:06
4055a38
to
92e03ff
Compare
msbutler
changed the title
Butler prevent data looping origin
crosscluster/logical: prevent data looping via OriginID session variable
Jul 1, 2024
msbutler
requested review from
dt,
stevendanna and
a team
and removed request for
a team
July 1, 2024 14:15
First patch in separate PR. |
msbutler
commented
Jul 1, 2024
dt
approved these changes
Jul 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll wanna rebase
Previously, LDR would prevent data looping by spinning up rangefeeds with filtering. This big hammer prevented LDR replicated data from appearing in destination side changefeeds. This patch replaces this data loop prevention strategy by 1) binding an OriginID of 1 to the MVCCValueHeader of each replicated KV during ingestion; 2) filtering these KVs with their OriginID value when these replicated KVs appear as LDR source side rangefeed events. To implement 1), the Internal Execetor in the LDR row processor now sets the OriginIDForLogicalDataReplication session variable to 1, which has the effect of binding OriginID=1 to each batch request header created by the InternalExecutor's write queries. The request header value will be plumbed to each KV's Value header in the kv layer. To implement 2), source side rangefeeds are now initialized with the WithEmitMatchingOriginIDs option, causing rangefeeds to only emit local writes, with OriginID=0. Note that a similar ingestion side plumbing strategy will be used for OriginTimestamp even though each ingested row may have a different timestamp. We can still bind the OriginTimestamp to the Internal Executor session before each query because 1) each IE query creates a new session; 2) we do not plan to use multi row insert statements during LDR ingestion via sql. Fixes cockroachdb#126253 Release note: none
msbutler
force-pushed
the
butler-prevent-data-looping-origin-id
branch
from
July 1, 2024 18:34
92e03ff
to
c7b720c
Compare
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
TFTR! bors r=dt |
msbutler
added a commit
to msbutler/cockroach
that referenced
this pull request
Jul 4, 2024
126404: crosscluster/logical: prevent data looping via OriginID session variable r=dt a=msbutler Previously, LDR would prevent data looping by spinning up rangefeeds with filtering. This big hammer prevented LDR replicated data from appearing in destination side changefeeds. This patch replaces this data loop prevention strategy by 1) binding an OriginID of 1 to the MVCCValueHeader of each replicated KV during ingestion; 2) filtering these KVs with their OriginID value when these replicated KVs appear as LDR source side rangefeed events. To implement 1), the Internal Execetor in the LDR row processor now sets the OriginIDForLogicalDataReplication session variable to 1, which has the effect of binding OriginID=1 to each batch request header created by the InternalExecutor's write queries. The request header value will be plumbed to each KV's Value header in the kv layer. To implement 2), source side rangefeeds are now initialized with the WithEmitMatchingOriginIDs option, causing rangefeeds to only emit local writes, with OriginID=0. Note that a similar ingestion side plumbing strategy will be used for OriginTimestamp even though each ingested row may have a different timestamp. We can still bind the OriginTimestamp to the Internal Executor session before each query because 1) each IE query creates a new session; 2) we do not plan to use multi row insert statements during LDR ingestion via sql. Fixes cockroachdb#126253 Release note: none Co-authored-by: Michael Butler <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, LDR would prevent data looping by spinning up rangefeeds with
filtering. This big hammer prevented LDR replicated data from appearing in
destination side changefeeds.
This patch replaces this data loop prevention strategy by 1) binding an
OriginID of 1 to the MVCCValueHeader of each replicated KV during ingestion; 2)
filtering these KVs with their OriginID value when these replicated KVs appear
as LDR source side rangefeed events.
To implement 1), the Internal Execetor in the LDR row processor now sets the
OriginIDForLogicalDataReplication session variable to 1, which has the effect
of binding OriginID=1 to each batch request header created by the
InternalExecutor's write queries. The request header value will be plumbed to
each KV's Value header in the kv layer.
To implement 2), source side rangefeeds are now initialized with the
WithEmitMatchingOriginIDs option, causing rangefeeds to only emit local writes,
with OriginID=0.
Note that a similar ingestion side plumbing strategy will be used for
OriginTimestamp even though each ingested row may have a different timestamp.
We can still bind the OriginTimestamp to the Internal Executor session before
each query because 1) each IE query creates a new session; 2) we do not plan to
use multi row insert statements during LDR ingestion via sql.
Fixes #126253
Release note: none