关于dictRehash 的疑问
作者: zhugeliuyun创建于 2018年6月29日更新于 2019年12月3日
while (de) { uint64_t h; nextde = de->next; /* Get the index in the new hash table */ h = dictHashKey(d, de->key) & d->ht[1].sizemask; de->next = d->ht[1].table[h]; d->ht[1].table[h] = de; d->ht[0].used--; d->ht[1].used++; de = nextde; } 以上代码是int dictRehash(dict *d, int n)的部分实现,对于d->ht[0].used--有疑问,由于我们使用链接法解决冲突,所以de节点后面链接的所有节点理论上并没有记录在d->ht[0].used中,所以这里不是很明白,希望大神能帮我解惑。
内容来源: huangzworks/redis-3.0-annotated