Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ int hashtableExpandIfNeeded(hashtable *ht) {
* resize policy to ALLOW, you may want to call hashtableShrinkIfNeeded. */
int hashtableShrinkIfNeeded(hashtable *ht) {
/* Don't shrink if rehashing is already in progress. */
if (hashtableIsRehashing(ht) || resize_policy == HASHTABLE_RESIZE_FORBID) {
if (hashtableIsRehashing(ht) || resize_policy == HASHTABLE_RESIZE_FORBID || ht->pause_auto_shrink) {
return 0;
}
size_t current_capacity = numBuckets(ht->bucket_exp[0]) * ENTRIES_PER_BUCKET;
Expand Down Expand Up @@ -1753,6 +1753,7 @@ size_t hashtableScanDefrag(hashtable *ht, size_t cursor, hashtableScanFunction f
/* Prevent entries from being moved around during the scan call, as a
* side-effect of the scan callback. */
hashtablePauseRehashing(ht);
hashtablePauseAutoShrink(ht);

/* Flags. */
int emit_ref = (flags & HASHTABLE_SCAN_EMIT_REF);
Expand Down Expand Up @@ -1857,6 +1858,7 @@ size_t hashtableScanDefrag(hashtable *ht, size_t cursor, hashtableScanFunction f
} while (cursor & (mask_small ^ mask_large));
}
hashtableResumeRehashing(ht);
hashtableResumeAutoShrink(ht);
return cursor;
}

Expand Down
Loading