From 907da00931c542eda1af39805f01080e581e4423 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 8 Feb 2023 16:04:15 +0100 Subject: [PATCH] if HT is full with entries and tombstones: give up/fail early --- src/borg/_hashindex.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/borg/_hashindex.c b/src/borg/_hashindex.c index 4e90c55ab..8f8b4ac9d 100644 --- a/src/borg/_hashindex.c +++ b/src/borg/_hashindex.c @@ -189,8 +189,14 @@ hashindex_lookup(HashIndex *index, const unsigned char *key, int *start_idx) idx -= index->num_buckets; } if(idx == start) { - /* we have done a full pass over all buckets. */ - break; + /* We have done a full pass over all buckets. + * - We did not find a bucket with the key we searched for. + * - We did not find an empty bucket either. + * So all buckets are either full or deleted/tombstones. + * This is an invalid state we never should get into, see + * upper_limit and min_empty. + */ + assert(0); /* should never happen - something is wrong here. */ } } /* we get here if we did not find a bucket with the key we searched for. */