msokolov commented on code in PR #13581:
URL: https://github.com/apache/lucene/pull/13581#discussion_r1698956262
##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -327,12 +331,14 @@ private void addDiverseNeighbors(int level, int node,
NeighborArray candidates)
continue;
}
int nbr = candidates.nodes()[i];
- NeighborArray nbrsOfNbr = hnsw.getNeighbors(level, nbr);
- nbrsOfNbr.rwlock.writeLock().lock();
- try {
+ if (hnswLock != null) {
+ try (HnswLock.LockedRow rowLock = hnswLock.write(level, nbr)) {
+ NeighborArray nbrsOfNbr = rowLock.row;
Review Comment:
I like the idea of more safety in the API to prevent accidentally
circumventing the lock, but I'm not sure if I followed the idea completely.
What would the Consumer do ?
--
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]