sync integration add error code
This commit is contained in:
parent
bf3fd9b9c3
commit
a1a498a19a
|
@ -407,6 +407,10 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_SYN_INVALID_MSGLEN TAOS_DEF_ERROR_CODE(0, 0x0909)
|
#define TSDB_CODE_SYN_INVALID_MSGLEN TAOS_DEF_ERROR_CODE(0, 0x0909)
|
||||||
#define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A)
|
#define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A)
|
||||||
|
|
||||||
|
// sync integration
|
||||||
|
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x0910)
|
||||||
|
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
|
||||||
|
|
||||||
// tq
|
// tq
|
||||||
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
|
||||||
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
|
||||||
|
|
|
@ -153,10 +153,10 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
||||||
|
|
||||||
int32_t ret = syncPropose(vnodeGetSyncHandle(pVnode->pImpl), pRpc, false);
|
int32_t ret = syncPropose(vnodeGetSyncHandle(pVnode->pImpl), pRpc, false);
|
||||||
if (ret == TAOS_SYNC_PROPOSE_NOT_LEADER) {
|
if (ret == TAOS_SYNC_PROPOSE_NOT_LEADER) {
|
||||||
rsp.code = -1;
|
rsp.code = TSDB_CODE_SYN_NOT_LEADER;
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
} else if (ret == TAOS_SYNC_PROPOSE_OTHER_ERROR) {
|
} else if (ret == TAOS_SYNC_PROPOSE_OTHER_ERROR) {
|
||||||
rsp.code = -2;
|
rsp.code = TSDB_CODE_SYN_INTERNAL_ERROR;
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
} else if (ret == TAOS_SYNC_PROPOSE_SUCCESS) {
|
} else if (ret == TAOS_SYNC_PROPOSE_SUCCESS) {
|
||||||
// ok
|
// ok
|
||||||
|
|
|
@ -42,8 +42,8 @@ void test1() {
|
||||||
|
|
||||||
void test2() {
|
void test2() {
|
||||||
SyncApplyMsg *pMsg = createMsg();
|
SyncApplyMsg *pMsg = createMsg();
|
||||||
uint32_t len = pMsg->bytes;
|
uint32_t len = pMsg->bytes;
|
||||||
char * serialized = (char *)taosMemoryMalloc(len);
|
char * serialized = (char *)taosMemoryMalloc(len);
|
||||||
syncApplyMsgSerialize(pMsg, serialized, len);
|
syncApplyMsgSerialize(pMsg, serialized, len);
|
||||||
SyncApplyMsg *pMsg2 = syncApplyMsgBuild(pMsg->dataLen);
|
SyncApplyMsg *pMsg2 = syncApplyMsgBuild(pMsg->dataLen);
|
||||||
syncApplyMsgDeserialize(serialized, len, pMsg2);
|
syncApplyMsgDeserialize(serialized, len, pMsg2);
|
||||||
|
@ -56,8 +56,8 @@ void test2() {
|
||||||
|
|
||||||
void test3() {
|
void test3() {
|
||||||
SyncApplyMsg *pMsg = createMsg();
|
SyncApplyMsg *pMsg = createMsg();
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
char * serialized = syncApplyMsgSerialize2(pMsg, &len);
|
char * serialized = syncApplyMsgSerialize2(pMsg, &len);
|
||||||
SyncApplyMsg *pMsg2 = syncApplyMsgDeserialize2(serialized, len);
|
SyncApplyMsg *pMsg2 = syncApplyMsgDeserialize2(serialized, len);
|
||||||
syncApplyMsgLog2((char *)"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 ", pMsg2);
|
syncApplyMsgLog2((char *)"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 ", pMsg2);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void test3() {
|
||||||
|
|
||||||
void test4() {
|
void test4() {
|
||||||
SyncApplyMsg *pMsg = createMsg();
|
SyncApplyMsg *pMsg = createMsg();
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg;
|
||||||
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
||||||
SyncApplyMsg *pMsg2 = (SyncApplyMsg *)taosMemoryMalloc(rpcMsg.contLen);
|
SyncApplyMsg *pMsg2 = (SyncApplyMsg *)taosMemoryMalloc(rpcMsg.contLen);
|
||||||
syncApplyMsgFromRpcMsg(&rpcMsg, pMsg2);
|
syncApplyMsgFromRpcMsg(&rpcMsg, pMsg2);
|
||||||
|
@ -81,7 +81,7 @@ void test4() {
|
||||||
|
|
||||||
void test5() {
|
void test5() {
|
||||||
SyncApplyMsg *pMsg = createMsg();
|
SyncApplyMsg *pMsg = createMsg();
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg;
|
||||||
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
||||||
SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg);
|
SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg);
|
||||||
syncApplyMsgLog2((char *)"test5: syncClientRequest2RpcMsg -> syncApplyMsgFromRpcMsg2 ", pMsg2);
|
syncApplyMsgLog2((char *)"test5: syncClientRequest2RpcMsg -> syncApplyMsgFromRpcMsg2 ", pMsg2);
|
||||||
|
@ -93,13 +93,13 @@ void test5() {
|
||||||
|
|
||||||
void test6() {
|
void test6() {
|
||||||
SyncApplyMsg *pMsg = createMsg();
|
SyncApplyMsg *pMsg = createMsg();
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg;
|
||||||
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
|
||||||
SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg);
|
SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg);
|
||||||
|
|
||||||
SRpcMsg originalRpcMsg;
|
SRpcMsg originalRpcMsg;
|
||||||
syncApplyMsg2OriginalRpcMsg(pMsg2, &originalRpcMsg);
|
syncApplyMsg2OriginalRpcMsg(pMsg2, &originalRpcMsg);
|
||||||
syncRpcMsgLog2((char*)"test6", &originalRpcMsg);
|
syncRpcMsgLog2((char *)"test6", &originalRpcMsg);
|
||||||
|
|
||||||
rpcFreeCont(originalRpcMsg.pCont);
|
rpcFreeCont(originalRpcMsg.pCont);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
|
|
Loading…
Reference in New Issue