Repository navigation
Conversation
|
Instead we should disallow Max Conn one. It's nonsensical. Even two is basically degenerate, forcing a circle or a line. One can only be satisfied by isolated pairs
Sent from [Proton Mail](https://proton.me/mail/home) for Android.
…-------- Original Message --------
On Friday, 11/20/26 at 04:25 qiye ***@***.***> wrote:
Description
When maxConn=1, a merge that reuses the HNSW graph of a segment with deletions never terminates.
InitializedHnswGraphBuilder#rebalanceGraph computes the target number of nodes per level as
size * (1/M)^level. When M=1, this is always equal to size and never drops to 0. The loop only
exits when this value reaches 0, so it never exits.
When M=1, use a per-level ratio of 1/e, which matches the level distribution in HnswGraphBuilder.
For M > 1 the behavior is unchanged.
---------------------------------------------------------------
You can view, comment on, or merge this pull request online at:
#17054
Commit Summary
- [d349c76](d349c76) Fix HNSW rebalanceGraph never terminating when maxConn is 1
File Changes
([2 files](https://github.com/apache/lucene/pull/17054/files))
- M [lucene/core/src/java/org/apache/lucene/util/hnsw/InitializedHnswGraphBuilder.java](https://github.com/apache/lucene/pull/17054/files#diff-49e0f0667501e9ce29b50c6408c847586c6305e47cfcf424800ddf42763c635c) (20)
- M [lucene/core/src/test/org/apache/lucene/util/hnsw/HnswGraphTestCase.java](https://github.com/apache/lucene/pull/17054/files#diff-06724576566992a5fc7616a273243e2bf185564d42105445c858a758a54ebacb) (25)
Patch Links:
- https://github.com/apache/lucene/pull/17054.patch
- https://github.com/apache/lucene/pull/17054.diff
—
Reply to this email directly, [view it on GitHub](#17054?email_source=notifications&email_token=AAHHUQPX2U4PPG4MTEJBROD52AEX5A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TIMJQHE2DOMZTHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAHHUQL6STJ7SMWNGLZHFP352AEX5AVCNFSNUABFKJSXA33TNF2G64TZHMZTIMJWGMYTGNJQHNEXG43VMU5TMNJQHA3DCMJUHE3KC5QC).
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for [iOS](https://github.com/notifications/mobile/ios/AAHHUQK22WPI3LP6JEDNEST52AEX5A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TIMJQHE2DOMZTHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM) and [Android](https://github.com/notifications/mobile/android/AAHHUQPU35BT3K3WDCG53ST52AEX5A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TIMJQHE2DOMZTHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE). Download it today!
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Agreed, I'll disallow Max Conn one instead. |
|
I plan to reject maxConn < 2 in all writable HNSW format constructors. I'm considering two options:
I prefer the 1. And should this CHANGES be treated as bug fix or API change? |
|
I don't think you need to concern yourself with existing usage of maxconn=1 given the problem you found |
d349c76 to
f4b12fd
Compare
maxConn=1 produces a degenerate graph, and merging such a graph after deletions never terminates: rebalanceGraph() expects (1/M)^level nodes on each level, which never drops to zero when M == 1. Require maxConn to be at least 2 in the writable HNSW formats instead of supporting it.
f4b12fd to
2d3a751
Compare
Thanks for your advice. |
msokolov
left a comment
There was a problem hiding this comment.
thanks, looks good except I would reclassify the comment in CHANGES
|
|
||
| Bug Fixes | ||
| --------------------- | ||
| * GITHUB#17054: HNSW vector formats now reject maxConn=1, since merging an HNSW graph with |
There was a problem hiding this comment.
I think this belongs under API Changes rather than Bug Fixes
There was a problem hiding this comment.
I have moved this to API Changes.
Description
When maxConn=1, a merge that reuses the HNSW graph of a segment with deletions never terminates.
InitializedHnswGraphBuilder#rebalanceGraphcomputes the target number of nodes per level assize * (1/M)^level. When M=1, this is always equal tosizeand never drops to 0. The loop onlyexits when this value reaches 0, so it never exits.
maxConn=1is a degenerate setting anyway, so instead of supporting it, this change rejectsmaxConn < 2in all writable HNSW vector formats