-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix renaming data streams with CCR replication #88875
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
801decd
Add failing test for data stream renaming through CCR
martijnvg e1d83ca
Fix renaming data streams with CCR replication
dakrone 9ee7adf
Update docs/changelog/88875.yaml
dakrone 1d3a7f5
Fix changelog
dakrone e3001d5
Add a test for an unparseable data stream backing index
dakrone 108eb5e
Merge remote-tracking branch 'origin/main' into fix-ccr-ds-rename
dakrone 2789600
Fix a typo in the docs
dakrone 00bdaba
Whoops, typo in test
dakrone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 88875 | ||
| summary: Fix renaming data streams with CCR replication | ||
| area: "Data streams" | ||
| type: bug | ||
| issues: | ||
| - 81751 |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
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.
Hm, if I understand correctly, CCR works on index level. With this API what we do is to follow a single leader index that belongs to a data stream and we provide also a data stream name. I do not see from this doc, any guidance on naming the follower index or the data stream of the follower index so it could be anything right?
Furthermore, I was wondering, if CCR is defined on an index level, this means that after the leader index will be rolled over the leader data stream would not be followed anymore. Right?
So, I was wondering. Is this API maybe too "free" and error prone, users might put invalid names and potentially create weird bugs?
Should we instead, verify the name of the follower index that it follows the data stream pattern and extract the data stream name from it?
So, if a user tries to follow an data stream backing index, for example,
.ds-logs-mysql-default_copy-2022-01-01-000001we will inferlogs-mysql-default_copyas the data stream name. While in the case they try to create a follower index like.ds-logs-mysql-default-2022-01-01-000001_copy, we will fail and let them now that this is an invalid name.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.
It's worse than that, a data stream can have any arbitrary backing index name, because we have the migrate to data stream API that converts an alias to a data stream. So a data stream named
logs-mysql-infocould have backing indices namedmyfirstindexandother-indexfollowing no pattern. Rather than enforce that there is a pattern with the backing index names, I opted to go with a check for something that looks like our regular pattern and if that doesn't work, then we treat it as an "I don't know" pattern and just do the regular name replacement.If for some reason we have something that looks like a good pattern name, but is not, then we throw an exception and stop the auto-following. I'll add a test for this specific scenario (in e3001d5).
If the leader is rolled over then the auto-follow pattern would pick up the next index in the data stream (presumably
<thing>-000002), the data stream is not really "followed" because CCR doesn't really follow data streams, but the next index would be replicated, only the data stream would already exist because the first index would have created it already.Things are a little different in ILM, because ILM auto-injects some
unfollowactions around rollover, but regardless the naming thing would be the same.