SpookyJumpyBeans opened a new pull request, #5114: URL: https://github.com/apache/solr/pull/5114
https://issues.apache.org/jira/browse/SOLR-18538 # Description `CreateSnapshotCmd` skips replicas that are not ACTIVE and only evaluates failures for shards it sent a core snapshot request to. If every replica of a shard is inactive, that shard is never checked and the collection snapshot is recorded as `Successful` with no core snapshot for it. The same happens when a shard's only active replica fails, because the failure count was compared against all of the shard's replicas, including the inactive ones that were skipped. In both cases the snapshot is reported as successful even though it can't be used to back up the missing shard. # Solution Replace the per-shard failure counting with the check the existing comment describes: after collecting the successful core snapshots, every active slice must have at least one replica that reported a snapshot. Any active slice without one is added to `failedShards`, so the command records `Failed` and throws, as it already did for other failures. # Tests Added `TestSolrCloudSnapshotInactiveShard`, which creates a single-shard, single-replica collection, stops the only node hosting it, and checks that CREATESNAPSHOT fails with "Failed to create snapshot on shards" and the snapshot is recorded as `Failed` with no core snapshots. The test fails without the fix (the request succeeds) and passes with it. The second case (a shard whose only active replica fails) goes through the same new check, but isn't covered by a separate test, since making a single core snapshot fail on demand isn't straightforward in a cloud test. Happy to add one if there's a preferred way to inject that failure. Also ran the existing snapshot tests (`TestSolrCloudSnapshots` with `-Ptests.nightly=true`, `TestSolrCoreSnapshots`, `CreateCollectionSnapshotAPITest`) and `./gradlew :solr:core:check -x test`. # Checklist - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation) - [x] I have developed this patch against the `main` branch. - [ ] I have run `./gradlew check`. - [x] I have added tests for my changes. - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) - [x] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
