Merge pull request #9248 from taosdata/feature/vnode
Merge branch '3.0' into feature/vnode
This commit is contained in:
commit
c684d1b3c1
|
@ -170,14 +170,41 @@ typedef struct {
|
||||||
char info[];
|
char info[];
|
||||||
} SVnodeRsp;
|
} SVnodeRsp;
|
||||||
|
|
||||||
#define VNODE_INIT_CREATE_STB_REQ(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
|
static FORCE_INLINE void vnodeSetCreateStbReq(SVnodeReq *pReq, char *name, uint32_t ttl, uint32_t keep, tb_uid_t suid,
|
||||||
{ .ver = 0, .ctReq = META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) }
|
STSchema *pSchema, STSchema *pTagSchema) {
|
||||||
|
pReq->ver = 0;
|
||||||
|
|
||||||
#define VNODE_INIT_CREATE_CTB_REQ(NAME, TTL, KEEP, SUID, PTAG) \
|
pReq->ctReq.name = name;
|
||||||
{ .ver = 0, .ctReq = META_INIT_CTB_CFG(NAME, TTL, KEEP, SUID, PTAG) }
|
pReq->ctReq.ttl = ttl;
|
||||||
|
pReq->ctReq.keep = keep;
|
||||||
|
pReq->ctReq.type = META_SUPER_TABLE;
|
||||||
|
pReq->ctReq.stbCfg.suid = suid;
|
||||||
|
pReq->ctReq.stbCfg.pSchema = pSchema;
|
||||||
|
pReq->ctReq.stbCfg.pTagSchema = pTagSchema;
|
||||||
|
}
|
||||||
|
|
||||||
#define VNODE_INIT_CREATE_NTB_REQ(NAME, TTL, KEEP, SUID, PSCHEMA) \
|
static FORCE_INLINE void vnodeSetCreateCtbReq(SVnodeReq *pReq, char *name, uint32_t ttl, uint32_t keep, tb_uid_t suid,
|
||||||
{ .ver = 0, .ctReq = META_INIT_NTB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA) }
|
SKVRow pTag) {
|
||||||
|
pReq->ver = 0;
|
||||||
|
|
||||||
|
pReq->ctReq.name = name;
|
||||||
|
pReq->ctReq.ttl = ttl;
|
||||||
|
pReq->ctReq.keep = keep;
|
||||||
|
pReq->ctReq.type = META_CHILD_TABLE;
|
||||||
|
pReq->ctReq.ctbCfg.suid = suid;
|
||||||
|
pReq->ctReq.ctbCfg.pTag = pTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void vnodeSetCreateNtbReq(SVnodeReq *pReq, char *name, uint32_t ttl, uint32_t keep,
|
||||||
|
STSchema *pSchema) {
|
||||||
|
pReq->ver = 0;
|
||||||
|
|
||||||
|
pReq->ctReq.name = name;
|
||||||
|
pReq->ctReq.ttl = ttl;
|
||||||
|
pReq->ctReq.keep = keep;
|
||||||
|
pReq->ctReq.type = META_NORMAL_TABLE;
|
||||||
|
pReq->ctReq.ntbCfg.pSchema = pSchema;
|
||||||
|
}
|
||||||
|
|
||||||
int vnodeBuildReq(void **buf, const SVnodeReq *pReq, uint8_t type);
|
int vnodeBuildReq(void **buf, const SVnodeReq *pReq, uint8_t type);
|
||||||
void *vnodeParseReq(void *buf, SVnodeReq *pReq, uint8_t type);
|
void *vnodeParseReq(void *buf, SVnodeReq *pReq, uint8_t type);
|
||||||
|
|
|
@ -81,7 +81,8 @@ static void vtBuildCreateStbReq(tb_uid_t suid, char *tbname, SRpcMsg **ppMsg) {
|
||||||
pSchema = vtCreateBasicSchema();
|
pSchema = vtCreateBasicSchema();
|
||||||
pTagSchema = vtCreateBasicTagSchema();
|
pTagSchema = vtCreateBasicTagSchema();
|
||||||
|
|
||||||
SVnodeReq vCreateSTbReq = VNODE_INIT_CREATE_STB_REQ(tbname, UINT32_MAX, UINT32_MAX, suid, pSchema, pTagSchema);
|
SVnodeReq vCreateSTbReq;
|
||||||
|
vnodeSetCreateStbReq(&vCreateSTbReq, tbname, UINT32_MAX, UINT32_MAX, suid, pSchema, pTagSchema);
|
||||||
|
|
||||||
zs = vnodeBuildReq(NULL, &vCreateSTbReq, TSDB_MSG_TYPE_CREATE_TABLE);
|
zs = vnodeBuildReq(NULL, &vCreateSTbReq, TSDB_MSG_TYPE_CREATE_TABLE);
|
||||||
pMsg = (SRpcMsg *)malloc(sizeof(SRpcMsg) + zs);
|
pMsg = (SRpcMsg *)malloc(sizeof(SRpcMsg) + zs);
|
||||||
|
@ -104,7 +105,8 @@ static void vtBuildCreateCtbReq(tb_uid_t suid, char *tbname, SRpcMsg **ppMsg) {
|
||||||
int tz;
|
int tz;
|
||||||
SKVRow pTag = vtCreateBasicTag();
|
SKVRow pTag = vtCreateBasicTag();
|
||||||
|
|
||||||
SVnodeReq vCreateCTbReq = VNODE_INIT_CREATE_CTB_REQ(tbname, UINT32_MAX, UINT32_MAX, suid, pTag);
|
SVnodeReq vCreateCTbReq;
|
||||||
|
vnodeSetCreateCtbReq(&vCreateCTbReq, tbname, UINT32_MAX, UINT32_MAX, suid, pTag);
|
||||||
|
|
||||||
tz = vnodeBuildReq(NULL, &vCreateCTbReq, TSDB_MSG_TYPE_CREATE_TABLE);
|
tz = vnodeBuildReq(NULL, &vCreateCTbReq, TSDB_MSG_TYPE_CREATE_TABLE);
|
||||||
pMsg = (SRpcMsg *)malloc(sizeof(SRpcMsg) + tz);
|
pMsg = (SRpcMsg *)malloc(sizeof(SRpcMsg) + tz);
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
|
||||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
Loading…
Reference in New Issue