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