You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add instructions for index upgrade in SolrCloud mode (#4424)
The UPGRADEINDEX API is currently only available in standalone mode as a CoreAdmin API. However, it is possible to achieve the same goal (i.e. upgrade the index in-place for future Solr major version upgrade) in SolrCloud with the recently introduced LatestVersionMergePolicyFactory. This commit details the steps for the same.
(cherry picked from commit 3039f30)
Copy file name to clipboardExpand all lines: solr/solr-ref-guide/modules/configuration-guide/pages/coreadmin-api.adoc
+31-1Lines changed: 31 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -792,7 +792,7 @@ Note:
792
792
793
793
* Only stored fields and fields with docValues enabled can be preserved during upgrade.
794
794
Fields that are neither stored nor docValues-backed will lose their data, unless they are `copyField` targets.
795
-
* Not supported in SolrCloud mode. In order to achieve the same purpose in SolrCloud mode (aka upgrade index for compatibility with next Solr version), configure the `LatestVersionMergePolicyFactory` for the collection and reindex all documents through a client utility.
795
+
* Not supported in SolrCloud mode; see <<Upgrading an Index in SolrCloud Mode>> below for the equivalent procedure.
796
796
* Indexes containing child/nested documents are not supported.
797
797
798
798
It is recommended to test on a copy and have a backup before running on production data.
Currently, a corresponding Collections API `UPGRADEINDEX` action for SolrCloud is not available.
874
+
However, the equivalent goal -- making the index compatible with the next Solr major version -- can be achieved by reindexing all documents while `LatestVersionMergePolicyFactory` is the active merge policy on the collection.
875
+
876
+
The procedure below avoids reprocessing documents that have already been reindexed, including across restarts:
877
+
878
+
. *Prepare a configset that uses `LatestVersionMergePolicyFactory`.*
879
+
Copy the collection's current xref:config-sets.adoc[configset] so the original is not modified, and edit `solrconfig.xml` in the copy to set the xref:index-segments-merging.adoc#mergepolicyfactory[`<mergePolicyFactory>`] to `org.apache.solr.index.LatestVersionMergePolicyFactory`.
880
+
. *Point the collection at the new configset.*
881
+
Use the xref:deployment-guide:collection-management.adoc#modifycollection[MODIFYCOLLECTION] Collections API action to set the `collection.configName` property to the name of the new configset.
882
+
. *Reload the collection* with the xref:deployment-guide:collection-management.adoc#reload[RELOAD] Collections API action so the new merge policy takes effect.
883
+
. *Record the current highest `\_version_` value in the index.*
884
+
Query the collection sorting by `\_version_` descending and note the top value, for example:
. *Reindex only the documents at or below that version.*
891
+
Have your client reindex all docs where `\_version_ \<= <highest_version>` (substituting the recorded value).
892
+
+
893
+
Reusing the same `<highest_version>` value across restarts ensures continuity: Documents that have already been reindexed -- as well as any newly indexed documents -- will have a `\_version_` greater than the recorded value and will fall outside the range, so no work is duplicated.
894
+
. *Issue a commit once reindexing is complete* to clear any older version segments:
0 commit comments