Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a0ae0c78
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a0ae0c78
编写于
8月 25, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: update table meta after auto creating table
上级
c2b16acc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
33 deletion
+72
-33
include/common/tmsg.h
include/common/tmsg.h
+31
-27
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+6
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+29
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+6
-6
未找到文件。
include/common/tmsg.h
浏览文件 @
a0ae0c78
...
...
@@ -268,6 +268,35 @@ STSRow* tGetSubmitBlkNext(SSubmitBlkIter* pIter);
// for debug
int32_t
tPrintFixedSchemaSubmitReq
(
SSubmitReq
*
pReq
,
STSchema
*
pSchema
);
struct
SSchema
{
int8_t
type
;
int8_t
flags
;
col_id_t
colId
;
int32_t
bytes
;
char
name
[
TSDB_COL_NAME_LEN
];
};
typedef
struct
{
char
tbName
[
TSDB_TABLE_NAME_LEN
];
char
stbName
[
TSDB_TABLE_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
int64_t
dbId
;
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
precision
;
int8_t
tableType
;
int32_t
sversion
;
int32_t
tversion
;
uint64_t
suid
;
uint64_t
tuid
;
int32_t
vgId
;
int8_t
sysInfo
;
SSchema
*
pSchemas
;
}
STableMetaRsp
;
typedef
struct
{
int32_t
code
;
int8_t
hashMeta
;
...
...
@@ -276,6 +305,7 @@ typedef struct {
int32_t
numOfRows
;
int32_t
affectedRows
;
int64_t
sver
;
STableMetaRsp
*
pMeta
;
}
SSubmitBlkRsp
;
typedef
struct
{
...
...
@@ -290,6 +320,7 @@ typedef struct {
int32_t
tEncodeSSubmitRsp
(
SEncoder
*
pEncoder
,
const
SSubmitRsp
*
pRsp
);
int32_t
tDecodeSSubmitRsp
(
SDecoder
*
pDecoder
,
SSubmitRsp
*
pRsp
);
void
tFreeSSubmitBlkRsp
(
void
*
param
);
void
tFreeSSubmitRsp
(
SSubmitRsp
*
pRsp
);
#define COL_SMA_ON ((int8_t)0x1)
...
...
@@ -297,13 +328,6 @@ void tFreeSSubmitRsp(SSubmitRsp* pRsp);
#define COL_SET_NULL ((int8_t)0x10)
#define COL_SET_VAL ((int8_t)0x20)
#define COL_IS_SYSINFO ((int8_t)0x40)
struct
SSchema
{
int8_t
type
;
int8_t
flags
;
col_id_t
colId
;
int32_t
bytes
;
char
name
[
TSDB_COL_NAME_LEN
];
};
#define COL_IS_SET(FLG) (((FLG) & (COL_SET_VAL | COL_SET_NULL)) != 0)
#define COL_CLR_SET(FLG) ((FLG) &= (~(COL_SET_VAL | COL_SET_NULL)))
...
...
@@ -442,26 +466,6 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapperEx(SDecoder* pDecoder, SSchemaW
STSchema
*
tdGetSTSChemaFromSSChema
(
SSchema
*
pSchema
,
int32_t
nCols
,
int32_t
sver
);
typedef
struct
{
char
tbName
[
TSDB_TABLE_NAME_LEN
];
char
stbName
[
TSDB_TABLE_NAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
int64_t
dbId
;
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
precision
;
int8_t
tableType
;
int32_t
sversion
;
int32_t
tversion
;
uint64_t
suid
;
uint64_t
tuid
;
int32_t
vgId
;
int8_t
sysInfo
;
SSchema
*
pSchemas
;
}
STableMetaRsp
;
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
igExists
;
...
...
source/client/src/clientImpl.c
浏览文件 @
a0ae0c78
...
...
@@ -723,6 +723,12 @@ int32_t handleSubmitExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog
for
(
int32_t
i
=
0
;
i
<
pRsp
->
nBlocks
;
++
i
)
{
SSubmitBlkRsp
*
blk
=
pRsp
->
pBlocks
+
i
;
if
(
blk
->
pMeta
)
{
handleCreateTbExecRes
(
blk
->
pMeta
,
pCatalog
);
tFreeSTableMetaRsp
(
blk
->
pMeta
);
taosMemoryFreeClear
(
blk
->
pMeta
);
}
if
(
NULL
==
blk
->
tblFName
||
0
==
blk
->
tblFName
[
0
])
{
continue
;
}
...
...
source/common/src/tmsg.c
浏览文件 @
a0ae0c78
...
...
@@ -5324,6 +5324,10 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
if
(
tEncodeI32v
(
pEncoder
,
pBlock
->
numOfRows
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pBlock
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tEncodeI64v
(
pEncoder
,
pBlock
->
sver
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pBlock
->
pMeta
?
1
:
0
)
<
0
)
return
-
1
;
if
(
pBlock
->
pMeta
)
{
if
(
tEncodeSTableMetaRsp
(
pEncoder
,
pBlock
->
pMeta
)
<
0
)
return
-
1
;
}
tEndEncode
(
pEncoder
);
return
0
;
...
...
@@ -5341,6 +5345,16 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
if
(
tDecodeI32v
(
pDecoder
,
&
pBlock
->
numOfRows
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pBlock
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tDecodeI64v
(
pDecoder
,
&
pBlock
->
sver
)
<
0
)
return
-
1
;
int32_t
meta
=
0
;
if
(
tDecodeI32
(
pDecoder
,
&
meta
)
<
0
)
return
-
1
;
if
(
meta
)
{
pBlock
->
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
STableMetaRsp
));
if
(
NULL
==
pBlock
->
pMeta
)
return
-
1
;
if
(
tDecodeSTableMetaRsp
(
pDecoder
,
pBlock
->
pMeta
)
<
0
)
return
-
1
;
}
else
{
pBlock
->
pMeta
=
NULL
;
}
tEndDecode
(
pDecoder
);
return
0
;
...
...
@@ -5379,6 +5393,21 @@ int32_t tDecodeSSubmitRsp(SDecoder *pDecoder, SSubmitRsp *pRsp) {
return
0
;
}
void
tFreeSSubmitBlkRsp
(
void
*
param
)
{
if
(
NULL
==
param
)
{
return
;
}
SSubmitBlkRsp
*
pRsp
=
(
SSubmitBlkRsp
*
)
param
;
taosMemoryFree
(
pRsp
->
tblFName
);
if
(
pRsp
->
pMeta
)
{
taosMemoryFree
(
pRsp
->
pMeta
->
pSchemas
);
taosMemoryFree
(
pRsp
->
pMeta
);
}
}
void
tFreeSSubmitRsp
(
SSubmitRsp
*
pRsp
)
{
if
(
NULL
==
pRsp
)
return
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
a0ae0c78
...
...
@@ -867,7 +867,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
goto
_exit
;
}
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
&
createTbReq
,
NULL
)
<
0
)
{
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
&
createTbReq
,
&
submitBlkRsp
.
pMeta
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
)
{
submitBlkRsp
.
code
=
terrno
;
pRsp
->
code
=
terrno
;
...
...
@@ -875,6 +875,10 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
taosArrayDestroy
(
createTbReq
.
ctb
.
tagName
);
goto
_exit
;
}
}
else
{
if
(
NULL
!=
submitBlkRsp
.
pMeta
)
{
vnodeUpdateMetaRsp
(
pVnode
,
submitBlkRsp
.
pMeta
);
}
}
taosArrayPush
(
newTbUids
,
&
createTbReq
.
uid
);
...
...
@@ -918,11 +922,7 @@ _exit:
tEncodeSSubmitRsp
(
&
encoder
,
&
submitRsp
);
tEncoderClear
(
&
encoder
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
submitRsp
.
pArray
);
i
++
)
{
taosMemoryFree
(((
SSubmitBlkRsp
*
)
taosArrayGet
(
submitRsp
.
pArray
,
i
))[
0
].
tblFName
);
}
taosArrayDestroy
(
submitRsp
.
pArray
);
taosArrayDestroyEx
(
submitRsp
.
pArray
,
tFreeSSubmitBlkRsp
);
// TODO: the partial success scenario and the error case
// => If partial success, extract the success submitted rows and reconstruct a new submit msg, and push to level
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录