Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40b841f7
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
40b841f7
编写于
6月 11, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:error in schemaless
上级
e45a9903
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
146 addition
and
237 deletion
+146
-237
source/client/src/clientSml.c
source/client/src/clientSml.c
+17
-13
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+129
-224
未找到文件。
source/client/src/clientSml.c
浏览文件 @
40b841f7
...
...
@@ -161,7 +161,6 @@ typedef struct {
typedef
struct
{
SRequestObj
*
request
;
SCatalog
*
catalog
;
tsem_t
sem
;
TdThreadSpinlock
lock
;
}
Params
;
...
...
@@ -1461,6 +1460,11 @@ static SSmlHandle* smlBuildSmlInfo(TAOS* taos, SRequestObj* request, SMLProtocol
((
SVnodeModifOpStmt
*
)(
info
->
pQuery
->
pRoot
))
->
payloadType
=
PAYLOAD_TYPE_KV
;
info
->
taos
=
(
STscObj
*
)
taos
;
code
=
catalogGetHandle
(
info
->
taos
->
pAppInfo
->
clusterId
,
&
info
->
pCatalog
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML:0x%"
PRIx64
" get catalog error %d"
,
info
->
id
,
code
);
goto
cleanup
;
}
info
->
precision
=
precision
;
info
->
protocol
=
protocol
;
...
...
@@ -2238,6 +2242,7 @@ static int32_t smlInsertData(SSmlHandle* info) {
code
=
smlBindData
(
info
->
exec
,
tableData
->
tags
,
(
*
pMeta
)
->
cols
,
tableData
->
cols
,
info
->
dataFormat
,
(
*
pMeta
)
->
tableMeta
,
tableData
->
childTableName
,
info
->
msgBuf
.
buf
,
info
->
msgBuf
.
len
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML:0x%"
PRIx64
" smlBindData failed"
,
info
->
id
);
return
code
;
}
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
oneTable
);
...
...
@@ -2332,7 +2337,14 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) {
return
code
;
}
static
int32_t
isSchemalessDb
(
STscObj
*
taos
,
SCatalog
*
catalog
){
static
int32_t
isSchemalessDb
(
STscObj
*
taos
){
SCatalog
*
catalog
=
NULL
;
int32_t
code
=
catalogGetHandle
(((
STscObj
*
)
taos
)
->
pAppInfo
->
clusterId
,
&
catalog
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML get catalog error %d"
,
code
);
return
code
;
}
SName
name
;
tNameSetDbName
(
&
name
,
taos
->
acctId
,
taos
->
db
,
strlen
(
taos
->
db
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
...
...
@@ -2340,7 +2352,7 @@ static int32_t isSchemalessDb(STscObj *taos, SCatalog *catalog){
SDbCfgInfo
pInfo
=
{
0
};
SEpSet
ep
=
getEpSet_s
(
&
taos
->
pAppInfo
->
mgmtEp
);
int32_t
code
=
catalogGetDBCfg
(
catalog
,
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
dbFname
,
&
pInfo
);
code
=
catalogGetDBCfg
(
catalog
,
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
dbFname
,
&
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2414,20 +2426,13 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
tsem_init
(
&
params
.
sem
,
0
,
0
);
taosThreadSpinInit
(
&
(
params
.
lock
),
0
);
int32_t
code
=
catalogGetHandle
(((
STscObj
*
)
taos
)
->
pAppInfo
->
clusterId
,
&
params
.
catalog
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML get catalog error %d"
,
code
);
request
->
code
=
code
;
goto
end
;
}
if
(
request
->
pDb
==
NULL
){
request
->
code
=
TSDB_CODE_PAR_DB_NOT_SPECIFIED
;
smlBuildInvalidDataMsg
(
&
msg
,
"Database not specified"
,
NULL
);
goto
end
;
}
if
(
isSchemalessDb
(((
STscObj
*
)
taos
)
,
params
.
catalog
)
!=
TSDB_CODE_SUCCESS
){
if
(
isSchemalessDb
(((
STscObj
*
)
taos
))
!=
TSDB_CODE_SUCCESS
){
request
->
code
=
TSDB_CODE_SML_INVALID_DB_CONF
;
smlBuildInvalidDataMsg
(
&
msg
,
"Cannot write data to a non schemaless database"
,
NULL
);
goto
end
;
...
...
@@ -2477,11 +2482,10 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
}
info
->
params
=
&
params
;
info
->
pCatalog
=
params
.
catalog
;
info
->
affectedRows
=
perBatch
;
info
->
pRequest
->
body
.
queryFp
=
smlInsertCallback
;
info
->
pRequest
->
body
.
param
=
info
;
code
=
smlProcess
(
info
,
lines
,
perBatch
);
int32_t
code
=
smlProcess
(
info
,
lines
,
perBatch
);
lines
+=
perBatch
;
if
(
code
!=
TSDB_CODE_SUCCESS
){
info
->
pRequest
->
body
.
queryFp
(
info
,
req
,
code
);
...
...
source/client/test/smlTest.cpp
浏览文件 @
40b841f7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录