提交 f20723b0 编写于 作者: R root

TD-1284

上级 772f5b57
...@@ -448,7 +448,6 @@ void sdbDecRef(void *handle, void *pObj) { ...@@ -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) { ...@@ -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) { ...@@ -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;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册