Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d5328b7a
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
d5328b7a
编写于
3月 17, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add log for schmaless
上级
4fdef742
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
13 deletion
+43
-13
source/client/src/clientSml.c
source/client/src/clientSml.c
+38
-10
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+2
-0
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+2
-2
source/util/src/tlog.c
source/util/src/tlog.c
+1
-1
未找到文件。
source/client/src/clientSml.c
浏览文件 @
d5328b7a
...
...
@@ -743,6 +743,7 @@ end:
}
static
int32_t
smlModifyDBSchemas
(
SSmlHandle
*
info
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas start, format:%d, needModifySchema:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
needModifySchema
);
if
(
info
->
dataFormat
&&
!
info
->
needModifySchema
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -772,6 +773,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
if
(
code
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
||
code
==
TSDB_CODE_MND_STB_NOT_EXIST
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas create table:%s"
,
info
->
id
,
pName
.
tname
);
SArray
*
pColumns
=
taosArrayInit
(
taosArrayGetSize
(
sTableData
->
cols
),
sizeof
(
SField
));
SArray
*
pTags
=
taosArrayInit
(
taosArrayGetSize
(
sTableData
->
tags
),
sizeof
(
SField
));
smlBuildFieldsList
(
info
,
NULL
,
NULL
,
sTableData
->
tags
,
pTags
,
0
,
true
);
...
...
@@ -804,6 +806,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
goto
end
;
}
if
(
action
!=
SCHEMA_ACTION_NULL
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas change table tag, table:%s, action:%d"
,
info
->
id
,
pName
.
tname
,
action
);
SArray
*
pColumns
=
taosArrayInit
(
taosArrayGetSize
(
sTableData
->
cols
)
+
pTableMeta
->
tableInfo
.
numOfColumns
,
sizeof
(
SField
));
SArray
*
pTags
=
...
...
@@ -851,6 +854,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
goto
end
;
}
if
(
action
!=
SCHEMA_ACTION_NULL
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas change table col, table:%s, action:%d"
,
info
->
id
,
pName
.
tname
,
action
);
SArray
*
pColumns
=
taosArrayInit
(
taosArrayGetSize
(
sTableData
->
cols
)
+
pTableMeta
->
tableInfo
.
numOfColumns
,
sizeof
(
SField
));
SArray
*
pTags
=
...
...
@@ -913,15 +917,19 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
}
sTableData
->
tableMeta
=
pTableMeta
;
uDebug
(
"SML:0x%"
PRIx64
"modify schema uid:%"
PRIu64
", sversion:%d, tversion:%d"
,
info
->
id
,
pTableMeta
->
uid
,
pTableMeta
->
sversion
,
pTableMeta
->
tversion
)
tmp
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tmp
);
}
uDebug
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas end success, format:%d, needModifySchema:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
needModifySchema
);
return
0
;
end:
taosHashCleanup
(
hashTmp
);
taosMemoryFreeClear
(
pTableMeta
);
catalogRefreshTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
1
);
uError
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas end failed:%d:%s, format:%d, needModifySchema:%d"
,
info
->
id
,
code
,
tstrerror
(
code
),
info
->
dataFormat
,
info
->
needModifySchema
);
return
code
;
}
...
...
@@ -997,8 +1005,9 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
}
else
{
size_t
tmp
=
taosArrayGetSize
(
metaArray
);
if
(
tmp
>
INT16_MAX
)
{
smlBuildInvalidDataMsg
(
msg
,
"too many cols or tags"
,
kv
->
key
);
uError
(
"too many cols or tags"
);
return
-
1
;
return
TSDB_CODE_SML_INVALID_DATA
;
}
int16_t
size
=
tmp
;
int
ret
=
taosHashPut
(
metaHash
,
kv
->
key
,
kv
->
keyLen
,
&
size
,
SHORT_BYTES
);
...
...
@@ -1145,6 +1154,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) {
}
static
int32_t
smlParseLineBottom
(
SSmlHandle
*
info
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom start, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
if
(
info
->
dataFormat
)
return
TSDB_CODE_SUCCESS
;
for
(
int32_t
i
=
0
;
i
<
info
->
lineNum
;
i
++
)
{
...
...
@@ -1184,6 +1194,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
SSmlSTableMeta
**
tableMeta
=
(
SSmlSTableMeta
**
)
taosHashGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
);
if
(
tableMeta
)
{
// update meta
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom update meta, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
ret
=
smlUpdateMeta
((
*
tableMeta
)
->
colHash
,
(
*
tableMeta
)
->
cols
,
elements
->
colArray
,
false
,
&
info
->
msgBuf
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
ret
=
smlUpdateMeta
((
*
tableMeta
)
->
tagHash
,
(
*
tableMeta
)
->
tags
,
tinfo
->
tags
,
true
,
&
info
->
msgBuf
);
...
...
@@ -1198,7 +1209,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
// uError("SML:0x%" PRIx64 " smlUpdateMeta failed", info->id);
// return ret;
// }
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom add meta, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
SSmlSTableMeta
*
meta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
smlInsertMeta
(
meta
->
tagHash
,
meta
->
tags
,
tinfo
->
tags
);
if
(
terrno
==
TSDB_CODE_DUP_KEY
){
return
terrno
;}
...
...
@@ -1206,12 +1217,14 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
meta
,
POINTER_BYTES
);
}
}
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom end, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
smlInsertData
(
SSmlHandle
*
info
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
uDebug
(
"SML:0x%"
PRIx64
" smlInsertData start, format:%d"
,
info
->
id
,
info
->
dataFormat
);
if
(
info
->
pRequest
->
dbList
==
NULL
){
info
->
pRequest
->
dbList
=
taosArrayInit
(
1
,
TSDB_DB_FNAME_LEN
);
...
...
@@ -1256,6 +1269,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
// use tablemeta of stable to save vgid and uid of child table
(
*
pMeta
)
->
tableMeta
->
vgId
=
vg
.
vgId
;
(
*
pMeta
)
->
tableMeta
->
uid
=
tableData
->
uid
;
// one table merge data block together according uid
uDebug
(
"SML:0x%"
PRIx64
" smlInsertData table:%s, uid:%"
PRIu64
", format:%d, code:%d,%s"
,
info
->
id
,
pName
.
tname
,
tableData
->
uid
,
info
->
dataFormat
);
code
=
smlBindData
(
info
->
pQuery
,
info
->
dataFormat
,
tableData
->
tags
,
(
*
pMeta
)
->
cols
,
tableData
->
cols
,
(
*
pMeta
)
->
tableMeta
,
tableData
->
childTableName
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
,
...
...
@@ -1278,16 +1292,18 @@ static int32_t smlInsertData(SSmlHandle *info) {
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertsReq
,
1
);
launchQueryImpl
(
info
->
pRequest
,
info
->
pQuery
,
true
,
NULL
);
uDebug
(
"SML:0x%"
PRIx64
" smlInsertData end, format:%d, code:%d,%s"
,
info
->
id
,
info
->
dataFormat
,
info
->
pRequest
->
code
,
tstrerror
(
info
->
pRequest
->
code
));
return
info
->
pRequest
->
code
;
}
static
void
smlPrintStatisticInfo
(
SSmlHandle
*
info
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d,alter stable tag num:%d,alter stable col num:%d \
" smlInsertLines result, code:%d,
msg:%s,
lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d,alter stable tag num:%d,alter stable col num:%d \
parse cost:%"
PRId64
",schema cost:%"
PRId64
",bind cost:%"
PRId64
",rpc cost:%"
PRId64
",total cost:%"
PRId64
""
,
info
->
id
,
info
->
cost
.
code
,
info
->
cost
.
lineNum
,
info
->
cost
.
numOfSTables
,
info
->
cost
.
numOfCTables
,
info
->
id
,
info
->
cost
.
code
,
tstrerror
(
info
->
cost
.
code
),
info
->
cost
.
lineNum
,
info
->
cost
.
numOfSTables
,
info
->
cost
.
numOfCTables
,
info
->
cost
.
numOfCreateSTables
,
info
->
cost
.
numOfAlterTagSTables
,
info
->
cost
.
numOfAlterColSTables
,
info
->
cost
.
schemaTime
-
info
->
cost
.
parseTime
,
info
->
cost
.
insertBindTime
-
info
->
cost
.
schemaTime
,
info
->
cost
.
insertRpcTime
-
info
->
cost
.
insertBindTime
,
info
->
cost
.
endTime
-
info
->
cost
.
insertRpcTime
,
...
...
@@ -1332,6 +1348,7 @@ int32_t smlClearForRerun(SSmlHandle *info) {
}
static
int32_t
smlParseLine
(
SSmlHandle
*
info
,
char
*
lines
[],
char
*
rawLine
,
char
*
rawLineEnd
,
int
numLines
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseLine start"
,
info
->
id
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
info
->
protocol
==
TSDB_SML_JSON_PROTOCOL
)
{
if
(
lines
)
{
...
...
@@ -1367,8 +1384,16 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
}
}
uDebug
(
"SML:0x%"
PRIx64
" smlParseLine israw:%d, len:%d, sql:%s"
,
info
->
id
,
info
->
isRawLine
,
len
,
(
info
->
isRawLine
?
"rawdata"
:
tmp
));
char
cTmp
=
0
;
// for print tmp if is raw
if
(
info
->
isRawLine
){
cTmp
=
tmp
[
len
-
1
];
tmp
[
len
-
1
]
=
'\0'
;
}
uDebug
(
"SML:0x%"
PRIx64
" smlParseLine israw:%d, numLines:%d, protocol:%d, len:%d, sql:%s"
,
info
->
id
,
info
->
isRawLine
,
numLines
,
info
->
protocol
,
len
,
tmp
);
if
(
info
->
isRawLine
){
tmp
[
len
-
1
]
=
cTmp
;
}
if
(
info
->
protocol
==
TSDB_SML_LINE_PROTOCOL
)
{
if
(
info
->
dataFormat
)
{
...
...
@@ -1393,6 +1418,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
return
code
;
}
if
(
info
->
reRun
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseLine re run"
,
info
->
id
);
i
=
0
;
rawLine
=
oldRaw
;
code
=
smlClearForRerun
(
info
);
...
...
@@ -1403,6 +1429,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
}
i
++
;
}
uDebug
(
"SML:0x%"
PRIx64
" smlParseLine end"
,
info
->
id
);
return
code
;
}
...
...
@@ -1515,16 +1542,17 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine,
request
->
code
=
code
;
info
->
cost
.
endTime
=
taosGetTimestampUs
();
info
->
cost
.
code
=
code
;
smlPrintStatisticInfo
(
info
);
if
(
code
==
TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER
||
code
==
TSDB_CODE_SDB_OBJ_CREATING
){
if
(
code
==
TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER
||
code
==
TSDB_CODE_SDB_OBJ_CREATING
||
code
==
TSDB_CODE_PAR_VALUE_TOO_LONG
||
code
==
TSDB_CODE_MND_TRANS_CONFLICT
){
refreshMeta
(
request
->
pTscObj
,
request
);
uInfo
(
"SML:%"
PRIx64
" ver is old retry or object is creating code:%d
"
,
info
->
id
,
code
);
uInfo
(
"SML:%"
PRIx64
" ver is old retry or object is creating code:%d
, msg:%s"
,
info
->
id
,
code
,
tstrerror
(
code
)
);
smlDestroyInfo
(
info
);
info
=
NULL
;
taos_free_result
(
request
);
request
=
NULL
;
continue
;
}
smlPrintStatisticInfo
(
info
);
break
;
}
...
...
source/client/src/clientSmlLine.c
浏览文件 @
d5328b7a
...
...
@@ -582,12 +582,14 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
.
i
=
ts
,
.
length
=
(
size_t
)
tDataTypes
[
TSDB_DATA_TYPE_TIMESTAMP
].
bytes
};
if
(
info
->
dataFormat
)
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format true, ts:%"
PRId64
,
info
->
id
,
ts
);
ret
=
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
return
ret
;}
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
return
ret
;}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
}
else
{
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxString format false, ts:%"
PRId64
,
info
->
id
,
ts
);
taosArraySet
(
elements
->
colArray
,
0
,
&
kv
);
}
info
->
preLine
=
*
elements
;
...
...
source/libs/parser/src/parInsertSml.c
浏览文件 @
d5328b7a
...
...
@@ -70,7 +70,7 @@ static int32_t smlBoundColumnData(SArray* cols, SBoundColInfo* pBoundInfo, SSche
SToken
sToken
=
{.
n
=
kv
->
keyLen
,
.
z
=
(
char
*
)
kv
->
key
};
col_id_t
t
=
lastColIdx
+
1
;
col_id_t
index
=
((
t
==
0
&&
!
isTag
)
?
0
:
insFindCol
(
&
sToken
,
t
,
pBoundInfo
->
numOfCols
,
pSchema
));
u
Debug
(
"SML, index:%d, t:%d, ncols:%d"
,
index
,
t
,
pBoundInfo
->
numOfCols
);
u
Trace
(
"SML, index:%d, t:%d, ncols:%d"
,
index
,
t
,
pBoundInfo
->
numOfCols
);
if
(
index
<
0
&&
t
>
0
)
{
index
=
insFindCol
(
&
sToken
,
0
,
t
,
pSchema
);
}
...
...
@@ -345,7 +345,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
}
if
(
!
taosMbsToUcs4
(
kv
->
value
,
kv
->
length
,
(
TdUcs4
*
)
pUcs4
,
pColSchema
->
bytes
-
VARSTR_HEADER_SIZE
,
&
len
))
{
if
(
errno
==
E2BIG
)
{
uError
(
"sml bind taosMbsToUcs4 error, kv
->value:%s, kv length:%d, bytes:%d"
,
kv
->
value
,
(
int
)
kv
->
length
,
pColSchema
->
bytes
);
uError
(
"sml bind taosMbsToUcs4 error, kv
length:%d, bytes:%d, kv->value:%s"
,
(
int
)
kv
->
length
,
pColSchema
->
bytes
,
kv
->
value
);
buildInvalidOperationMsg
(
&
pBuf
,
"value too long"
);
ret
=
TSDB_CODE_PAR_VALUE_TOO_LONG
;
goto
end
;
...
...
source/util/src/tlog.c
浏览文件 @
d5328b7a
...
...
@@ -21,7 +21,7 @@
#include "tjson.h"
#include "tglobal.h"
#define LOG_MAX_LINE_SIZE (1024)
#define LOG_MAX_LINE_SIZE (10
0
24)
#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3)
#define LOG_MAX_LINE_DUMP_SIZE (1024 * 1024)
#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 3)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录