[td-225] add some logs.
This commit is contained in:
parent
6f6896293b
commit
bd2b9b2b35
|
@ -284,6 +284,7 @@ void *taosHashGetCB(SHashObj *pHashObj, const void *key, size_t keyLen, void (*f
|
||||||
|
|
||||||
// no data, return directly
|
// no data, return directly
|
||||||
if (atomic_load_32(&pe->num) == 0) {
|
if (atomic_load_32(&pe->num) == 0) {
|
||||||
|
|
||||||
__rd_unlock(&pHashObj->lock, pHashObj->type);
|
__rd_unlock(&pHashObj->lock, pHashObj->type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +296,12 @@ void *taosHashGetCB(SHashObj *pHashObj, const void *key, size_t keyLen, void (*f
|
||||||
taosRLockLatch(&pe->latch);
|
taosRLockLatch(&pe->latch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pe->num > 0) {
|
||||||
|
assert(pe->next != NULL);
|
||||||
|
} else {
|
||||||
|
assert(pe->next == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
SHashNode *pNode = doSearchInEntryList(pe, key, keyLen, hashVal);
|
SHashNode *pNode = doSearchInEntryList(pe, key, keyLen, hashVal);
|
||||||
if (pNode != NULL) {
|
if (pNode != NULL) {
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
|
@ -342,6 +349,8 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
|
||||||
|
|
||||||
// no data, return directly
|
// no data, return directly
|
||||||
if (pe->num == 0) {
|
if (pe->num == 0) {
|
||||||
|
assert(pe->next == NULL);
|
||||||
|
|
||||||
__rd_unlock(&pHashObj->lock, pHashObj->type);
|
__rd_unlock(&pHashObj->lock, pHashObj->type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -374,6 +383,12 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pe->num == 0) {
|
||||||
|
assert(pe->next == NULL);
|
||||||
|
} else {
|
||||||
|
assert(pe->next != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (pHashObj->type == HASH_ENTRY_LOCK) {
|
if (pHashObj->type == HASH_ENTRY_LOCK) {
|
||||||
taosWUnLockLatch(&pe->latch);
|
taosWUnLockLatch(&pe->latch);
|
||||||
}
|
}
|
||||||
|
@ -471,6 +486,8 @@ void taosHashCleanup(SHashObj *pHashObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pNode = pEntry->next;
|
pNode = pEntry->next;
|
||||||
|
assert(pNode != NULL);
|
||||||
|
|
||||||
while (pNode) {
|
while (pNode) {
|
||||||
pNext = pNode->next;
|
pNext = pNode->next;
|
||||||
FREE_HASH_NODE(pHashObj, pNode);
|
FREE_HASH_NODE(pHashObj, pNode);
|
||||||
|
@ -655,6 +672,12 @@ void taosHashTableResize(SHashObj *pHashObj) {
|
||||||
pe->num -= 1;
|
pe->num -= 1;
|
||||||
pe->next = pNode->next;
|
pe->next = pNode->next;
|
||||||
|
|
||||||
|
if (pe->num == 0) {
|
||||||
|
assert(pe->next == NULL);
|
||||||
|
} else {
|
||||||
|
assert(pe->next != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
SHashEntry *pNewEntry = pHashObj->hashList[j];
|
SHashEntry *pNewEntry = pHashObj->hashList[j];
|
||||||
pushfrontNodeInEntryList(pNewEntry, pNode);
|
pushfrontNodeInEntryList(pNewEntry, pNode);
|
||||||
} else {
|
} else {
|
||||||
|
@ -671,11 +694,25 @@ void taosHashTableResize(SHashObj *pHashObj) {
|
||||||
|
|
||||||
// added into new slot
|
// added into new slot
|
||||||
SHashEntry *pNewEntry = pHashObj->hashList[j];
|
SHashEntry *pNewEntry = pHashObj->hashList[j];
|
||||||
|
|
||||||
|
if (pNewEntry->num == 0) {
|
||||||
|
assert(pNewEntry->next == NULL);
|
||||||
|
} else {
|
||||||
|
assert(pNewEntry->next != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
pushfrontNodeInEntryList(pNewEntry, pNext);
|
pushfrontNodeInEntryList(pNewEntry, pNext);
|
||||||
} else {
|
} else {
|
||||||
pNode = pNext;
|
pNode = pNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pe->num == 0) {
|
||||||
|
assert(pe->next == NULL);
|
||||||
|
} else {
|
||||||
|
assert(pe->next != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue