[td-225] add some logs.

This commit is contained in:
Haojun Liao 2020-08-04 19:36:01 +08:00
parent d6c19bbb5e
commit 6eca95b6ce
1 changed files with 25 additions and 0 deletions

View File

@ -238,6 +238,12 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, void *da
// no data in hash table with the specified key, add it into hash table // no data in hash table with the specified key, add it into hash table
pushfrontNodeInEntryList(pe, pNewNode); pushfrontNodeInEntryList(pe, pNewNode);
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);
} }
@ -449,6 +455,12 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
pEntry->num -= 1; pEntry->num -= 1;
pEntry->next = pNode->next; pEntry->next = pNode->next;
if (pEntry->num == 0) {
assert(pEntry->next == NULL);
} else {
assert(pEntry->next != NULL);
}
FREE_HASH_NODE(pHashObj, pNode); FREE_HASH_NODE(pHashObj, pNode);
} else { } else {
break; break;
@ -466,6 +478,12 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
pNode->next = pNext->next; pNode->next = pNext->next;
pEntry->num -= 1; pEntry->num -= 1;
if (pEntry->num == 0) {
assert(pEntry->next == NULL);
} else {
assert(pEntry->next != NULL);
}
FREE_HASH_NODE(pHashObj, pNext); FREE_HASH_NODE(pHashObj, pNext);
} else { } else {
pNode = pNext; pNode = pNext;
@ -675,6 +693,13 @@ void taosHashTableResize(SHashObj *pHashObj) {
pHashObj->capacity = newSize; pHashObj->capacity = newSize;
for (int32_t i = 0; i < pHashObj->capacity; ++i) { for (int32_t i = 0; i < pHashObj->capacity; ++i) {
SHashEntry *pe = pHashObj->hashList[i]; SHashEntry *pe = pHashObj->hashList[i];
if (pe->num == 0) {
assert(pe->next == NULL);
} else {
assert(pe->next != NULL);
}
if (pe->num == 0) { if (pe->num == 0) {
assert(pe->next == NULL); assert(pe->next == NULL);
continue; continue;