set terrno with taos_return
This commit is contained in:
parent
383e90e43f
commit
b0b9dd7d5f
|
@ -103,7 +103,8 @@ int32_t tqMetaSaveInfo(STQ* pTq, TTB* ttb, const void* key, int32_t kLen, const
|
|||
int32_t code = TDB_CODE_SUCCESS;
|
||||
TXN* txn = NULL;
|
||||
|
||||
TQ_ERR_RETURN(tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
TQ_ERR_RETURN(
|
||||
tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
TQ_ERR_RETURN(tdbTbUpsert(ttb, key, kLen, value, vLen, txn));
|
||||
TQ_ERR_RETURN(tdbCommit(pTq->pMetaDB, txn));
|
||||
TQ_ERR_RETURN(tdbPostCommit(pTq->pMetaDB, txn));
|
||||
|
@ -115,7 +116,8 @@ int32_t tqMetaDeleteInfo(STQ* pTq, TTB* ttb, const void* key, int32_t kLen) {
|
|||
int32_t code = TDB_CODE_SUCCESS;
|
||||
TXN* txn = NULL;
|
||||
|
||||
TQ_ERR_RETURN(tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
TQ_ERR_RETURN(
|
||||
tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
TQ_ERR_RETURN(tdbTbDelete(ttb, key, kLen, txn));
|
||||
TQ_ERR_RETURN(tdbCommit(pTq->pMetaDB, txn));
|
||||
TQ_ERR_RETURN(tdbPostCommit(pTq->pMetaDB, txn));
|
||||
|
@ -192,7 +194,6 @@ END:
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int tqMetaInitHandle(STQ* pTq, STqHandle* handle) {
|
||||
int32_t code = TDB_CODE_SUCCESS;
|
||||
|
||||
|
@ -201,7 +202,7 @@ static int tqMetaInitHandle(STQ* pTq, STqHandle* handle){
|
|||
|
||||
handle->pRef = walOpenRef(pVnode->pWal);
|
||||
if (handle->pRef == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
TQ_ERR_RETURN(walSetRefVer(handle->pRef, handle->snapshotVer));
|
||||
|
||||
|
@ -308,7 +309,8 @@ int32_t tqMetaCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle){
|
|||
if (tqMetaInitHandle(pTq, handle) < 0) {
|
||||
return -1;
|
||||
}
|
||||
tqInfo("tqMetaCreateHandle %s consumer 0x%" PRIx64 " vgId:%d, snapshotVer:%" PRId64, handle->subKey, handle->consumerId, vgId, handle->snapshotVer);
|
||||
tqInfo("tqMetaCreateHandle %s consumer 0x%" PRIx64 " vgId:%d, snapshotVer:%" PRId64, handle->subKey,
|
||||
handle->consumerId, vgId, handle->snapshotVer);
|
||||
return taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle));
|
||||
}
|
||||
|
||||
|
@ -323,7 +325,8 @@ static int32_t tqMetaTransformInfo(TDB* pMetaDB, TTB* pOld, TTB* pNew){
|
|||
int32_t code = TDB_CODE_SUCCESS;
|
||||
|
||||
TQ_ERR_GO_TO_END(tdbTbcOpen(pOld, &pCur, NULL));
|
||||
TQ_ERR_GO_TO_END(tdbBegin(pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
TQ_ERR_GO_TO_END(
|
||||
tdbBegin(pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED));
|
||||
|
||||
TQ_ERR_GO_TO_END(tdbTbcMoveToFirst(pCur));
|
||||
while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
SWalRef *walOpenRef(SWal *pWal) {
|
||||
SWalRef *pRef = taosMemoryCalloc(1, sizeof(SWalRef));
|
||||
if (pRef == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -29,6 +30,7 @@ SWalRef *walOpenRef(SWal *pWal) {
|
|||
|
||||
if (taosHashPut(pWal->pRefHash, &pRef->refId, sizeof(int64_t), &pRef, sizeof(void *))) {
|
||||
taosMemoryFree(pRef);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue