enh: return error code
This commit is contained in:
parent
cdc85d9588
commit
280c5d4b3d
|
@ -113,6 +113,8 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct) {
|
static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_ACCT, ACCT_VER_NUMBER, sizeof(SAcctObj) + ACCT_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_ACCT, ACCT_VER_NUMBER, sizeof(SAcctObj) + ACCT_RESERVE_SIZE);
|
||||||
|
@ -153,6 +155,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SAcctObj *pAcct = NULL;
|
SAcctObj *pAcct = NULL;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
|
|
|
@ -114,6 +114,8 @@ void mndArbGroupInitFromVgObj(SVgObj *pVgObj, SArbGroup *outGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup) {
|
SSdbRaw *mndArbGroupActionEncode(SArbGroup *pGroup) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = sizeof(SArbGroup) + ARBGROUP_RESERVE_SIZE;
|
int32_t size = sizeof(SArbGroup) + ARBGROUP_RESERVE_SIZE;
|
||||||
|
@ -152,6 +154,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndArbGroupActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndArbGroupActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SArbGroup *pGroup = NULL;
|
SArbGroup *pGroup = NULL;
|
||||||
|
|
|
@ -144,6 +144,8 @@ int64_t mndGetClusterUpTime(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_CLUSTER, CLUSTER_VER_NUMBE, sizeof(SClusterObj) + CLUSTER_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_CLUSTER, CLUSTER_VER_NUMBE, sizeof(SClusterObj) + CLUSTER_RESERVE_SIZE);
|
||||||
|
@ -172,6 +174,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SClusterObj *pCluster = NULL;
|
SClusterObj *pCluster = NULL;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
|
|
|
@ -88,6 +88,8 @@ int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
@ -136,6 +138,8 @@ OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SCompactObj *pCompact = NULL;
|
SCompactObj *pCompact = NULL;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
|
|
@ -144,6 +144,8 @@ int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailO
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
@ -193,9 +195,11 @@ OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndCompactDetailActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndCompactDetailActionDecode(SSdbRaw *pRaw) {
|
||||||
SSdbRow *pRow = NULL;
|
int32_t code = 0;
|
||||||
SCompactDetailObj *pCompact = NULL;
|
int32_t lino = 0;
|
||||||
void *buf = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
|
SCompactDetailObj *pCompact = NULL;
|
||||||
|
void *buf = NULL;
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
|
|
|
@ -700,6 +700,8 @@ _over:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer) {
|
SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
@ -736,6 +738,8 @@ CM_ENCODE_OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SMqConsumerObj *pConsumer = NULL;
|
SMqConsumerObj *pConsumer = NULL;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
|
|
@ -88,6 +88,8 @@ int32_t mndInitDb(SMnode *pMnode) {
|
||||||
void mndCleanupDb(SMnode *pMnode) {}
|
void mndCleanupDb(SMnode *pMnode) {}
|
||||||
|
|
||||||
SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
|
SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = sizeof(SDbObj) + pDb->cfg.numOfRetensions * sizeof(SRetention) + DB_RESERVE_SIZE;
|
int32_t size = sizeof(SDbObj) + pDb->cfg.numOfRetensions * sizeof(SRetention) + DB_RESERVE_SIZE;
|
||||||
|
@ -166,6 +168,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
|
|
|
@ -184,6 +184,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode) {
|
static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_DNODE, TSDB_DNODE_VER_NUMBER, sizeof(SDnodeObj) + TSDB_DNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_DNODE, TSDB_DNODE_VER_NUMBER, sizeof(SDnodeObj) + TSDB_DNODE_RESERVE_SIZE);
|
||||||
|
@ -215,6 +217,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SDnodeObj *pDnode = NULL;
|
SDnodeObj *pDnode = NULL;
|
||||||
|
|
|
@ -61,6 +61,8 @@ int32_t mndInitFunc(SMnode *pMnode) {
|
||||||
void mndCleanupFunc(SMnode *pMnode) {}
|
void mndCleanupFunc(SMnode *pMnode) {}
|
||||||
|
|
||||||
static SSdbRaw *mndFuncActionEncode(SFuncObj *pFunc) {
|
static SSdbRaw *mndFuncActionEncode(SFuncObj *pFunc) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = pFunc->commentSize + pFunc->codeSize + sizeof(SFuncObj) + SDB_FUNC_RESERVE_SIZE;
|
int32_t size = pFunc->commentSize + pFunc->codeSize + sizeof(SFuncObj) + SDB_FUNC_RESERVE_SIZE;
|
||||||
|
@ -101,6 +103,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SFuncObj *pFunc = NULL;
|
SFuncObj *pFunc = NULL;
|
||||||
|
|
|
@ -207,6 +207,8 @@ void mndCleanupIdx(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndIdxActionEncode(SIdxObj *pIdx) {
|
static SSdbRaw *mndIdxActionEncode(SIdxObj *pIdx) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
// int32_t size =
|
// int32_t size =
|
||||||
|
@ -244,6 +246,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndIdxActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndIdxActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SIdxObj *pIdx = NULL;
|
SIdxObj *pIdx = NULL;
|
||||||
|
|
|
@ -127,6 +127,8 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndMnodeActionEncode(SMnodeObj *pObj) {
|
static SSdbRaw *mndMnodeActionEncode(SMnodeObj *pObj) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_MNODE, MNODE_VER_NUMBER, sizeof(SMnodeObj) + MNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_MNODE, MNODE_VER_NUMBER, sizeof(SMnodeObj) + MNODE_RESERVE_SIZE);
|
||||||
|
@ -154,6 +156,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SMnodeObj *pObj = NULL;
|
SMnodeObj *pObj = NULL;
|
||||||
|
|
|
@ -75,6 +75,8 @@ void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, QNODE_VER_NUMBER, sizeof(SQnodeObj) + QNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, QNODE_VER_NUMBER, sizeof(SQnodeObj) + QNODE_RESERVE_SIZE);
|
||||||
|
@ -100,6 +102,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SQnodeObj *pObj = NULL;
|
SQnodeObj *pObj = NULL;
|
||||||
|
|
|
@ -112,6 +112,8 @@ int32_t mndInitSma(SMnode *pMnode) {
|
||||||
void mndCleanupSma(SMnode *pMnode) {}
|
void mndCleanupSma(SMnode *pMnode) {}
|
||||||
|
|
||||||
static SSdbRaw *mndSmaActionEncode(SSmaObj *pSma) {
|
static SSdbRaw *mndSmaActionEncode(SSmaObj *pSma) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size =
|
int32_t size =
|
||||||
|
@ -173,6 +175,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SSmaObj *pSma = NULL;
|
SSmaObj *pSma = NULL;
|
||||||
|
|
|
@ -79,6 +79,8 @@ void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, SNODE_VER_NUMBER, sizeof(SSnodeObj) + SNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, SNODE_VER_NUMBER, sizeof(SSnodeObj) + SNODE_RESERVE_SIZE);
|
||||||
|
@ -104,6 +106,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SSnodeObj *pObj = NULL;
|
SSnodeObj *pObj = NULL;
|
||||||
|
|
|
@ -115,6 +115,8 @@ int32_t mndInitStb(SMnode *pMnode) {
|
||||||
void mndCleanupStb(SMnode *pMnode) {}
|
void mndCleanupStb(SMnode *pMnode) {}
|
||||||
|
|
||||||
SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + pStb->commentLen +
|
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + pStb->commentLen +
|
||||||
|
@ -205,6 +207,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SStbObj *pStb = NULL;
|
SStbObj *pStb = NULL;
|
||||||
|
|
|
@ -160,6 +160,8 @@ void mndCleanupStream(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
|
|
|
@ -177,6 +177,8 @@ STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, ETrnCo
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
|
SSdbRaw *mndStreamActionEncode(SStreamObj *pStream) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
|
|
||||||
|
|
|
@ -1096,6 +1096,8 @@ end:
|
||||||
void mndCleanupSubscribe(SMnode *pMnode) {}
|
void mndCleanupSubscribe(SMnode *pMnode) {}
|
||||||
|
|
||||||
static SSdbRaw *mndSubActionEncode(SMqSubscribeObj *pSub) {
|
static SSdbRaw *mndSubActionEncode(SMqSubscribeObj *pSub) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
int32_t tlen = tEncodeSubscribeObj(NULL, pSub);
|
int32_t tlen = tEncodeSubscribeObj(NULL, pSub);
|
||||||
|
@ -1132,6 +1134,8 @@ SUB_ENCODE_OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
|
static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SMqSubscribeObj *pSub = NULL;
|
SMqSubscribeObj *pSub = NULL;
|
||||||
|
|
|
@ -76,6 +76,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
|
SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
void *swBuf = NULL;
|
void *swBuf = NULL;
|
||||||
|
@ -163,6 +165,8 @@ TOPIC_ENCODE_OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SMqTopicObj *pTopic = NULL;
|
SMqTopicObj *pTopic = NULL;
|
||||||
|
|
|
@ -105,6 +105,8 @@ static int32_t mndTransGetActionsSize(SArray *pArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndTransEncodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionsNum) {
|
static int32_t mndTransEncodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionsNum) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
int32_t dataPos = *offset;
|
int32_t dataPos = *offset;
|
||||||
int8_t unused = 0;
|
int8_t unused = 0;
|
||||||
int32_t ret = -1;
|
int32_t ret = -1;
|
||||||
|
@ -142,6 +144,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndTransEncode(STrans *pTrans) {
|
SSdbRaw *mndTransEncode(STrans *pTrans) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
int8_t sver = taosArrayGetSize(pTrans->prepareActions) ? TRANS_VER2_NUMBER : TRANS_VER1_NUMBER;
|
int8_t sver = taosArrayGetSize(pTrans->prepareActions) ? TRANS_VER2_NUMBER : TRANS_VER1_NUMBER;
|
||||||
|
|
||||||
|
@ -225,6 +229,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndTransDecodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionNum) {
|
static int32_t mndTransDecodeAction(SSdbRaw *pRaw, int32_t *offset, SArray *pActions, int32_t actionNum) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
int32_t dataPos = *offset;
|
int32_t dataPos = *offset;
|
||||||
int8_t unused = 0;
|
int8_t unused = 0;
|
||||||
|
@ -279,7 +285,8 @@ _OVER:
|
||||||
|
|
||||||
SSdbRow *mndTransDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndTransDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
STrans *pTrans = NULL;
|
STrans *pTrans = NULL;
|
||||||
char *pData = NULL;
|
char *pData = NULL;
|
||||||
|
|
|
@ -784,11 +784,11 @@ static int32_t createIpWhiteList(void *buf, int32_t len, SIpWhiteList **ppList)
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
tDecoderInit(&decoder, buf, len);
|
tDecoderInit(&decoder, buf, len);
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(tStartDecode(&decoder), &lino, _OVER), &lino, _OVER);
|
TAOS_CHECK_GOTO(tStartDecode(&decoder), &lino, _OVER);
|
||||||
TAOS_CHECK_GOTO(tDecodeI32(&decoder, &num), &lino, _OVER), &lino, _OVER);
|
TAOS_CHECK_GOTO(tDecodeI32(&decoder, &num), &lino, _OVER);
|
||||||
|
|
||||||
p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + num * sizeof(SIpV4Range));
|
p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + num * sizeof(SIpV4Range));
|
||||||
if(p == NULL) {
|
if (p == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||||
}
|
}
|
||||||
TAOS_CHECK_GOTO(tDerializeIpWhileList(buf, len, p), &lino, _OVER);
|
TAOS_CHECK_GOTO(tDerializeIpWhileList(buf, len, p), &lino, _OVER);
|
||||||
|
@ -796,7 +796,12 @@ static int32_t createIpWhiteList(void *buf, int32_t len, SIpWhiteList **ppList)
|
||||||
_OVER:
|
_OVER:
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return p;
|
if (code != 0) {
|
||||||
|
taosMemoryFreeClear(p);
|
||||||
|
mError("failed to create ip white list at line %d since %s", lino, tstrerror(code));
|
||||||
|
}
|
||||||
|
*ppList = p;
|
||||||
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createDefaultIpWhiteList(SIpWhiteList **ppWhiteList) {
|
static int32_t createDefaultIpWhiteList(SIpWhiteList **ppWhiteList) {
|
||||||
|
@ -876,7 +881,8 @@ static int32_t mndCreateDefaultUsers(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
||||||
int32_t code = TSDB_CODE_OUT_OF_MEMORY;
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
int32_t ipWhiteReserve =
|
int32_t ipWhiteReserve =
|
||||||
pUser->pIpWhiteList ? (sizeof(SIpV4Range) * pUser->pIpWhiteList->num + sizeof(SIpWhiteList) + 4) : 16;
|
pUser->pIpWhiteList ? (sizeof(SIpV4Range) * pUser->pIpWhiteList->num + sizeof(SIpWhiteList) + 4) : 16;
|
||||||
|
@ -989,7 +995,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size);
|
||||||
if (pRaw == NULL) {
|
if (pRaw == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _OVER);
|
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
|
@ -1744,21 +1750,30 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
||||||
if(pUniqueTab == NULL){
|
if(pUniqueTab == NULL){
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
int32_t dummpy = 0;
|
int32_t dummpy = 0;
|
||||||
for (int i = 0; i < pCreate->numIpRanges; i++) {
|
for (int i = 0; i < pCreate->numIpRanges; i++) {
|
||||||
SIpV4Range range = {.ip = pCreate->pIpRanges[i].ip, .mask = pCreate->pIpRanges[i].mask};
|
SIpV4Range range = {.ip = pCreate->pIpRanges[i].ip, .mask = pCreate->pIpRanges[i].mask};
|
||||||
if(code = taosHashPut(pUniqueTab, &range, sizeof(range), &dummpy, sizeof(dummpy));
|
if ((code = taosHashPut(pUniqueTab, &range, sizeof(range), &dummpy, sizeof(dummpy))) != 0) {
|
||||||
|
taosHashCleanup(pUniqueTab);
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((code = taosHashPut(pUniqueTab, &defaultIpRange, sizeof(defaultIpRange), &dummpy, sizeof(dummpy))) != 0) {
|
||||||
|
taosHashCleanup(pUniqueTab);
|
||||||
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
taosHashPut(pUniqueTab, &defaultIpRange, sizeof(defaultIpRange), &dummpy, sizeof(dummpy));
|
|
||||||
|
|
||||||
if (taosHashGetSize(pUniqueTab) > MND_MAX_USE_HOST) {
|
if (taosHashGetSize(pUniqueTab) > MND_MAX_USE_HOST) {
|
||||||
terrno = TSDB_CODE_MND_TOO_MANY_USER_HOST;
|
|
||||||
taosHashCleanup(pUniqueTab);
|
taosHashCleanup(pUniqueTab);
|
||||||
return terrno;
|
TAOS_RETURN(TSDB_CODE_MND_TOO_MANY_USER_HOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numOfRanges = taosHashGetSize(pUniqueTab);
|
int32_t numOfRanges = taosHashGetSize(pUniqueTab);
|
||||||
SIpWhiteList *p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + numOfRanges * sizeof(SIpV4Range));
|
SIpWhiteList *p = taosMemoryCalloc(1, sizeof(SIpWhiteList) + numOfRanges * sizeof(SIpV4Range));
|
||||||
|
if (p == NULL) {
|
||||||
|
taosHashCleanup(pUniqueTab);
|
||||||
|
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
void *pIter = taosHashIterate(pUniqueTab, NULL);
|
void *pIter = taosHashIterate(pUniqueTab, NULL);
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
|
@ -1781,9 +1796,8 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-user");
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-user");
|
||||||
if (pTrans == NULL) {
|
if (pTrans == NULL) {
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
||||||
|
|
||||||
taosMemoryFree(userObj.pIpWhiteList);
|
taosMemoryFree(userObj.pIpWhiteList);
|
||||||
return -1;
|
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
mInfo("trans:%d, used to create user:%s", pTrans->id, pCreate->user);
|
mInfo("trans:%d, used to create user:%s", pTrans->id, pCreate->user);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,8 @@ int32_t mndInitVgroup(SMnode *pMnode) {
|
||||||
void mndCleanupVgroup(SMnode *pMnode) {}
|
void mndCleanupVgroup(SMnode *pMnode) {}
|
||||||
|
|
||||||
SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup) {
|
SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_VGROUP, VGROUP_VER_NUMBER, sizeof(SVgObj) + VGROUP_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_VGROUP, VGROUP_VER_NUMBER, sizeof(SVgObj) + VGROUP_RESERVE_SIZE);
|
||||||
|
@ -127,6 +129,8 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
|
SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SSdbRow *pRow = NULL;
|
SSdbRow *pRow = NULL;
|
||||||
SVgObj *pVgroup = NULL;
|
SVgObj *pVgroup = NULL;
|
||||||
|
|
|
@ -39,18 +39,20 @@ extern "C" {
|
||||||
|
|
||||||
#define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \
|
#define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \
|
||||||
{ \
|
{ \
|
||||||
if (func(pRaw, dataPos, val) != 0) { \
|
if ((code = func(pRaw, dataPos, val)) != 0) { \
|
||||||
|
lino = __LINE__; \
|
||||||
goto pos; \
|
goto pos; \
|
||||||
} \
|
} \
|
||||||
dataPos += sizeof(type); \
|
dataPos += sizeof(type); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDB_GET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
#define SDB_GET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
||||||
{ \
|
{ \
|
||||||
if (sdbGetRawBinary(pRaw, dataPos, val, valLen) != 0) { \
|
if ((code = sdbGetRawBinary(pRaw, dataPos, val, valLen)) != 0) { \
|
||||||
goto pos; \
|
lino = __LINE__; \
|
||||||
} \
|
goto pos; \
|
||||||
dataPos += valLen; \
|
} \
|
||||||
|
dataPos += valLen; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDB_GET_INT64(pData, dataPos, val, pos) SDB_GET_VAL(pData, dataPos, val, pos, sdbGetRawInt64, int64_t)
|
#define SDB_GET_INT64(pData, dataPos, val, pos) SDB_GET_VAL(pData, dataPos, val, pos, sdbGetRawInt64, int64_t)
|
||||||
|
@ -67,7 +69,8 @@ extern "C" {
|
||||||
|
|
||||||
#define SDB_SET_VAL(pRaw, dataPos, val, pos, func, type) \
|
#define SDB_SET_VAL(pRaw, dataPos, val, pos, func, type) \
|
||||||
{ \
|
{ \
|
||||||
if (func(pRaw, dataPos, val) != 0) { \
|
if ((code = func(pRaw, dataPos, val)) != 0) { \
|
||||||
|
lino = __LINE__; \
|
||||||
goto pos; \
|
goto pos; \
|
||||||
} \
|
} \
|
||||||
dataPos += sizeof(type); \
|
dataPos += sizeof(type); \
|
||||||
|
@ -79,12 +82,13 @@ extern "C" {
|
||||||
#define SDB_SET_INT8(pRaw, dataPos, val, pos) SDB_SET_VAL(pRaw, dataPos, val, pos, sdbSetRawInt8, int8_t)
|
#define SDB_SET_INT8(pRaw, dataPos, val, pos) SDB_SET_VAL(pRaw, dataPos, val, pos, sdbSetRawInt8, int8_t)
|
||||||
#define SDB_SET_UINT8(pRaw, dataPos, val, pos) SDB_SET_VAL(pRaw, dataPos, val, pos, sdbSetRawUInt8, uint8_t)
|
#define SDB_SET_UINT8(pRaw, dataPos, val, pos) SDB_SET_VAL(pRaw, dataPos, val, pos, sdbSetRawUInt8, uint8_t)
|
||||||
|
|
||||||
#define SDB_SET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
#define SDB_SET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
||||||
{ \
|
{ \
|
||||||
if (sdbSetRawBinary(pRaw, dataPos, val, valLen) != 0) { \
|
if ((code = sdbSetRawBinary(pRaw, dataPos, val, valLen)) != 0) { \
|
||||||
goto pos; \
|
lino = __LINE__; \
|
||||||
} \
|
goto pos; \
|
||||||
dataPos += valLen; \
|
} \
|
||||||
|
dataPos += valLen; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDB_SET_RESERVE(pRaw, dataPos, valLen, pos) \
|
#define SDB_SET_RESERVE(pRaw, dataPos, valLen, pos) \
|
||||||
|
@ -93,11 +97,12 @@ extern "C" {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
SDB_SET_BINARY(pRaw, dataPos, val, valLen, pos) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDB_SET_DATALEN(pRaw, dataLen, pos) \
|
#define SDB_SET_DATALEN(pRaw, dataLen, pos) \
|
||||||
{ \
|
{ \
|
||||||
if (sdbSetRawDataLen(pRaw, dataLen) != 0) { \
|
if ((code = sdbSetRawDataLen(pRaw, dataLen)) != 0) { \
|
||||||
goto pos; \
|
lino = __LINE__; \
|
||||||
} \
|
goto pos; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct SMnode SMnode;
|
typedef struct SMnode SMnode;
|
||||||
|
|
Loading…
Reference in New Issue