feat: put dup record in the last
This commit is contained in:
parent
e0f53dfc32
commit
54420f06fc
|
@ -56,10 +56,10 @@ typedef enum { SSkipListPutSuccess = 0, SSkipListPutEarlyStop = 1, SSkipListPutS
|
||||||
|
|
||||||
typedef struct SSkipList {
|
typedef struct SSkipList {
|
||||||
uint32_t seed;
|
uint32_t seed;
|
||||||
|
uint16_t len;
|
||||||
__compar_fn_t comparFn;
|
__compar_fn_t comparFn;
|
||||||
__sl_key_fn_t keyFn;
|
__sl_key_fn_t keyFn;
|
||||||
TdThreadRwlock *lock;
|
TdThreadRwlock *lock;
|
||||||
uint16_t len;
|
|
||||||
uint8_t maxLevel;
|
uint8_t maxLevel;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint8_t type; // static info above
|
uint8_t type; // static info above
|
||||||
|
|
|
@ -185,10 +185,10 @@ void tSkipListPutBatchByIter(SSkipList *pSkipList, void *iter, iter_next_fn_t it
|
||||||
pKey = SL_GET_NODE_KEY(pSkipList, p);
|
pKey = SL_GET_NODE_KEY(pSkipList, p);
|
||||||
|
|
||||||
compare = pSkipList->comparFn(pKey, pDataKey);
|
compare = pSkipList->comparFn(pKey, pDataKey);
|
||||||
if (compare >= 0) {
|
if (compare > 0) {
|
||||||
if (compare == 0 && !hasDup) hasDup = true;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
if (compare == 0 && !hasDup) hasDup = true;
|
||||||
px = p;
|
px = p;
|
||||||
p = SL_NODE_GET_FORWARD_POINTER(px, i);
|
p = SL_NODE_GET_FORWARD_POINTER(px, i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue