-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[CCR] Record follower index historyUUIDs #34078
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
martijnvg
merged 9 commits into
elastic:master
from
martijnvg:ccr_record_follower_history_uuid
Oct 2, 2018
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9e9e2b1
[CCR] Record follower index historyUUIDs
martijnvg 0da8064
iter
martijnvg 6d4575b
Merge remote-tracking branch 'es/master' into ccr_record_follower_his…
martijnvg abd85ac
fixed test
martijnvg 28a72eb
Merge remote-tracking branch 'es/master' into ccr_record_follower_his…
martijnvg f326fd1
Merge remote-tracking branch 'es/master' into ccr_record_follower_his…
martijnvg f276c22
fetch follower history uuid from indices stats api when starting the …
martijnvg ea94ff3
fetch leader history uuid from follower's IndexMetaData instead of
martijnvg e581ba7
iter
martijnvg 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
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 |
---|---|---|
|
@@ -132,8 +132,9 @@ public <T> void checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUU | |
final Client leaderClient = client.getRemoteClusterClient(clusterAlias); | ||
hasPrivilegesToFollowIndices(leaderClient, new String[] {leaderIndex}, e -> { | ||
if (e == null) { | ||
fetchLeaderHistoryUUIDs(leaderClient, leaderIndexMetaData, onFailure, historyUUIDs -> | ||
consumer.accept(historyUUIDs, leaderIndexMetaData)); | ||
fetchHistoryUUIDs(leaderClient, leaderIndexMetaData, onFailure, historyUUIDs -> { | ||
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. this change is unneeded now? |
||
consumer.accept(historyUUIDs, leaderIndexMetaData); | ||
}); | ||
} else { | ||
onFailure.accept(e); | ||
} | ||
|
@@ -226,25 +227,25 @@ public void onFailure(final Exception e) { | |
} | ||
|
||
/** | ||
* Fetches the history UUIDs for leader index on per shard basis using the specified leaderClient. | ||
* Fetches the history UUIDs for specified index on per shard basis using the specified client. | ||
* | ||
* @param leaderClient the leader client | ||
* @param leaderIndexMetaData the leader index metadata | ||
* @param client the specified client | ||
* @param indexMetaData the index metadata of the specified index | ||
* @param onFailure the failure consumer | ||
* @param historyUUIDConsumer the leader index history uuid and consumer | ||
* @param historyUUIDConsumer the index history uuid consumer | ||
*/ | ||
// NOTE: Placed this method here; in order to avoid duplication of logic for fetching history UUIDs | ||
// in case of following a local or a remote cluster. | ||
public void fetchLeaderHistoryUUIDs( | ||
final Client leaderClient, | ||
final IndexMetaData leaderIndexMetaData, | ||
public void fetchHistoryUUIDs( | ||
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. revert all of this? |
||
final Client client, | ||
final IndexMetaData indexMetaData, | ||
final Consumer<Exception> onFailure, | ||
final Consumer<String[]> historyUUIDConsumer) { | ||
|
||
String leaderIndex = leaderIndexMetaData.getIndex().getName(); | ||
String leaderIndex = indexMetaData.getIndex().getName(); | ||
CheckedConsumer<IndicesStatsResponse, Exception> indicesStatsHandler = indicesStatsResponse -> { | ||
IndexStats indexStats = indicesStatsResponse.getIndices().get(leaderIndex); | ||
String[] historyUUIDs = new String[leaderIndexMetaData.getNumberOfShards()]; | ||
String[] historyUUIDs = new String[indexMetaData.getNumberOfShards()]; | ||
for (IndexShardStats indexShardStats : indexStats) { | ||
for (ShardStats shardStats : indexShardStats) { | ||
// Ignore replica shards as they may not have yet started and | ||
|
@@ -274,7 +275,7 @@ public void fetchLeaderHistoryUUIDs( | |
IndicesStatsRequest request = new IndicesStatsRequest(); | ||
request.clear(); | ||
request.indices(leaderIndex); | ||
leaderClient.admin().indices().stats(request, ActionListener.wrap(indicesStatsHandler, onFailure)); | ||
client.admin().indices().stats(request, ActionListener.wrap(indicesStatsHandler, onFailure)); | ||
} | ||
|
||
/** | ||
|
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.
This is not used any more?