SAI-6282: preferredMergePolicyFactory to allow canary merge policy#321
SAI-6282: preferredMergePolicyFactory to allow canary merge policy#321patsonluk wants to merge 5 commits into
Conversation
7729001 to
94f6b0e
Compare
0fea567 to
a117e89
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a117e89. Configure here.
| preferredMergePolicyFactory); | ||
| } else { | ||
| mergePolicyFactoryInfo = mergePolicyFactory; | ||
| } |
There was a problem hiding this comment.
Missing class still overrides factory
Medium Severity
The new javadoc says mergePolicyFactory is used when preferredMergePolicyFactory is absent or lacks a class, but the constructor treats any existing preferred node as authoritative. A preferred element without a usable class replaces a valid mergePolicyFactory and core load fails instantiating a null factory class.
Reviewed by Cursor Bugbot for commit a117e89. Configure here.


Description
Currently we cannot easily test different merge policy on a node, as:
_FS7solrconfig.xmlunder_FS7then nodes that are NOT being canaried, then Solr will run into classloading issue on restart/new collections as they are not aware ofTemporalMergePolicySolution
In
solrconfig.xml, under<indexConfig>, add a new node<preferredMergePolicyFactory>which has exactly the same structure and parse logic as<mergePolicyFactory>, and if both defined<preferredMergePolicyFactory>would take precendenceFor node that still runs the old hash, such
<preferredMergePolicyFactory>would just be ignored. if a node is running the new hash (selected for canary), then they will pick up the preferred factory and log the contents on startupUsing <preferredMergePolicyFactory>...Remarks
This is likely NOT something we want in long term. For simplicity we can still merge to
fs/branch_9_7(there's no harm at all). But after time routed segment project concludes, we should just revert this change here?Test
localreturns same # of docs3843d3c071917900b7077ada0d0ecfdf7d534da9) to playpen c92-1 to use this PR. Restart the cluster again. This emulates a canary nodeo.a.s.u.SolrIndexConfig Using <preferredMergePolicyFactory> ({type = preferredMergePolicyFactory,class = org.apache.solr.index.SortingMergePolicyFactory,attributes = {class=org.apache.solr.index.SortingMergePolicyFactory},args = {inner.useExponentialBuckets=true, inner.minThreshold=4, inner.maxThreshold=8, sort=IndvId asc, EventStart asc, wrapped.prefix=inner, inner.class=mn.fs.solr.index.TemporalMergePolicyFactory, inner.temporalField=EventStart, inner.compactionRatio=1.5}}) instead of <mergePolicyFactory>Note
Medium Risk
Changes which merge policy factory builds the index on cores that enable preferred config, affecting merge and indexing behavior; backward compatibility relies on older binaries ignoring the new XML element.
Overview
Adds optional
preferredMergePolicyFactoryunderindexConfiginsolrconfig.xml, parsed likemergePolicyFactory. When it has aclass,SolrIndexConfiguses it formergePolicyFactoryInfoand logs that choice at startup; otherwise behavior stays onmergePolicyFactory.Configsets can define both so older Solr builds (that do not know the new element) keep the legacy factory, while newer canary nodes run a different merge policy (e.g. custom temporal policy) without changing configset for everyone.
Includes a test fixture and
testPreferredMergePolicyFactoryOverridesMergePolicyFactory.PrometheusMetricsServletonly reformats someCoreMetricenum constructor arguments (no metric behavior change).Reviewed by Cursor Bugbot for commit a117e89. Bugbot is set up for automated code reviews on this repo. Configure here.