dungba88 commented on code in PR #12738:
URL: https://github.com/apache/lucene/pull/12738#discussion_r1380001349
##########
lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java:
##########
@@ -328,7 +298,100 @@ private void rehash(long lastNodeAddress) throws
IOException {
}
mask = newMask;
- entries = newEntries;
+ fstNodeAddress = newEntries;
+ copiedNodeAddress = newCopiedOffsets;
+ }
+
+ // hash code for a frozen node. this must precisely match the hash
computation of an unfrozen
+ // node!
+ private long hash(long node, long pos) throws IOException {
+ FST.BytesReader in = getBytesReader(node, pos);
Review Comment:
I can add this, but that means the caller must be mindful to not get the
bytes reader from the wrong table, or use a node address different from the
node address in the hash() function call, e.g:
```
assert primaryTable.hash(nodeAddress,
primaryTable.getBytesReader(nodeAddress, hashSlot)) == hash
: "mismatch frozenHash="
+ primaryTable.hash(nodeAddress,
primaryTable.getBytesReader(nodeAddress, hashSlot))
+ " vs hash="
+ hash;
```
If one use a wrong table here, or maybe keep this bytesReader and decide to
use it, the nodeAddress in the getBytesReader could be different from the one
in hash.
What do you think about this case?
--
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]