Skip to content

Conversation

@kingherc
Copy link
Contributor

@kingherc kingherc commented Sep 24, 2024

Fast refresh indices should now behave like non fast refresh indices in how they execute (m)gets and searches. I.e., they should use the search shards.

For BWC, we define a new transport version. We expect search shards to be upgraded first, before promotable shards. Until the cluster is fully upgraded, the promotable shards (whether upgraded or not) will still receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579

@kingherc kingherc added >non-issue :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. labels Sep 24, 2024
@kingherc kingherc self-assigned this Sep 24, 2024
@kingherc kingherc force-pushed the non-issue/ES-9573-fast-refresh-rco branch 3 times, most recently from 3f87579 to f1ff18a Compare September 25, 2024 16:21
@kingherc kingherc marked this pull request as ready for review September 30, 2024 14:35
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@kingherc kingherc requested a review from Tim-Brooks September 30, 2024 14:38
Copy link
Contributor

@arteam arteam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Looking forward to simplify things with ES-9563 after this PR is successfully rolled out.

@kingherc kingherc requested a review from pxsalehi October 2, 2024 08:30
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few comments/questions.

// 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

But it does not guarantee immediate availability of the latest state on the search node.

Doesn't our upgrade process guarantee that, since search nodes are upgraded first?

So we risk some seconds of non-realtime GET requests going backwards during such an upgrade?

A non-realtime GET coordinated by an old search node will go the primary to execute.
A non-realtime GET coordinated by a new search node, with an old primary node, will go the primary to execute.
A non-realtime GET coordinated by a new search node on a fully upgraded cluster, will be executed on the search node as is done for non-fast-refresh indices. Which should be fine as well. Not sure I see when/why it might go backwards?

I think real-time GET requests will be saved by the wait-for generation, is that also your understanding?

A real-time GET coordinated by an old search node will go the primary to execute.
A real-time GET coordinated by a new search node, with an old primary node, will go the primary to execute.
A real-time GET coordinated by a new search node on a fully upgraded cluster, will be executed on the search node as is done for non-fast-refresh indices. Which should use wait-for generation if necessary.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

@kingherc kingherc force-pushed the non-issue/ES-9573-fast-refresh-rco branch from f1ff18a to 40df9da Compare October 3, 2024 13:30
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Oct 3, 2024
Copy link
Contributor Author

@kingherc kingherc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @henningandersen for the feedback! Feel free to review again.

// 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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

But it does not guarantee immediate availability of the latest state on the search node.

Doesn't our upgrade process guarantee that, since search nodes are upgraded first?

So we risk some seconds of non-realtime GET requests going backwards during such an upgrade?

A non-realtime GET coordinated by an old search node will go the primary to execute.
A non-realtime GET coordinated by a new search node, with an old primary node, will go the primary to execute.
A non-realtime GET coordinated by a new search node on a fully upgraded cluster, will be executed on the search node as is done for non-fast-refresh indices. Which should be fine as well. Not sure I see when/why it might go backwards?

I think real-time GET requests will be saved by the wait-for generation, is that also your understanding?

A real-time GET coordinated by an old search node will go the primary to execute.
A real-time GET coordinated by a new search node, with an old primary node, will go the primary to execute.
A real-time GET coordinated by a new search node on a fully upgraded cluster, will be executed on the search node as is done for non-fast-refresh indices. Which should use wait-for generation if necessary.

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.

Fast refresh indices should now behave like non fast refresh indices in
how they execute (m)gets and searches. I.e., they should use the search
shards.

For BWC, we define a new transport version. We expect search shards to
be upgraded first, before promotable shards. Until the cluster is fully
upgraded, the promotable shards (whether upgraded or not) will still
receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, main issue remaining is the BitsetFilterCache.

// 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

