Skip to content

Allow leaving corrupted indexes as readable after header repair#3801

Merged
ScottDugas merged 19 commits intoFoundationDB:mainfrom
ScottDugas:repair-store-without-disable
Mar 2, 2026
Merged

Allow leaving corrupted indexes as readable after header repair#3801
ScottDugas merged 19 commits intoFoundationDB:mainfrom
ScottDugas:repair-store-without-disable

Conversation

@ScottDugas
Copy link
Copy Markdown
Collaborator

In the case of a broader corruption, where records have been corrupted along with the store header, it may be beneficial to look at the indexes involved while looking at the store. This may be useful if you want to resurrect some information from the indexes if any exists.

In the case of a broader corruption, where records have been
corrupted along with the store header, it may be beneficial to
look at the indexes involved while looking at the store. This may
be useful if you want to resurrect some information from the indexes
if any exists.
@ScottDugas ScottDugas added the enhancement New feature or request label Dec 11, 2025
@ScottDugas ScottDugas marked this pull request as ready for review December 18, 2025 15:12
…tBase

As noted in the PR `withStore` was potentially brittle because of
the `recordStore` field. I could have changed that to a consumer
but still set the field, but that felt just as bad, so I changed it
to extend FDBRecordStoreConcurrentTestBase.
@ScottDugas ScottDugas marked this pull request as draft December 23, 2025 19:44
Conflict on PreventCommitCheck because that was brought into main
on a different PR.

Conflict on FDBRecordStoreRepairHeaderTest because I added a method close
to a method that was renamed. I changed the new test method because the
rename made it clear that createOriginalRecords didn't create anything,
and thus the call was unnecessary
Also, I had to fix a couple tests that dependended on the recordStore
field.
Primarily by adding helper methods
This makes it easier to cover the version that doesn't take a
parameter.
I'm not sure whether we should make the assertion stronger when we
expect there to be data.
@API(API.Status.DEPRECATED)
public CompletableFuture<NonnullPair<Boolean, FDBRecordStore>> repairMissingHeader(final int userVersion, FormatVersion minimumPossibleFormatVersion) {
return repairMissingHeader(userVersion, minimumPossibleFormatVersion, null);
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I looked into this test gap:
I think I'm seeing a false test gap. https://fdb.teamscale.io/activity/merge-requests/foundationdb-fdb-record-layer/FoundationDB%2Ffdb-record-layer%2F3801 for commit 049a768 I checked the upload details, and downloaded the coverage, and all the repairMissingHeader methods have full method coverage: https://fdb.teamscale.io/project/project?name=foundationdb-fdb-record-layer&action=showExternalAnalysisUploads -- https://fdb.teamscale.io/api/projects/foundationdb-fdb-record-layer/external-analysis/reports/FORK_MR%2F3801%2FScottDugas%2Frepair-store-without-disable%3A1770831010000/0
Oh, I see, in the coverage provided it is at 5811:

<method name="repairMissingHeader" desc="(ILcom/apple/foundationdb/record/provider/foundationdb/FormatVersion;)Ljava/util/concurrent/CompletableFuture;" line="5811">
  <counter type="INSTRUCTION" missed="0" covered="6"/>
  <counter type="LINE" missed="0" covered="1"/>
  <counter type="COMPLEXITY" missed="0" covered="1"/>
  <counter type="METHOD" missed="0" covered="1"/>
</method>

And if I look at the html from jacoco, you can see that the line numbers are different:

Image

@ScottDugas ScottDugas marked this pull request as ready for review February 11, 2026 21:21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like we're already doing this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Partially, I think the fact that IndexScrubbing only works for value indexes is still valuable.

}

enum DisableIndexBehavior {
LeaveCorrupted {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice!

Instead of having a @nullable reason, this means using a method,
which makes it a lot clearer what you are intending.
Most notably, adding a missing join() in the test code
@ScottDugas ScottDugas force-pushed the repair-store-without-disable branch from 1376463 to 4ad934c Compare February 26, 2026 22:07
@ScottDugas ScottDugas merged commit 3281a98 into FoundationDB:main Mar 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants