Merge pull request #10204 from taosdata/feature/privilege
message redirection mechanism of mnode
This commit is contained in:
commit
9799bc2c86
|
@ -552,8 +552,12 @@ static void dndWriteMnodeMsgToWorker(SDnode *pDnode, SDnodeWorker *pWorker, SRpc
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (pRpcMsg->msgType & 1u) {
|
if (pRpcMsg->msgType & 1u) {
|
||||||
SRpcMsg rsp = {.handle = pRpcMsg->handle, .ahandle = pRpcMsg->ahandle, .code = code};
|
if (code == TSDB_CODE_DND_MNODE_NOT_DEPLOYED || code == TSDB_CODE_APP_NOT_READY) {
|
||||||
rpcSendResponse(&rsp);
|
dndSendRedirectRsp(pDnode, pRpcMsg);
|
||||||
|
} else {
|
||||||
|
SRpcMsg rsp = {.handle = pRpcMsg->handle, .ahandle = pRpcMsg->ahandle, .code = code};
|
||||||
|
rpcSendResponse(&rsp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rpcFreeCont(pRpcMsg->pCont);
|
rpcFreeCont(pRpcMsg->pCont);
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,13 +604,13 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
|
||||||
|
|
||||||
pShow->bytes[cols] = 8;
|
pShow->bytes[cols] = 8;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
strcpy(pSchema[cols].name, "role_time");
|
strcpy(pSchema[cols].name, "create_time");
|
||||||
pSchema[cols].bytes = htonl(pShow->bytes[cols]);
|
pSchema[cols].bytes = htonl(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pShow->bytes[cols] = 8;
|
pShow->bytes[cols] = 8;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
strcpy(pSchema[cols].name, "create_time");
|
strcpy(pSchema[cols].name, "role_time");
|
||||||
pSchema[cols].bytes = htonl(pShow->bytes[cols]);
|
pSchema[cols].bytes = htonl(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
@ -659,11 +659,11 @@ static int32_t mndRetrieveMnodes(SMnodeMsg *pReq, SShowObj *pShow, char *data, i
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
*(int64_t *)pWrite = pObj->roleTime;
|
*(int64_t *)pWrite = pObj->createdTime;
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
*(int64_t *)pWrite = pObj->createdTime;
|
*(int64_t *)pWrite = pObj->roleTime;
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
|
|
|
@ -45,8 +45,8 @@ TEST_F(MndTestMnode, 01_ShowDnode) {
|
||||||
CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id");
|
CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id");
|
||||||
CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint");
|
CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint");
|
||||||
CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, 12 + VARSTR_HEADER_SIZE, "role");
|
CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, 12 + VARSTR_HEADER_SIZE, "role");
|
||||||
CHECK_SCHEMA(3, TSDB_DATA_TYPE_TIMESTAMP, 8, "role_time");
|
CHECK_SCHEMA(3, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time");
|
||||||
CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time");
|
CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "role_time");
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
test.SendShowRetrieveReq();
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
@ -54,8 +54,8 @@ TEST_F(MndTestMnode, 01_ShowDnode) {
|
||||||
CheckInt16(1);
|
CheckInt16(1);
|
||||||
CheckBinary("localhost:9028", TSDB_EP_LEN);
|
CheckBinary("localhost:9028", TSDB_EP_LEN);
|
||||||
CheckBinary("master", 12);
|
CheckBinary("master", 12);
|
||||||
CheckInt64(0);
|
|
||||||
CheckTimestamp();
|
CheckTimestamp();
|
||||||
|
IgnoreTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
|
TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
|
||||||
|
@ -124,10 +124,10 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
CheckBinary("localhost:9029", TSDB_EP_LEN);
|
CheckBinary("localhost:9029", TSDB_EP_LEN);
|
||||||
CheckBinary("master", 12);
|
CheckBinary("master", 12);
|
||||||
CheckBinary("slave", 12);
|
CheckBinary("slave", 12);
|
||||||
CheckInt64(0);
|
|
||||||
CheckInt64(0);
|
|
||||||
CheckTimestamp();
|
CheckTimestamp();
|
||||||
CheckTimestamp();
|
CheckTimestamp();
|
||||||
|
IgnoreTimestamp();
|
||||||
|
IgnoreTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -148,8 +148,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
CheckInt16(1);
|
CheckInt16(1);
|
||||||
CheckBinary("localhost:9028", TSDB_EP_LEN);
|
CheckBinary("localhost:9028", TSDB_EP_LEN);
|
||||||
CheckBinary("master", 12);
|
CheckBinary("master", 12);
|
||||||
CheckInt64(0);
|
|
||||||
CheckTimestamp();
|
CheckTimestamp();
|
||||||
|
IgnoreTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue