提交 8cd40297 编写于 作者: D dapan1121

[td-11544][Enhancement] compatibility between old version client and new version server

上级 52516028
...@@ -902,6 +902,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -902,6 +902,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SArray* queryOperator = createExecOperatorPlan(&query); SArray* queryOperator = createExecOperatorPlan(&query);
SQueryTableMsg *pQueryMsg = (SQueryTableMsg *)pCmd->payload; SQueryTableMsg *pQueryMsg = (SQueryTableMsg *)pCmd->payload;
tstrncpy(pQueryMsg->version, version, tListLen(pQueryMsg->version)); tstrncpy(pQueryMsg->version, version, tListLen(pQueryMsg->version));
int32_t numOfTags = query.numOfTags; int32_t numOfTags = query.numOfTags;
...@@ -1141,6 +1142,23 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1141,6 +1142,23 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
memcpy(pMsg, pSql->sqlstr, sqlLen); memcpy(pMsg, pSql->sqlstr, sqlLen);
pMsg += sqlLen; pMsg += sqlLen;
/*
//MSG EXTEND DEMO
pQueryMsg->extend = 1;
STLV *tlv = (STLV *)pMsg;
tlv->type = htons(TLV_TYPE_DUMMY);
tlv->len = htonl(sizeof(int16_t));
*(int16_t *)tlv->value = htons(12345);
pMsg += sizeof(*tlv) + ntohl(tlv->len);
tlv = (STLV *)pMsg;
tlv->len = 0;
pMsg += sizeof(*tlv);
*/
int32_t msgLen = (int32_t)(pMsg - pCmd->payload); int32_t msgLen = (int32_t)(pMsg - pCmd->payload);
tscDebug("0x%"PRIx64" msg built success, len:%d bytes", pSql->self, msgLen); tscDebug("0x%"PRIx64" msg built success, len:%d bytes", pSql->self, msgLen);
......
...@@ -230,6 +230,7 @@ typedef struct SSubmitBlk { ...@@ -230,6 +230,7 @@ typedef struct SSubmitBlk {
// Submit message for this TSDB // Submit message for this TSDB
typedef struct SSubmitMsg { typedef struct SSubmitMsg {
SMsgHead header; SMsgHead header;
int8_t extend;
int32_t length; int32_t length;
int32_t numOfBlocks; int32_t numOfBlocks;
char blocks[]; char blocks[];
...@@ -243,6 +244,7 @@ typedef struct { ...@@ -243,6 +244,7 @@ typedef struct {
} SShellSubmitRspBlock; } SShellSubmitRspBlock;
typedef struct { typedef struct {
int8_t extend;
int32_t code; // 0-success, > 0 error code int32_t code; // 0-success, > 0 error code
int32_t numOfRows; // number of records the client is trying to write int32_t numOfRows; // number of records the client is trying to write
int32_t affectedRows; // number of records actually written int32_t affectedRows; // number of records actually written
...@@ -278,6 +280,7 @@ typedef struct { ...@@ -278,6 +280,7 @@ typedef struct {
} SMDCreateTableMsg; } SMDCreateTableMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t len; // one create table message int32_t len; // one create table message
char tableName[TSDB_TABLE_FNAME_LEN]; char tableName[TSDB_TABLE_FNAME_LEN];
int8_t igExists; int8_t igExists;
...@@ -290,11 +293,13 @@ typedef struct { ...@@ -290,11 +293,13 @@ typedef struct {
} SCreateTableMsg; } SCreateTableMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t numOfTables; int32_t numOfTables;
int32_t contLen; int32_t contLen;
} SCMCreateTableMsg; } SCMCreateTableMsg;
typedef struct { typedef struct {
int8_t extend;
char name[TSDB_TABLE_FNAME_LEN]; char name[TSDB_TABLE_FNAME_LEN];
// if user specify DROP STABLE, this flag will be set. And an error will be returned if it is not a super table // if user specify DROP STABLE, this flag will be set. And an error will be returned if it is not a super table
int8_t supertable; int8_t supertable;
...@@ -302,6 +307,7 @@ typedef struct { ...@@ -302,6 +307,7 @@ typedef struct {
} SCMDropTableMsg; } SCMDropTableMsg;
typedef struct { typedef struct {
int8_t extend;
char tableFname[TSDB_TABLE_FNAME_LEN]; char tableFname[TSDB_TABLE_FNAME_LEN];
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]; char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
int16_t type; /* operation type */ int16_t type; /* operation type */
...@@ -314,6 +320,7 @@ typedef struct { ...@@ -314,6 +320,7 @@ typedef struct {
typedef struct { typedef struct {
SMsgHead head; SMsgHead head;
int8_t extend;
int64_t uid; int64_t uid;
int32_t tid; int32_t tid;
int16_t tversion; int16_t tversion;
...@@ -327,6 +334,7 @@ typedef struct { ...@@ -327,6 +334,7 @@ typedef struct {
} SUpdateTableTagValMsg; } SUpdateTableTagValMsg;
typedef struct { typedef struct {
int8_t extend;
char clientVersion[TSDB_VERSION_LEN]; char clientVersion[TSDB_VERSION_LEN];
char msgVersion[TSDB_VERSION_LEN]; char msgVersion[TSDB_VERSION_LEN];
char db[TSDB_TABLE_FNAME_LEN]; char db[TSDB_TABLE_FNAME_LEN];
...@@ -335,6 +343,7 @@ typedef struct { ...@@ -335,6 +343,7 @@ typedef struct {
} SConnectMsg; } SConnectMsg;
typedef struct { typedef struct {
int8_t extend;
char acctId[TSDB_ACCT_ID_LEN]; char acctId[TSDB_ACCT_ID_LEN];
char serverVersion[TSDB_VERSION_LEN]; char serverVersion[TSDB_VERSION_LEN];
char clusterId[TSDB_CLUSTER_ID_LEN]; char clusterId[TSDB_CLUSTER_ID_LEN];
...@@ -361,16 +370,19 @@ typedef struct { ...@@ -361,16 +370,19 @@ typedef struct {
} SAcctCfg; } SAcctCfg;
typedef struct { typedef struct {
int8_t extend;
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; char pass[TSDB_KEY_LEN];
SAcctCfg cfg; SAcctCfg cfg;
} SCreateAcctMsg, SAlterAcctMsg; } SCreateAcctMsg, SAlterAcctMsg;
typedef struct { typedef struct {
char user[TSDB_USER_LEN]; int8_t extend;
char user[TSDB_USER_LEN];
} SDropUserMsg, SDropAcctMsg; } SDropUserMsg, SDropAcctMsg;
typedef struct { typedef struct {
int8_t extend;
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; char pass[TSDB_KEY_LEN];
int8_t privilege; int8_t privilege;
...@@ -462,6 +474,7 @@ typedef struct { ...@@ -462,6 +474,7 @@ typedef struct {
typedef struct { typedef struct {
SMsgHead head; SMsgHead head;
int8_t extend;
char version[TSDB_VERSION_LEN]; char version[TSDB_VERSION_LEN];
bool stableQuery; // super table query or not bool stableQuery; // super table query or not
...@@ -513,6 +526,7 @@ typedef struct { ...@@ -513,6 +526,7 @@ typedef struct {
} SQueryTableMsg; } SQueryTableMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t code; int32_t code;
union{uint64_t qhandle; uint64_t qId;}; // query handle union{uint64_t qhandle; uint64_t qId;}; // query handle
} SQueryTableRsp; } SQueryTableRsp;
...@@ -520,11 +534,13 @@ typedef struct { ...@@ -520,11 +534,13 @@ typedef struct {
// todo: the show handle should be replaced with id // todo: the show handle should be replaced with id
typedef struct { typedef struct {
SMsgHead header; SMsgHead header;
int8_t extend;
union{uint64_t qhandle; uint64_t qId;}; // query handle union{uint64_t qhandle; uint64_t qId;}; // query handle
uint16_t free; uint16_t free;
} SRetrieveTableMsg; } SRetrieveTableMsg;
typedef struct SRetrieveTableRsp { typedef struct SRetrieveTableRsp {
int8_t extend;
int32_t numOfRows; int32_t numOfRows;
int8_t completed; // all results are returned to client int8_t completed; // all results are returned to client
int16_t precision; int16_t precision;
...@@ -550,6 +566,7 @@ typedef struct { ...@@ -550,6 +566,7 @@ typedef struct {
} SVnodeLoad; } SVnodeLoad;
typedef struct { typedef struct {
int8_t extend;
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]; char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
int32_t cacheBlockSize; //MB int32_t cacheBlockSize; //MB
int32_t totalBlocks; int32_t totalBlocks;
...@@ -576,6 +593,7 @@ typedef struct { ...@@ -576,6 +593,7 @@ typedef struct {
} SCreateDbMsg, SAlterDbMsg; } SCreateDbMsg, SAlterDbMsg;
typedef struct { typedef struct {
int8_t extend;
char name[TSDB_FUNC_NAME_LEN]; char name[TSDB_FUNC_NAME_LEN];
char path[PATH_MAX]; char path[PATH_MAX];
int32_t funcType; int32_t funcType;
...@@ -587,11 +605,13 @@ typedef struct { ...@@ -587,11 +605,13 @@ typedef struct {
} SCreateFuncMsg; } SCreateFuncMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t num; int32_t num;
char name[]; char name[];
} SRetrieveFuncMsg; } SRetrieveFuncMsg;
typedef struct { typedef struct {
int8_t extend;
char name[TSDB_FUNC_NAME_LEN]; char name[TSDB_FUNC_NAME_LEN];
int32_t funcType; int32_t funcType;
int8_t resType; int8_t resType;
...@@ -602,15 +622,18 @@ typedef struct { ...@@ -602,15 +622,18 @@ typedef struct {
} SFunctionInfoMsg; } SFunctionInfoMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t num; int32_t num;
char content[]; char content[];
} SUdfFuncMsg; } SUdfFuncMsg;
typedef struct { typedef struct {
int8_t extend;
char name[TSDB_FUNC_NAME_LEN]; char name[TSDB_FUNC_NAME_LEN];
} SDropFuncMsg; } SDropFuncMsg;
typedef struct { typedef struct {
int8_t extend;
char db[TSDB_TABLE_FNAME_LEN]; char db[TSDB_TABLE_FNAME_LEN];
uint8_t ignoreNotExists; uint8_t ignoreNotExists;
} SDropDbMsg, SUseDbMsg, SSyncDbMsg; } SDropDbMsg, SUseDbMsg, SSyncDbMsg;
...@@ -743,12 +766,14 @@ typedef struct { ...@@ -743,12 +766,14 @@ typedef struct {
} SCreateVnodeMsg, SAlterVnodeMsg; } SCreateVnodeMsg, SAlterVnodeMsg;
typedef struct { typedef struct {
int8_t extend;
char tableFname[TSDB_TABLE_FNAME_LEN]; char tableFname[TSDB_TABLE_FNAME_LEN];
int16_t createFlag; int16_t createFlag;
char tags[]; char tags[];
} STableInfoMsg; } STableInfoMsg;
typedef struct { typedef struct {
int8_t extend;
uint8_t metaClone; // create local clone of the cached table meta uint8_t metaClone; // create local clone of the cached table meta
int32_t numOfVgroups; int32_t numOfVgroups;
int32_t numOfTables; int32_t numOfTables;
...@@ -757,21 +782,25 @@ typedef struct { ...@@ -757,21 +782,25 @@ typedef struct {
} SMultiTableInfoMsg; } SMultiTableInfoMsg;
typedef struct SSTableVgroupMsg { typedef struct SSTableVgroupMsg {
int8_t extend;
int32_t numOfTables; int32_t numOfTables;
} SSTableVgroupMsg, SSTableVgroupRspMsg; } SSTableVgroupMsg, SSTableVgroupRspMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t vgId; int32_t vgId;
int8_t numOfEps; int8_t numOfEps;
SEpAddrMsg epAddr[TSDB_MAX_REPLICA]; SEpAddrMsg epAddr[TSDB_MAX_REPLICA];
} SVgroupMsg, SVgroupInfo; } SVgroupMsg, SVgroupInfo;
typedef struct { typedef struct {
int8_t extend;
int32_t numOfVgroups; int32_t numOfVgroups;
SVgroupMsg vgroups[]; SVgroupMsg vgroups[];
} SVgroupsMsg, SVgroupsInfo; } SVgroupsMsg, SVgroupsInfo;
typedef struct STableMetaMsg { typedef struct STableMetaMsg {
int8_t extend;
int32_t contLen; int32_t contLen;
char tableFname[TSDB_TABLE_FNAME_LEN]; // table id char tableFname[TSDB_TABLE_FNAME_LEN]; // table id
uint8_t numOfTags; uint8_t numOfTags;
...@@ -813,6 +842,7 @@ typedef struct { ...@@ -813,6 +842,7 @@ typedef struct {
* payloadLen is the length of payload * payloadLen is the length of payload
*/ */
typedef struct { typedef struct {
int8_t extend;
int8_t type; int8_t type;
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]; char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
uint16_t payloadLen; uint16_t payloadLen;
...@@ -820,17 +850,20 @@ typedef struct { ...@@ -820,17 +850,20 @@ typedef struct {
} SShowMsg; } SShowMsg;
typedef struct { typedef struct {
int8_t extend;
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]; char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
int32_t numOfVgroup; int32_t numOfVgroup;
int32_t vgid[]; int32_t vgid[];
} SCompactMsg; } SCompactMsg;
typedef struct SShowRsp { typedef struct SShowRsp {
int8_t extend;
uint64_t qhandle; uint64_t qhandle;
STableMetaMsg tableMeta; STableMetaMsg tableMeta;
} SShowRsp; } SShowRsp;
typedef struct { typedef struct {
int8_t extend;
char ep[TSDB_EP_LEN]; // end point, hostname:port char ep[TSDB_EP_LEN]; // end point, hostname:port
} SCreateDnodeMsg, SDropDnodeMsg; } SCreateDnodeMsg, SDropDnodeMsg;
...@@ -852,6 +885,7 @@ typedef struct { ...@@ -852,6 +885,7 @@ typedef struct {
} SConfigVnodeMsg; } SConfigVnodeMsg;
typedef struct { typedef struct {
int8_t extend;
char ep[TSDB_EP_LEN]; // end point, hostname:port char ep[TSDB_EP_LEN]; // end point, hostname:port
char config[64]; char config[64];
} SCfgDnodeMsg; } SCfgDnodeMsg;
...@@ -883,6 +917,7 @@ typedef struct { ...@@ -883,6 +917,7 @@ typedef struct {
} SStreamDesc; } SStreamDesc;
typedef struct { typedef struct {
int8_t extend;
char clientVer[TSDB_VERSION_LEN]; char clientVer[TSDB_VERSION_LEN];
uint32_t connId; uint32_t connId;
int32_t pid; int32_t pid;
...@@ -893,6 +928,7 @@ typedef struct { ...@@ -893,6 +928,7 @@ typedef struct {
} SHeartBeatMsg; } SHeartBeatMsg;
typedef struct { typedef struct {
int8_t extend;
uint32_t queryId; uint32_t queryId;
uint32_t streamId; uint32_t streamId;
uint32_t totalDnodes; uint32_t totalDnodes;
...@@ -903,10 +939,12 @@ typedef struct { ...@@ -903,10 +939,12 @@ typedef struct {
} SHeartBeatRsp; } SHeartBeatRsp;
typedef struct { typedef struct {
int8_t extend;
char queryId[TSDB_KILL_MSG_LEN + 1]; char queryId[TSDB_KILL_MSG_LEN + 1];
} SKillQueryMsg, SKillStreamMsg, SKillConnMsg; } SKillQueryMsg, SKillStreamMsg, SKillConnMsg;
typedef struct { typedef struct {
int8_t extend;
int32_t vnode; int32_t vnode;
int32_t sid; int32_t sid;
uint64_t uid; uint64_t uid;
...@@ -931,6 +969,16 @@ typedef struct { ...@@ -931,6 +969,16 @@ typedef struct {
char reserved2[64]; char reserved2[64];
} SStartupStep; } SStartupStep;
typedef struct {
int16_t type;
int32_t len;
char value[];
} STLV;
enum {
TLV_TYPE_DUMMY = 1,
};
#pragma pack(pop) #pragma pack(pop)
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -8129,6 +8129,32 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { ...@@ -8129,6 +8129,32 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) {
goto _cleanup; goto _cleanup;
} }
/*
//MSG EXTEND DEMO
if (pQueryMsg->extend) {
pMsg += pQueryMsg->sqlstrLen;
STLV *tlv = NULL;
while (1) {
tlv = (STLV *)pMsg;
tlv->type = ntohs(tlv->type);
tlv->len = ntohl(tlv->len);
if (tlv->len > 0) {
*(int16_t *)tlv->value = ntohs(*(int16_t *)tlv->value);
qDebug("Got TLV,type:%d,len:%d,value:%d", tlv->type, tlv->len, *(int16_t*)tlv->value);
pMsg += sizeof(*tlv) + tlv->len;
continue;
}
break;
}
}
*/
qDebug("qmsg:%p query %d tables, type:%d, qrange:%" PRId64 "-%" PRId64 ", numOfGroupbyTagCols:%d, order:%d, " qDebug("qmsg:%p query %d tables, type:%d, qrange:%" PRId64 "-%" PRId64 ", numOfGroupbyTagCols:%d, order:%d, "
"outputCols:%d, numOfCols:%d, interval:%" PRId64 ", fillType:%d, comptsLen:%d, compNumOfBlocks:%d, limit:%" PRId64 ", offset:%" PRId64, "outputCols:%d, numOfCols:%d, interval:%" PRId64 ", fillType:%d, comptsLen:%d, compNumOfBlocks:%d, limit:%" PRId64 ", offset:%" PRId64,
pQueryMsg, pQueryMsg->numOfTables, pQueryMsg->queryType, pQueryMsg->window.skey, pQueryMsg->window.ekey, pQueryMsg->numOfGroupCols, pQueryMsg, pQueryMsg->numOfTables, pQueryMsg->queryType, pQueryMsg->window.skey, pQueryMsg->window.ekey, pQueryMsg->numOfGroupCols,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册