_hashindex.c: set min_empty and num_empty even when permit_compact=True

This commit is contained in:
Dan Christensen 2023-02-11 20:11:09 -05:00
parent 60bea46eb7
commit 36aa395e49
1 changed files with 4 additions and 4 deletions

View File

@ -570,11 +570,11 @@ hashindex_read(PyObject *file_py, int permit_compact, int legacy)
}
index->buckets = index->buckets_buffer.buf;
if(!permit_compact) {
index->min_empty = get_min_empty(index->num_buckets);
if (index->num_empty == -1) // we read a legacy index without num_empty value
index->num_empty = count_empty(index);
index->min_empty = get_min_empty(index->num_buckets);
if (index->num_empty == -1) // we read a legacy index without num_empty value
index->num_empty = count_empty(index);
if(!permit_compact) {
if(index->num_empty < index->min_empty) {
/* too many tombstones here / not enough empty buckets, do a same-size rebuild */
if(!hashindex_resize(index, index->num_buckets)) {