Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
755ef983
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
755ef983
编写于
1月 03, 2020
作者:
F
fangpanpan
提交者:
GitHub
1月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1061 from taosdata/feature/lihui
[#1059 TBASE-1436]
上级
ef44bf60
bdd8292e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
22 deletion
+20
-22
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+18
-20
src/system/detail/src/vnodeMeter.c
src/system/detail/src/vnodeMeter.c
+2
-2
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
755ef983
...
...
@@ -36,7 +36,7 @@ enum {
TSDB_USE_CLI_TS
=
1
,
};
static
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
);
static
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
,
int32_t
*
numOfRows
);
static
int32_t
tscToInteger
(
SSQLToken
*
pToken
,
int64_t
*
value
,
char
**
endPtr
)
{
int32_t
numType
=
isValidNumber
(
pToken
);
...
...
@@ -522,14 +522,15 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, SMeterMeta *pMeterMe
*
str
+=
index
;
if
(
numOfRows
>=
maxRows
||
pDataBlock
->
size
+
pMeterMeta
->
rowSize
>=
pDataBlock
->
nAllocSize
)
{
int32_t
tSize
=
tscAllocateMemIfNeed
(
pDataBlock
,
pMeterMeta
->
rowSize
);
if
(
0
==
tSize
)
{
//TODO pass the correct error code to client
int32_t
tSize
;
int32_t
retcode
=
tscAllocateMemIfNeed
(
pDataBlock
,
pMeterMeta
->
rowSize
,
&
tSize
);
if
(
retcode
!=
TSDB_CODE_SUCCESS
)
{
//TODO pass the correct error code to client
strcpy
(
error
,
"client out of memory"
);
*
code
=
TSDB_CODE_CLI_OUT_OF_MEMORY
;
*
code
=
retcode
;
return
-
1
;
}
maxRows
+
=
tSize
;
ASSERT
(
tSize
>
maxRows
);
maxRows
=
tSize
;
}
int32_t
len
=
tsParseOneRowData
(
str
,
pDataBlock
,
pSchema
,
spd
,
error
,
precision
,
code
,
tmpTokenBuf
);
...
...
@@ -574,7 +575,7 @@ static void tscSetAssignedColumnInfo(SParsedDataColInfo *spd, SSchema *pSchema,
}
}
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
)
{
int32_t
tscAllocateMemIfNeed
(
STableDataBlocks
*
pDataBlock
,
int32_t
rowSize
,
int32_t
*
numOfRows
)
{
size_t
remain
=
pDataBlock
->
nAllocSize
-
pDataBlock
->
size
;
const
int
factor
=
5
;
uint32_t
nAllocSizeOld
=
pDataBlock
->
nAllocSize
;
...
...
@@ -594,11 +595,13 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize) {
//assert(false);
// do nothing
pDataBlock
->
nAllocSize
=
nAllocSizeOld
;
return
0
;
*
numOfRows
=
(
int32_t
)(
pDataBlock
->
nAllocSize
)
/
rowSize
;
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
}
return
(
int32_t
)(
pDataBlock
->
nAllocSize
-
pDataBlock
->
size
)
/
rowSize
;
*
numOfRows
=
(
int32_t
)(
pDataBlock
->
nAllocSize
)
/
rowSize
;
return
TSDB_CODE_SUCCESS
;
}
static
void
tsSetBlockInfo
(
SShellSubmitBlock
*
pBlocks
,
const
SMeterMeta
*
pMeterMeta
,
int32_t
numOfRows
)
{
...
...
@@ -664,8 +667,9 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableHashList, char
return
ret
;
}
int32_t
maxNumOfRows
=
tscAllocateMemIfNeed
(
dataBuf
,
pMeterMeta
->
rowSize
);
if
(
0
==
maxNumOfRows
)
{
int32_t
maxNumOfRows
;
ret
=
tscAllocateMemIfNeed
(
dataBuf
,
pMeterMeta
->
rowSize
,
&
maxNumOfRows
);
if
(
TSDB_CODE_SUCCESS
!=
ret
)
{
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
...
...
@@ -1326,7 +1330,7 @@ static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
char
*
line
=
NULL
;
size_t
n
=
0
;
int
len
=
0
;
uint32_t
maxRows
=
0
;
int32_t
maxRows
=
0
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
int
numOfRows
=
0
;
int32_t
code
=
0
;
...
...
@@ -1345,8 +1349,8 @@ static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
tscAppendDataBlock
(
pCmd
->
pDataBlocks
,
pTableDataBlock
);
maxRows
=
tscAllocateMemIfNeed
(
pTableDataBlock
,
rowSize
);
if
(
maxRows
<
1
)
return
-
1
;
code
=
tscAllocateMemIfNeed
(
pTableDataBlock
,
rowSize
,
&
maxRows
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
return
-
1
;
int
count
=
0
;
SParsedDataColInfo
spd
=
{.
numOfCols
=
pMeterMetaInfo
->
pMeterMeta
->
numOfColumns
};
...
...
@@ -1362,12 +1366,6 @@ static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
char
*
lineptr
=
line
;
strtolower
(
line
,
line
);
if
(
numOfRows
>=
maxRows
||
pTableDataBlock
->
size
+
pMeterMeta
->
rowSize
>=
pTableDataBlock
->
nAllocSize
)
{
uint32_t
tSize
=
tscAllocateMemIfNeed
(
pTableDataBlock
,
pMeterMeta
->
rowSize
);
if
(
0
==
tSize
)
return
(
-
TSDB_CODE_CLI_OUT_OF_MEMORY
);
maxRows
+=
tSize
;
}
len
=
tsParseOneRowData
(
&
lineptr
,
pTableDataBlock
,
pSchema
,
&
spd
,
pCmd
->
payload
,
pMeterMeta
->
precision
,
&
code
,
tmpTokenBuf
);
if
(
len
<=
0
||
pTableDataBlock
->
numOfParams
>
0
)
{
pSql
->
res
.
code
=
code
;
...
...
src/system/detail/src/vnodeMeter.c
浏览文件 @
755ef983
...
...
@@ -563,8 +563,8 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
if
(
numOfPoints
>=
(
pVnode
->
cfg
.
blocksPerMeter
-
2
)
*
pObj
->
pointsPerBlock
)
{
code
=
TSDB_CODE_BATCH_SIZE_TOO_BIG
;
dError
(
"vid:%d sid:%d id:%s, batch size too big, it shall be smaller than:%d"
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
(
pVnode
->
cfg
.
blocksPerMeter
-
2
)
*
pObj
->
pointsPerBlock
);
dError
(
"vid:%d sid:%d id:%s, batch size too big, i
nsert points:%d, i
t shall be smaller than:%d"
,
pObj
->
vnode
,
pObj
->
sid
,
pObj
->
meterId
,
numOfPoints
,
(
pVnode
->
cfg
.
blocksPerMeter
-
2
)
*
pObj
->
pointsPerBlock
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录