-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[7.x] Deprecate Auto-Follow system indices #73237
Merged
fcofdez
merged 24 commits into
elastic:7.x
from
fcofdez:deprecate-auto-follow-system-indices
Jun 29, 2021
Merged
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9b8adc0
Add deprecation warning when a system index is followed
fcofdez f38bc7a
More precise naming
fcofdez 7e8d53e
Warning only on auto-followed system indices
fcofdez 8804d9d
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez f4967e5
Fix error
fcofdez a48b770
Add deprecation docs
fcofdez 69910d7
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez d895be7
Fixes
fcofdez 9066e41
Cleanup
fcofdez 790a09f
Add proper auto follow system indices check
fcofdez 88d5188
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez 19cae57
Remove unused code
fcofdez 28918ce
Unused imports
fcofdez 08b3641
Simplify test
fcofdez 3a6cc0b
Include migrating behaviour
fcofdez 3045ead
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez 962a747
Simplify
fcofdez 36d81a6
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez a949a91
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez 74c289b
Fix compilation
fcofdez b80e0e9
Review comments
fcofdez 6a9edf8
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez 8727ce5
Rearrange docs
fcofdez 0573217
Merge remote-tracking branch 'origin/7.x' into deprecate-auto-follow-…
fcofdez 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 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 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 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 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 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 |
---|---|---|
|
@@ -30,6 +30,8 @@ | |
import org.elasticsearch.core.Tuple; | ||
import org.elasticsearch.common.component.AbstractLifecycleComponent; | ||
import org.elasticsearch.common.component.Lifecycle; | ||
import org.elasticsearch.common.logging.DeprecationCategory; | ||
import org.elasticsearch.common.logging.DeprecationLogger; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.core.TimeValue; | ||
import org.elasticsearch.common.util.concurrent.AtomicArray; | ||
|
@@ -38,12 +40,12 @@ | |
import org.elasticsearch.index.IndexSettings; | ||
import org.elasticsearch.license.LicenseUtils; | ||
import org.elasticsearch.transport.NoSuchRemoteClusterException; | ||
import org.elasticsearch.xpack.ccr.Ccr; | ||
import org.elasticsearch.xpack.ccr.CcrLicenseChecker; | ||
import org.elasticsearch.xpack.ccr.CcrSettings; | ||
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata; | ||
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata.AutoFollowPattern; | ||
import org.elasticsearch.xpack.core.ccr.AutoFollowStats; | ||
import org.elasticsearch.xpack.core.ccr.CcrConstants; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add a check to (not related to the line the comment is on). |
||
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; | ||
import org.elasticsearch.xpack.core.searchablesnapshots.SearchableSnapshotsConstants; | ||
|
||
|
@@ -75,6 +77,8 @@ | |
public class AutoFollowCoordinator extends AbstractLifecycleComponent implements ClusterStateListener { | ||
|
||
private static final Logger LOGGER = LogManager.getLogger(AutoFollowCoordinator.class); | ||
public static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(AutoFollowCoordinator.class); | ||
|
||
private static final int MAX_AUTO_FOLLOW_ERRORS = 256; | ||
|
||
private final Client client; | ||
|
@@ -538,6 +542,14 @@ private void checkAutoFollowPattern(String autoFollowPattenName, | |
updateAutoFollowMetadata(recordLeaderIndexAsFollowFunction(autoFollowPattenName, indexToFollow), | ||
error -> groupedListener.onResponse(new Tuple<>(indexToFollow, error))); | ||
} else { | ||
if (indexAbstraction.isSystem()) { | ||
deprecationLogger.deprecate(DeprecationCategory.INDICES, | ||
"ccr_auto_follow_system_indices", | ||
"Auto following a leader system index " + indexToFollow.getName() + | ||
" will not work in the next major version" | ||
); | ||
} | ||
|
||
followLeaderIndex(autoFollowPattenName, remoteCluster, indexToFollow, autoFollowPattern, headers, | ||
error -> groupedListener.onResponse(new Tuple<>(indexToFollow, error))); | ||
} | ||
|
@@ -555,9 +567,9 @@ private static boolean leaderIndexAlreadyFollowed(AutoFollowPattern autoFollowPa | |
// we should let the auto follower attempt to auto follow it, so it can fail later and | ||
// it is then visible in the auto follow stats. For example a cluster can just happen to have | ||
// an index with the same name as the new follower index. | ||
Map<String, String> customData = indexMetadata.getCustomData(Ccr.CCR_CUSTOM_METADATA_KEY); | ||
Map<String, String> customData = indexMetadata.getCustomData(CcrConstants.CCR_CUSTOM_METADATA_KEY); | ||
if (customData != null) { | ||
String recordedLeaderIndexUUID = customData.get(Ccr.CCR_CUSTOM_METADATA_LEADER_INDEX_UUID_KEY); | ||
String recordedLeaderIndexUUID = customData.get(CcrConstants.CCR_CUSTOM_METADATA_LEADER_INDEX_UUID_KEY); | ||
return leaderIndex.getUUID().equals(recordedLeaderIndexUUID); | ||
} | ||
} | ||
|
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
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
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.
Perhaps leave a comment here, stating that these moved to CcrConstants in 7.x (since this targets 7.x only)?
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.
Addressed in b80e0e9