[TD-437] reference count calc error when drop table
This commit is contained in:
parent
75f50850a7
commit
d790d9ad09
|
@ -358,8 +358,8 @@ void sdbIncRef(void *handle, void *pObj) {
|
||||||
SSdbTable *pTable = handle;
|
SSdbTable *pTable = handle;
|
||||||
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
||||||
atomic_add_fetch_32(pRefCount, 1);
|
atomic_add_fetch_32(pRefCount, 1);
|
||||||
if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) {
|
if (0 && (pTable->tableId == SDB_TABLE_CTABLE || pTable->tableId == SDB_TABLE_DB)) {
|
||||||
sdbTrace("add ref to table:%s record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
sdbTrace("add ref to table:%s record:%p:%s:%d", pTable->tableName, pObj, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,13 +369,13 @@ void sdbDecRef(void *handle, void *pObj) {
|
||||||
SSdbTable *pTable = handle;
|
SSdbTable *pTable = handle;
|
||||||
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
||||||
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
||||||
if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) {
|
if (0 && (pTable->tableId == SDB_TABLE_CTABLE || pTable->tableId == SDB_TABLE_DB)) {
|
||||||
sdbTrace("def ref of table:%s record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
sdbTrace("def ref of table:%s record:%p:%s:%d", pTable->tableName, pObj, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t *updateEnd = pObj + pTable->refCountPos - 1;
|
int8_t *updateEnd = pObj + pTable->refCountPos - 1;
|
||||||
if (refCount <= 0 && *updateEnd) {
|
if (refCount <= 0 && *updateEnd) {
|
||||||
sdbTrace("table:%s, record:%s:%d is destroyed", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
sdbTrace("table:%s, record:%p:%s:%d is destroyed", pTable->tableName, pObj, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
||||||
SSdbOper oper = {.pObj = pObj};
|
SSdbOper oper = {.pObj = pObj};
|
||||||
(*pTable->destroyFp)(&oper);
|
(*pTable->destroyFp)(&oper);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1916,7 +1916,6 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) {
|
||||||
if (rpcMsg->code != TSDB_CODE_SUCCESS) {
|
if (rpcMsg->code != TSDB_CODE_SUCCESS) {
|
||||||
mError("table:%s, failed to drop in dnode, reason:%s", pTable->info.tableId, tstrerror(rpcMsg->code));
|
mError("table:%s, failed to drop in dnode, reason:%s", pTable->info.tableId, tstrerror(rpcMsg->code));
|
||||||
dnodeSendRpcMnodeWriteRsp(mnodeMsg, rpcMsg->code);
|
dnodeSendRpcMnodeWriteRsp(mnodeMsg, rpcMsg->code);
|
||||||
mnodeDecTableRef(pTable);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue