Describe the bug
`
zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) {
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
unsigned int rank[ZSKIPLIST_MAXLEVEL];
`
A short description of the bug.
To reproduce
Steps to reproduce the behavior and/or a minimal code sample.
Expected behavior
`
zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) {
//---------------------------impovement-------------------------------------------
int level = zslRandomLevel(); // 1st obtains new level value
int max = max(level, zsl->level);
zskiplistNode *update[max]; // low probability to reach ZSKIPLIST_MAXLEVEL
//------------------------------------bug fix--------------------------------------------------------------
// from server.h
// unsigned long length; unsigned long span;
// #define ZSKIPLIST_MAXLEVEL 32 /* Should be enough for 2^64 elements /
// #define ZSKIPLIST_P 0.25 / Skiplist P = 1/4 */
// if x will be inserted at the end of list, and length has been greater than max of unsigned int, overflow can occur.
unsigned long rank[max];// long not int
`
A description of what you expected to happen.
Additional information
Any additional information that is relevant to the problem.