Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3700f0dc
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看板
提交
3700f0dc
编写于
12月 01, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
0525b4fa
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
57 addition
and
32 deletion
+57
-32
include/common/tdataformat.h
include/common/tdataformat.h
+2
-1
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+44
-25
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+7
-2
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+3
-3
未找到文件。
include/common/tdataformat.h
浏览文件 @
3700f0dc
...
...
@@ -111,6 +111,7 @@ void debugPrintSTag(STag *pTag, const char *tag, int32_t ln); // TODO: remov
int32_t
parseJsontoTagData
(
const
char
*
json
,
SArray
*
pTagVals
,
STag
**
ppTag
,
void
*
pMsgBuf
);
// SColData ================================
typedef
void
*
(
*
xMallocFn
)(
void
*
,
int32_t
);
void
tColDataDestroy
(
void
*
ph
);
void
tColDataInit
(
SColData
*
pColData
,
int16_t
cid
,
int8_t
type
,
int8_t
smaOn
);
void
tColDataClear
(
SColData
*
pColData
);
...
...
@@ -118,7 +119,7 @@ void tColDataDeepClear(SColData *pColData);
int32_t
tColDataAppendValue
(
SColData
*
pColData
,
SColVal
*
pColVal
);
void
tColDataGetValue
(
SColData
*
pColData
,
int32_t
iVal
,
SColVal
*
pColVal
);
uint8_t
tColDataGetBitValue
(
const
SColData
*
pColData
,
int32_t
iVal
);
int32_t
tColDataCopy
(
SColData
*
pColData
Src
,
SColData
*
pColDataDest
);
int32_t
tColDataCopy
(
SColData
*
pColData
From
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
);
extern
void
(
*
tColDataCalcSMA
[])(
SColData
*
pColData
,
int64_t
*
sum
,
int64_t
*
max
,
int64_t
*
min
,
int16_t
*
numOfNull
);
// for stmt bind
...
...
source/common/src/tdataformat.c
浏览文件 @
3700f0dc
...
...
@@ -2018,41 +2018,60 @@ uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal) {
return
v
;
}
int32_t
tColDataCopy
(
SColData
*
pColData
Src
,
SColData
*
pColDataDest
)
{
int32_t
tColDataCopy
(
SColData
*
pColData
From
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
)
{
int32_t
code
=
0
;
int32_t
size
;
ASSERT
(
pColDataSrc
->
nVal
>
0
);
ASSERT
(
pColDataDest
->
cid
==
pColDataSrc
->
cid
);
ASSERT
(
pColDataDest
->
type
==
pColDataSrc
->
type
);
pColDataDest
->
smaOn
=
pColDataSrc
->
smaOn
;
pColDataDest
->
nVal
=
pColDataSrc
->
nVal
;
pColDataDest
->
flag
=
pColDataSrc
->
flag
;
*
pColData
=
*
pColDataFrom
;
// bitmap
if
(
pColDataSrc
->
flag
!=
HAS_NONE
&&
pColDataSrc
->
flag
!=
HAS_NULL
&&
pColDataSrc
->
flag
!=
HAS_VALUE
)
{
size
=
BIT2_SIZE
(
pColDataSrc
->
nVal
);
code
=
tRealloc
(
&
pColDataDest
->
pBitMap
,
size
);
if
(
code
)
goto
_exit
;
memcpy
(
pColDataDest
->
pBitMap
,
pColDataSrc
->
pBitMap
,
size
);
switch
(
pColData
->
flag
)
{
case
(
HAS_NULL
|
HAS_NONE
):
case
(
HAS_VALUE
|
HAS_NONE
):
case
(
HAS_VALUE
|
HAS_NULL
):
pColData
->
pBitMap
=
xMalloc
(
arg
,
BIT1_SIZE
(
pColData
->
nVal
));
if
(
pColData
->
pBitMap
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
memcpy
(
pColData
->
pBitMap
,
pColDataFrom
->
pBitMap
,
BIT1_SIZE
(
pColData
->
nVal
));
break
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
pColData
->
pBitMap
=
xMalloc
(
arg
,
BIT2_SIZE
(
pColData
->
nVal
));
if
(
pColData
->
pBitMap
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
memcpy
(
pColData
->
pBitMap
,
pColDataFrom
->
pBitMap
,
BIT2_SIZE
(
pColData
->
nVal
));
break
;
default:
pColData
->
pBitMap
=
NULL
;
break
;
}
// offset
if
(
IS_VAR_DATA_TYPE
(
pColDataDest
->
type
))
{
size
=
sizeof
(
int32_t
)
*
pColDataSrc
->
nVal
;
code
=
tRealloc
((
uint8_t
**
)
&
pColDataDest
->
aOffset
,
size
);
if
(
code
)
goto
_exit
;
memcpy
(
pColDataDest
->
aOffset
,
pColDataSrc
->
aOffset
,
size
);
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
)
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
pColData
->
aOffset
=
xMalloc
(
arg
,
pColData
->
nVal
<<
2
);
if
(
pColData
->
aOffset
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
memcpy
(
pColData
->
aOffset
,
pColDataFrom
->
aOffset
,
pColData
->
nVal
<<
2
);
}
else
{
pColData
->
aOffset
=
NULL
;
}
// value
pColDataDest
->
nData
=
pColDataSrc
->
nData
;
code
=
tRealloc
(
&
pColDataDest
->
pData
,
pColDataSrc
->
nData
);
if
(
code
)
goto
_exit
;
memcpy
(
pColDataDest
->
pData
,
pColDataSrc
->
pData
,
pColDataDest
->
nData
);
if
(
pColData
->
nVal
)
{
pColData
->
pData
=
xMalloc
(
arg
,
pColData
->
nVal
);
if
(
pColData
->
pData
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
memcpy
(
pColData
->
pData
,
pColDataFrom
->
pData
,
pColData
->
nData
);
}
else
{
pColData
->
pData
=
NULL
;
}
_exit:
return
code
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
3700f0dc
...
...
@@ -87,7 +87,7 @@ typedef struct SSnapDataHdr SSnapDataHdr;
#define VNODE_RSMA2_DIR "rsma2"
// vnd.h
void
*
vnodeBufPoolMalloc
(
SVBufPool
*
pPool
,
int
size
);
void
*
vnodeBufPoolMalloc
(
SVBufPool
*
pPool
,
int
32_t
size
);
void
vnodeBufPoolFree
(
SVBufPool
*
pPool
,
void
*
p
);
void
vnodeBufPoolRef
(
SVBufPool
*
pPool
);
void
vnodeBufPoolUnRef
(
SVBufPool
*
pPool
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
3700f0dc
...
...
@@ -601,8 +601,13 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData,
memcpy
(
pBlockData
->
aTSKEY
,
aColData
[
0
].
pData
,
aColData
[
0
].
nData
);
pBlockData
->
nColData
=
nColData
-
1
;
for
(
int32_t
iColData
=
1
;
iColData
<
nColData
;
++
iColData
)
{
// todo
pBlockData
->
aColData
=
vnodeBufPoolMalloc
(
pPool
,
sizeof
(
SColData
)
*
pBlockData
->
nColData
);
if
(
pBlockData
->
aColData
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
for
(
int32_t
iColData
=
0
;
iColData
<
pBlockData
->
nColData
;
++
iColData
)
{
code
=
tColDataCopy
(
&
aColData
[
iColData
+
1
],
&
pBlockData
->
aColData
[
iColData
],
(
xMallocFn
)
vnodeBufPoolMalloc
,
pPool
);
if
(
code
)
goto
_exit
;
}
// loop to add each row to the skiplist
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
3700f0dc
...
...
@@ -35,7 +35,7 @@ static int vnodeBufPoolCreate(SVnode *pVnode, int64_t size, SVBufPool **ppPool)
return
-
1
;
}
if
(
taosThreadSpinInit
(
pPool
->
lock
,
0
)
!=
0
)
{
taosMemoryFree
((
void
*
)
pPool
->
lock
);
taosMemoryFree
((
void
*
)
pPool
->
lock
);
taosMemoryFree
(
pPool
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
...
...
@@ -62,7 +62,7 @@ static int vnodeBufPoolDestroy(SVBufPool *pPool) {
vnodeBufPoolReset
(
pPool
);
if
(
pPool
->
lock
)
{
taosThreadSpinDestroy
(
pPool
->
lock
);
taosMemoryFree
((
void
*
)
pPool
->
lock
);
taosMemoryFree
((
void
*
)
pPool
->
lock
);
}
taosMemoryFree
(
pPool
);
return
0
;
...
...
@@ -123,7 +123,7 @@ void vnodeBufPoolReset(SVBufPool *pPool) {
pPool
->
ptr
=
pPool
->
node
.
data
;
}
void
*
vnodeBufPoolMalloc
(
SVBufPool
*
pPool
,
int
size
)
{
void
*
vnodeBufPoolMalloc
(
SVBufPool
*
pPool
,
int
32_t
size
)
{
SVBufPoolNode
*
pNode
;
void
*
p
=
NULL
;
ASSERT
(
pPool
!=
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录