Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
889aa8a1
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
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看板
提交
889aa8a1
编写于
7月 12, 2021
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code refactor
上级
21a8b091
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
21 deletion
+16
-21
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+5
-9
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+5
-5
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+0
-1
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+2
-3
src/inc/taosdef.h
src/inc/taosdef.h
+4
-3
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
889aa8a1
...
@@ -104,15 +104,11 @@ typedef struct SParsedDataColInfo {
...
@@ -104,15 +104,11 @@ typedef struct SParsedDataColInfo {
}
SParsedDataColInfo
;
}
SParsedDataColInfo
;
typedef
struct
{
typedef
struct
{
// for SDataRow
SSchema
*
pSchema
;
SSchema
*
pSchema
;
int16_t
sversion
;
int16_t
sversion
;
int32_t
flen
;
int32_t
flen
;
uint16_t
nCols
;
// for SKVRow
void
*
buf
;
uint16_t
nCols
;
uint16_t
size
;
void
*
buf
;
void
*
pDataBlock
;
void
*
pDataBlock
;
SSubmitBlk
*
pSubmitBlk
;
SSubmitBlk
*
pSubmitBlk
;
}
SMemRowBuilder
;
}
SMemRowBuilder
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
889aa8a1
...
@@ -48,7 +48,7 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
...
@@ -48,7 +48,7 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
static
FORCE_INLINE
int32_t
getExtendedRowSize
(
STableComInfo
*
tinfo
)
{
static
FORCE_INLINE
int32_t
getExtendedRowSize
(
STableComInfo
*
tinfo
)
{
return
tinfo
->
rowSize
+
PAYLOAD_HEADER_LEN
+
PAYLOAD_COL_HEAD_LEN
*
tinfo
->
numOfColumns
;
return
tinfo
->
rowSize
+
PAYLOAD_HEADER_LEN
+
PAYLOAD_COL_HEAD_LEN
*
tinfo
->
numOfColumns
;
}
}
int
initSMemRowHelper
(
SMemRowHelper
*
pHelper
,
SSchema
*
pSSchema
,
uint16_t
nCols
,
uint16_t
allNullColsLen
)
{
static
int
initSMemRowHelper
(
SMemRowHelper
*
pHelper
,
SSchema
*
pSSchema
,
uint16_t
nCols
,
uint16_t
allNullColsLen
)
{
pHelper
->
allNullLen
=
allNullColsLen
;
// TODO: get allNullColsLen when creating or altering table meta
pHelper
->
allNullLen
=
allNullColsLen
;
// TODO: get allNullColsLen when creating or altering table meta
if
(
pHelper
->
allNullLen
==
0
)
{
if
(
pHelper
->
allNullLen
==
0
)
{
for
(
uint16_t
i
=
0
;
i
<
nCols
;
++
i
)
{
for
(
uint16_t
i
=
0
;
i
<
nCols
;
++
i
)
{
...
@@ -406,7 +406,7 @@ static FORCE_INLINE TDRowLenT tsSetPayloadColValue(char *payloadStart, char *pay
...
@@ -406,7 +406,7 @@ static FORCE_INLINE TDRowLenT tsSetPayloadColValue(char *payloadStart, char *pay
payloadColSetId
(
payload
,
columnId
);
payloadColSetId
(
payload
,
columnId
);
payloadColSetType
(
payload
,
columnType
);
payloadColSetType
(
payload
,
columnType
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
value
,
valueLen
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
value
,
valueLen
);
payloadSetTLen
(
payloadStart
,
payloadTLen
(
payloadStart
)
+
valueLen
);
//
payloadSetTLen(payloadStart, payloadTLen(payloadStart) + valueLen);
return
valueLen
;
return
valueLen
;
}
}
...
@@ -793,7 +793,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
...
@@ -793,7 +793,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
payloadSetNCols
(
payload
,
spd
->
numOfBound
);
payloadSetNCols
(
payload
,
spd
->
numOfBound
);
payloadValOffset
=
payloadValuesOffset
(
payload
);
// rely on payloadNCols
payloadValOffset
=
payloadValuesOffset
(
payload
);
// rely on payloadNCols
payloadSetTLen
(
payload
,
payloadValOffset
);
//
payloadSetTLen(payload, payloadValOffset);
char
*
kvPrimaryKeyStart
=
payload
+
PAYLOAD_HEADER_LEN
;
// primaryKey in 1st column tuple
char
*
kvPrimaryKeyStart
=
payload
+
PAYLOAD_HEADER_LEN
;
// primaryKey in 1st column tuple
char
*
kvStart
=
kvPrimaryKeyStart
+
PAYLOAD_COL_HEAD_LEN
;
// the column tuple behind the primaryKey
char
*
kvStart
=
kvPrimaryKeyStart
+
PAYLOAD_COL_HEAD_LEN
;
// the column tuple behind the primaryKey
...
@@ -1138,7 +1138,7 @@ int tscSortRemoveDataBlockDupRows(STableDataBlocks *dataBuf, SBlockKeyInfo *pBlk
...
@@ -1138,7 +1138,7 @@ int tscSortRemoveDataBlockDupRows(STableDataBlocks *dataBuf, SBlockKeyInfo *pBlk
size_t
nAlloc
=
nRows
*
sizeof
(
SBlockKeyTuple
);
size_t
nAlloc
=
nRows
*
sizeof
(
SBlockKeyTuple
);
if
(
pBlkKeyInfo
->
pKeyTuple
==
NULL
||
pBlkKeyInfo
->
maxBytesAlloc
<
nAlloc
)
{
if
(
pBlkKeyInfo
->
pKeyTuple
==
NULL
||
pBlkKeyInfo
->
maxBytesAlloc
<
nAlloc
)
{
size_t
nRealAlloc
=
nAlloc
+
10
*
sizeof
(
SBlockKeyTuple
);
size_t
nRealAlloc
=
nAlloc
+
10
*
sizeof
(
SBlockKeyTuple
);
char
*
tmp
=
realloc
(
pBlkKeyInfo
->
pKeyTuple
,
nRealAlloc
);
char
*
tmp
=
t
realloc
(
pBlkKeyInfo
->
pKeyTuple
,
nRealAlloc
);
if
(
tmp
==
NULL
)
{
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -1609,7 +1609,7 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
...
@@ -1609,7 +1609,7 @@ static int32_t parseBoundColumns(SInsertStatementParam *pInsertParam, SParsedDat
pColInfo
->
isOrdered
=
isOrdered
;
pColInfo
->
isOrdered
=
isOrdered
;
if
(
!
isOrdered
)
{
if
(
!
isOrdered
)
{
pColInfo
->
colIdxInfo
=
calloc
(
pColInfo
->
numOfBound
,
sizeof
(
SBoundIdxInfo
));
pColInfo
->
colIdxInfo
=
t
calloc
(
pColInfo
->
numOfBound
,
sizeof
(
SBoundIdxInfo
));
if
(
pColInfo
->
colIdxInfo
==
NULL
)
{
if
(
pColInfo
->
colIdxInfo
==
NULL
)
{
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_clean
;
goto
_clean
;
...
...
src/client/src/tscUtil.c
浏览文件 @
889aa8a1
...
@@ -1829,7 +1829,6 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
...
@@ -1829,7 +1829,6 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
rowBuilder
.
pDataBlock
=
pDataBlock
;
rowBuilder
.
pDataBlock
=
pDataBlock
;
rowBuilder
.
pSubmitBlk
=
pBlock
;
rowBuilder
.
pSubmitBlk
=
pBlock
;
rowBuilder
.
buf
=
p
;
rowBuilder
.
buf
=
p
;
rowBuilder
.
size
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
rowBuilder
.
buf
=
(
blkKeyTuple
+
i
)
->
payloadAddr
;
rowBuilder
.
buf
=
(
blkKeyTuple
+
i
)
->
payloadAddr
;
...
...
src/common/inc/tdataformat.h
浏览文件 @
889aa8a1
...
@@ -190,7 +190,7 @@ static FORCE_INLINE int tkeyComparFn(const void *tkey1, const void *tkey2) {
...
@@ -190,7 +190,7 @@ static FORCE_INLINE int tkeyComparFn(const void *tkey1, const void *tkey2) {
// ----------------- Data row structure
// ----------------- Data row structure
/* A data row, the format is like below:
/* A data row, the format is like below:
* |<--------------------
+
--------------------------- len ---------------------------------->|
* |<--------------------
-
--------------------------- len ---------------------------------->|
* |<-- Head -->|<--------- flen -------------->| |
* |<-- Head -->|<--------- flen -------------->| |
* +---------------------+---------------------------------+---------------------------------+
* +---------------------+---------------------------------+---------------------------------+
* | uint16_t | int16_t | | |
* | uint16_t | int16_t | | |
...
@@ -224,11 +224,10 @@ SDataRow tdDataRowDup(SDataRow row);
...
@@ -224,11 +224,10 @@ SDataRow tdDataRowDup(SDataRow row);
static
FORCE_INLINE
int
tdAppendColVal
(
SDataRow
row
,
const
void
*
value
,
int8_t
type
,
int32_t
offset
)
{
static
FORCE_INLINE
int
tdAppendColVal
(
SDataRow
row
,
const
void
*
value
,
int8_t
type
,
int32_t
offset
)
{
ASSERT
(
value
!=
NULL
);
ASSERT
(
value
!=
NULL
);
int32_t
toffset
=
offset
+
TD_DATA_ROW_HEAD_SIZE
;
int32_t
toffset
=
offset
+
TD_DATA_ROW_HEAD_SIZE
;
char
*
ptr
=
(
char
*
)
POINTER_SHIFT
(
row
,
dataRowLen
(
row
));
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
*
(
VarDataOffsetT
*
)
POINTER_SHIFT
(
row
,
toffset
)
=
dataRowLen
(
row
);
*
(
VarDataOffsetT
*
)
POINTER_SHIFT
(
row
,
toffset
)
=
dataRowLen
(
row
);
memcpy
(
ptr
,
value
,
varDataTLen
(
value
));
memcpy
(
POINTER_SHIFT
(
row
,
dataRowLen
(
row
))
,
value
,
varDataTLen
(
value
));
dataRowLen
(
row
)
+=
varDataTLen
(
value
);
dataRowLen
(
row
)
+=
varDataTLen
(
value
);
}
else
{
}
else
{
if
(
offset
==
0
)
{
if
(
offset
==
0
)
{
...
...
src/inc/taosdef.h
浏览文件 @
889aa8a1
...
@@ -196,9 +196,10 @@ do { \
...
@@ -196,9 +196,10 @@ do { \
#define TSDB_APPNAME_LEN TSDB_UNI_LEN
#define TSDB_APPNAME_LEN TSDB_UNI_LEN
/**
/**
* Don't change to 65536. As in some scenarios uint16_t (0~65535) is used to store the row len.
* In some scenarios uint16_t (0~65535) is used to store the row len.
* So, we use 65531(65535 - 4), as the SDataRow and SKVRow including 4 bits header.
* - Firstly, we use 65531(65535 - 4), as the SDataRow and SKVRow including 4 bits header.
* If all cols are VarType except primary key, we need 4 bits to store the offset. 65531-8-4095*4=49143
* - Secondly, if all cols are VarType except primary key, we need 4 bits to store the offset, thus
* the final value is 65531-8-4095*4 = 49143.
*/
*/
#define TSDB_MAX_BYTES_PER_ROW 49143
#define TSDB_MAX_BYTES_PER_ROW 49143
#define TSDB_MAX_TAGS_LEN 16384
#define TSDB_MAX_TAGS_LEN 16384
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录