TD-1284
This commit is contained in:
parent
772f5b577e
commit
f20723b057
|
@ -448,7 +448,6 @@ void sdbDecRef(void *handle, void *pObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sdbGetRowMeta(SSdbTable *pTable, void *key) {
|
static void *sdbGetRowMeta(SSdbTable *pTable, void *key) {
|
||||||
void *pRet = NULL;
|
|
||||||
if (pTable == NULL) return NULL;
|
if (pTable == NULL) return NULL;
|
||||||
|
|
||||||
int32_t keySize = sizeof(int32_t);
|
int32_t keySize = sizeof(int32_t);
|
||||||
|
@ -456,12 +455,10 @@ static void *sdbGetRowMeta(SSdbTable *pTable, void *key) {
|
||||||
keySize = strlen((char *)key);
|
keySize = strlen((char *)key);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&pTable->mutex);
|
|
||||||
void **ppRow = (void **)taosHashGet(pTable->iHandle, key, keySize);
|
void **ppRow = (void **)taosHashGet(pTable->iHandle, key, keySize);
|
||||||
if (ppRow != NULL) pRet = *ppRow;
|
if (ppRow != NULL) return *ppRow;
|
||||||
pthread_mutex_unlock(&pTable->mutex);
|
|
||||||
|
|
||||||
return pRet;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sdbGetRowMetaFromObj(SSdbTable *pTable, void *key) {
|
static void *sdbGetRowMetaFromObj(SSdbTable *pTable, void *key) {
|
||||||
|
@ -469,10 +466,12 @@ static void *sdbGetRowMetaFromObj(SSdbTable *pTable, void *key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *sdbGetRow(void *handle, void *key) {
|
void *sdbGetRow(void *handle, void *key) {
|
||||||
|
SSdbTable *pTable = handle;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&pTable->mutex);
|
||||||
void *pRow = sdbGetRowMeta(handle, key);
|
void *pRow = sdbGetRowMeta(handle, key);
|
||||||
if (pRow) {
|
if (pRow) sdbIncRef(handle, pRow);
|
||||||
sdbIncRef(handle, pRow);
|
pthread_mutex_unlock(&pTable->mutex);
|
||||||
}
|
|
||||||
|
|
||||||
return pRow;
|
return pRow;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue