rahulgoswami opened a new pull request, #5406:
URL: https://github.com/apache/solr/pull/5406

   https://issues.apache.org/jira/browse/SOLR-18190
   
   Supersedes #4245, which was opened from a different fork.
   
   # Description
   
   A new Collections API action, `UPGRADEINDEX`, to upgrade a SolrCloud 
collection's index to the current Lucene format in place, building on the 
CoreAdmin `UPGRADEINDEX` action. This lets users move to a future Solr major 
version without reindexing from source.
   
   The collection stays writable for the whole upgrade. Correctness comes from 
the existing version checks in `DistributedUpdateProcessor`, not from a 
read-only freeze: every re-added document carries the `_version_` it was read 
with, and the shard leader drops it if the document changed in the meantime.
   
   # Solution
   
   Design is mine, as discussed on SOLR-18190 and the dev list. Per shard, the 
flow is:
   
   1. Enable an in-memory `LatestVersionMergePolicy` on every replica that 
indexes.
   2. Upgrade the leader through the default update chain, which forwards each 
accepted re-add to the other replicas.
   3. Upgrade each NRT follower in turn to clean up documents its own merges 
kept in older segments. Its re-adds round-trip through the leader.
   4. TLOG and PULL replicas converge by replication.
   5. Poll every replica with `checkOnly=true` until none has older-format 
segments, then restore the merge policy.
   
   This PR is built in slices.
   
   **Slice 1 (this commit): core-level changes to the CoreAdmin `UPGRADEINDEX` 
action**
   - Runs in SolrCloud on NRT replicas and the shard leader through the normal 
distributed update path; PULL and non-leader TLOG replicas are rejected. This 
replaces the `cloudMode` flag and the local-only chain from the earlier 
read-only design.
   - Re-adds use `failOnVersionConflicts=false`, so a document that a 
concurrent update or delete changed is dropped instead of failing the pass.
   - A document left in an older segment by a concurrent in-place update is 
retried in another pass, up to `maxPasses` (default 5). The upgrade fails if a 
pass makes no progress.
   - New `latestVersionMergePolicy=enable|disable` parameter toggles the 
in-memory merge policy alone, for the collection command to use. The policy 
stays installed until the end of an upgrade instead of being removed before the 
final commit.
   - Read-only cores or collections are rejected upfront, and a document with 
no `_version_` fails the upgrade instead of being re-added without a version 
check.
   - `checkOnly=true` reports whether older-format segments remain.
   
   **Still to come**
   - Slice 2: rework the Collections API command to the write-open flow above 
(it still contains the earlier read-only logic and is not functional yet), with 
pre-flight checks for down replicas, inactive shards and aliases.
   - Collection-level SolrCloud tests with mixed replica types and concurrent 
writes.
   - V2 API, SolrJ request class, ref guide for the Collections API action, and 
a changelog entry.
   
   Code 🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   # Tests
   
   - `UpgradeCoreIndexActionTest` (standalone): existing tests, plus 
merge-policy toggling and restoration, `maxPasses` validation and read-only 
rejection.
   - New `UpgradeCoreIndexCloudTest` (SolrCloud), which simulates older-format 
segments on every replica and checks:
     - upgrading the leader also upgrades an NRT follower;
     - an in-place update during a pass is retried and preserved;
     - a pass without progress fails;
     - exceeding `maxPasses` fails;
     - PULL replicas are rejected for reindexing but allowed `checkOnly`;
     - read-only collections are rejected.
   - `./gradlew check -x test` passes.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [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.
   


-- 
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]

Reply via email to