antirez/redis — pull request #2207 by Brochen (2014-12-11 03:21:37+00:00)
Title: Update dict.c

in the method dictRehash , the check "if rehashed the whole table..." is only in the begin of the while loop,
so there is a case that the while loop ended, ht[0].size = 0, ht[1].size > 0, d->rehashidx != -1,
in this case, ht[0].size =0 but the dict is not empty.

in the api method "dictFind","dictGenericDelete", there are two lines beloew:
A: if (d->ht[0].size == 0) return DICT_ERR;
B: if (dictIsRehashing(d)) _dictRehashStep(d);
in that case it should not be return DICT_ERR in the line A.

slove methods:
1. in the method dictRehash: add the check "if rehashed the whole table..." not only in the begin of the while loop, but also in the end of the loop
2. change the order of lines A and B in the method "dictFind","dictGenericDelete"