-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fast refresh indices should use search shards #113478
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
Changes from all commits
da342b0
e11e283
28781a5
9ec611e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
| import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
| import org.elasticsearch.core.Nullable; | ||
| import org.elasticsearch.core.TimeValue; | ||
| import org.elasticsearch.index.IndexSettings; | ||
| import org.elasticsearch.index.engine.Engine; | ||
| import org.elasticsearch.index.shard.IndexShard; | ||
| import org.elasticsearch.index.translog.Translog; | ||
|
|
@@ -53,9 +52,7 @@ public void refreshShard( | |
| case WAIT_UNTIL -> waitUntil(indexShard, location, new ActionListener<>() { | ||
| @Override | ||
| public void onResponse(Boolean forced) { | ||
| // Fast refresh indices do not depend on the unpromotables being refreshed | ||
| boolean fastRefresh = IndexSettings.INDEX_FAST_REFRESH_SETTING.get(indexShard.indexSettings().getSettings()); | ||
| if (location != null && (indexShard.routingEntry().isSearchable() == false && fastRefresh == false)) { | ||
| if (location != null && indexShard.routingEntry().isSearchable() == false) { | ||
|
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 fixes it for future refreshes after the indexing node upgraded. But it does not guarantee immediate availability of the latest state on the search node. So we risk some seconds of non-realtime GET requests going backwards during such an upgrade? I think real-time GET requests will be saved by the wait-for generation, is that also your understanding? 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. The reasoning here is this code runs on the primary/indexing node, and indeed that the indexing node will be upgraded after the search nodes.
Doesn't our upgrade process guarantee that, since search nodes are upgraded first?
A non-realtime GET coordinated by an old search node will go the primary to execute.
A real-time GET coordinated by an old search node will go the primary to execute. Please tell me if you see any corner cases I might have missed or not considered. It might be useful to think about the above combinations also for searches/mgets, but I believe it should be a similar story for them as well. 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 you are right that it works out. The upgrade will force a relocation, which forces a flush, bringing things back into order. Thanks. |
||
| refreshUnpromotables(indexShard, location, listener, forced, postWriteRefreshTimeout); | ||
| } else { | ||
| listener.onResponse(forced); | ||
|
|
@@ -68,9 +65,7 @@ public void onFailure(Exception e) { | |
| } | ||
| }); | ||
| case IMMEDIATE -> immediate(indexShard, listener.delegateFailureAndWrap((l, r) -> { | ||
| // Fast refresh indices do not depend on the unpromotables being refreshed | ||
| boolean fastRefresh = IndexSettings.INDEX_FAST_REFRESH_SETTING.get(indexShard.indexSettings().getSettings()); | ||
| if (indexShard.getReplicationGroup().getRoutingTable().unpromotableShards().size() > 0 && fastRefresh == false) { | ||
| if (indexShard.getReplicationGroup().getRoutingTable().unpromotableShards().size() > 0) { | ||
| sendUnpromotableRequests(indexShard, r.generation(), true, l, postWriteRefreshTimeout); | ||
| } else { | ||
| l.onResponse(true); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.