mirror of https://github.com/apache/lucene.git
The bitsRequired passed during NodeHash rehash (when building an FST) (#12545)
This commit is contained in:
parent
a7202e2e6f
commit
57dd5a4bda
|
@ -146,7 +146,7 @@ final class NodeHash<T> {
|
||||||
table.set(pos, node);
|
table.set(pos, node);
|
||||||
// Rehash at 2/3 occupancy:
|
// Rehash at 2/3 occupancy:
|
||||||
if (count > 2 * table.size() / 3) {
|
if (count > 2 * table.size() / 3) {
|
||||||
rehash();
|
rehash(node);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
} else if (nodesEqual(nodeIn, v)) {
|
} else if (nodesEqual(nodeIn, v)) {
|
||||||
|
@ -174,12 +174,15 @@ final class NodeHash<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rehash() throws IOException {
|
private void rehash(long lastNodeAddress) throws IOException {
|
||||||
final PagedGrowableWriter oldTable = table;
|
final PagedGrowableWriter oldTable = table;
|
||||||
|
|
||||||
table =
|
table =
|
||||||
new PagedGrowableWriter(
|
new PagedGrowableWriter(
|
||||||
2 * oldTable.size(), 1 << 30, PackedInts.bitsRequired(count), PackedInts.COMPACT);
|
2 * oldTable.size(),
|
||||||
|
1 << 27,
|
||||||
|
PackedInts.bitsRequired(lastNodeAddress),
|
||||||
|
PackedInts.COMPACT);
|
||||||
mask = table.size() - 1;
|
mask = table.size() - 1;
|
||||||
for (long idx = 0; idx < oldTable.size(); idx++) {
|
for (long idx = 0; idx < oldTable.size(); idx++) {
|
||||||
final long address = oldTable.get(idx);
|
final long address = oldTable.get(idx);
|
||||||
|
|
Loading…
Reference in New Issue