@mark-vieira mark-vieira added auto-backport Automatically create backport pull requests when merged and removed auto-backport-and-merge labels Oct 4, 2024
kingherc added a commit to kingherc/elasticsearch that referenced this pull request Oct 6, 2024
As recognized in PR elastic#113478 reviewing, the bitset filter cache
was wrongly eagerly loaded only for fast refresh indices on index
nodes. However, it should be eagerly loaded for any index that
can be searched. This PR fixes this.
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kingherc kingherc merged commit 4990276 into elastic:main Oct 7, 2024
16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

kingherc added a commit to kingherc/elasticsearch that referenced this pull request Oct 7, 2024
Fast refresh indices should now behave like non fast refresh indices in
how they execute (m)gets and searches. I.e., they should use the search
shards.

For BWC, we define a new transport version. We expect search shards to
be upgraded first, before promotable shards. Until the cluster is fully
upgraded, the promotable shards (whether upgraded or not) will still
receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579
elasticsearchmachine pushed a commit that referenced this pull request Oct 7, 2024
Fast refresh indices should now behave like non fast refresh indices in
how they execute (m)gets and searches. I.e., they should use the search
shards.

For BWC, we define a new transport version. We expect search shards to
be upgraded first, before promotable shards. Until the cluster is fully
upgraded, the promotable shards (whether upgraded or not) will still
receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579
@ywangd
Copy link
Member

ywangd commented Oct 8, 2024

IIUC, it is not absolutely necessary to backport this PR to 8.16 since the change affects serverless only and serverless works on the main branch only? I am trying understanding the reason here in case it applies to any future work. Thanks!

@kingherc
Copy link
Contributor Author

kingherc commented Oct 8, 2024

Hi @ywangd , I think I backported it because I saw the transport versions are still on 8 major version, so somehow it made sense in my mind this should be backported. But, no, it was not necessary to backport it indeed. And it has nothing to do with any future work. Nor does it affect stateful.

@ywangd
Copy link
Member

ywangd commented Oct 8, 2024

Thanks for the explanation. 🙏

matthewabbott pushed a commit to matthewabbott/elasticsearch that referenced this pull request Oct 10, 2024
Fast refresh indices should now behave like non fast refresh indices in
how they execute (m)gets and searches. I.e., they should use the search
shards.

For BWC, we define a new transport version. We expect search shards to
be upgraded first, before promotable shards. Until the cluster is fully
upgraded, the promotable shards (whether upgraded or not) will still
receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579
kingherc added a commit that referenced this pull request Oct 11, 2024
As recognized in PR #113478 reviewing, the bitset filter cache
was wrongly eagerly loaded only for fast refresh indices on index
nodes. However, it should be eagerly loaded for any index that
can be searched. This PR fixes this.
kingherc added a commit to kingherc/elasticsearch that referenced this pull request Oct 11, 2024
As recognized in PR elastic#113478 reviewing, the bitset filter cache
was wrongly eagerly loaded only for fast refresh indices on index
nodes. However, it should be eagerly loaded for any index that
can be searched. This PR fixes this.
elasticsearchmachine pushed a commit that referenced this pull request Oct 11, 2024
As recognized in PR #113478 reviewing, the bitset filter cache
was wrongly eagerly loaded only for fast refresh indices on index
nodes. However, it should be eagerly loaded for any index that
can be searched. This PR fixes this.
davidkyle pushed a commit to davidkyle/elasticsearch that referenced this pull request Oct 13, 2024
Fast refresh indices should now behave like non fast refresh indices in
how they execute (m)gets and searches. I.e., they should use the search
shards.

For BWC, we define a new transport version. We expect search shards to
be upgraded first, before promotable shards. Until the cluster is fully
upgraded, the promotable shards (whether upgraded or not) will still
receive and execute gets/searches locally.

Relates ES-9573
Relates ES-9579
davidkyle pushed a commit to davidkyle/elasticsearch that referenced this pull request Oct 13, 2024
As recognized in PR elastic#113478 reviewing, the bitset filter cache
was wrongly eagerly loaded only for fast refresh indices on index
nodes. However, it should be eagerly loaded for any index that
can be searched. This PR fixes this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue serverless-linked Added by automation, don't add manually Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.16.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants