SOLR-18200: make TextProfileSignature stable across HashMap rehash #5339
Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).
<!-- Assessed commit 5a70cedaceb89a3bfed90d60c9356a52fdfa6b80 -->
🤖 AI text below 🤖 (reviewed by Nick Shanin)
This can change the signature for profiles whose tied tokens previously had a different order. Existing documents keep their old signatures, so overwriteDupes may no longer match them. If the signature is the unique key, a later add can also get a different ID.
Could the upgrade notes explain this effect for users of TextProfileSignature and when they may need to rebuild their index?
🤖 AI text below 🤖 (reviewed by Nick Shanin)
The resize test covers the reported failure. Could the tests also assert a known signature for a profile with different frequencies and a tie after quantization? That would check the intended frequency order and tie-break as well as stability.
Could the Javadoc list the sorting step after quantization and filtering, to match the order in the implementation?
added an upgrade note in major-changes-in-solr-11 covering the signature change for tied tokens, overwriteDupes mismatch, uniqueKey ID risk, and when to reindex.
added testKnownSignatureFrequencyOrderAndQuantizationTie.. fixed hex for aaaa/bbbb/cccc with a post-quantization tie, plus shuffled input.
yep, javadoc now lists sort after quantization/filtering to match the implementation.
LGTM, +1.
Approved these changes.
Approved these changes.
@iprithv you need to merge from main to get a non-Crave runner.
ah okay. got it, thanks for the heads up. merged main!
sigram
iprithv
https://issues.apache.org/jira/browse/SOLR-18200
TextProfileSignature sorted tokens by frequency only, so equal-frequency ties followed HashMap iteration order. that order changes when the map rehashes, so the same surviving profile could get a different MD5.
tie-break on the token string so the profile is a pure function of the input.