Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes intermittent missing documents during reindexing (CMS 6) by ensuring a deterministic ordering when fetching DataObjects in batches, addressing #58.
Changes:
- Force consistent batch ordering in
DataObjectFetcherby sorting the fetched list (defaultID ASC, configurable). - Add a batch-oriented regression test intended to ensure all records are fetched across multiple batches.
- Add a versioned
Pagetest fake used by the new batching test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/DataObject/DataObjectFetcher.php |
Applies a deterministic sort (default ID ASC) to prevent unstable pagination across batches. |
tests/DataObject/DataObjectFetcherTest.php |
Adds a regression test intended to verify batch fetching returns all records. |
tests/Fake/PageFakeVersioned.php |
Introduces a versioned Page fake for use in batching tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
@adunn49 would you be able to double check the comments around the test? I think this was a CMS6 API change (https://github.com/silverstripeltd/silverstripe-forager/blob/main/src/DataObject/DataObjectFetcher.php#L75) The comment about always including ID is a good one but I think an enhancement if you don't have time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
#58
Description
Details and how to replicate the issue are on #58
The fix is simply to add ->sort('ID') to the data object fetcher so that it consistent when indexing across multiple batches.
Test notes
Before fix:
After fix:
All expected documents have been indexed after running clear and reindex jobs.