Skip to content

Online Indexer: stop retrying an unresolvable partly-built mismatch - #4454

Open
jjezra wants to merge 4 commits into
FoundationDB:mainfrom
jjezra:indexer_no_futile_partly_built_retries
Open

Online Indexer: stop retrying an unresolvable partly-built mismatch#4454
jjezra wants to merge 4 commits into
FoundationDB:mainfrom
jjezra:indexer_no_futile_partly_built_retries

Conversation

@jjezra

@jjezra jjezra commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The CONTINUE path in OnlineIndexer.indexingCatcher could re-apply an adjustment that was already in effect. An unresolvable "This index was partly built by another method" mismatch was therefore retried identically until reaching max attempts, ending with a misleading "Too many indexing attempts" error.

  • Every adjustment (fallback to a by-records scan, continuation by the previous source index) is now attempted at most once.
  • The mismatch reported to the caller is the first one, so it names the requested indexing method rather than the internal fallback.

Each policy adjustment in the CONTINUE path is now attempted at most once, and the mismatch reported to the caller is the first one - naming the requested indexing method rather than the internal fallback.
@jjezra
jjezra requested a review from ScottDugas August 14, 2026 19:33
@jjezra jjezra added the bug fix Change that fixes a bug label Aug 14, 2026
@jjezra
jjezra marked this pull request as ready for review August 14, 2026 19:33
@jjezra
jjezra marked this pull request as draft August 14, 2026 19:33
@jjezra
jjezra marked this pull request as ready for review August 17, 2026 13:27
fallbackToRecordsScan = true;
return indexingLauncher(indexingFunc, attemptCount);
}
if (method == IndexBuildProto.IndexBuildIndexingStamp.Method.BY_INDEX &&

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why isn't the whole method like this. i.e Shouldn't we always just create a new policy based on the previous method and carry on.

// to a single target, but not to a subset.
fallbackToRecordsScan = true;
return indexingLauncher(indexingFunc, attemptCount);
// Here: match the policy to the previous run. Every adjustment is attempted once

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why would an adjustment happen more than once in general? i.e if we get to this point because the previous method was by_index and we're doing multi_target, shouldn't it switch to by_index. At which point it wouldn't go back to multi_target, right?

The only reason I can see this happening more than once is if two indexers are running simultaneously and both are set to REBUILD with different methods, and thus keep stepping over each other, but that should be prevented by the heartbeats

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking at this a bit more... setIndexingTypeOrThrow checks shouldAllowTypeConversionContinue and if it is not allowed to takeover, it throws PartlyBuiltException. So that handles the case where we use our policy, and this is intended to handle the case where our fallback policy is the same?

return indexingLauncher(indexingFunc, attemptCount);
}
if (method == IndexBuildProto.IndexBuildIndexingStamp.Method.BY_INDEX &&
!isPolicySourceIndexOf(conflictingIndexingTypeStamp)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ig this is true, doesn't that mean we're rebuilding by the same method, and thus we should not be catching IndexingBase.PartlyBuiltException ?

}

private boolean isPolicySourceIndexOf(IndexBuildProto.IndexBuildIndexingStamp conflictingIndexingTypeStamp) {
// true if the policy already points at the conflicting stamp's source index, hence retrying by this source

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you have coverage of trying to build with a different source index?


@ParameterizedTest
@BooleanSource
void testMultiTargetPartlyBuiltContinueByIndex(boolean allowTakeover) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What about the other combinations? Would it be possible (but not too cumbersome) to parameterize this by the two build types, and whether takeover is allowed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants