summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-08-26 10:18:56 +0200
committerantirez <antirez@gmail.com>2014-08-26 10:18:56 +0200
commit064d5c96ac0545e2115edd7d4153433a99aaa707 (patch)
treeb428de881f4149da73803d9b9b1cc1b65a70e1d2
parent293348d0de8776e409551bbbd72691f66cb121cf (diff)
downloadredis-064d5c96ac0545e2115edd7d4153433a99aaa707.tar.gz
Use long for rehash and iterator index in dict.h.
This allows to support datasets with more than 2 billion of keys (possible in very large memory instances, this bug was actually reported). Closes issue #1814.
-rw-r--r--src/dict.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dict.h b/src/dict.h
index b82e137f9..7421078f8 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -77,7 +77,7 @@ typedef struct dict {
dictType *type;
void *privdata;
dictht ht[2];
- int rehashidx; /* rehashing not in progress if rehashidx == -1 */
+ long rehashidx; /* rehashing not in progress if rehashidx == -1 */
int iterators; /* number of iterators currently running */
} dict;
@@ -87,9 +87,11 @@ typedef struct dict {
* should be called while iterating. */
typedef struct dictIterator {
dict *d;
- int table, index, safe;
+ long index;
+ int table, safe;
dictEntry *entry, *nextEntry;
- long long fingerprint; /* unsafe iterator fingerprint for misuse detection */
+ /* unsafe iterator fingerprint for misuse detection. */
+ long long fingerprint;
} dictIterator;
typedef void (dictScanFunction)(void *privdata, const dictEntry *de);