summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorSun He <sunheehnus@gmail.com>2015-02-06 11:18:58 +0800
committerantirez <antirez@gmail.com>2015-02-11 10:52:26 +0100
commit2385630d0d245482027e9e36c76d6f8675dd2f6b (patch)
treeefe5cb6592df1a9f70e2b1f0d22440390f80c22d /src/dict.c
parent4f427bc298b0cfc45bd25381cd04df86868c0843 (diff)
downloadredis-2385630d0d245482027e9e36c76d6f8675dd2f6b.tar.gz
dict.c/dictRehash: check again to update
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index 9ba0d7d7e..3b23fbcd0 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -282,6 +282,13 @@ int dictRehash(dict *d, int n) {
d->ht[0].table[d->rehashidx] = NULL;
d->rehashidx++;
}
+ /* Check again if we already rehashed the whole table... */
+ if (d->ht[0].used == 0) {
+ zfree(d->ht[0].table);
+ d->ht[0] = d->ht[1];
+ _dictReset(&d->ht[1]);
+ d->rehashidx = -1;
+ }
return 1;
}