Skip to content

Open and Close PIT for Reindexing#143248

Merged
joshua-adams-1 merged 66 commits intoelastic:mainfrom
joshua-adams-1:reindexing-resilience-full
Mar 13, 2026
Merged

Open and Close PIT for Reindexing#143248
joshua-adams-1 merged 66 commits intoelastic:mainfrom
joshua-adams-1:reindexing-resilience-full

Conversation

@joshua-adams-1
Copy link
Copy Markdown
Contributor

Introduces logic to open and close a point-in-time search before slicing.

Relates to: https://github.com/elastic/elasticsearch-team/issues/2088

joshua-adams-1 and others added 30 commits February 11, 2026 16:05
…hua-adams-1/elasticsearch into reindexing-plumb-pittable-hit-source
…hua-adams-1/elasticsearch into reindexing-plumb-pittable-hit-source
…hua-adams-1/elasticsearch into reindexing-plumb-pittable-hit-source
…hua-adams-1/elasticsearch into reindexing-plumb-pittable-hit-source
As part of the new reindexing resilience work, we're migrating from
using scroll search to using point-in-time (PIT). This change opens a
PIT (if we're behind a feature flag) before slicing a request, and
closes a PIT once the reindexing is complete. It does not pass the PIT
ID into the worker actions to use, however; this will be completed in a
follow-up PR.

Relates: elastic/elasticsearch-team#2088
Copy link
Copy Markdown
Member

@PeteGillinElastic PeteGillinElastic 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, thanks!

@joshua-adams-1 joshua-adams-1 added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Mar 5, 2026
@joshua-adams-1 joshua-adams-1 removed the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Mar 11, 2026
* We test synchronous (<code>?wait_for_completion=true</code>) invocation of the _cancel endpoint in this test.
*/
public void testCancelEndpointEndToEndSynchronously() throws Exception {
assumeFalse("scroll-based reindex uses a different code path", ReindexPlugin.REINDEX_PIT_SEARCH_ENABLED);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These tests fail because:

  1. On snapshot builds the REINDEX_PIT_SEARCH_ENABLED feature flag is enabled
  2. We open a PIT before we slice. This is an asynchronous operation and requires waiting
  3. Then we create the worker tasks
  4. Each worker task creates a scroll

The test flow does not account for the asynchronous waiting of the PIT. I could modify the test to account for both pit and scroll functionality, but since PIT isn't complete yet, it is easier to disable these tests unless we're running with scroll. When PIT is complete, I shall make a PIT specific version of this test. I've made a note of this in https://github.com/elastic/elasticsearch-team/issues/2088 so that I don't forget.


public void testUpgradeDataStream() throws Exception {
// TODO - https://github.com/elastic/elasticsearch-team/issues/2410
assumeFalse("PIT search cannot be used on closed indices", ReindexPlugin.REINDEX_PIT_SEARCH_ENABLED);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test was failing because PIT was being used on closed indices. I sunk some time into trying to fix it, but couldn't figure it out. I therefore have disabled the test from running with PIT and will fix it as a follow up

joshua-adams-1 added a commit to joshua-adams-1/elasticsearch that referenced this pull request Mar 12, 2026
@joshua-adams-1 joshua-adams-1 merged commit 5aaf3b8 into elastic:main Mar 13, 2026
36 checks passed
@joshua-adams-1 joshua-adams-1 deleted the reindexing-resilience-full branch March 13, 2026 14:31
michalborek pushed a commit to michalborek/elasticsearch that referenced this pull request Mar 23, 2026
Introduces logic to open and close a point-in-time search before slicing.

Relates to: elastic/elasticsearch-team#2088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Reindex Issues relating to reindex that are not caused by issues further down >non-issue Team:Distributed Meta label for distributed team. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants