Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a6667e1a
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,发现更多精彩内容 >>
未验证
提交
a6667e1a
编写于
2月 23, 2023
作者:
H
Haojun Liao
提交者:
GitHub
2月 23, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20102 from taosdata/fix/TD-22665
fix: coverity scan problem
上级
db560be5
81ee050a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
81 addition
and
62 deletion
+81
-62
include/common/tdataformat.h
include/common/tdataformat.h
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+39
-40
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+3
-6
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+11
-8
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+3
-1
source/dnode/vnode/src/vnd/vnodeCompact.c
source/dnode/vnode/src/vnd/vnodeCompact.c
+11
-3
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+2
-2
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+9
-1
source/util/src/terror.c
source/util/src/terror.c
+1
-0
未找到文件。
include/common/tdataformat.h
浏览文件 @
a6667e1a
...
@@ -106,7 +106,7 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
...
@@ -106,7 +106,7 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
// SRow ================================
// SRow ================================
int32_t
tRowBuild
(
SArray
*
aColVal
,
const
STSchema
*
pTSchema
,
SRow
**
ppRow
);
int32_t
tRowBuild
(
SArray
*
aColVal
,
const
STSchema
*
pTSchema
,
SRow
**
ppRow
);
void
tRowGet
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
int32_t
tRowGet
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
void
tRowDestroy
(
SRow
*
pRow
);
void
tRowDestroy
(
SRow
*
pRow
);
void
tRowSort
(
SArray
*
aRowP
);
void
tRowSort
(
SArray
*
aRowP
);
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
);
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
);
...
...
include/util/taoserror.h
浏览文件 @
a6667e1a
...
@@ -119,6 +119,7 @@ int32_t* taosGetErrno();
...
@@ -119,6 +119,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) //
#define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) //
#define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) //
#define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) //
#define TSDB_CODE_IVLD_DATA_FMT TAOS_DEF_ERROR_CODE(0, 0x0132) //
//client
//client
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
...
...
source/common/src/tdataformat.c
浏览文件 @
a6667e1a
...
@@ -139,7 +139,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
...
@@ -139,7 +139,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
nkv
+=
tPutI16v
(
NULL
,
-
pTColumn
->
colId
);
nkv
+=
tPutI16v
(
NULL
,
-
pTColumn
->
colId
);
nIdx
++
;
nIdx
++
;
}
else
{
}
else
{
ASSERT
(
0
);
if
(
ASSERTS
(
0
,
"invalid input"
))
{
code
=
TSDB_CODE_INVALID_PARA
;
goto
_exit
;
}
}
}
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
pTSchema
->
columns
+
iTColumn
:
NULL
;
pTColumn
=
(
++
iTColumn
<
pTSchema
->
numOfCols
)
?
pTSchema
->
columns
+
iTColumn
:
NULL
;
...
@@ -176,8 +179,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
...
@@ -176,8 +179,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
ntp
=
sizeof
(
SRow
)
+
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
)
+
pTSchema
->
flen
+
ntp
;
ntp
=
sizeof
(
SRow
)
+
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
)
+
pTSchema
->
flen
+
ntp
;
break
;
break
;
default:
default:
ASSERT
(
0
);
if
(
ASSERTS
(
0
,
"impossible"
))
{
break
;
code
=
TSDB_CODE_INVALID_PARA
;
goto
_exit
;
}
}
}
if
(
maxIdx
<=
UINT8_MAX
)
{
if
(
maxIdx
<=
UINT8_MAX
)
{
nkv
=
sizeof
(
SRow
)
+
sizeof
(
SKVIdx
)
+
nIdx
+
nkv
;
nkv
=
sizeof
(
SRow
)
+
sizeof
(
SKVIdx
)
+
nIdx
+
nkv
;
...
@@ -306,8 +311,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
...
@@ -306,8 +311,10 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
pv
=
pf
+
pTSchema
->
flen
;
pv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
default:
default:
ASSERT
(
0
);
if
(
ASSERTS
(
0
,
"impossible"
))
{
break
;
code
=
TSDB_CODE_INVALID_PARA
;
goto
_exit
;
}
}
}
if
(
pb
)
{
if
(
pb
)
{
...
@@ -370,7 +377,7 @@ _exit:
...
@@ -370,7 +377,7 @@ _exit:
return
code
;
return
code
;
}
}
void
tRowGet
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
)
{
int32_t
tRowGet
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
)
{
ASSERT
(
iCol
<
pTSchema
->
numOfCols
);
ASSERT
(
iCol
<
pTSchema
->
numOfCols
);
ASSERT
(
pRow
->
sver
==
pTSchema
->
version
);
ASSERT
(
pRow
->
sver
==
pTSchema
->
version
);
...
@@ -381,17 +388,17 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -381,17 +388,17 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
pColVal
->
type
=
pTColumn
->
type
;
pColVal
->
type
=
pTColumn
->
type
;
pColVal
->
flag
=
CV_FLAG_VALUE
;
pColVal
->
flag
=
CV_FLAG_VALUE
;
memcpy
(
&
pColVal
->
value
.
val
,
&
pRow
->
ts
,
sizeof
(
TSKEY
));
memcpy
(
&
pColVal
->
value
.
val
,
&
pRow
->
ts
,
sizeof
(
TSKEY
));
return
;
return
0
;
}
}
if
(
pRow
->
flag
==
HAS_NONE
)
{
if
(
pRow
->
flag
==
HAS_NONE
)
{
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
0
;
}
}
if
(
pRow
->
flag
==
HAS_NULL
)
{
if
(
pRow
->
flag
==
HAS_NULL
)
{
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
0
;
}
}
if
(
pRow
->
flag
>>
4
)
{
// KV Row
if
(
pRow
->
flag
>>
4
)
{
// KV Row
...
@@ -440,7 +447,7 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -440,7 +447,7 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
memcpy
(
&
pColVal
->
value
.
val
,
pData
,
pTColumn
->
bytes
);
memcpy
(
&
pColVal
->
value
.
val
,
pData
,
pTColumn
->
bytes
);
}
}
}
}
return
;
return
0
;
}
else
if
(
TABS
(
cid
)
<
pTColumn
->
colId
)
{
}
else
if
(
TABS
(
cid
)
<
pTColumn
->
colId
)
{
lidx
=
mid
+
1
;
lidx
=
mid
+
1
;
}
else
{
}
else
{
...
@@ -492,16 +499,16 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -492,16 +499,16 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
pv
=
pf
+
pTSchema
->
flen
;
pv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
default:
default:
ASSERT
(
0
);
ASSERT
S
(
0
,
"invalid row format"
);
break
;
return
TSDB_CODE_IVLD_DATA_FMT
;
}
}
if
(
bv
==
BIT_FLG_NONE
)
{
if
(
bv
==
BIT_FLG_NONE
)
{
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NONE
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
0
;
}
else
if
(
bv
==
BIT_FLG_NULL
)
{
}
else
if
(
bv
==
BIT_FLG_NULL
)
{
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
*
pColVal
=
COL_VAL_NULL
(
pTColumn
->
colId
,
pTColumn
->
type
);
return
;
return
0
;
}
}
pColVal
->
cid
=
pTColumn
->
colId
;
pColVal
->
cid
=
pTColumn
->
colId
;
...
@@ -520,6 +527,8 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
...
@@ -520,6 +527,8 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
}
}
}
}
}
}
return
0
;
}
}
void
tRowDestroy
(
SRow
*
pRow
)
{
void
tRowDestroy
(
SRow
*
pRow
)
{
...
@@ -710,7 +719,6 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
...
@@ -710,7 +719,6 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) {
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
*
ppIter
=
NULL
;
*
ppIter
=
NULL
;
if
(
pIter
)
taosMemoryFree
(
pIter
);
}
else
{
}
else
{
*
ppIter
=
pIter
;
*
ppIter
=
pIter
;
}
}
...
@@ -929,8 +937,8 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
...
@@ -929,8 +937,8 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
pv
=
pf
+
pTSchema
->
flen
;
pv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
default:
default:
ASSERT
(
0
);
ASSERT
S
(
0
,
"Invalid row flag"
);
break
;
return
TSDB_CODE_IVLD_DATA_FMT
;
}
}
while
(
pColData
)
{
while
(
pColData
)
{
...
@@ -954,8 +962,8 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
...
@@ -954,8 +962,8 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
bv
=
GET_BIT2
(
pb
,
iTColumn
-
1
);
bv
=
GET_BIT2
(
pb
,
iTColumn
-
1
);
break
;
break
;
default:
default:
ASSERT
(
0
);
ASSERT
S
(
0
,
"Invalid row flag"
);
break
;
return
TSDB_CODE_IVLD_DATA_FMT
;
}
}
if
(
bv
==
BIT_FLG_NONE
)
{
if
(
bv
==
BIT_FLG_NONE
)
{
...
@@ -1045,7 +1053,8 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo
...
@@ -1045,7 +1053,8 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo
}
else
if
(
pRow
->
flag
&
KV_FLG_BIG
)
{
}
else
if
(
pRow
->
flag
&
KV_FLG_BIG
)
{
pData
=
pv
+
((
uint32_t
*
)
pKVIdx
->
idx
)[
iCol
];
pData
=
pv
+
((
uint32_t
*
)
pKVIdx
->
idx
)[
iCol
];
}
else
{
}
else
{
ASSERT
(
0
);
ASSERTS
(
0
,
"Invalid KV row format"
);
return
TSDB_CODE_IVLD_DATA_FMT
;
}
}
int16_t
cid
;
int16_t
cid
;
...
@@ -1579,7 +1588,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, uint8_t *pData,
...
@@ -1579,7 +1588,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, uint8_t *pData,
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
))
{
code
=
tRealloc
((
uint8_t
**
)(
&
pColData
->
aOffset
),
(
pColData
->
nVal
+
1
)
<<
2
);
code
=
tRealloc
((
uint8_t
**
)(
&
pColData
->
aOffset
),
(
(
int64_t
)(
pColData
->
nVal
+
1
)
)
<<
2
);
if
(
code
)
goto
_exit
;
if
(
code
)
goto
_exit
;
pColData
->
aOffset
[
pColData
->
nVal
]
=
pColData
->
nData
;
pColData
->
aOffset
[
pColData
->
nVal
]
=
pColData
->
nData
;
...
@@ -2312,35 +2321,25 @@ void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) {
...
@@ -2312,35 +2321,25 @@ void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) {
}
}
uint8_t
tColDataGetBitValue
(
const
SColData
*
pColData
,
int32_t
iVal
)
{
uint8_t
tColDataGetBitValue
(
const
SColData
*
pColData
,
int32_t
iVal
)
{
uint8_t
v
;
switch
(
pColData
->
flag
)
{
switch
(
pColData
->
flag
)
{
case
HAS_NONE
:
case
HAS_NONE
:
v
=
0
;
return
0
;
break
;
case
HAS_NULL
:
case
HAS_NULL
:
v
=
1
;
return
1
;
break
;
case
(
HAS_NULL
|
HAS_NONE
):
case
(
HAS_NULL
|
HAS_NONE
):
v
=
GET_BIT1
(
pColData
->
pBitMap
,
iVal
);
return
GET_BIT1
(
pColData
->
pBitMap
,
iVal
);
break
;
case
HAS_VALUE
:
case
HAS_VALUE
:
v
=
2
;
return
2
;
break
;
case
(
HAS_VALUE
|
HAS_NONE
):
case
(
HAS_VALUE
|
HAS_NONE
):
v
=
GET_BIT1
(
pColData
->
pBitMap
,
iVal
);
return
(
GET_BIT1
(
pColData
->
pBitMap
,
iVal
))
?
2
:
0
;
if
(
v
)
v
=
2
;
break
;
case
(
HAS_VALUE
|
HAS_NULL
):
case
(
HAS_VALUE
|
HAS_NULL
):
v
=
GET_BIT1
(
pColData
->
pBitMap
,
iVal
)
+
1
;
return
GET_BIT1
(
pColData
->
pBitMap
,
iVal
)
+
1
;
break
;
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
case
(
HAS_VALUE
|
HAS_NULL
|
HAS_NONE
):
v
=
GET_BIT2
(
pColData
->
pBitMap
,
iVal
);
return
GET_BIT2
(
pColData
->
pBitMap
,
iVal
);
break
;
default:
default:
ASSERT
(
0
);
ASSERT
S
(
0
,
"not possible"
);
break
;
return
0
;
}
}
return
v
;
}
}
int32_t
tColDataCopy
(
SColData
*
pColDataFrom
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
)
{
int32_t
tColDataCopy
(
SColData
*
pColDataFrom
,
SColData
*
pColData
,
xMallocFn
xMalloc
,
void
*
arg
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
a6667e1a
...
@@ -328,10 +328,6 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* pReader, uint8_t** ppData)
...
@@ -328,10 +328,6 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* pReader, uint8_t** ppData)
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pReader
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pReader
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
if
(
pData
)
{
taosMemoryFree
(
pData
);
pData
=
NULL
;
}
}
}
*
ppData
=
pData
;
*
ppData
=
pData
;
return
code
;
return
code
;
...
@@ -404,7 +400,7 @@ static int32_t tsdbSnapReadTombData(STsdbSnapReader* pReader, uint8_t** ppData)
...
@@ -404,7 +400,7 @@ static int32_t tsdbSnapReadTombData(STsdbSnapReader* pReader, uint8_t** ppData)
}
}
while
(
pDelInfo
&&
pDelInfo
->
suid
==
pReader
->
tbid
.
suid
&&
pDelInfo
->
uid
==
pReader
->
tbid
.
uid
)
{
while
(
pDelInfo
&&
pDelInfo
->
suid
==
pReader
->
tbid
.
suid
&&
pDelInfo
->
uid
==
pReader
->
tbid
.
uid
)
{
if
(
taosArrayPush
(
pReader
->
aDelData
,
&
pDelInfo
->
delData
)
<
0
)
{
if
(
taosArrayPush
(
pReader
->
aDelData
,
&
pDelInfo
->
delData
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
@@ -1252,7 +1248,7 @@ static int32_t tsdbSnapWriteDelTableData(STsdbSnapWriter* pWriter, TABLEID* pId,
...
@@ -1252,7 +1248,7 @@ static int32_t tsdbSnapWriteDelTableData(STsdbSnapWriter* pWriter, TABLEID* pId,
SDelData
delData
;
SDelData
delData
;
n
+=
tGetDelData
(
pData
+
n
,
&
delData
);
n
+=
tGetDelData
(
pData
+
n
,
&
delData
);
if
(
taosArrayPush
(
pWriter
->
aDelData
,
&
delData
)
<
0
)
{
if
(
taosArrayPush
(
pWriter
->
aDelData
,
&
delData
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
@@ -1420,6 +1416,7 @@ _exit:
...
@@ -1420,6 +1416,7 @@ _exit:
tBlockDataDestroy
(
&
pWriter
->
bData
);
tBlockDataDestroy
(
&
pWriter
->
bData
);
tBlockDataDestroy
(
&
pWriter
->
inData
);
tBlockDataDestroy
(
&
pWriter
->
inData
);
tsdbFSDestroy
(
&
pWriter
->
fs
);
tsdbFSDestroy
(
&
pWriter
->
fs
);
taosMemoryFree
(
pWriter
);
pWriter
=
NULL
;
pWriter
=
NULL
;
}
}
}
else
{
}
else
{
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
a6667e1a
...
@@ -116,12 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
...
@@ -116,12 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
}
}
_exit:
_exit:
if
(
code
)
{
*
ppArray
=
pArray
;
*
ppArray
=
NULL
;
if
(
pArray
)
taosArrayDestroy
(
pArray
);
}
else
{
*
ppArray
=
pArray
;
}
return
code
;
return
code
;
}
}
...
@@ -1233,14 +1228,22 @@ int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema,
...
@@ -1233,14 +1228,22 @@ int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema,
int32_t
iColumn
=
1
;
int32_t
iColumn
=
1
;
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iColumn
];
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iColumn
];
for
(
int32_t
iCid
=
0
;
iCid
<
nCid
;
iCid
++
)
{
for
(
int32_t
iCid
=
0
;
iCid
<
nCid
;
iCid
++
)
{
ASSERT
(
pTColumn
);
if
(
ASSERTS
(
pTColumn
!=
NULL
,
"invalid input param"
))
{
code
=
TSDB_CODE_INVALID_PARA
;
goto
_exit
;
}
while
(
pTColumn
->
colId
<
aCid
[
iCid
])
{
while
(
pTColumn
->
colId
<
aCid
[
iCid
])
{
iColumn
++
;
iColumn
++
;
ASSERT
(
iColumn
<
pTSchema
->
numOfCols
);
ASSERT
(
iColumn
<
pTSchema
->
numOfCols
);
pTColumn
=
&
pTSchema
->
columns
[
iColumn
];
pTColumn
=
&
pTSchema
->
columns
[
iColumn
];
}
}
ASSERT
(
pTColumn
->
colId
==
aCid
[
iCid
]);
if
(
ASSERTS
(
pTColumn
->
colId
==
aCid
[
iCid
],
"invalid input param"
))
{
code
=
TSDB_CODE_INVALID_PARA
;
goto
_exit
;
}
tColDataInit
(
&
pBlockData
->
aColData
[
iCid
],
pTColumn
->
colId
,
pTColumn
->
type
,
tColDataInit
(
&
pBlockData
->
aColData
[
iCid
],
pTColumn
->
colId
,
pTColumn
->
type
,
(
pTColumn
->
flags
&
COL_SMA_ON
)
?
1
:
0
);
(
pTColumn
->
flags
&
COL_SMA_ON
)
?
1
:
0
);
...
...
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
a6667e1a
...
@@ -31,7 +31,9 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq2 *pMsg, SSubmitRsp2
...
@@ -31,7 +31,9 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq2 *pMsg, SSubmitRsp2
int32_t
affectedrows
=
0
;
int32_t
affectedrows
=
0
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
ASSERT
(
pTsdb
->
mem
!=
NULL
);
if
(
ASSERTS
(
pTsdb
->
mem
!=
NULL
,
"vgId:%d, mem is NULL"
,
TD_VID
(
pTsdb
->
pVnode
)))
{
return
-
1
;
}
if
(
pMsg
)
{
if
(
pMsg
)
{
arrSize
=
taosArrayGetSize
(
pMsg
->
aSubmitTbData
);
arrSize
=
taosArrayGetSize
(
pMsg
->
aSubmitTbData
);
...
...
source/dnode/vnode/src/vnd/vnodeCompact.c
浏览文件 @
a6667e1a
...
@@ -36,8 +36,8 @@ static int32_t vnodeCompactTask(void *param) {
...
@@ -36,8 +36,8 @@ static int32_t vnodeCompactTask(void *param) {
vnodeCommitInfo
(
dir
);
vnodeCommitInfo
(
dir
);
_exit:
_exit:
taosMemoryFree
(
pInfo
);
tsem_post
(
&
pInfo
->
pVnode
->
canCommit
);
tsem_post
(
&
pInfo
->
pVnode
->
canCommit
);
taosMemoryFree
(
pInfo
);
return
code
;
return
code
;
}
}
static
int32_t
vnodePrepareCompact
(
SVnode
*
pVnode
,
SCompactInfo
*
pInfo
)
{
static
int32_t
vnodePrepareCompact
(
SVnode
*
pVnode
,
SCompactInfo
*
pInfo
)
{
...
@@ -59,9 +59,17 @@ static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) {
...
@@ -59,9 +59,17 @@ static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) {
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
}
}
vnodeLoadInfo
(
dir
,
&
info
);
if
(
vnodeLoadInfo
(
dir
,
&
info
)
<
0
)
{
code
=
terrno
;
goto
_exit
;
}
info
.
state
.
commitID
=
pInfo
->
commitID
;
info
.
state
.
commitID
=
pInfo
->
commitID
;
vnodeSaveInfo
(
dir
,
&
info
);
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
)
{
code
=
terrno
;
goto
_exit
;
}
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
a6667e1a
...
@@ -48,7 +48,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
...
@@ -48,7 +48,7 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
info
.
state
.
applied
=
-
1
;
info
.
state
.
applied
=
-
1
;
info
.
state
.
commitID
=
0
;
info
.
state
.
commitID
=
0
;
vInfo
(
"vgId:%d, save config while create"
,
pCfg
->
vgId
);
vInfo
(
"vgId:%d, save config while create"
,
info
.
config
.
vgId
);
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
||
vnodeCommitInfo
(
dir
)
<
0
)
{
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
||
vnodeCommitInfo
(
dir
)
<
0
)
{
vError
(
"vgId:%d, failed to save vnode config since %s"
,
pCfg
?
pCfg
->
vgId
:
0
,
tstrerror
(
terrno
));
vError
(
"vgId:%d, failed to save vnode config since %s"
,
pCfg
?
pCfg
->
vgId
:
0
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
...
@@ -124,7 +124,7 @@ int32_t vnodeRenameVgroupId(const char *srcPath, const char *dstPath, int32_t sr
...
@@ -124,7 +124,7 @@ int32_t vnodeRenameVgroupId(const char *srcPath, const char *dstPath, int32_t sr
while
(
1
)
{
while
(
1
)
{
const
STfsFile
*
tsdbFile
=
tfsReaddir
(
tsdbDir
);
const
STfsFile
*
tsdbFile
=
tfsReaddir
(
tsdbDir
);
if
(
tsdbFile
==
NULL
)
break
;
if
(
tsdbFile
==
NULL
)
break
;
if
(
tsdbFile
->
rname
==
NULL
)
continue
;
if
(
tsdbFile
->
rname
[
0
]
==
'\0'
)
continue
;
tstrncpy
(
oldRname
,
tsdbFile
->
rname
,
TSDB_FILENAME_LEN
);
tstrncpy
(
oldRname
,
tsdbFile
->
rname
,
TSDB_FILENAME_LEN
);
char
*
tsdbFilePrefixPos
=
strstr
(
oldRname
,
tsdbFilePrefix
);
char
*
tsdbFilePrefixPos
=
strstr
(
oldRname
,
tsdbFilePrefix
);
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
a6667e1a
...
@@ -141,7 +141,10 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
...
@@ -141,7 +141,10 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
*
(
int64_t
*
)(
pCoder
->
data
+
pCoder
->
pos
)
=
uid
;
*
(
int64_t
*
)(
pCoder
->
data
+
pCoder
->
pos
)
=
uid
;
pCoder
->
pos
+=
sizeof
(
int64_t
);
pCoder
->
pos
+=
sizeof
(
int64_t
);
}
else
{
}
else
{
tDecodeI64
(
pCoder
,
&
submitTbData
.
uid
);
if
(
tDecodeI64
(
pCoder
,
&
submitTbData
.
uid
)
<
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
}
if
(
tDecodeI32v
(
pCoder
,
&
submitTbData
.
sver
)
<
0
)
{
if
(
tDecodeI32v
(
pCoder
,
&
submitTbData
.
sver
)
<
0
)
{
...
@@ -168,6 +171,11 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
...
@@ -168,6 +171,11 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
SColData
colData
=
{
0
};
SColData
colData
=
{
0
};
pCoder
->
pos
+=
tGetColData
(
pCoder
->
data
+
pCoder
->
pos
,
&
colData
);
pCoder
->
pos
+=
tGetColData
(
pCoder
->
data
+
pCoder
->
pos
,
&
colData
);
if
(
colData
.
flag
!=
HAS_VALUE
)
{
code
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
}
for
(
int32_t
iRow
=
0
;
iRow
<
colData
.
nVal
;
iRow
++
)
{
for
(
int32_t
iRow
=
0
;
iRow
<
colData
.
nVal
;
iRow
++
)
{
if
(((
TSKEY
*
)
colData
.
pData
)[
iRow
]
<
minKey
||
((
TSKEY
*
)
colData
.
pData
)[
iRow
]
>
maxKey
)
{
if
(((
TSKEY
*
)
colData
.
pData
)[
iRow
]
<
minKey
||
((
TSKEY
*
)
colData
.
pData
)[
iRow
]
>
maxKey
)
{
code
=
TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE
;
code
=
TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE
;
...
...
source/util/src/terror.c
浏览文件 @
a6667e1a
...
@@ -97,6 +97,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TIMEOUT_ERROR, "Operation timeout")
...
@@ -97,6 +97,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TIMEOUT_ERROR, "Operation timeout")
TAOS_DEFINE_ERROR
(
TSDB_CODE_APP_IS_STARTING
,
"Database is starting up"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_APP_IS_STARTING
,
"Database is starting up"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_APP_IS_STOPPING
,
"Database is closing down"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_APP_IS_STOPPING
,
"Database is closing down"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_IVLD_DATA_FMT
,
"Invalid data format"
)
//client
//client
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_OPERATION
,
"Invalid operation"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_OPERATION
,
"Invalid operation"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录