Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
47f7ce67
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
47f7ce67
编写于
4月 18, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into fix/tsim
上级
595d2ce3
2aeb1c3b
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
383 addition
and
301 deletion
+383
-301
include/common/trow.h
include/common/trow.h
+13
-8
include/common/ttypes.h
include/common/ttypes.h
+2
-2
include/os/osMemory.h
include/os/osMemory.h
+6
-6
source/client/src/clientMain.c
source/client/src/clientMain.c
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/common/src/trow.c
source/common/src/trow.c
+48
-7
source/common/src/ttypes.c
source/common/src/ttypes.c
+51
-51
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+92
-75
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+26
-5
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+26
-14
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+3
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+9
-31
source/util/src/tcache.c
source/util/src/tcache.c
+2
-0
source/util/src/tconfig.c
source/util/src/tconfig.c
+3
-3
source/util/src/tlog.c
source/util/src/tlog.c
+85
-78
tests/script/tsim/parser/fourArithmetic-basic.sim
tests/script/tsim/parser/fourArithmetic-basic.sim
+0
-1
tests/script/tsim/query/charScalarFunction.sim
tests/script/tsim/query/charScalarFunction.sim
+0
-1
tests/script/tsim/query/scalarFunction.sim
tests/script/tsim/query/scalarFunction.sim
+0
-1
tests/script/tsim/query/session.sim
tests/script/tsim/query/session.sim
+0
-1
tests/script/tsim/tmq/basic1.sim
tests/script/tsim/tmq/basic1.sim
+0
-1
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim
+0
-1
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim
+0
-1
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim
+0
-1
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim
+0
-1
tests/script/tsim/tmq/mainConsumerInMultiTopic.sim
tests/script/tsim/tmq/mainConsumerInMultiTopic.sim
+0
-1
tests/script/tsim/tmq/mainConsumerInOneTopic.sim
tests/script/tsim/tmq/mainConsumerInOneTopic.sim
+0
-1
tests/script/tsim/tmq/multiTopic.sim
tests/script/tsim/tmq/multiTopic.sim
+0
-1
tests/script/tsim/tmq/oneTopic.sim
tests/script/tsim/tmq/oneTopic.sim
+0
-1
tests/script/tsim/tmq/overlapTopic2Con1Cgrp.sim
tests/script/tsim/tmq/overlapTopic2Con1Cgrp.sim
+0
-1
tests/tsim/inc/simInt.h
tests/tsim/inc/simInt.h
+1
-1
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+11
-2
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+1
-1
未找到文件。
include/common/trow.h
浏览文件 @
47f7ce67
...
@@ -48,9 +48,12 @@ extern "C" {
...
@@ -48,9 +48,12 @@ extern "C" {
#define TD_VTYPE_NONE 0x02U // none or unknown/undefined
#define TD_VTYPE_NONE 0x02U // none or unknown/undefined
#define TD_VTYPE_MAX 0x03U //
#define TD_VTYPE_MAX 0x03U //
#define TD_VTYPE_NORM_BYTE 0x0U
#define TD_VTYPE_NORM_BYTE_I 0x0U
#define TD_VTYPE_NULL_BYTE 0x55U
#define TD_VTYPE_NULL_BYTE_I 0xFFU
#define TD_VTYPE_NONE_BYTE 0xAAU
#define TD_VTYPE_NORM_BYTE_II 0x0U
#define TD_VTYPE_NULL_BYTE_II 0x55U
#define TD_VTYPE_NONE_BYTE_II 0xAAU
#define TD_ROWS_ALL_NORM 0x00U
#define TD_ROWS_ALL_NORM 0x00U
#define TD_ROWS_NULL_NORM 0x01U
#define TD_ROWS_NULL_NORM 0x01U
...
@@ -224,8 +227,10 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
...
@@ -224,8 +227,10 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
);
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeI
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeI
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeII
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeII
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValType
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
,
int8_t
bitmapMode
);
static
FORCE_INLINE
int32_t
tdGetBitmapValType
(
const
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
,
static
FORCE_INLINE
bool
tdIsBitmapValTypeNormII
(
const
void
*
pBitmap
,
int16_t
idx
);
int8_t
bitmapMode
);
static
FORCE_INLINE
bool
tdIsBitmapValTypeNorm
(
const
void
*
pBitmap
,
int16_t
idx
,
int8_t
bitmapMode
);
bool
tdIsBitmapBlkNorm
(
const
void
*
pBitmap
,
int32_t
numOfBits
,
int8_t
bitmapMode
);
int32_t
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int32_t
numOfRows
,
int32_t
maxPoints
,
int32_t
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int32_t
numOfRows
,
int32_t
maxPoints
,
int8_t
bitmapMode
);
int8_t
bitmapMode
);
static
FORCE_INLINE
int32_t
tdAppendColValToTpRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
static
FORCE_INLINE
int32_t
tdAppendColValToTpRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
...
@@ -233,7 +238,7 @@ static FORCE_INLINE int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowVa
...
@@ -233,7 +238,7 @@ static FORCE_INLINE int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowVa
static
FORCE_INLINE
int32_t
tdAppendColValToKvRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
static
FORCE_INLINE
int32_t
tdAppendColValToKvRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
bool
isCopyVarData
,
int8_t
colType
,
int16_t
colIdx
,
int32_t
offset
,
bool
isCopyVarData
,
int8_t
colType
,
int16_t
colIdx
,
int32_t
offset
,
col_id_t
colId
);
col_id_t
colId
);
int32_t
tdAppendSTSRowToDataCol
(
STSRow
*
pRow
,
STSchema
*
pSchema
,
SDataCols
*
pCols
);
int32_t
tdAppendSTSRowToDataCol
(
STSRow
*
pRow
,
STSchema
*
pSchema
,
SDataCols
*
pCols
);
/**
/**
* @brief
* @brief
...
@@ -327,9 +332,9 @@ static FORCE_INLINE int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx,
...
@@ -327,9 +332,9 @@ static FORCE_INLINE int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx,
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
FORCE_INLINE
bool
tdIsBitmapValTypeNorm
II
(
const
void
*
pBitmap
,
int16_t
idx
)
{
static
FORCE_INLINE
bool
tdIsBitmapValTypeNorm
(
const
void
*
pBitmap
,
int16_t
idx
,
int8_t
bitmapMode
)
{
TDRowValT
valType
=
0
;
TDRowValT
valType
=
0
;
tdGetBitmapValType
II
(
pBitmap
,
idx
,
&
valTyp
e
);
tdGetBitmapValType
(
pBitmap
,
idx
,
&
valType
,
bitmapMod
e
);
if
(
tdValTypeIsNorm
(
valType
))
{
if
(
tdValTypeIsNorm
(
valType
))
{
return
true
;
return
true
;
}
}
...
...
include/common/ttypes.h
浏览文件 @
47f7ce67
...
@@ -248,8 +248,8 @@ typedef struct tDataTypeDescriptor {
...
@@ -248,8 +248,8 @@ typedef struct tDataTypeDescriptor {
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
(
*
decompFunc
)(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
(
*
decompFunc
)(
const
char
*
const
input
,
int32_t
compressedSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
int32_t
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int32_t
bufferSize
);
void
(
*
statisFunc
)(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numofrow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
void
(
*
statisFunc
)(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numofrow
,
int64_t
*
min
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
int
64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int
16_t
*
maxindex
,
int16_t
*
numofnull
);
}
tDataTypeDescriptor
;
}
tDataTypeDescriptor
;
extern
tDataTypeDescriptor
tDataTypes
[
15
];
extern
tDataTypeDescriptor
tDataTypes
[
15
];
...
...
include/os/osMemory.h
浏览文件 @
47f7ce67
...
@@ -36,12 +36,12 @@ void *taosMemoryStrDup(void *ptr);
...
@@ -36,12 +36,12 @@ void *taosMemoryStrDup(void *ptr);
void
taosMemoryFree
(
void
*
ptr
);
void
taosMemoryFree
(
void
*
ptr
);
int32_t
taosMemorySize
(
void
*
ptr
);
int32_t
taosMemorySize
(
void
*
ptr
);
#define taosMemoryFreeClear(ptr) \
#define taosMemoryFreeClear(ptr)
\
do { \
do {
\
if (ptr) { \
if (ptr) {
\
taosMemoryFree((void
*)ptr);
\
taosMemoryFree((void
*)ptr);
\
(ptr) = NULL; \
(ptr) = NULL;
\
} \
}
\
} while (0)
} while (0)
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/client/src/clientMain.c
浏览文件 @
47f7ce67
...
@@ -69,9 +69,9 @@ void taos_cleanup(void) {
...
@@ -69,9 +69,9 @@ void taos_cleanup(void) {
rpcCleanup
();
rpcCleanup
();
catalogDestroy
();
catalogDestroy
();
schedulerDestroy
();
schedulerDestroy
();
taosCloseLog
();
tscInfo
(
"all local resources released"
);
tscInfo
(
"all local resources released"
);
taosCloseLog
();
}
}
setConfRet
taos_set_config
(
const
char
*
config
)
{
setConfRet
taos_set_config
(
const
char
*
config
)
{
...
...
source/common/src/tglobal.c
浏览文件 @
47f7ce67
...
@@ -238,7 +238,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char *inputCfgDir, const char *e
...
@@ -238,7 +238,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char *inputCfgDir, const char *e
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfgDir
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfgDir
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfgFile
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfgFile
)
!=
0
)
{
u
Error
(
"failed to load from config file:%s
since %s"
,
cfgFile
,
terrstr
());
u
Info
(
"cfg file:%s not read
since %s"
,
cfgFile
,
terrstr
());
return
0
;
return
0
;
}
}
}
}
...
...
source/common/src/trow.c
浏览文件 @
47f7ce67
...
@@ -16,10 +16,19 @@
...
@@ -16,10 +16,19 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "trow.h"
#include "trow.h"
const
uint8_t
tdVTypeByte
[
3
]
=
{
const
uint8_t
tdVTypeByte
[
2
][
3
]
=
{{
TD_VTYPE_NORM_BYTE
,
// TD_VTYPE_NORM
// 2 bits
TD_VTYPE_NONE_BYTE
,
// TD_VTYPE_NONE
TD_VTYPE_NORM_BYTE_II
,
TD_VTYPE_NULL_BYTE
,
// TD_VTYPE_NULL
TD_VTYPE_NONE_BYTE_II
,
TD_VTYPE_NULL_BYTE_II
,
},
{
// 1 bit
TD_VTYPE_NORM_BYTE_I
,
TD_VTYPE_NULL_BYTE_I
,
TD_VTYPE_NULL_BYTE_I
,
// padding
}
};
};
// declaration
// declaration
...
@@ -266,21 +275,53 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
...
@@ -266,21 +275,53 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
// }
// }
// }
// }
/**
* @brief Set bitmap area by byte preferentially and then by bit.
*
* @param pBitmap
* @param nEle
* @param valType
* @param bitmapMode 0 for 2 bits, 1 for 1 bit
* @return int32_t
*/
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
)
{
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
)
{
TASSERT
(
valType
<
TD_VTYPE_MAX
);
TASSERT
(
valType
<
TD_VTYPE_MAX
);
int16_t
nBytes
=
nEle
/
TD_VTYPE_PARTS
;
int32_t
nBytes
=
(
bitmapMode
==
0
?
nEle
/
TD_VTYPE_PARTS
:
nEle
/
TD_VTYPE_PARTS_I
);
uint8_t
vTypeByte
=
tdVTypeByte
[
bitmapMode
][
valType
];
for
(
int
i
=
0
;
i
<
nBytes
;
++
i
)
{
for
(
int
i
=
0
;
i
<
nBytes
;
++
i
)
{
*
(
uint8_t
*
)
pBitmap
=
tdVTypeByte
[
valType
]
;
*
(
uint8_t
*
)
pBitmap
=
vTypeByte
;
pBitmap
=
POINTER_SHIFT
(
pBitmap
,
1
);
pBitmap
=
POINTER_SHIFT
(
pBitmap
,
1
);
}
}
int16_t
nLeft
=
nEle
-
nBytes
*
TD_VTYPE_BITS
;
int32_t
nLeft
=
nEle
-
nBytes
*
(
bitmapMode
==
0
?
TD_VTYPE_BITS
:
TD_VTYPE_BITS_I
);
for
(
int
j
=
0
;
j
<
nLeft
;
++
j
)
{
for
(
int
j
=
0
;
j
<
nLeft
;
++
j
)
{
tdSetBitmapValType
(
pBitmap
,
j
,
valType
,
bitmapMode
);
tdSetBitmapValType
(
pBitmap
,
j
,
valType
,
bitmapMode
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
bool
tdIsBitmapBlkNorm
(
const
void
*
pBitmap
,
int32_t
numOfBits
,
int8_t
bitmapMode
)
{
int32_t
nBytes
=
(
bitmapMode
==
0
?
numOfBits
/
TD_VTYPE_PARTS
:
numOfBits
/
TD_VTYPE_PARTS_I
);
uint8_t
vTypeByte
=
tdVTypeByte
[
bitmapMode
][
TD_VTYPE_NORM
];
for
(
int
i
=
0
;
i
<
nBytes
;
++
i
)
{
if
(
*
((
uint8_t
*
)
pBitmap
)
!=
vTypeByte
)
{
return
false
;
}
pBitmap
=
POINTER_SHIFT
(
pBitmap
,
1
);
}
int32_t
nLeft
=
numOfBits
-
nBytes
*
(
bitmapMode
==
0
?
TD_VTYPE_BITS
:
TD_VTYPE_BITS_I
);
for
(
int
j
=
0
;
j
<
nLeft
;
++
j
)
{
uint8_t
vType
;
tdGetBitmapValType
(
pBitmap
,
j
,
&
vType
,
bitmapMode
);
if
(
vType
!=
TD_VTYPE_NORM
)
{
return
false
;
}
}
return
true
;
}
static
FORCE_INLINE
void
dataColSetNoneAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
,
int8_t
bitmapMode
)
{
static
FORCE_INLINE
void
dataColSetNoneAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
,
int8_t
bitmapMode
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
pCol
->
dataOff
[
index
]
=
pCol
->
len
;
pCol
->
dataOff
[
index
]
=
pCol
->
len
;
...
...
source/common/src/ttypes.c
浏览文件 @
47f7ce67
...
@@ -50,8 +50,8 @@ const int32_t TYPE_BYTES[15] = {
...
@@ -50,8 +50,8 @@ const int32_t TYPE_BYTES[15] = {
} \
} \
} while (0)
} while (0)
static
void
getStatics_bool
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_bool
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int8_t
*
data
=
(
int8_t
*
)
pData
;
int8_t
*
data
=
(
int8_t
*
)
pData
;
*
min
=
INT64_MAX
;
*
min
=
INT64_MAX
;
*
max
=
INT64_MIN
;
*
max
=
INT64_MIN
;
...
@@ -62,7 +62,7 @@ static void getStatics_bool(const void *pBitmap, const void *pData, int32_t numO
...
@@ -62,7 +62,7 @@ static void getStatics_bool(const void *pBitmap, const void *pData, int32_t numO
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (data[i] == TSDB_DATA_BOOL_NULL) {
// if (data[i] == TSDB_DATA_BOOL_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -71,8 +71,8 @@ static void getStatics_bool(const void *pBitmap, const void *pData, int32_t numO
...
@@ -71,8 +71,8 @@ static void getStatics_bool(const void *pBitmap, const void *pData, int32_t numO
}
}
}
}
static
void
getStatics_i8
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_i8
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int8_t
*
data
=
(
int8_t
*
)
pData
;
int8_t
*
data
=
(
int8_t
*
)
pData
;
*
min
=
INT64_MAX
;
*
min
=
INT64_MAX
;
*
max
=
INT64_MIN
;
*
max
=
INT64_MIN
;
...
@@ -83,7 +83,7 @@ static void getStatics_i8(const void *pBitmap, const void *pData, int32_t numOfR
...
@@ -83,7 +83,7 @@ static void getStatics_i8(const void *pBitmap, const void *pData, int32_t numOfR
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint8_t)data[i]) == TSDB_DATA_TINYINT_NULL) {
// if (((uint8_t)data[i]) == TSDB_DATA_TINYINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -92,8 +92,8 @@ static void getStatics_i8(const void *pBitmap, const void *pData, int32_t numOfR
...
@@ -92,8 +92,8 @@ static void getStatics_i8(const void *pBitmap, const void *pData, int32_t numOfR
}
}
}
}
static
void
getStatics_u8
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_u8
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
uint8_t
*
data
=
(
uint8_t
*
)
pData
;
uint8_t
*
data
=
(
uint8_t
*
)
pData
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_max
=
0
;
uint64_t
_max
=
0
;
...
@@ -106,7 +106,7 @@ static void getStatics_u8(const void *pBitmap, const void *pData, int32_t numOfR
...
@@ -106,7 +106,7 @@ static void getStatics_u8(const void *pBitmap, const void *pData, int32_t numOfR
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint8_t)data[i]) == TSDB_DATA_UTINYINT_NULL) {
// if (((uint8_t)data[i]) == TSDB_DATA_UTINYINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -119,8 +119,8 @@ static void getStatics_u8(const void *pBitmap, const void *pData, int32_t numOfR
...
@@ -119,8 +119,8 @@ static void getStatics_u8(const void *pBitmap, const void *pData, int32_t numOfR
*
sum
=
_sum
;
*
sum
=
_sum
;
}
}
static
void
getStatics_i16
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_i16
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int16_t
*
data
=
(
int16_t
*
)
pData
;
int16_t
*
data
=
(
int16_t
*
)
pData
;
*
min
=
INT64_MAX
;
*
min
=
INT64_MAX
;
*
max
=
INT64_MIN
;
*
max
=
INT64_MIN
;
...
@@ -131,7 +131,7 @@ static void getStatics_i16(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -131,7 +131,7 @@ static void getStatics_i16(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint16_t)data[i]) == TSDB_DATA_SMALLINT_NULL) {
// if (((uint16_t)data[i]) == TSDB_DATA_SMALLINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -140,8 +140,8 @@ static void getStatics_i16(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -140,8 +140,8 @@ static void getStatics_i16(const void *pBitmap, const void *pData, int32_t numOf
}
}
}
}
static
void
getStatics_u16
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_u16
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
uint16_t
*
data
=
(
uint16_t
*
)
pData
;
uint16_t
*
data
=
(
uint16_t
*
)
pData
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_max
=
0
;
uint64_t
_max
=
0
;
...
@@ -154,7 +154,7 @@ static void getStatics_u16(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -154,7 +154,7 @@ static void getStatics_u16(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint16_t)data[i]) == TSDB_DATA_USMALLINT_NULL) {
// if (((uint16_t)data[i]) == TSDB_DATA_USMALLINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -167,8 +167,8 @@ static void getStatics_u16(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -167,8 +167,8 @@ static void getStatics_u16(const void *pBitmap, const void *pData, int32_t numOf
*
sum
=
_sum
;
*
sum
=
_sum
;
}
}
static
void
getStatics_i32
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_i32
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int32_t
*
data
=
(
int32_t
*
)
pData
;
int32_t
*
data
=
(
int32_t
*
)
pData
;
*
min
=
INT64_MAX
;
*
min
=
INT64_MAX
;
*
max
=
INT64_MIN
;
*
max
=
INT64_MIN
;
...
@@ -179,7 +179,7 @@ static void getStatics_i32(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -179,7 +179,7 @@ static void getStatics_i32(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint32_t)data[i]) == TSDB_DATA_INT_NULL) {
// if (((uint32_t)data[i]) == TSDB_DATA_INT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -188,8 +188,8 @@ static void getStatics_i32(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -188,8 +188,8 @@ static void getStatics_i32(const void *pBitmap, const void *pData, int32_t numOf
}
}
}
}
static
void
getStatics_u32
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_u32
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
uint32_t
*
data
=
(
uint32_t
*
)
pData
;
uint32_t
*
data
=
(
uint32_t
*
)
pData
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_max
=
0
;
uint64_t
_max
=
0
;
...
@@ -202,7 +202,7 @@ static void getStatics_u32(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -202,7 +202,7 @@ static void getStatics_u32(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint32_t)data[i]) == TSDB_DATA_UINT_NULL) {
// if (((uint32_t)data[i]) == TSDB_DATA_UINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -215,8 +215,8 @@ static void getStatics_u32(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -215,8 +215,8 @@ static void getStatics_u32(const void *pBitmap, const void *pData, int32_t numOf
*
sum
=
_sum
;
*
sum
=
_sum
;
}
}
static
void
getStatics_i64
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_i64
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int64_t
*
data
=
(
int64_t
*
)
pData
;
int64_t
*
data
=
(
int64_t
*
)
pData
;
*
min
=
INT64_MAX
;
*
min
=
INT64_MAX
;
*
max
=
INT64_MIN
;
*
max
=
INT64_MIN
;
...
@@ -227,7 +227,7 @@ static void getStatics_i64(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -227,7 +227,7 @@ static void getStatics_i64(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint64_t)data[i]) == TSDB_DATA_BIGINT_NULL) {
// if (((uint64_t)data[i]) == TSDB_DATA_BIGINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -236,8 +236,8 @@ static void getStatics_i64(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -236,8 +236,8 @@ static void getStatics_i64(const void *pBitmap, const void *pData, int32_t numOf
}
}
}
}
static
void
getStatics_u64
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_u64
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
uint64_t
*
data
=
(
uint64_t
*
)
pData
;
uint64_t
*
data
=
(
uint64_t
*
)
pData
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_min
=
UINT64_MAX
;
uint64_t
_max
=
0
;
uint64_t
_max
=
0
;
...
@@ -250,7 +250,7 @@ static void getStatics_u64(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -250,7 +250,7 @@ static void getStatics_u64(const void *pBitmap, const void *pData, int32_t numOf
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (((uint64_t)data[i]) == TSDB_DATA_UBIGINT_NULL) {
// if (((uint64_t)data[i]) == TSDB_DATA_UBIGINT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -263,8 +263,8 @@ static void getStatics_u64(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -263,8 +263,8 @@ static void getStatics_u64(const void *pBitmap, const void *pData, int32_t numOf
*
sum
=
_sum
;
*
sum
=
_sum
;
}
}
static
void
getStatics_f
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_f
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
float
*
data
=
(
float
*
)
pData
;
float
*
data
=
(
float
*
)
pData
;
float
fmin
=
FLT_MAX
;
float
fmin
=
FLT_MAX
;
float
fmax
=
-
FLT_MAX
;
float
fmax
=
-
FLT_MAX
;
...
@@ -276,7 +276,7 @@ static void getStatics_f(const void *pBitmap, const void *pData, int32_t numOfRo
...
@@ -276,7 +276,7 @@ static void getStatics_f(const void *pBitmap, const void *pData, int32_t numOfRo
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if ((*(uint32_t *)&(data[i])) == TSDB_DATA_FLOAT_NULL) {
// if ((*(uint32_t *)&(data[i])) == TSDB_DATA_FLOAT_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -300,8 +300,8 @@ static void getStatics_f(const void *pBitmap, const void *pData, int32_t numOfRo
...
@@ -300,8 +300,8 @@ static void getStatics_f(const void *pBitmap, const void *pData, int32_t numOfRo
SET_DOUBLE_VAL
(
min
,
fmin
);
SET_DOUBLE_VAL
(
min
,
fmin
);
}
}
static
void
getStatics_d
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_d
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
double
*
data
=
(
double
*
)
pData
;
double
*
data
=
(
double
*
)
pData
;
double
dmin
=
DBL_MAX
;
double
dmin
=
DBL_MAX
;
double
dmax
=
-
DBL_MAX
;
double
dmax
=
-
DBL_MAX
;
...
@@ -313,7 +313,7 @@ static void getStatics_d(const void *pBitmap, const void *pData, int32_t numOfRo
...
@@ -313,7 +313,7 @@ static void getStatics_d(const void *pBitmap, const void *pData, int32_t numOfRo
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if ((*(uint64_t *)&(data[i])) == TSDB_DATA_DOUBLE_NULL) {
// if ((*(uint64_t *)&(data[i])) == TSDB_DATA_DOUBLE_NULL) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
continue
;
continue
;
}
}
...
@@ -337,14 +337,14 @@ static void getStatics_d(const void *pBitmap, const void *pData, int32_t numOfRo
...
@@ -337,14 +337,14 @@ static void getStatics_d(const void *pBitmap, const void *pData, int32_t numOfRo
SET_DOUBLE_PTR
(
min
,
&
dmin
);
SET_DOUBLE_PTR
(
min
,
&
dmin
);
}
}
static
void
getStatics_bin
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_bin
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
const
char
*
data
=
pData
;
const
char
*
data
=
pData
;
assert
(
numOfRow
<=
INT16_MAX
);
assert
(
numOfRow
<=
INT16_MAX
);
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (isNull(data, TSDB_DATA_TYPE_BINARY)) {
// if (isNull(data, TSDB_DATA_TYPE_BINARY)) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
}
}
...
@@ -358,14 +358,14 @@ static void getStatics_bin(const void *pBitmap, const void *pData, int32_t numOf
...
@@ -358,14 +358,14 @@ static void getStatics_bin(const void *pBitmap, const void *pData, int32_t numOf
*
maxIndex
=
0
;
*
maxIndex
=
0
;
}
}
static
void
getStatics_nchr
(
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
static
void
getStatics_nchr
(
int8_t
bitmapMode
,
const
void
*
pBitmap
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
int
64_t
*
max
,
int64_t
*
sum
,
int
16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
const
char
*
data
=
pData
;
const
char
*
data
=
pData
;
assert
(
numOfRow
<=
INT16_MAX
);
assert
(
numOfRow
<=
INT16_MAX
);
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRow
;
++
i
)
{
// if (isNull(data, TSDB_DATA_TYPE_NCHAR)) {
// if (isNull(data, TSDB_DATA_TYPE_NCHAR)) {
if
(
!
tdIsBitmapValTypeNorm
II
(
pBitmap
,
i
))
{
if
(
!
tdIsBitmapValTypeNorm
(
pBitmap
,
i
,
bitmapMode
))
{
(
*
numOfNull
)
+=
1
;
(
*
numOfNull
)
+=
1
;
}
}
...
@@ -405,19 +405,19 @@ tDataTypeDescriptor tDataTypes[15] = {
...
@@ -405,19 +405,19 @@ tDataTypeDescriptor tDataTypes[15] = {
};
};
char
tTokenTypeSwitcher
[
13
]
=
{
char
tTokenTypeSwitcher
[
13
]
=
{
TSDB_DATA_TYPE_NULL
,
// no type
TSDB_DATA_TYPE_NULL
,
// no type
TSDB_DATA_TYPE_BINARY
,
// TK_ID
TSDB_DATA_TYPE_BINARY
,
// TK_ID
TSDB_DATA_TYPE_BOOL
,
// TK_BOOL
TSDB_DATA_TYPE_BOOL
,
// TK_BOOL
TSDB_DATA_TYPE_BIGINT
,
// TK_TINYINT
TSDB_DATA_TYPE_BIGINT
,
// TK_TINYINT
TSDB_DATA_TYPE_BIGINT
,
// TK_SMALLINT
TSDB_DATA_TYPE_BIGINT
,
// TK_SMALLINT
TSDB_DATA_TYPE_BIGINT
,
// TK_INTEGER
TSDB_DATA_TYPE_BIGINT
,
// TK_INTEGER
TSDB_DATA_TYPE_BIGINT
,
// TK_BIGINT
TSDB_DATA_TYPE_BIGINT
,
// TK_BIGINT
TSDB_DATA_TYPE_DOUBLE
,
// TK_FLOAT
TSDB_DATA_TYPE_DOUBLE
,
// TK_FLOAT
TSDB_DATA_TYPE_DOUBLE
,
// TK_DOUBLE
TSDB_DATA_TYPE_DOUBLE
,
// TK_DOUBLE
TSDB_DATA_TYPE_BINARY
,
// TK_STRING
TSDB_DATA_TYPE_BINARY
,
// TK_STRING
TSDB_DATA_TYPE_BIGINT
,
// TK_TIMESTAMP
TSDB_DATA_TYPE_BIGINT
,
// TK_TIMESTAMP
TSDB_DATA_TYPE_VARCHAR
,
// TK_BINARY
TSDB_DATA_TYPE_VARCHAR
,
// TK_BINARY
TSDB_DATA_TYPE_NCHAR
,
// TK_NCHAR
TSDB_DATA_TYPE_NCHAR
,
// TK_NCHAR
};
};
float
floatMin
=
-
FLT_MAX
,
floatMax
=
FLT_MAX
;
float
floatMin
=
-
FLT_MAX
,
floatMax
=
FLT_MAX
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
47f7ce67
...
@@ -262,6 +262,7 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
...
@@ -262,6 +262,7 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
vmCloseVnodes
(
pMgmt
);
vmCloseVnodes
(
pMgmt
);
vmStopWorker
(
pMgmt
);
vmStopWorker
(
pMgmt
);
vnodeCleanup
();
vnodeCleanup
();
tfsClose
(
pMgmt
->
pTfs
);
// walCleanUp();
// walCleanUp();
taosMemoryFree
(
pMgmt
);
taosMemoryFree
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
pWrapper
->
pMgmt
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
47f7ce67
...
@@ -1354,7 +1354,7 @@ char *mndGetDbStr(char *src) {
...
@@ -1354,7 +1354,7 @@ char *mndGetDbStr(char *src) {
return
pos
;
return
pos
;
}
}
static
void
dumpDbInfoData
(
SSDataBlock
*
pBlock
,
SDbObj
*
pDb
,
SShowObj
*
pShow
,
int32_t
rows
,
int64_t
numOfTables
)
{
static
void
dumpDbInfoData
(
SSDataBlock
*
pBlock
,
SDbObj
*
pDb
,
SShowObj
*
pShow
,
int32_t
rows
,
int64_t
numOfTables
,
bool
sysDb
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
char
*
buf
=
taosMemoryMalloc
(
pShow
->
bytes
[
cols
]);
char
*
buf
=
taosMemoryMalloc
(
pShow
->
bytes
[
cols
]);
...
@@ -1366,100 +1366,117 @@ static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1366,100 +1366,117 @@ static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, in
ASSERT
(
0
);
ASSERT
(
0
);
}
}
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
)
;
char
*
status
=
"ready"
;
c
olDataAppend
(
pColInfo
,
rows
,
buf
,
false
)
;
c
har
b
[
24
]
=
{
0
}
;
taosMemoryFree
(
buf
);
STR_WITH_SIZE_TO_VARSTR
(
b
,
status
,
strlen
(
status
)
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
if
(
sysDb
)
{
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
createdTime
,
false
);
for
(
int32_t
i
=
0
;
i
<
pShow
->
numOfColumns
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
i
==
0
)
{
colDataAppend
(
pColInfo
,
rows
,
buf
,
false
);
}
else
if
(
i
==
3
)
{
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
numOfTables
,
false
);
}
else
if
(
i
==
20
)
{
colDataAppend
(
pColInfo
,
rows
,
b
,
false
);
}
else
{
colDataAppendNULL
(
pColInfo
,
rows
);
}
}
}
else
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
buf
,
false
);
taosMemoryFree
(
buf
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfVgroups
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
createdTime
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
numOfTable
s
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfVgroup
s
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
replication
s
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
numOfTable
s
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
quorum
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
replications
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
daysPerFile
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
quorum
,
false
);
char
tmp
[
128
]
=
{
0
};
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
int32_t
len
=
0
;
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
daysPerFile
,
false
);
if
(
pDb
->
cfg
.
daysToKeep0
>
pDb
->
cfg
.
daysToKeep1
||
pDb
->
cfg
.
daysToKeep0
>
pDb
->
cfg
.
daysToKeep2
)
{
len
=
sprintf
(
&
tmp
[
VARSTR_HEADER_SIZE
],
"%d,%d,%d"
,
pDb
->
cfg
.
daysToKeep1
,
pDb
->
cfg
.
daysToKeep2
,
pDb
->
cfg
.
daysToKeep0
);
}
else
{
len
=
sprintf
(
&
tmp
[
VARSTR_HEADER_SIZE
],
"%d,%d,%d"
,
pDb
->
cfg
.
daysToKeep0
,
pDb
->
cfg
.
daysToKeep1
,
pDb
->
cfg
.
daysToKeep2
);
}
varDataSetLen
(
tmp
,
len
);
char
tmp
[
128
]
=
{
0
};
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
int32_t
len
=
0
;
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
tmp
,
false
);
if
(
pDb
->
cfg
.
daysToKeep0
>
pDb
->
cfg
.
daysToKeep1
||
pDb
->
cfg
.
daysToKeep0
>
pDb
->
cfg
.
daysToKeep2
)
{
len
=
sprintf
(
&
tmp
[
VARSTR_HEADER_SIZE
],
"%d,%d,%d"
,
pDb
->
cfg
.
daysToKeep1
,
pDb
->
cfg
.
daysToKeep2
,
pDb
->
cfg
.
daysToKeep0
);
}
else
{
len
=
sprintf
(
&
tmp
[
VARSTR_HEADER_SIZE
],
"%d,%d,%d"
,
pDb
->
cfg
.
daysToKeep0
,
pDb
->
cfg
.
daysToKeep1
,
pDb
->
cfg
.
daysToKeep2
);
}
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
varDataSetLen
(
tmp
,
len
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
cacheBlockSize
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
tmp
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
totalBlocks
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
cacheBlockSize
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
minRow
s
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
totalBlock
s
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
max
Rows
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
min
Rows
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
walLevel
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
maxRows
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
fsyncPeriod
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
walLevel
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
compression
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
fsyncPeriod
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
cacheLastRow
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
compression
,
false
);
char
*
prec
=
NULL
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
switch
(
pDb
->
cfg
.
precision
)
{
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
cacheLastRow
,
false
);
case
TSDB_TIME_PRECISION_MILLI
:
prec
=
TSDB_TIME_PRECISION_MILLI_STR
;
break
;
case
TSDB_TIME_PRECISION_MICRO
:
prec
=
TSDB_TIME_PRECISION_MICRO_STR
;
break
;
case
TSDB_TIME_PRECISION_NANO
:
prec
=
TSDB_TIME_PRECISION_NANO_STR
;
break
;
default:
prec
=
"none"
;
break
;
}
char
t
[
10
]
=
{
0
};
char
*
prec
=
NULL
;
STR_WITH_SIZE_TO_VARSTR
(
t
,
prec
,
2
);
switch
(
pDb
->
cfg
.
precision
)
{
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
case
TSDB_TIME_PRECISION_MILLI
:
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
t
,
false
);
prec
=
TSDB_TIME_PRECISION_MILLI_STR
;
break
;
case
TSDB_TIME_PRECISION_MICRO
:
prec
=
TSDB_TIME_PRECISION_MICRO_STR
;
break
;
case
TSDB_TIME_PRECISION_NANO
:
prec
=
TSDB_TIME_PRECISION_NANO_STR
;
break
;
default:
prec
=
"none"
;
break
;
}
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
char
t
[
10
]
=
{
0
};
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
ttl
,
false
);
STR_WITH_SIZE_TO_VARSTR
(
t
,
prec
,
2
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
t
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
singleSTable
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
ttl
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
streamMod
e
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
singleSTabl
e
,
false
);
char
*
status
=
"ready"
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
char
b
[
24
]
=
{
0
};
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
streamMode
,
false
);
STR_WITH_SIZE_TO_VARSTR
(
b
,
status
,
strlen
(
status
));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
}
// pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
// pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity);
// *(int8_t *)pWrite = pDb->cfg.update;
// *(int8_t *)pWrite = pDb->cfg.update;
...
@@ -1508,13 +1525,13 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlo
...
@@ -1508,13 +1525,13 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlo
if
(
!
pShow
->
sysDbRsp
)
{
if
(
!
pShow
->
sysDbRsp
)
{
SDbObj
infoschemaDb
=
{
0
};
SDbObj
infoschemaDb
=
{
0
};
setInformationSchemaDbCfg
(
&
infoschemaDb
);
setInformationSchemaDbCfg
(
&
infoschemaDb
);
dumpDbInfoData
(
pBlock
,
&
infoschemaDb
,
pShow
,
numOfRows
,
14
);
dumpDbInfoData
(
pBlock
,
&
infoschemaDb
,
pShow
,
numOfRows
,
14
,
true
);
numOfRows
+=
1
;
numOfRows
+=
1
;
SDbObj
perfschemaDb
=
{
0
};
SDbObj
perfschemaDb
=
{
0
};
setPerfSchemaDbCfg
(
&
perfschemaDb
);
setPerfSchemaDbCfg
(
&
perfschemaDb
);
dumpDbInfoData
(
pBlock
,
&
perfschemaDb
,
pShow
,
numOfRows
,
3
);
dumpDbInfoData
(
pBlock
,
&
perfschemaDb
,
pShow
,
numOfRows
,
3
,
true
);
numOfRows
+=
1
;
numOfRows
+=
1
;
pShow
->
sysDbRsp
=
true
;
pShow
->
sysDbRsp
=
true
;
...
@@ -1529,7 +1546,7 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlo
...
@@ -1529,7 +1546,7 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* pBlo
int32_t
numOfTables
=
0
;
int32_t
numOfTables
=
0
;
sdbTraverse
(
pSdb
,
SDB_VGROUP
,
mndGetTablesOfDbFp
,
&
numOfTables
,
NULL
,
NULL
);
sdbTraverse
(
pSdb
,
SDB_VGROUP
,
mndGetTablesOfDbFp
,
&
numOfTables
,
NULL
,
NULL
);
dumpDbInfoData
(
pBlock
,
pDb
,
pShow
,
numOfRows
,
numOfTables
);
dumpDbInfoData
(
pBlock
,
pDb
,
pShow
,
numOfRows
,
numOfTables
,
false
);
numOfRows
++
;
numOfRows
++
;
sdbRelease
(
pSdb
,
pDb
);
sdbRelease
(
pSdb
,
pDb
);
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
47f7ce67
...
@@ -1201,6 +1201,23 @@ static int tsdbComparKeyBlock(const void *arg1, const void *arg2) {
...
@@ -1201,6 +1201,23 @@ static int tsdbComparKeyBlock(const void *arg1, const void *arg2) {
}
}
}
}
/**
* @brief Write SDataCols to data file.
*
* @param pRepo
* @param pTable
* @param pDFile
* @param pDFileAggr
* @param pDataCols The pDataCols would be generated from mem/imem directly with 2 bits bitmap or from tsdbRead
* interface with 1 bit bitmap.
* @param pBlock
* @param isLast
* @param isSuper
* @param ppBuf
* @param ppCBuf
* @param ppExBuf
* @return int
*/
int
tsdbWriteBlockImpl
(
STsdb
*
pRepo
,
STable
*
pTable
,
SDFile
*
pDFile
,
SDFile
*
pDFileAggr
,
SDataCols
*
pDataCols
,
int
tsdbWriteBlockImpl
(
STsdb
*
pRepo
,
STable
*
pTable
,
SDFile
*
pDFile
,
SDFile
*
pDFileAggr
,
SDataCols
*
pDataCols
,
SBlock
*
pBlock
,
bool
isLast
,
bool
isSuper
,
void
**
ppBuf
,
void
**
ppCBuf
,
void
**
ppExBuf
)
{
SBlock
*
pBlock
,
bool
isLast
,
bool
isSuper
,
void
**
ppBuf
,
void
**
ppCBuf
,
void
**
ppExBuf
)
{
STsdbCfg
*
pCfg
=
REPO_CFG
(
pRepo
);
STsdbCfg
*
pCfg
=
REPO_CFG
(
pRepo
);
...
@@ -1244,14 +1261,15 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
...
@@ -1244,14 +1261,15 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
pBlockCol
->
type
=
pDataCol
->
type
;
pBlockCol
->
type
=
pDataCol
->
type
;
pAggrBlkCol
->
colId
=
pDataCol
->
colId
;
pAggrBlkCol
->
colId
=
pDataCol
->
colId
;
if
(
tDataTypes
[
pDataCol
->
type
].
statisFunc
)
{
if
(
isSuper
&&
pColumn
->
sma
&&
tDataTypes
[
pDataCol
->
type
].
statisFunc
)
{
#if 0
#if 0
(*tDataTypes[pDataCol->type].statisFunc)(pDataCol->pData, rowsToWrite, &(pBlockCol->min), &(pBlockCol->max),
(*tDataTypes[pDataCol->type].statisFunc)(pDataCol->pData, rowsToWrite, &(pBlockCol->min), &(pBlockCol->max),
&(pBlockCol->sum), &(pBlockCol->minIndex), &(pBlockCol->maxIndex),
&(pBlockCol->sum), &(pBlockCol->minIndex), &(pBlockCol->maxIndex),
&(pBlockCol->numOfNull));
&(pBlockCol->numOfNull));
#endif
#endif
(
*
tDataTypes
[
pDataCol
->
type
].
statisFunc
)(
pDataCol
->
pBitmap
,
pDataCol
->
pData
,
rowsToWrite
,
&
(
pAggrBlkCol
->
min
),
&
(
pAggrBlkCol
->
max
),
(
*
tDataTypes
[
pDataCol
->
type
].
statisFunc
)(
pDataCols
->
bitmapMode
,
pDataCol
->
pBitmap
,
pDataCol
->
pData
,
rowsToWrite
,
&
(
pAggrBlkCol
->
sum
),
&
(
pAggrBlkCol
->
minIndex
),
&
(
pAggrBlkCol
->
maxIndex
),
&
(
pAggrBlkCol
->
min
),
&
(
pAggrBlkCol
->
max
),
&
(
pAggrBlkCol
->
sum
),
&
(
pAggrBlkCol
->
minIndex
),
&
(
pAggrBlkCol
->
maxIndex
),
&
(
pAggrBlkCol
->
numOfNull
));
&
(
pAggrBlkCol
->
numOfNull
));
if
(
pAggrBlkCol
->
numOfNull
==
0
)
{
if
(
pAggrBlkCol
->
numOfNull
==
0
)
{
...
@@ -1259,13 +1277,16 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
...
@@ -1259,13 +1277,16 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
}
else
{
}
else
{
TD_SET_COL_ROWS_MISC
(
pBlockCol
);
TD_SET_COL_ROWS_MISC
(
pBlockCol
);
}
}
}
else
if
(
tdIsBitmapBlkNorm
(
pDataCol
->
pBitmap
,
rowsToWrite
,
pDataCols
->
bitmapMode
))
{
// check if all rows normal
TD_SET_COL_ROWS_NORM
(
pBlockCol
);
}
else
{
}
else
{
TD_SET_COL_ROWS_MISC
(
pBlockCol
);
TD_SET_COL_ROWS_MISC
(
pBlockCol
);
}
}
++
nColsNotAllNull
;
++
nColsNotAllNull
;
if
(
pColumn
->
sma
)
{
if
(
isSuper
&&
pColumn
->
sma
)
{
++
nColsOfBlockSma
;
++
nColsOfBlockSma
;
}
}
}
}
...
@@ -1277,7 +1298,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
...
@@ -1277,7 +1298,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF
uint32_t
toffset
=
0
;
uint32_t
toffset
=
0
;
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
nColsNotAllNull
,
SBlockVerLatest
);
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
nColsNotAllNull
,
SBlockVerLatest
);
int32_t
lsize
=
tsize
;
int32_t
lsize
=
tsize
;
uint32_t
tsizeAggr
=
(
uint32_t
)
tsdbBlockAggrSize
(
nCols
NotAllNull
,
SBlockVerLatest
);
uint32_t
tsizeAggr
=
(
uint32_t
)
tsdbBlockAggrSize
(
nCols
OfBlockSma
,
SBlockVerLatest
);
int32_t
keyLen
=
0
;
int32_t
keyLen
=
0
;
int32_t
nBitmaps
=
(
int32_t
)
TD_BITMAP_BYTES
(
rowsToWrite
);
int32_t
nBitmaps
=
(
int32_t
)
TD_BITMAP_BYTES
(
rowsToWrite
);
int32_t
sBitmaps
=
isSuper
?
(
int32_t
)
TD_BITMAP_BYTES_I
(
rowsToWrite
)
:
nBitmaps
;
int32_t
sBitmaps
=
isSuper
?
(
int32_t
)
TD_BITMAP_BYTES_I
(
rowsToWrite
)
:
nBitmaps
;
...
...
source/libs/function/src/builtins.c
浏览文件 @
47f7ce67
...
@@ -237,33 +237,45 @@ static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
...
@@ -237,33 +237,45 @@ static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateConcatImpl
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
,
int32_t
minParaNum
,
int32_t
maxParaNum
,
int32_t
primaryParaNo
)
{
static
int32_t
translateConcatImpl
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
,
int32_t
minParaNum
,
int32_t
maxParaNum
,
bool
hasSep
)
{
int32_t
paraNum
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
int32_t
paraNum
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
if
(
paraNum
<
minParaNum
||
paraNum
>
maxParaNum
)
{
if
(
paraNum
<
minParaNum
||
paraNum
>
maxParaNum
)
{
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
uint8_t
resultType
=
TSDB_DATA_TYPE_
NCHAR
;
uint8_t
resultType
=
TSDB_DATA_TYPE_
BINARY
;
int32_t
resultBytes
=
0
;
int32_t
resultBytes
=
0
;
int32_t
sepBytes
=
0
;
int32_t
sepBytes
=
0
;
for
(
int32_t
i
=
0
;
i
<
LIST_LENGTH
(
pFunc
->
pParameterList
);
++
i
)
{
/* For concat/concat_ws function, if params have NCHAR type, promote the final result to NCHAR */
for
(
int32_t
i
=
0
;
i
<
paraNum
;
++
i
)
{
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
uint8_t
paraType
=
((
SExprNode
*
)
pPara
)
->
resType
.
type
;
uint8_t
paraType
=
((
SExprNode
*
)
pPara
)
->
resType
.
type
;
int32_t
paraBytes
=
((
SExprNode
*
)
pPara
)
->
resType
.
bytes
;
if
(
!
IS_VAR_DATA_TYPE
(
paraType
))
{
if
(
!
IS_VAR_DATA_TYPE
(
paraType
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
if
(
i
<
primaryParaNo
)
{
if
(
TSDB_DATA_TYPE_NCHAR
==
paraType
)
{
sepBytes
=
paraBytes
;
resultType
=
paraType
;
continue
;
}
}
for
(
int32_t
i
=
0
;
i
<
paraNum
;
++
i
)
{
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
uint8_t
paraType
=
((
SExprNode
*
)
pPara
)
->
resType
.
type
;
int32_t
paraBytes
=
((
SExprNode
*
)
pPara
)
->
resType
.
bytes
;
int32_t
factor
=
1
;
if
(
TSDB_DATA_TYPE_NCHAR
==
resultType
&&
TSDB_DATA_TYPE_VARCHAR
==
paraType
)
{
factor
*=
TSDB_NCHAR_SIZE
;
}
}
if
(
TSDB_DATA_TYPE_BINARY
==
paraType
)
{
resultBytes
+=
paraBytes
*
factor
;
resultType
=
TSDB_DATA_TYPE_BINARY
;
if
(
i
==
0
)
{
sepBytes
=
paraBytes
*
factor
;
}
}
resultBytes
+=
paraBytes
;
}
}
if
(
sepBytes
>
0
)
{
resultBytes
+=
sepBytes
*
(
paraNum
-
2
);
if
(
hasSep
)
{
resultBytes
+=
sepBytes
*
(
paraNum
-
3
);
}
}
pFunc
->
node
.
resType
=
(
SDataType
)
{
.
bytes
=
resultBytes
,
.
type
=
resultType
};
pFunc
->
node
.
resType
=
(
SDataType
)
{
.
bytes
=
resultBytes
,
.
type
=
resultType
};
...
@@ -271,11 +283,11 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -271,11 +283,11 @@ static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
}
}
static
int32_t
translateConcat
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateConcat
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateConcatImpl
(
pFunc
,
pErrBuf
,
len
,
2
,
8
,
0
);
return
translateConcatImpl
(
pFunc
,
pErrBuf
,
len
,
2
,
8
,
false
);
}
}
static
int32_t
translateConcatWs
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateConcatWs
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateConcatImpl
(
pFunc
,
pErrBuf
,
len
,
3
,
9
,
1
);
return
translateConcatImpl
(
pFunc
,
pErrBuf
,
len
,
3
,
9
,
true
);
}
}
static
int32_t
translateSubstr
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateSubstr
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
47f7ce67
...
@@ -1226,7 +1226,7 @@ void valueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
...
@@ -1226,7 +1226,7 @@ void valueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
case
TSDB_DATA_TYPE_VARBINARY
:
pVal
->
pz
=
pNode
->
datum
.
p
+
VARSTR_HEADER_SIZE
;
pVal
->
pz
=
pNode
->
datum
.
p
;
break
;
break
;
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_DECIMAL
:
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
47f7ce67
...
@@ -1470,6 +1470,9 @@ void qWorkerDestroy(void **qWorkerMgmt) {
...
@@ -1470,6 +1470,9 @@ void qWorkerDestroy(void **qWorkerMgmt) {
//TODO FREE ALL
//TODO FREE ALL
taosHashCleanup
(
mgmt
->
ctxHash
);
taosHashCleanup
(
mgmt
->
schHash
);
taosMemoryFreeClear
(
*
qWorkerMgmt
);
taosMemoryFreeClear
(
*
qWorkerMgmt
);
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
47f7ce67
...
@@ -313,8 +313,8 @@ static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
...
@@ -313,8 +313,8 @@ static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
concatCopyHelper
(
const
char
*
input
,
char
*
output
,
bool
hasNchar
Col
,
int32_t
type
,
int16_t
*
dataLen
)
{
static
int32_t
concatCopyHelper
(
const
char
*
input
,
char
*
output
,
bool
hasNchar
,
int32_t
type
,
int16_t
*
dataLen
)
{
if
(
hasNchar
Col
&&
type
==
TSDB_DATA_TYPE_VARCHAR
)
{
if
(
hasNchar
&&
type
==
TSDB_DATA_TYPE_VARCHAR
)
{
TdUcs4
*
newBuf
=
taosMemoryCalloc
((
varDataLen
(
input
)
+
1
)
*
TSDB_NCHAR_SIZE
,
1
);
TdUcs4
*
newBuf
=
taosMemoryCalloc
((
varDataLen
(
input
)
+
1
)
*
TSDB_NCHAR_SIZE
,
1
);
bool
ret
=
taosMbsToUcs4
(
varDataVal
(
input
),
varDataLen
(
input
),
newBuf
,
(
varDataLen
(
input
)
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
bool
ret
=
taosMbsToUcs4
(
varDataVal
(
input
),
varDataLen
(
input
),
newBuf
,
(
varDataLen
(
input
)
+
1
)
*
TSDB_NCHAR_SIZE
,
NULL
);
if
(
!
ret
)
{
if
(
!
ret
)
{
...
@@ -345,10 +345,6 @@ static int32_t getNumOfNullEntries(SColumnInfoData *pColumnInfoData, int32_t num
...
@@ -345,10 +345,6 @@ static int32_t getNumOfNullEntries(SColumnInfoData *pColumnInfoData, int32_t num
}
}
int32_t
concatFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
int32_t
concatFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
if
(
inputNum
<
2
||
inputNum
>
8
)
{
// concat accpet 2-8 input strings
return
TSDB_CODE_FAILED
;
}
SColumnInfoData
**
pInputData
=
taosMemoryCalloc
(
inputNum
,
sizeof
(
SColumnInfoData
*
));
SColumnInfoData
**
pInputData
=
taosMemoryCalloc
(
inputNum
,
sizeof
(
SColumnInfoData
*
));
SColumnInfoData
*
pOutputData
=
pOutput
->
columnData
;
SColumnInfoData
*
pOutputData
=
pOutput
->
columnData
;
char
**
input
=
taosMemoryCalloc
(
inputNum
,
POINTER_BYTES
);
char
**
input
=
taosMemoryCalloc
(
inputNum
,
POINTER_BYTES
);
...
@@ -356,15 +352,8 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
...
@@ -356,15 +352,8 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
int32_t
inputLen
=
0
;
int32_t
inputLen
=
0
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
bool
hasNchar
Col
=
false
;
bool
hasNchar
=
(
GET_PARAM_TYPE
(
pOutput
)
==
TSDB_DATA_TYPE_NCHAR
)
?
true
:
false
;
for
(
int32_t
i
=
0
;
i
<
inputNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
inputNum
;
++
i
)
{
int32_t
type
=
GET_PARAM_TYPE
(
&
pInput
[
i
]);
if
(
!
IS_VAR_DATA_TYPE
(
type
))
{
return
TSDB_CODE_FAILED
;
}
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
hasNcharCol
=
true
;
}
if
(
pInput
[
i
].
numOfRows
>
numOfRows
)
{
if
(
pInput
[
i
].
numOfRows
>
numOfRows
)
{
numOfRows
=
pInput
[
i
].
numOfRows
;
numOfRows
=
pInput
[
i
].
numOfRows
;
}
}
...
@@ -373,7 +362,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
...
@@ -373,7 +362,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
pInputData
[
i
]
=
pInput
[
i
].
columnData
;
pInputData
[
i
]
=
pInput
[
i
].
columnData
;
input
[
i
]
=
pInputData
[
i
]
->
pData
+
pInputData
[
i
]
->
varmeta
.
offset
[
0
];
input
[
i
]
=
pInputData
[
i
]
->
pData
+
pInputData
[
i
]
->
varmeta
.
offset
[
0
];
int32_t
factor
=
1
;
int32_t
factor
=
1
;
if
(
hasNchar
Col
&&
(
GET_PARAM_TYPE
(
&
pInput
[
i
])
==
TSDB_DATA_TYPE_VARCHAR
))
{
if
(
hasNchar
&&
(
GET_PARAM_TYPE
(
&
pInput
[
i
])
==
TSDB_DATA_TYPE_VARCHAR
))
{
factor
=
TSDB_NCHAR_SIZE
;
factor
=
TSDB_NCHAR_SIZE
;
}
}
...
@@ -405,7 +394,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
...
@@ -405,7 +394,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
int16_t
dataLen
=
0
;
int16_t
dataLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
inputNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
inputNum
;
++
i
)
{
int32_t
ret
=
concatCopyHelper
(
input
[
i
],
output
,
hasNchar
Col
,
GET_PARAM_TYPE
(
&
pInput
[
i
]),
&
dataLen
);
int32_t
ret
=
concatCopyHelper
(
input
[
i
],
output
,
hasNchar
,
GET_PARAM_TYPE
(
&
pInput
[
i
]),
&
dataLen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
@@ -428,10 +417,6 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
...
@@ -428,10 +417,6 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
int32_t
concatWsFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
int32_t
concatWsFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
if
(
inputNum
<
3
||
inputNum
>
9
)
{
// concat accpet 3-9 input strings including the separator
return
TSDB_CODE_FAILED
;
}
SColumnInfoData
**
pInputData
=
taosMemoryCalloc
(
inputNum
,
sizeof
(
SColumnInfoData
*
));
SColumnInfoData
**
pInputData
=
taosMemoryCalloc
(
inputNum
,
sizeof
(
SColumnInfoData
*
));
SColumnInfoData
*
pOutputData
=
pOutput
->
columnData
;
SColumnInfoData
*
pOutputData
=
pOutput
->
columnData
;
char
**
input
=
taosMemoryCalloc
(
inputNum
,
POINTER_BYTES
);
char
**
input
=
taosMemoryCalloc
(
inputNum
,
POINTER_BYTES
);
...
@@ -439,15 +424,8 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
...
@@ -439,15 +424,8 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
int32_t
inputLen
=
0
;
int32_t
inputLen
=
0
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
bool
hasNchar
Col
=
false
;
bool
hasNchar
=
(
GET_PARAM_TYPE
(
pOutput
)
==
TSDB_DATA_TYPE_NCHAR
)
?
true
:
false
;
for
(
int32_t
i
=
1
;
i
<
inputNum
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
inputNum
;
++
i
)
{
int32_t
type
=
GET_PARAM_TYPE
(
&
pInput
[
i
]);
if
(
!
IS_VAR_DATA_TYPE
(
GET_PARAM_TYPE
(
&
pInput
[
i
])))
{
return
TSDB_CODE_FAILED
;
}
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
hasNcharCol
=
true
;
}
if
(
pInput
[
i
].
numOfRows
>
numOfRows
)
{
if
(
pInput
[
i
].
numOfRows
>
numOfRows
)
{
numOfRows
=
pInput
[
i
].
numOfRows
;
numOfRows
=
pInput
[
i
].
numOfRows
;
}
}
...
@@ -456,7 +434,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
...
@@ -456,7 +434,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
pInputData
[
i
]
=
pInput
[
i
].
columnData
;
pInputData
[
i
]
=
pInput
[
i
].
columnData
;
input
[
i
]
=
pInputData
[
i
]
->
pData
+
pInputData
[
i
]
->
varmeta
.
offset
[
0
];
input
[
i
]
=
pInputData
[
i
]
->
pData
+
pInputData
[
i
]
->
varmeta
.
offset
[
0
];
int32_t
factor
=
1
;
int32_t
factor
=
1
;
if
(
hasNchar
Col
&&
(
GET_PARAM_TYPE
(
&
pInput
[
i
])
==
TSDB_DATA_TYPE_VARCHAR
))
{
if
(
hasNchar
&&
(
GET_PARAM_TYPE
(
&
pInput
[
i
])
==
TSDB_DATA_TYPE_VARCHAR
))
{
factor
=
TSDB_NCHAR_SIZE
;
factor
=
TSDB_NCHAR_SIZE
;
}
}
...
@@ -487,7 +465,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
...
@@ -487,7 +465,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
continue
;
continue
;
}
}
int32_t
ret
=
concatCopyHelper
(
input
[
i
],
output
,
hasNchar
Col
,
GET_PARAM_TYPE
(
&
pInput
[
i
]),
&
dataLen
);
int32_t
ret
=
concatCopyHelper
(
input
[
i
],
output
,
hasNchar
,
GET_PARAM_TYPE
(
&
pInput
[
i
]),
&
dataLen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
@@ -499,7 +477,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
...
@@ -499,7 +477,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
if
(
i
<
inputNum
-
1
)
{
if
(
i
<
inputNum
-
1
)
{
//insert the separator
//insert the separator
char
*
sep
=
pInputData
[
0
]
->
pData
;
char
*
sep
=
pInputData
[
0
]
->
pData
;
int32_t
ret
=
concatCopyHelper
(
sep
,
output
,
hasNchar
Col
,
GET_PARAM_TYPE
(
&
pInput
[
0
]),
&
dataLen
);
int32_t
ret
=
concatCopyHelper
(
sep
,
output
,
hasNchar
,
GET_PARAM_TYPE
(
&
pInput
[
0
]),
&
dataLen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
}
}
...
...
source/util/src/tcache.c
浏览文件 @
47f7ce67
...
@@ -910,6 +910,8 @@ void taosCacheRefresh(SCacheObj *pCacheObj, __cache_trav_fn_t fp, void *param1)
...
@@ -910,6 +910,8 @@ void taosCacheRefresh(SCacheObj *pCacheObj, __cache_trav_fn_t fp, void *param1)
void
taosStopCacheRefreshWorker
(
void
)
{
void
taosStopCacheRefreshWorker
(
void
)
{
stopRefreshWorker
=
true
;
stopRefreshWorker
=
true
;
taosThreadJoin
(
cacheRefreshWorker
,
NULL
);
taosArrayDestroy
(
pCacheArrayList
);
}
}
size_t
taosCacheGetNumOfObj
(
const
SCacheObj
*
pCacheObj
)
{
size_t
taosCacheGetNumOfObj
(
const
SCacheObj
*
pCacheObj
)
{
...
...
source/util/src/tconfig.c
浏览文件 @
47f7ce67
...
@@ -591,12 +591,12 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
...
@@ -591,12 +591,12 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
}
}
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
u
Info
(
"load from env variables not implemented yet"
);
u
Debug
(
"load from env variables not implemented yet"
);
return
0
;
return
0
;
}
}
int32_t
cfgLoadFromEnvFile
(
SConfig
*
pConfig
,
const
char
*
filepath
)
{
int32_t
cfgLoadFromEnvFile
(
SConfig
*
pConfig
,
const
char
*
filepath
)
{
u
Info
(
"load from env file not implemented yet"
);
u
Debug
(
"load from env file not implemented yet"
);
return
0
;
return
0
;
}
}
...
@@ -655,6 +655,6 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
...
@@ -655,6 +655,6 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
}
}
int32_t
cfgLoadFromApollUrl
(
SConfig
*
pConfig
,
const
char
*
url
)
{
int32_t
cfgLoadFromApollUrl
(
SConfig
*
pConfig
,
const
char
*
url
)
{
u
Info
(
"load from apoll url not implemented yet"
);
u
Debug
(
"load from apoll url not implemented yet"
);
return
0
;
return
0
;
}
}
source/util/src/tlog.c
浏览文件 @
47f7ce67
...
@@ -38,27 +38,26 @@
...
@@ -38,27 +38,26 @@
#define LOG_BUF_MUTEX(x) ((x)->buffMutex)
#define LOG_BUF_MUTEX(x) ((x)->buffMutex)
typedef
struct
{
typedef
struct
{
char
*
buffer
;
char
*
buffer
;
int32_t
buffStart
;
int32_t
buffStart
;
int32_t
buffEnd
;
int32_t
buffEnd
;
int32_t
buffSize
;
int32_t
buffSize
;
int32_t
minBuffSize
;
int32_t
minBuffSize
;
TdFilePtr
pFile
;
TdFilePtr
pFile
;
int32_t
stop
;
int32_t
stop
;
TdThread
asyncThread
;
TdThread
asyncThread
;
TdThreadMutex
buffMutex
;
TdThreadMutex
buffMutex
;
tsem_t
buffNotEmpty
;
}
SLogBuff
;
}
SLogBuff
;
typedef
struct
{
typedef
struct
{
int32_t
fileNum
;
int32_t
fileNum
;
int32_t
maxLines
;
int32_t
maxLines
;
int32_t
lines
;
int32_t
lines
;
int32_t
flag
;
int32_t
flag
;
int32_t
openInProgress
;
int32_t
openInProgress
;
pid_t
pid
;
pid_t
pid
;
char
logName
[
LOG_FILE_NAME_LEN
];
char
logName
[
LOG_FILE_NAME_LEN
];
SLogBuff
*
logHandle
;
SLogBuff
*
logHandle
;
TdThreadMutex
logMutex
;
TdThreadMutex
logMutex
;
}
SLogObj
;
}
SLogObj
;
...
@@ -100,7 +99,7 @@ int64_t dbgBigWN = 0;
...
@@ -100,7 +99,7 @@ int64_t dbgBigWN = 0;
int64_t
dbgWSize
=
0
;
int64_t
dbgWSize
=
0
;
static
void
*
taosAsyncOutputLog
(
void
*
param
);
static
void
*
taosAsyncOutputLog
(
void
*
param
);
static
int32_t
taosPushLogBuffer
(
SLogBuff
*
tLogBuf
f
,
const
char
*
msg
,
int32_t
msgLen
);
static
int32_t
taosPushLogBuffer
(
SLogBuff
*
pLogBu
f
,
const
char
*
msg
,
int32_t
msgLen
);
static
SLogBuff
*
taosLogBuffNew
(
int32_t
bufSize
);
static
SLogBuff
*
taosLogBuffNew
(
int32_t
bufSize
);
static
void
taosCloseLogByFd
(
TdFilePtr
pFile
);
static
void
taosCloseLogByFd
(
TdFilePtr
pFile
);
static
int32_t
taosOpenLogFile
(
char
*
fn
,
int32_t
maxLines
,
int32_t
maxFileNum
);
static
int32_t
taosOpenLogFile
(
char
*
fn
,
int32_t
maxLines
,
int32_t
maxFileNum
);
...
@@ -136,16 +135,24 @@ static void taosStopLog() {
...
@@ -136,16 +135,24 @@ static void taosStopLog() {
}
}
}
}
static
void
taosLogBuffDestroy
()
{
taosThreadMutexDestroy
(
&
tsLogObj
.
logHandle
->
buffMutex
);
taosCloseFile
(
&
tsLogObj
.
logHandle
->
pFile
);
taosMemoryFreeClear
(
tsLogObj
.
logHandle
->
buffer
);
memset
(
&
tsLogObj
.
logHandle
->
buffer
,
0
,
sizeof
(
tsLogObj
.
logHandle
->
buffer
));
taosThreadMutexDestroy
(
&
tsLogObj
.
logMutex
);
taosMemoryFreeClear
(
tsLogObj
.
logHandle
);
memset
(
&
tsLogObj
.
logHandle
,
0
,
sizeof
(
tsLogObj
.
logHandle
));
tsLogObj
.
logHandle
=
NULL
;
}
void
taosCloseLog
()
{
void
taosCloseLog
()
{
taosStopLog
();
taosStopLog
();
if
(
taosCheckPthreadValid
(
tsLogObj
.
logHandle
->
asyncThread
))
{
if
(
taosCheckPthreadValid
(
tsLogObj
.
logHandle
->
asyncThread
))
{
taosThreadJoin
(
tsLogObj
.
logHandle
->
asyncThread
,
NULL
);
taosThreadJoin
(
tsLogObj
.
logHandle
->
asyncThread
,
NULL
);
}
}
tsLogInited
=
0
;
tsLogInited
=
0
;
// In case that other threads still use log resources causing invalid write in valgrind
taosLogBuffDestroy
(
tsLogObj
.
logHandle
);
// we comment two lines below.
// taosLogBuffDestroy(tsLogObj.logHandle);
// taosCloseLog();
}
}
static
bool
taosLockLogFile
(
TdFilePtr
pFile
)
{
static
bool
taosLockLogFile
(
TdFilePtr
pFile
)
{
...
@@ -231,7 +238,7 @@ static int32_t taosOpenNewLogFile() {
...
@@ -231,7 +238,7 @@ static int32_t taosOpenNewLogFile() {
tsLogObj
.
openInProgress
=
1
;
tsLogObj
.
openInProgress
=
1
;
uInfo
(
"open new log file ......"
);
uInfo
(
"open new log file ......"
);
TdThread
thread
;
TdThread
thread
;
TdThreadAttr
attr
;
TdThreadAttr
attr
;
taosThreadAttrInit
(
&
attr
);
taosThreadAttrInit
(
&
attr
);
taosThreadAttrSetDetachState
(
&
attr
,
PTHREAD_CREATE_DETACHED
);
taosThreadAttrSetDetachState
(
&
attr
,
PTHREAD_CREATE_DETACHED
);
...
@@ -506,45 +513,45 @@ static void taosCloseLogByFd(TdFilePtr pFile) {
...
@@ -506,45 +513,45 @@ static void taosCloseLogByFd(TdFilePtr pFile) {
}
}
static
SLogBuff
*
taosLogBuffNew
(
int32_t
bufSize
)
{
static
SLogBuff
*
taosLogBuffNew
(
int32_t
bufSize
)
{
SLogBuff
*
tLogBuf
f
=
NULL
;
SLogBuff
*
pLogBu
f
=
NULL
;
tLogBuf
f
=
taosMemoryCalloc
(
1
,
sizeof
(
SLogBuff
));
pLogBu
f
=
taosMemoryCalloc
(
1
,
sizeof
(
SLogBuff
));
if
(
tLogBuf
f
==
NULL
)
return
NULL
;
if
(
pLogBu
f
==
NULL
)
return
NULL
;
LOG_BUF_BUFFER
(
tLogBuf
f
)
=
taosMemoryMalloc
(
bufSize
);
LOG_BUF_BUFFER
(
pLogBu
f
)
=
taosMemoryMalloc
(
bufSize
);
if
(
LOG_BUF_BUFFER
(
tLogBuf
f
)
==
NULL
)
goto
_err
;
if
(
LOG_BUF_BUFFER
(
pLogBu
f
)
==
NULL
)
goto
_err
;
LOG_BUF_START
(
tLogBuff
)
=
LOG_BUF_END
(
tLogBuf
f
)
=
0
;
LOG_BUF_START
(
pLogBuf
)
=
LOG_BUF_END
(
pLogBu
f
)
=
0
;
LOG_BUF_SIZE
(
tLogBuf
f
)
=
bufSize
;
LOG_BUF_SIZE
(
pLogBu
f
)
=
bufSize
;
tLogBuf
f
->
minBuffSize
=
bufSize
/
10
;
pLogBu
f
->
minBuffSize
=
bufSize
/
10
;
tLogBuf
f
->
stop
=
0
;
pLogBu
f
->
stop
=
0
;
if
(
taosThreadMutexInit
(
&
LOG_BUF_MUTEX
(
tLogBuf
f
),
NULL
)
<
0
)
goto
_err
;
if
(
taosThreadMutexInit
(
&
LOG_BUF_MUTEX
(
pLogBu
f
),
NULL
)
<
0
)
goto
_err
;
// tsem_init(&(
tLogBuf
f->buffNotEmpty), 0, 0);
// tsem_init(&(
pLogBu
f->buffNotEmpty), 0, 0);
return
tLogBuf
f
;
return
pLogBu
f
;
_err:
_err:
taosMemoryFreeClear
(
LOG_BUF_BUFFER
(
tLogBuf
f
));
taosMemoryFreeClear
(
LOG_BUF_BUFFER
(
pLogBu
f
));
taosMemoryFreeClear
(
tLogBuf
f
);
taosMemoryFreeClear
(
pLogBu
f
);
return
NULL
;
return
NULL
;
}
}
static
void
taosCopyLogBuffer
(
SLogBuff
*
tLogBuf
f
,
int32_t
start
,
int32_t
end
,
const
char
*
msg
,
int32_t
msgLen
)
{
static
void
taosCopyLogBuffer
(
SLogBuff
*
pLogBu
f
,
int32_t
start
,
int32_t
end
,
const
char
*
msg
,
int32_t
msgLen
)
{
if
(
start
>
end
)
{
if
(
start
>
end
)
{
memcpy
(
LOG_BUF_BUFFER
(
tLogBuf
f
)
+
end
,
msg
,
msgLen
);
memcpy
(
LOG_BUF_BUFFER
(
pLogBu
f
)
+
end
,
msg
,
msgLen
);
}
else
{
}
else
{
if
(
LOG_BUF_SIZE
(
tLogBuf
f
)
-
end
<
msgLen
)
{
if
(
LOG_BUF_SIZE
(
pLogBu
f
)
-
end
<
msgLen
)
{
memcpy
(
LOG_BUF_BUFFER
(
tLogBuff
)
+
end
,
msg
,
LOG_BUF_SIZE
(
tLogBuf
f
)
-
end
);
memcpy
(
LOG_BUF_BUFFER
(
pLogBuf
)
+
end
,
msg
,
LOG_BUF_SIZE
(
pLogBu
f
)
-
end
);
memcpy
(
LOG_BUF_BUFFER
(
tLogBuff
),
msg
+
LOG_BUF_SIZE
(
tLogBuff
)
-
end
,
msgLen
-
LOG_BUF_SIZE
(
tLogBuf
f
)
+
end
);
memcpy
(
LOG_BUF_BUFFER
(
pLogBuf
),
msg
+
LOG_BUF_SIZE
(
pLogBuf
)
-
end
,
msgLen
-
LOG_BUF_SIZE
(
pLogBu
f
)
+
end
);
}
else
{
}
else
{
memcpy
(
LOG_BUF_BUFFER
(
tLogBuf
f
)
+
end
,
msg
,
msgLen
);
memcpy
(
LOG_BUF_BUFFER
(
pLogBu
f
)
+
end
,
msg
,
msgLen
);
}
}
}
}
LOG_BUF_END
(
tLogBuff
)
=
(
LOG_BUF_END
(
tLogBuff
)
+
msgLen
)
%
LOG_BUF_SIZE
(
tLogBuf
f
);
LOG_BUF_END
(
pLogBuf
)
=
(
LOG_BUF_END
(
pLogBuf
)
+
msgLen
)
%
LOG_BUF_SIZE
(
pLogBu
f
);
}
}
static
int32_t
taosPushLogBuffer
(
SLogBuff
*
tLogBuf
f
,
const
char
*
msg
,
int32_t
msgLen
)
{
static
int32_t
taosPushLogBuffer
(
SLogBuff
*
pLogBu
f
,
const
char
*
msg
,
int32_t
msgLen
)
{
int32_t
start
=
0
;
int32_t
start
=
0
;
int32_t
end
=
0
;
int32_t
end
=
0
;
int32_t
remainSize
=
0
;
int32_t
remainSize
=
0
;
...
@@ -552,13 +559,13 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t ms
...
@@ -552,13 +559,13 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t ms
char
tmpBuf
[
40
]
=
{
0
};
char
tmpBuf
[
40
]
=
{
0
};
int32_t
tmpBufLen
=
0
;
int32_t
tmpBufLen
=
0
;
if
(
tLogBuff
==
NULL
||
tLogBuf
f
->
stop
)
return
-
1
;
if
(
pLogBuf
==
NULL
||
pLogBu
f
->
stop
)
return
-
1
;
taosThreadMutexLock
(
&
LOG_BUF_MUTEX
(
tLogBuf
f
));
taosThreadMutexLock
(
&
LOG_BUF_MUTEX
(
pLogBu
f
));
start
=
LOG_BUF_START
(
tLogBuf
f
);
start
=
LOG_BUF_START
(
pLogBu
f
);
end
=
LOG_BUF_END
(
tLogBuf
f
);
end
=
LOG_BUF_END
(
pLogBu
f
);
remainSize
=
(
start
>
end
)
?
(
start
-
end
-
1
)
:
(
start
+
LOG_BUF_SIZE
(
tLogBuf
f
)
-
end
-
1
);
remainSize
=
(
start
>
end
)
?
(
start
-
end
-
1
)
:
(
start
+
LOG_BUF_SIZE
(
pLogBu
f
)
-
end
-
1
);
if
(
lostLine
>
0
)
{
if
(
lostLine
>
0
)
{
sprintf
(
tmpBuf
,
"...Lost %"
PRId64
" lines here...
\n
"
,
lostLine
);
sprintf
(
tmpBuf
,
"...Lost %"
PRId64
" lines here...
\n
"
,
lostLine
);
...
@@ -568,47 +575,47 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t ms
...
@@ -568,47 +575,47 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t ms
if
(
remainSize
<=
msgLen
||
((
lostLine
>
0
)
&&
(
remainSize
<=
(
msgLen
+
tmpBufLen
))))
{
if
(
remainSize
<=
msgLen
||
((
lostLine
>
0
)
&&
(
remainSize
<=
(
msgLen
+
tmpBufLen
))))
{
lostLine
++
;
lostLine
++
;
tsAsyncLogLostLines
++
;
tsAsyncLogLostLines
++
;
taosThreadMutexUnlock
(
&
LOG_BUF_MUTEX
(
tLogBuf
f
));
taosThreadMutexUnlock
(
&
LOG_BUF_MUTEX
(
pLogBu
f
));
return
-
1
;
return
-
1
;
}
}
if
(
lostLine
>
0
)
{
if
(
lostLine
>
0
)
{
taosCopyLogBuffer
(
tLogBuf
f
,
start
,
end
,
tmpBuf
,
tmpBufLen
);
taosCopyLogBuffer
(
pLogBu
f
,
start
,
end
,
tmpBuf
,
tmpBufLen
);
lostLine
=
0
;
lostLine
=
0
;
}
}
taosCopyLogBuffer
(
tLogBuff
,
LOG_BUF_START
(
tLogBuff
),
LOG_BUF_END
(
tLogBuf
f
),
msg
,
msgLen
);
taosCopyLogBuffer
(
pLogBuf
,
LOG_BUF_START
(
pLogBuf
),
LOG_BUF_END
(
pLogBu
f
),
msg
,
msgLen
);
// int32_t w = atomic_sub_fetch_32(&waitLock, 1);
// int32_t w = atomic_sub_fetch_32(&waitLock, 1);
/*
/*
if (w <= 0 || ((remainSize - msgLen - tmpBufLen) < (LOG_BUF_SIZE(
tLogBuf
f) * 4 /5))) {
if (w <= 0 || ((remainSize - msgLen - tmpBufLen) < (LOG_BUF_SIZE(
pLogBu
f) * 4 /5))) {
tsem_post(&(
tLogBuf
f->buffNotEmpty));
tsem_post(&(
pLogBu
f->buffNotEmpty));
dbgPostN++;
dbgPostN++;
} else {
} else {
dbgNoPostN++;
dbgNoPostN++;
}
}
*/
*/
taosThreadMutexUnlock
(
&
LOG_BUF_MUTEX
(
tLogBuf
f
));
taosThreadMutexUnlock
(
&
LOG_BUF_MUTEX
(
pLogBu
f
));
return
0
;
return
0
;
}
}
static
int32_t
taosGetLogRemainSize
(
SLogBuff
*
tLogBuf
f
,
int32_t
start
,
int32_t
end
)
{
static
int32_t
taosGetLogRemainSize
(
SLogBuff
*
pLogBu
f
,
int32_t
start
,
int32_t
end
)
{
int32_t
rSize
=
end
-
start
;
int32_t
rSize
=
end
-
start
;
return
rSize
>=
0
?
rSize
:
LOG_BUF_SIZE
(
tLogBuf
f
)
+
rSize
;
return
rSize
>=
0
?
rSize
:
LOG_BUF_SIZE
(
pLogBu
f
)
+
rSize
;
}
}
static
void
taosWriteLog
(
SLogBuff
*
tLogBuf
f
)
{
static
void
taosWriteLog
(
SLogBuff
*
pLogBu
f
)
{
static
int32_t
lastDuration
=
0
;
static
int32_t
lastDuration
=
0
;
int32_t
remainChecked
=
0
;
int32_t
remainChecked
=
0
;
int32_t
start
,
end
,
pollSize
;
int32_t
start
,
end
,
pollSize
;
do
{
do
{
if
(
remainChecked
==
0
)
{
if
(
remainChecked
==
0
)
{
start
=
LOG_BUF_START
(
tLogBuf
f
);
start
=
LOG_BUF_START
(
pLogBu
f
);
end
=
LOG_BUF_END
(
tLogBuf
f
);
end
=
LOG_BUF_END
(
pLogBu
f
);
if
(
start
==
end
)
{
if
(
start
==
end
)
{
dbgEmptyW
++
;
dbgEmptyW
++
;
...
@@ -616,8 +623,8 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
...
@@ -616,8 +623,8 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
return
;
return
;
}
}
pollSize
=
taosGetLogRemainSize
(
tLogBuf
f
,
start
,
end
);
pollSize
=
taosGetLogRemainSize
(
pLogBu
f
,
start
,
end
);
if
(
pollSize
<
tLogBuf
f
->
minBuffSize
)
{
if
(
pollSize
<
pLogBu
f
->
minBuffSize
)
{
lastDuration
+=
tsWriteInterval
;
lastDuration
+=
tsWriteInterval
;
if
(
lastDuration
<
LOG_MAX_WAIT_MSEC
)
{
if
(
lastDuration
<
LOG_MAX_WAIT_MSEC
)
{
break
;
break
;
...
@@ -628,38 +635,38 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
...
@@ -628,38 +635,38 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
}
}
if
(
start
<
end
)
{
if
(
start
<
end
)
{
taosWriteFile
(
tLogBuff
->
pFile
,
LOG_BUF_BUFFER
(
tLogBuf
f
)
+
start
,
pollSize
);
taosWriteFile
(
pLogBuf
->
pFile
,
LOG_BUF_BUFFER
(
pLogBu
f
)
+
start
,
pollSize
);
}
else
{
}
else
{
int32_t
tsize
=
LOG_BUF_SIZE
(
tLogBuf
f
)
-
start
;
int32_t
tsize
=
LOG_BUF_SIZE
(
pLogBu
f
)
-
start
;
taosWriteFile
(
tLogBuff
->
pFile
,
LOG_BUF_BUFFER
(
tLogBuf
f
)
+
start
,
tsize
);
taosWriteFile
(
pLogBuf
->
pFile
,
LOG_BUF_BUFFER
(
pLogBu
f
)
+
start
,
tsize
);
taosWriteFile
(
tLogBuff
->
pFile
,
LOG_BUF_BUFFER
(
tLogBuf
f
),
end
);
taosWriteFile
(
pLogBuf
->
pFile
,
LOG_BUF_BUFFER
(
pLogBu
f
),
end
);
}
}
dbgWN
++
;
dbgWN
++
;
dbgWSize
+=
pollSize
;
dbgWSize
+=
pollSize
;
if
(
pollSize
<
tLogBuf
f
->
minBuffSize
)
{
if
(
pollSize
<
pLogBu
f
->
minBuffSize
)
{
dbgSmallWN
++
;
dbgSmallWN
++
;
if
(
tsWriteInterval
<
LOG_MAX_INTERVAL
)
{
if
(
tsWriteInterval
<
LOG_MAX_INTERVAL
)
{
tsWriteInterval
+=
LOG_INTERVAL_STEP
;
tsWriteInterval
+=
LOG_INTERVAL_STEP
;
}
}
}
else
if
(
pollSize
>
LOG_BUF_SIZE
(
tLogBuf
f
)
/
3
)
{
}
else
if
(
pollSize
>
LOG_BUF_SIZE
(
pLogBu
f
)
/
3
)
{
dbgBigWN
++
;
dbgBigWN
++
;
tsWriteInterval
=
LOG_MIN_INTERVAL
;
tsWriteInterval
=
LOG_MIN_INTERVAL
;
}
else
if
(
pollSize
>
LOG_BUF_SIZE
(
tLogBuf
f
)
/
4
)
{
}
else
if
(
pollSize
>
LOG_BUF_SIZE
(
pLogBu
f
)
/
4
)
{
if
(
tsWriteInterval
>
LOG_MIN_INTERVAL
)
{
if
(
tsWriteInterval
>
LOG_MIN_INTERVAL
)
{
tsWriteInterval
-=
LOG_INTERVAL_STEP
;
tsWriteInterval
-=
LOG_INTERVAL_STEP
;
}
}
}
}
LOG_BUF_START
(
tLogBuff
)
=
(
LOG_BUF_START
(
tLogBuff
)
+
pollSize
)
%
LOG_BUF_SIZE
(
tLogBuf
f
);
LOG_BUF_START
(
pLogBuf
)
=
(
LOG_BUF_START
(
pLogBuf
)
+
pollSize
)
%
LOG_BUF_SIZE
(
pLogBu
f
);
start
=
LOG_BUF_START
(
tLogBuf
f
);
start
=
LOG_BUF_START
(
pLogBu
f
);
end
=
LOG_BUF_END
(
tLogBuf
f
);
end
=
LOG_BUF_END
(
pLogBu
f
);
pollSize
=
taosGetLogRemainSize
(
tLogBuf
f
,
start
,
end
);
pollSize
=
taosGetLogRemainSize
(
pLogBu
f
,
start
,
end
);
if
(
pollSize
<
tLogBuf
f
->
minBuffSize
)
{
if
(
pollSize
<
pLogBu
f
->
minBuffSize
)
{
break
;
break
;
}
}
...
@@ -670,16 +677,16 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
...
@@ -670,16 +677,16 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
}
}
static
void
*
taosAsyncOutputLog
(
void
*
param
)
{
static
void
*
taosAsyncOutputLog
(
void
*
param
)
{
SLogBuff
*
tLogBuf
f
=
(
SLogBuff
*
)
param
;
SLogBuff
*
pLogBu
f
=
(
SLogBuff
*
)
param
;
setThreadName
(
"log"
);
setThreadName
(
"log"
);
while
(
1
)
{
while
(
1
)
{
taosMsleep
(
tsWriteInterval
);
taosMsleep
(
tsWriteInterval
);
// Polling the buffer
// Polling the buffer
taosWriteLog
(
tLogBuf
f
);
taosWriteLog
(
pLogBu
f
);
if
(
tLogBuf
f
->
stop
)
break
;
if
(
pLogBu
f
->
stop
)
break
;
}
}
return
NULL
;
return
NULL
;
...
...
tests/script/tsim/parser/fourArithmetic-basic.sim
浏览文件 @
47f7ce67
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/query/charScalarFunction.sim
浏览文件 @
47f7ce67
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/query/scalarFunction.sim
浏览文件 @
47f7ce67
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/query/session.sim
浏览文件 @
47f7ce67
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/basic1.sim
浏览文件 @
47f7ce67
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrCtb.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/main2Con1Cgrp1TopicFrStb.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrCtb.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/main2Con1Cgrp2TopicFrStb.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/mainConsumerInMultiTopic.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/mainConsumerInOneTopic.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/multiTopic.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/oneTopic.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/script/tsim/tmq/overlapTopic2Con1Cgrp.sim
浏览文件 @
47f7ce67
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
$loop_cnt = 0
...
...
tests/tsim/inc/simInt.h
浏览文件 @
47f7ce67
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#define MAX_BACKGROUND_SCRIPT_NUM 10
#define MAX_BACKGROUND_SCRIPT_NUM 10
#define MAX_FILE_NAME_LEN 256
#define MAX_FILE_NAME_LEN 256
#define MAX_ERROR_LEN 1024
#define MAX_ERROR_LEN 1024
#define MAX_QUERY_VALUE_LEN
40
#define MAX_QUERY_VALUE_LEN
1024
#define MAX_QUERY_COL_NUM 100
#define MAX_QUERY_COL_NUM 100
#define MAX_QUERY_ROW_NUM 100
#define MAX_QUERY_ROW_NUM 100
#define MAX_SYSTEM_RESULT_LEN 2048
#define MAX_SYSTEM_RESULT_LEN 2048
...
...
tests/tsim/src/simExe.c
浏览文件 @
47f7ce67
...
@@ -368,7 +368,8 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
...
@@ -368,7 +368,8 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
return
true
;
return
true
;
}
}
void
simReplaceStr
(
char
*
buf
,
char
*
src
,
char
*
dst
)
{
bool
simReplaceStr
(
char
*
buf
,
char
*
src
,
char
*
dst
)
{
bool
replaced
=
false
;
char
*
begin
=
strstr
(
buf
,
src
);
char
*
begin
=
strstr
(
buf
,
src
);
if
(
begin
!=
NULL
)
{
if
(
begin
!=
NULL
)
{
int32_t
srcLen
=
(
int32_t
)
strlen
(
src
);
int32_t
srcLen
=
(
int32_t
)
strlen
(
src
);
...
@@ -383,13 +384,16 @@ void simReplaceStr(char *buf, char *src, char *dst) {
...
@@ -383,13 +384,16 @@ void simReplaceStr(char *buf, char *src, char *dst) {
}
}
memcpy
(
begin
,
dst
,
dstLen
);
memcpy
(
begin
,
dst
,
dstLen
);
replaced
=
true
;
}
}
simInfo
(
"system cmd is %s"
,
buf
);
simInfo
(
"system cmd is %s"
,
buf
);
return
replaced
;
}
}
bool
simExecuteSystemCmd
(
SScript
*
script
,
char
*
option
)
{
bool
simExecuteSystemCmd
(
SScript
*
script
,
char
*
option
)
{
char
buf
[
4096
]
=
{
0
};
char
buf
[
4096
]
=
{
0
};
bool
replaced
=
false
;
#ifndef WINDOWS
#ifndef WINDOWS
sprintf
(
buf
,
"cd %s; "
,
simScriptDir
);
sprintf
(
buf
,
"cd %s; "
,
simScriptDir
);
...
@@ -404,7 +408,7 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
...
@@ -404,7 +408,7 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
}
}
if
(
useValgrind
)
{
if
(
useValgrind
)
{
simReplaceStr
(
buf
,
"exec.sh"
,
"exec.sh -v"
);
replaced
=
simReplaceStr
(
buf
,
"exec.sh"
,
"exec.sh -v"
);
}
}
simLogSql
(
buf
,
true
);
simLogSql
(
buf
,
true
);
...
@@ -422,6 +426,11 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
...
@@ -422,6 +426,11 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
sprintf
(
script
->
system_exit_code
,
"%d"
,
code
);
sprintf
(
script
->
system_exit_code
,
"%d"
,
code
);
script
->
linePos
++
;
script
->
linePos
++
;
if
(
replaced
&&
strstr
(
buf
,
"start"
)
!=
NULL
)
{
simInfo
(
"====> startup is slow in valgrind mode, so sleep 5 seconds after exec.sh -s start"
);
taosMsleep
(
5000
);
}
return
true
;
return
true
;
}
}
...
...
tools/shell/src/shellMain.c
浏览文件 @
47f7ce67
...
@@ -45,7 +45,7 @@ static tsem_t cancelSem;
...
@@ -45,7 +45,7 @@ static tsem_t cancelSem;
static
struct
argp_option
options
[]
=
{
static
struct
argp_option
options
[]
=
{
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
{
"password"
,
'p'
,
0
,
0
,
"The password to use when connecting to the server."
},
{
"password"
,
'p'
,
0
,
0
,
"The password to use when connecting to the server."
},
{
"port"
,
'P'
,
"PORT"
,
0
,
"The TCP/IP port number to use for the connection."
},
{
"port"
,
'P'
,
"PORT"
,
0
,
"The TCP/IP port number to use for the connection."
},
{
"user"
,
'u'
,
"USER"
,
0
,
"The user name to use when connecting to the server."
},
{
"user"
,
'u'
,
"USER"
,
0
,
"The user name to use when connecting to the server."
},
{
"auth"
,
'A'
,
"Auth"
,
0
,
"The auth string to use when connecting to the server."
},
{
"auth"
,
'A'
,
"Auth"
,
0
,
"The auth string to use when connecting to the server."
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录