Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aed53ac9
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aed53ac9
编写于
5月 06, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: create table if not exists
上级
c7eaa2a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
8 deletion
+12
-8
include/common/tmsg.h
include/common/tmsg.h
+2
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+5
-5
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+5
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
aed53ac9
...
@@ -672,7 +672,6 @@ typedef struct {
...
@@ -672,7 +672,6 @@ typedef struct {
SArray
*
pArray
;
// Array of SUseDbRsp
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
}
SUseDbBatchRsp
;
int32_t
tSerializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
int32_t
tSerializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
int32_t
tDeserializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
int32_t
tDeserializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
void
tFreeSUseDbBatchRsp
(
SUseDbBatchRsp
*
pRsp
);
void
tFreeSUseDbBatchRsp
(
SUseDbBatchRsp
*
pRsp
);
...
@@ -685,7 +684,6 @@ int32_t tSerializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp
...
@@ -685,7 +684,6 @@ int32_t tSerializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
);
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
);
void
tFreeSUserAuthBatchRsp
(
SUserAuthBatchRsp
*
pRsp
);
void
tFreeSUserAuthBatchRsp
(
SUserAuthBatchRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
}
SCompactDbReq
;
}
SCompactDbReq
;
...
@@ -1554,7 +1552,9 @@ typedef struct SVDropStbReq {
...
@@ -1554,7 +1552,9 @@ typedef struct SVDropStbReq {
int32_t
tEncodeSVDropStbReq
(
SCoder
*
pCoder
,
const
SVDropStbReq
*
pReq
);
int32_t
tEncodeSVDropStbReq
(
SCoder
*
pCoder
,
const
SVDropStbReq
*
pReq
);
int32_t
tDecodeSVDropStbReq
(
SCoder
*
pCoder
,
SVDropStbReq
*
pReq
);
int32_t
tDecodeSVDropStbReq
(
SCoder
*
pCoder
,
SVDropStbReq
*
pReq
);
#define TD_CREATE_IF_NOT_EXISTS 0x1
typedef
struct
SVCreateTbReq
{
typedef
struct
SVCreateTbReq
{
int32_t
flags
;
tb_uid_t
uid
;
tb_uid_t
uid
;
int64_t
ctime
;
int64_t
ctime
;
const
char
*
name
;
const
char
*
name
;
...
...
source/common/src/tmsg.c
浏览文件 @
aed53ac9
...
@@ -1255,7 +1255,6 @@ int32_t tDeserializeSGetUserAuthRspImpl(SCoder *pDecoder, SGetUserAuthRsp *pRsp)
...
@@ -1255,7 +1255,6 @@ int32_t tDeserializeSGetUserAuthRspImpl(SCoder *pDecoder, SGetUserAuthRsp *pRsp)
return
0
;
return
0
;
}
}
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
@@ -2091,7 +2090,7 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp *pRsp) {
...
@@ -2091,7 +2090,7 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp *pRsp) {
taosArrayDestroy
(
pRsp
->
pArray
);
taosArrayDestroy
(
pRsp
->
pArray
);
}
}
int32_t
tSerializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
int32_t
tSerializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
@@ -2110,7 +2109,7 @@ int32_t tSerializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp
...
@@ -2110,7 +2109,7 @@ int32_t tSerializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchRsp
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
int32_t
tDeserializeSUserAuthBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserAuthBatchRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
@@ -2136,7 +2135,7 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR
...
@@ -2136,7 +2135,7 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR
return
0
;
return
0
;
}
}
void
tFreeSUserAuthBatchRsp
(
SUserAuthBatchRsp
*
pRsp
)
{
void
tFreeSUserAuthBatchRsp
(
SUserAuthBatchRsp
*
pRsp
)
{
int32_t
numOfBatch
=
taosArrayGetSize
(
pRsp
->
pArray
);
int32_t
numOfBatch
=
taosArrayGetSize
(
pRsp
->
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOfBatch
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBatch
;
++
i
)
{
SGetUserAuthRsp
*
pUserAuthRsp
=
taosArrayGet
(
pRsp
->
pArray
,
i
);
SGetUserAuthRsp
*
pUserAuthRsp
=
taosArrayGet
(
pRsp
->
pArray
,
i
);
...
@@ -2146,7 +2145,6 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp){
...
@@ -2146,7 +2145,6 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp){
taosArrayDestroy
(
pRsp
->
pArray
);
taosArrayDestroy
(
pRsp
->
pArray
);
}
}
int32_t
tSerializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
int32_t
tSerializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
@@ -3746,6 +3744,7 @@ STSchema *tdGetSTSChemaFromSSChema(SSchema **pSchema, int32_t nCols) {
...
@@ -3746,6 +3744,7 @@ STSchema *tdGetSTSChemaFromSSChema(SSchema **pSchema, int32_t nCols) {
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctime
)
<
0
)
return
-
1
;
...
@@ -3771,6 +3770,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -3771,6 +3770,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
flags
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctime
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
aed53ac9
...
@@ -360,7 +360,11 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -360,7 +360,11 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
// do create table
// do create table
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
pCreateReq
)
<
0
)
{
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
pCreateReq
)
<
0
)
{
cRsp
.
code
=
terrno
;
if
(
pCreateReq
->
flags
&
TD_CREATE_IF_NOT_EXISTS
&&
terrno
==
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
)
{
cRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
else
{
cRsp
.
code
=
terrno
;
}
}
else
{
}
else
{
cRsp
.
code
=
TSDB_CODE_SUCCESS
;
cRsp
.
code
=
TSDB_CODE_SUCCESS
;
tsdbFetchTbUidList
(
pVnode
->
pTsdb
,
&
pStore
,
pCreateReq
->
ctb
.
suid
,
pCreateReq
->
uid
);
tsdbFetchTbUidList
(
pVnode
->
pTsdb
,
&
pStore
,
pCreateReq
->
ctb
.
suid
,
pCreateReq
->
uid
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录