Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6f62e807
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
未验证
提交
6f62e807
编写于
7月 28, 2021
作者:
H
Haojun Liao
提交者:
GitHub
7月 28, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7007 from taosdata/fix/TD-5474
[TD-5474]<fix> fix runtime error
上级
565ab2be
f89a8ea6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
79 addition
and
27 deletion
+79
-27
src/plugins/http/src/httpGcJson.c
src/plugins/http/src/httpGcJson.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+50
-5
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+7
-5
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+11
-8
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+8
-6
src/util/src/tcompression.c
src/util/src/tcompression.c
+2
-2
未找到文件。
src/plugins/http/src/httpGcJson.c
浏览文件 @
6f62e807
...
...
@@ -199,7 +199,7 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
for
(
int32_t
i
=
dataFields
;
i
>=
0
;
i
--
)
{
httpJsonItemToken
(
jsonBuf
);
if
(
row
[
i
]
==
NULL
)
{
if
(
row
==
NULL
||
i
>=
num_fields
||
row
[
i
]
==
NULL
)
{
httpJsonOriginString
(
jsonBuf
,
"null"
,
4
);
continue
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
6f62e807
...
...
@@ -97,12 +97,47 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
#define GET_NUM_OF_TABLEGROUP(q) taosArrayGetSize((q)->tableqinfoGroupInfo.pGroupList)
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
#define TSKEY_MAX_ADD(a,b) \
do { \
if (a < 0) { a = a + b; break;} \
if (sizeof(a) == sizeof(int32_t)) { \
if((b) > 0 && ((b) >= INT32_MAX - (a))){\
a = INT32_MAX; \
} else { \
a = a + b; \
} \
} else { \
if((b) > 0 && ((b) >= INT64_MAX - (a))){\
a = INT64_MAX; \
} else { \
a = a + b; \
} \
} \
} while(0)
#define TSKEY_MIN_SUB(a,b) \
do { \
if (a >= 0) { a = a + b; break;} \
if (sizeof(a) == sizeof(int32_t)){ \
if((b) < 0 && ((b) <= INT32_MIN - (a))){\
a = INT32_MIN; \
} else { \
a = a + b; \
} \
} else { \
if((b) < 0 && ((b) <= INT64_MIN-(a))) {\
a = INT64_MIN; \
} else { \
a = a + b; \
} \
} \
} while (0)
uint64_t
queryHandleId
=
0
;
int32_t
getMaximumIdleDurationSec
()
{
return
tsShellActivityTimer
*
2
;
}
int64_t
genQueryId
(
void
)
{
int64_t
uid
=
0
;
int64_t
did
=
tsDnodeId
;
...
...
@@ -3124,7 +3159,9 @@ void setTagValue(SOperatorInfo* pOperatorInfo, void *pTable, SQLFunctionCtx* pCt
||
pLocalExprInfo
->
base
.
resType
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
memcpy
(
pRuntimeEnv
->
tagVal
+
offset
,
&
pCtx
[
idx
].
tag
.
i64
,
pLocalExprInfo
->
base
.
resBytes
);
}
else
{
memcpy
(
pRuntimeEnv
->
tagVal
+
offset
,
pCtx
[
idx
].
tag
.
pz
,
pCtx
[
idx
].
tag
.
nLen
);
if
(
pCtx
[
idx
].
tag
.
pz
!=
NULL
)
{
memcpy
(
pRuntimeEnv
->
tagVal
+
offset
,
pCtx
[
idx
].
tag
.
pz
,
pCtx
[
idx
].
tag
.
nLen
);
}
}
offset
+=
pLocalExprInfo
->
base
.
resBytes
;
...
...
@@ -3934,8 +3971,8 @@ static void toSSDataBlock(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv* pRunti
// refactor : extract method
SColumnInfoData
*
pInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
if
(
pInfoData
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
//add condition (pBlock->info.rows >= 1) just to runtime happy
if
(
pInfoData
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
pBlock
->
info
.
rows
>=
1
)
{
STimeWindow
*
w
=
&
pBlock
->
info
.
window
;
w
->
skey
=
*
(
int64_t
*
)
pInfoData
->
pData
;
w
->
ekey
=
*
(
int64_t
*
)(((
char
*
)
pInfoData
->
pData
)
+
TSDB_KEYSIZE
*
(
pBlock
->
info
.
rows
-
1
));
...
...
@@ -5273,7 +5310,15 @@ static SSDataBlock* doSTableAggregate(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
);
TSKEY
key
=
QUERY_IS_ASC_QUERY
(
pQueryAttr
)
?
pBlock
->
info
.
window
.
ekey
+
1
:
pBlock
->
info
.
window
.
skey
-
1
;
TSKEY
key
=
0
;
if
(
QUERY_IS_ASC_QUERY
(
pQueryAttr
))
{
key
=
pBlock
->
info
.
window
.
ekey
;
TSKEY_MAX_ADD
(
key
,
1
);
}
else
{
key
=
pBlock
->
info
.
window
.
skey
;
TSKEY_MIN_SUB
(
key
,
-
1
);
}
setExecutionContext
(
pRuntimeEnv
,
pInfo
,
pOperator
->
numOfOutput
,
pRuntimeEnv
->
current
->
groupIndex
,
key
);
doAggregateImpl
(
pOperator
,
pQueryAttr
->
window
.
skey
,
pInfo
->
pCtx
,
pBlock
);
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
6f62e807
...
...
@@ -722,7 +722,8 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
// OK,let's load row from backward to get not-null column
for
(
int32_t
rowId
=
pBlock
->
numOfRows
-
1
;
rowId
>=
0
;
rowId
--
)
{
SDataCol
*
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
i
;
tdAppendColVal
(
memRowDataBody
(
row
),
tdGetColDataOfRow
(
pDataCol
,
rowId
),
pCol
->
type
,
pCol
->
offset
);
const
void
*
pColData
=
tdGetColDataOfRow
(
pDataCol
,
rowId
);
tdAppendColVal
(
memRowDataBody
(
row
),
pColData
,
pCol
->
type
,
pCol
->
offset
);
//SDataCol *pDataCol = readh.pDCols[0]->cols + j;
void
*
value
=
tdGetRowDataOfCol
(
memRowDataBody
(
row
),
(
int8_t
)
pCol
->
type
,
TD_DATA_ROW_HEAD_SIZE
+
pCol
->
offset
);
if
(
isNull
(
value
,
pCol
->
type
))
{
...
...
@@ -735,11 +736,12 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
continue
;
}
// save not-null column
uint16_t
bytes
=
IS_VAR_DATA_TYPE
(
pCol
->
type
)
?
varDataTLen
(
pColData
)
:
pCol
->
bytes
;
SDataCol
*
pLastCol
=
&
(
pTable
->
lastCols
[
idx
]);
pLastCol
->
pData
=
malloc
(
pCol
->
bytes
);
pLastCol
->
bytes
=
pCol
->
bytes
;
pLastCol
->
pData
=
malloc
(
bytes
);
pLastCol
->
bytes
=
bytes
;
pLastCol
->
colId
=
pCol
->
colId
;
memcpy
(
pLastCol
->
pData
,
value
,
pCol
->
bytes
);
memcpy
(
pLastCol
->
pData
,
value
,
bytes
);
// save row ts(in column 0)
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
0
;
...
...
@@ -991,4 +993,4 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) {
}
return
0
;
}
\ No newline at end of file
}
src/tsdb/src/tsdbMemTable.c
浏览文件 @
6f62e807
...
...
@@ -1019,7 +1019,7 @@ static void updateTableLatestColumn(STsdbRepo *pRepo, STable *pTable, SMemRow ro
if
(
isDataRow
)
{
value
=
tdGetRowDataOfCol
(
memRowDataBody
(
row
),
(
int8_t
)
pTCol
->
type
,
TD_DATA_ROW_HEAD_SIZE
+
p
Schema
->
columns
[
j
].
offset
);
TD_DATA_ROW_HEAD_SIZE
+
p
TCol
->
offset
);
}
else
{
// SKVRow
SColIdx
*
pColIdx
=
tdGetKVRowIdxOfCol
(
memRowKvBody
(
row
),
pTCol
->
colId
);
...
...
@@ -1034,14 +1034,17 @@ static void updateTableLatestColumn(STsdbRepo *pRepo, STable *pTable, SMemRow ro
SDataCol
*
pDataCol
=
&
(
pLatestCols
[
idx
]);
if
(
pDataCol
->
pData
==
NULL
)
{
pDataCol
->
pData
=
malloc
(
p
Schema
->
columns
[
j
].
bytes
);
pDataCol
->
bytes
=
p
Schema
->
columns
[
j
].
bytes
;
}
else
if
(
pDataCol
->
bytes
<
p
Schema
->
columns
[
j
].
bytes
)
{
pDataCol
->
pData
=
realloc
(
pDataCol
->
pData
,
p
Schema
->
columns
[
j
].
bytes
);
pDataCol
->
bytes
=
p
Schema
->
columns
[
j
].
bytes
;
pDataCol
->
pData
=
malloc
(
p
TCol
->
bytes
);
pDataCol
->
bytes
=
p
TCol
->
bytes
;
}
else
if
(
pDataCol
->
bytes
<
p
TCol
->
bytes
)
{
pDataCol
->
pData
=
realloc
(
pDataCol
->
pData
,
p
TCol
->
bytes
);
pDataCol
->
bytes
=
p
TCol
->
bytes
;
}
memcpy
(
pDataCol
->
pData
,
value
,
pDataCol
->
bytes
);
// the actual value size
uint16_t
bytes
=
IS_VAR_DATA_TYPE
(
pTCol
->
type
)
?
varDataTLen
(
value
)
:
pTCol
->
bytes
;
// the actual data size CANNOT larger than column size
assert
(
pTCol
->
bytes
>=
bytes
);
memcpy
(
pDataCol
->
pData
,
value
,
bytes
);
//tsdbInfo("updateTableLatestColumn vgId:%d cache column %d for %d,%s", REPO_ID(pRepo), j, pDataCol->bytes, (char*)pDataCol->pData);
pDataCol
->
ts
=
memRowKey
(
row
);
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
6f62e807
...
...
@@ -640,7 +640,7 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
size_t
numOfGroup
=
taosArrayGetSize
(
pGroupList
->
pGroupList
);
STableGroupInfo
*
pNew
=
calloc
(
1
,
sizeof
(
STableGroupInfo
));
pNew
->
pGroupList
=
taosArrayInit
(
numOfGroup
,
sizeof
(
SArray
)
);
pNew
->
pGroupList
=
taosArrayInit
(
numOfGroup
,
POINTER_BYTES
);
for
(
int32_t
i
=
0
;
i
<
numOfGroup
;
++
i
)
{
SArray
*
oneGroup
=
taosArrayGetP
(
pGroupList
->
pGroupList
,
i
);
...
...
@@ -3383,11 +3383,13 @@ static int32_t tableGroupComparFn(const void *p1, const void *p2, const void *pa
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
tGetTbnameColumnSchema
()
->
bytes
;
}
else
{
STColumn
*
pCol
=
schemaColAt
(
pTableGroupSupp
->
pTagSchema
,
colIndex
);
bytes
=
pCol
->
bytes
;
type
=
pCol
->
type
;
f1
=
tdGetKVRowValOfCol
(
pTable1
->
tagVal
,
pCol
->
colId
);
f2
=
tdGetKVRowValOfCol
(
pTable2
->
tagVal
,
pCol
->
colId
);
if
(
pTableGroupSupp
->
pTagSchema
&&
colIndex
<
pTableGroupSupp
->
pTagSchema
->
numOfCols
)
{
STColumn
*
pCol
=
schemaColAt
(
pTableGroupSupp
->
pTagSchema
,
colIndex
);
bytes
=
pCol
->
bytes
;
type
=
pCol
->
type
;
f1
=
tdGetKVRowValOfCol
(
pTable1
->
tagVal
,
pCol
->
colId
);
f2
=
tdGetKVRowValOfCol
(
pTable2
->
tagVal
,
pCol
->
colId
);
}
}
// this tags value may be NULL
...
...
src/util/src/tcompression.c
浏览文件 @
6f62e807
...
...
@@ -159,7 +159,7 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o
break
;
}
// Get difference.
if
(
!
safeInt64Add
(
curr_value
,
-
prev_value
))
goto
_copy_and_exit
;
if
(
!
safeInt64Add
(
curr_value
,
-
prev_value
_tmp
))
goto
_copy_and_exit
;
int64_t
diff
=
curr_value
-
prev_value_tmp
;
// Zigzag encode the value.
...
...
@@ -993,4 +993,4 @@ int tsDecompressDoubleLossyImp(const char * input, int compressedSize, const int
// decompressed with sz
return
tdszDecompress
(
SZ_DOUBLE
,
input
+
1
,
compressedSize
-
1
,
nelements
,
output
);
}
#endif
\ No newline at end of file
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录