Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3484f251
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3484f251
编写于
8月 11, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
8月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3005 from taosdata/feature/os
Feature/os
上级
72252e0a
0ac54021
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
46 addition
and
40 deletion
+46
-40
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+3
-3
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+4
-4
src/os/inc/osSemphone.h
src/os/inc/osSemphone.h
+1
-0
src/os/src/detail/osSemphone.c
src/os/src/detail/osSemphone.c
+1
-0
src/os/src/windows/w64Semphone.c
src/os/src/windows/w64Semphone.c
+4
-0
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+9
-9
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+6
-6
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
src/util/src/hash.c
src/util/src/hash.c
+8
-8
src/util/src/tcache.c
src/util/src/tcache.c
+3
-3
未找到文件。
src/client/src/tscLocalMerge.c
浏览文件 @
3484f251
...
@@ -914,8 +914,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
...
@@ -914,8 +914,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfRowsGroup
>
pQueryInfo
->
limit
.
limit
)
{
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfRowsGroup
>
pQueryInfo
->
limit
.
limit
)
{
/* impose the limitation of output rows on the final result */
/* impose the limitation of output rows on the final result */
int32_t
prevSize
=
pFinalDataPage
->
num
;
int32_t
prevSize
=
(
int32_t
)
pFinalDataPage
->
num
;
int32_t
overflow
=
pRes
->
numOfRowsGroup
-
pQueryInfo
->
limit
.
limit
;
int32_t
overflow
=
(
int32_t
)(
pRes
->
numOfRowsGroup
-
pQueryInfo
->
limit
.
limit
)
;
assert
(
overflow
<
pRes
->
numOfRows
);
assert
(
overflow
<
pRes
->
numOfRows
);
pRes
->
numOfRowsGroup
=
pQueryInfo
->
limit
.
limit
;
pRes
->
numOfRowsGroup
=
pQueryInfo
->
limit
.
limit
;
...
@@ -984,7 +984,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
...
@@ -984,7 +984,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
if
(
pRes
->
numOfRows
>
0
)
{
if
(
pRes
->
numOfRows
>
0
)
{
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfRows
>
pQueryInfo
->
limit
.
limit
)
{
if
(
pQueryInfo
->
limit
.
limit
>=
0
&&
pRes
->
numOfRows
>
pQueryInfo
->
limit
.
limit
)
{
int32_t
overflow
=
pRes
->
numOfRows
-
pQueryInfo
->
limit
.
limit
;
int32_t
overflow
=
(
int32_t
)(
pRes
->
numOfRows
-
pQueryInfo
->
limit
.
limit
)
;
pRes
->
numOfRows
-=
overflow
;
pRes
->
numOfRows
-=
overflow
;
pFinalDataPage
->
num
-=
overflow
;
pFinalDataPage
->
num
-=
overflow
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
3484f251
...
@@ -1182,7 +1182,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
...
@@ -1182,7 +1182,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
char
*
c
=
tbufGetData
(
&
bw
,
true
);
char
*
c
=
tbufGetData
(
&
bw
,
true
);
// set the serialized binary string as the parameter of arithmetic expression
// set the serialized binary string as the parameter of arithmetic expression
addExprParams
(
pExpr
,
c
,
TSDB_DATA_TYPE_BINARY
,
len
,
index
.
tableIndex
);
addExprParams
(
pExpr
,
c
,
TSDB_DATA_TYPE_BINARY
,
(
int32_t
)
len
,
index
.
tableIndex
);
insertResultField
(
pQueryInfo
,
exprIndex
,
&
columnList
,
sizeof
(
double
),
TSDB_DATA_TYPE_DOUBLE
,
pExpr
->
aliasName
,
pExpr
);
insertResultField
(
pQueryInfo
,
exprIndex
,
&
columnList
,
sizeof
(
double
),
TSDB_DATA_TYPE_DOUBLE
,
pExpr
->
aliasName
,
pExpr
);
...
@@ -1237,7 +1237,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
...
@@ -1237,7 +1237,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
}
}
for
(
int32_t
i
=
0
;
i
<
pSelection
->
nExpr
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pSelection
->
nExpr
;
++
i
)
{
int32_t
outputIndex
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
int32_t
outputIndex
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
tSQLExprItem
*
pItem
=
&
pSelection
->
a
[
i
];
tSQLExprItem
*
pItem
=
&
pSelection
->
a
[
i
];
// project on all fields
// project on all fields
...
@@ -3144,7 +3144,7 @@ static int32_t arithmeticExprToString(tSQLExpr* pExpr, char** str) {
...
@@ -3144,7 +3144,7 @@ static int32_t arithmeticExprToString(tSQLExpr* pExpr, char** str) {
int32_t
code
=
doArithmeticExprToString
(
pExpr
,
str
);
int32_t
code
=
doArithmeticExprToString
(
pExpr
,
str
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
// remove out the parenthesis
if
(
code
==
TSDB_CODE_SUCCESS
)
{
// remove out the parenthesis
int32_t
len
=
strlen
(
start
);
int32_t
len
=
(
int32_t
)
strlen
(
start
);
memmove
(
start
,
start
+
1
,
len
-
2
);
memmove
(
start
,
start
+
1
,
len
-
2
);
start
[
len
-
2
]
=
0
;
start
[
len
-
2
]
=
0
;
}
}
...
...
src/client/src/tscSql.c
浏览文件 @
3484f251
...
@@ -263,7 +263,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) {
...
@@ -263,7 +263,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) {
}
}
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
return
taos_query_c
(
taos
,
sqlstr
,
strlen
(
sqlstr
));
return
taos_query_c
(
taos
,
sqlstr
,
(
uint32_t
)
strlen
(
sqlstr
));
}
}
int
taos_result_precision
(
TAOS_RES
*
res
)
{
int
taos_result_precision
(
TAOS_RES
*
res
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
3484f251
...
@@ -1027,7 +1027,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
...
@@ -1027,7 +1027,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
int32_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
int32_t
numOfExprs
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
pRes
->
pColumnIndex
=
calloc
(
1
,
sizeof
(
SColumnIndex
)
*
numOfExprs
);
pRes
->
pColumnIndex
=
calloc
(
1
,
sizeof
(
SColumnIndex
)
*
numOfExprs
);
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
3484f251
...
@@ -1683,7 +1683,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
...
@@ -1683,7 +1683,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
// current sql function is not direct output result, so create a dummy output field
// current sql function is not direct output result, so create a dummy output field
static
void
doSetNewFieldInfo
(
SQueryInfo
*
pNewQueryInfo
,
SSqlExpr
*
pExpr
)
{
static
void
doSetNewFieldInfo
(
SQueryInfo
*
pNewQueryInfo
,
SSqlExpr
*
pExpr
)
{
TAOS_FIELD
f
=
{.
type
=
pExpr
->
resType
,
.
bytes
=
pExpr
->
resBytes
};
TAOS_FIELD
f
=
{.
type
=
(
uint8_t
)
pExpr
->
resType
,
.
bytes
=
pExpr
->
resBytes
};
tstrncpy
(
f
.
name
,
pExpr
->
aliasName
,
sizeof
(
f
.
name
));
tstrncpy
(
f
.
name
,
pExpr
->
aliasName
,
sizeof
(
f
.
name
));
SFieldSupInfo
*
pInfo1
=
tscFieldInfoAppend
(
&
pNewQueryInfo
->
fieldsInfo
,
&
f
);
SFieldSupInfo
*
pInfo1
=
tscFieldInfoAppend
(
&
pNewQueryInfo
->
fieldsInfo
,
&
f
);
...
@@ -1693,7 +1693,7 @@ static void doSetNewFieldInfo(SQueryInfo* pNewQueryInfo, SSqlExpr* pExpr) {
...
@@ -1693,7 +1693,7 @@ static void doSetNewFieldInfo(SQueryInfo* pNewQueryInfo, SSqlExpr* pExpr) {
}
}
static
void
doSetSqlExprAndResultFieldInfo
(
SQueryInfo
*
pQueryInfo
,
SQueryInfo
*
pNewQueryInfo
,
int64_t
uid
)
{
static
void
doSetSqlExprAndResultFieldInfo
(
SQueryInfo
*
pQueryInfo
,
SQueryInfo
*
pNewQueryInfo
,
int64_t
uid
)
{
int32_t
numOfOutput
=
tscSqlExprNumOfExprs
(
pNewQueryInfo
);
int32_t
numOfOutput
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pNewQueryInfo
);
if
(
numOfOutput
==
0
)
{
if
(
numOfOutput
==
0
)
{
return
;
return
;
}
}
...
@@ -2044,7 +2044,7 @@ bool hasMoreVnodesToTry(SSqlObj* pSql) {
...
@@ -2044,7 +2044,7 @@ bool hasMoreVnodesToTry(SSqlObj* pSql) {
int32_t
numOfVgroups
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
int32_t
numOfVgroups
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
if
(
pTableMetaInfo
->
pVgroupTables
!=
NULL
)
{
if
(
pTableMetaInfo
->
pVgroupTables
!=
NULL
)
{
numOfVgroups
=
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
numOfVgroups
=
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
}
}
return
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
return
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
...
@@ -2249,6 +2249,6 @@ bool tscSetSqlOwner(SSqlObj* pSql) {
...
@@ -2249,6 +2249,6 @@ bool tscSetSqlOwner(SSqlObj* pSql) {
}
}
void
tscClearSqlOwner
(
SSqlObj
*
pSql
)
{
void
tscClearSqlOwner
(
SSqlObj
*
pSql
)
{
assert
(
pSql
->
owner
!=
0
);
assert
(
taosCheckPthreadValid
(
pSql
->
owner
)
);
atomic_store_64
(
&
pSql
->
owner
,
0
);
atomic_store_64
(
&
pSql
->
owner
,
0
);
}
}
\ No newline at end of file
src/os/inc/osSemphone.h
浏览文件 @
3484f251
...
@@ -32,6 +32,7 @@ extern "C" {
...
@@ -32,6 +32,7 @@ extern "C" {
bool
taosCheckPthreadValid
(
pthread_t
thread
);
bool
taosCheckPthreadValid
(
pthread_t
thread
);
int64_t
taosGetPthreadId
();
int64_t
taosGetPthreadId
();
void
taosResetPthread
(
pthread_t
*
thread
);
void
taosResetPthread
(
pthread_t
*
thread
);
bool
taosComparePthread
(
pthread_t
first
,
pthread_t
second
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/os/src/detail/osSemphone.c
浏览文件 @
3484f251
...
@@ -21,5 +21,6 @@
...
@@ -21,5 +21,6 @@
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
return
thread
!=
0
;
}
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
return
thread
!=
0
;
}
int64_t
taosGetPthreadId
()
{
return
(
int64_t
)
pthread_self
();
}
int64_t
taosGetPthreadId
()
{
return
(
int64_t
)
pthread_self
();
}
void
taosResetPthread
(
pthread_t
*
thread
)
{
*
thread
=
0
;
}
void
taosResetPthread
(
pthread_t
*
thread
)
{
*
thread
=
0
;
}
bool
taosComparePthread
(
pthread_t
first
,
pthread_t
second
)
{
return
first
==
second
;
}
#endif
#endif
\ No newline at end of file
src/os/src/windows/w64Semphone.c
浏览文件 @
3484f251
...
@@ -32,3 +32,7 @@ int64_t taosGetPthreadId() {
...
@@ -32,3 +32,7 @@ int64_t taosGetPthreadId() {
return
(
int64_t
)
pthread_self
();
return
(
int64_t
)
pthread_self
();
#endif
#endif
}
}
bool
taosComparePthread
(
pthread_t
first
,
pthread_t
second
)
{
return
first
.
p
==
second
.
p
;
}
src/query/inc/qExecutor.h
浏览文件 @
3484f251
...
@@ -186,7 +186,7 @@ enum {
...
@@ -186,7 +186,7 @@ enum {
typedef
struct
SQInfo
{
typedef
struct
SQInfo
{
void
*
signature
;
void
*
signature
;
int32_t
code
;
// error code to returned to client
int32_t
code
;
// error code to returned to client
pthread_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
void
*
tsdb
;
void
*
tsdb
;
int32_t
vgId
;
int32_t
vgId
;
STableGroupInfo
tableGroupInfo
;
// table id list < only includes the STable list>
STableGroupInfo
tableGroupInfo
;
// table id list < only includes the STable list>
...
...
src/query/src/qExecutor.c
浏览文件 @
3484f251
...
@@ -130,8 +130,8 @@ static void finalizeQueryResult(SQueryRuntimeEnv *pRuntimeEnv);
...
@@ -130,8 +130,8 @@ static void finalizeQueryResult(SQueryRuntimeEnv *pRuntimeEnv);
(tw)->ekey = (tw)->skey + ((_q)->intervalTime - 1); \
(tw)->ekey = (tw)->skey + ((_q)->intervalTime - 1); \
} while (0)
} while (0)
#define SET_STABLE_QUERY_OVER(_q) ((_q)->tableIndex = (
_q)->tableqinfoGroupInfo.numOfTables
)
#define SET_STABLE_QUERY_OVER(_q) ((_q)->tableIndex = (
int32_t)((_q)->tableqinfoGroupInfo.numOfTables)
)
#define IS_STASBLE_QUERY_OVER(_q) ((_q)->tableIndex >= (
_q)->tableqinfoGroupInfo.numOfTables
)
#define IS_STASBLE_QUERY_OVER(_q) ((_q)->tableIndex >= (
int32_t)((_q)->tableqinfoGroupInfo.numOfTables)
)
// todo move to utility
// todo move to utility
static
int32_t
mergeIntoGroupResultImpl
(
SQInfo
*
pQInfo
,
SArray
*
group
);
static
int32_t
mergeIntoGroupResultImpl
(
SQInfo
*
pQInfo
,
SArray
*
group
);
...
@@ -405,9 +405,9 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
...
@@ -405,9 +405,9 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
if
(
pWindowResInfo
->
size
>=
pWindowResInfo
->
capacity
)
{
if
(
pWindowResInfo
->
size
>=
pWindowResInfo
->
capacity
)
{
int64_t
newCap
=
0
;
int64_t
newCap
=
0
;
if
(
pWindowResInfo
->
capacity
>
10000
)
{
if
(
pWindowResInfo
->
capacity
>
10000
)
{
newCap
=
pWindowResInfo
->
capacity
*
1
.
25
;
newCap
=
(
int64_t
)(
pWindowResInfo
->
capacity
*
1
.
25
)
;
}
else
{
}
else
{
newCap
=
pWindowResInfo
->
capacity
*
1
.
5
;
newCap
=
(
int64_t
)(
pWindowResInfo
->
capacity
*
1
.
5
)
;
}
}
char
*
t
=
realloc
(
pWindowResInfo
->
pResult
,
newCap
*
sizeof
(
SWindowResult
));
char
*
t
=
realloc
(
pWindowResInfo
->
pResult
,
newCap
*
sizeof
(
SWindowResult
));
...
@@ -2725,7 +2725,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
...
@@ -2725,7 +2725,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
memcpy
(
pDest
+
offset
*
bytes
,
pData
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
pData
->
num
,
bytes
*
pData
->
num
);
memcpy
(
pDest
+
offset
*
bytes
,
pData
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
pData
->
num
,
bytes
*
pData
->
num
);
}
}
offset
+=
pData
->
num
;
offset
+=
(
int32_t
)
pData
->
num
;
}
}
assert
(
pQuery
->
rec
.
rows
==
0
);
assert
(
pQuery
->
rec
.
rows
==
0
);
...
@@ -3051,7 +3051,7 @@ void disableFuncInReverseScan(SQInfo *pQInfo) {
...
@@ -3051,7 +3051,7 @@ void disableFuncInReverseScan(SQInfo *pQInfo) {
static
void
setupQueryRangeForReverseScan
(
SQInfo
*
pQInfo
)
{
static
void
setupQueryRangeForReverseScan
(
SQInfo
*
pQInfo
)
{
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
numOfGroups
=
GET_NUM_OF_TABLEGROUP
(
pQInfo
);
int32_t
numOfGroups
=
(
int32_t
)(
GET_NUM_OF_TABLEGROUP
(
pQInfo
)
);
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
SArray
*
group
=
GET_TABLEGROUP
(
pQInfo
,
i
);
SArray
*
group
=
GET_TABLEGROUP
(
pQInfo
,
i
);
...
@@ -6378,7 +6378,7 @@ static bool doBuildResCheck(SQInfo* pQInfo) {
...
@@ -6378,7 +6378,7 @@ static bool doBuildResCheck(SQInfo* pQInfo) {
pthread_mutex_unlock
(
&
pQInfo
->
lock
);
pthread_mutex_unlock
(
&
pQInfo
->
lock
);
// clear qhandle owner
// clear qhandle owner
assert
(
pQInfo
->
owner
==
pthread_self
());
assert
(
pQInfo
->
owner
==
taosGetPthreadId
());
pQInfo
->
owner
=
0
;
pQInfo
->
owner
=
0
;
return
buildRes
;
return
buildRes
;
...
@@ -6387,7 +6387,7 @@ static bool doBuildResCheck(SQInfo* pQInfo) {
...
@@ -6387,7 +6387,7 @@ static bool doBuildResCheck(SQInfo* pQInfo) {
bool
qTableQuery
(
qinfo_t
qinfo
)
{
bool
qTableQuery
(
qinfo_t
qinfo
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
assert
(
pQInfo
&&
pQInfo
->
signature
==
pQInfo
);
assert
(
pQInfo
&&
pQInfo
->
signature
==
pQInfo
);
int64_t
threadId
=
pthread_self
();
int64_t
threadId
=
taosGetPthreadId
();
int64_t
curOwner
=
0
;
int64_t
curOwner
=
0
;
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pQInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pQInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
...
@@ -6549,7 +6549,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
...
@@ -6549,7 +6549,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
// Wait for the query executing thread being stopped/
// Wait for the query executing thread being stopped/
// Once the query is stopped, the owner of qHandle will be cleared immediately.
// Once the query is stopped, the owner of qHandle will be cleared immediately.
while
(
pQInfo
->
owner
!=
0
)
{
while
(
pQInfo
->
owner
!=
0
)
{
taosMsleep
(
100
);
taosMsleep
(
100
);
}
}
...
...
src/query/src/qResultbuf.c
浏览文件 @
3484f251
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "queryLog.h"
#include "queryLog.h"
#include "taoserror.h"
#include "taoserror.h"
#define GET_DATA_PAYLOAD(_p) ((_p)->pData + POINTER_BYTES)
#define GET_DATA_PAYLOAD(_p) ((
char *)(
_p)->pData + POINTER_BYTES)
#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
rowSize
,
int32_t
pagesize
,
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
rowSize
,
int32_t
pagesize
,
...
@@ -248,7 +248,7 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
...
@@ -248,7 +248,7 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
int32_t
prev
=
pResultBuf
->
inMemPages
;
int32_t
prev
=
pResultBuf
->
inMemPages
;
// increase by 50% of previous mem pages
// increase by 50% of previous mem pages
pResultBuf
->
inMemPages
=
pResultBuf
->
inMemPages
*
1
.
5
f
;
pResultBuf
->
inMemPages
=
(
int32_t
)(
pResultBuf
->
inMemPages
*
1
.
5
f
)
;
qWarn
(
"%p in memory buf page not sufficient, expand from %d to %d, page size:%d"
,
pResultBuf
,
prev
,
qWarn
(
"%p in memory buf page not sufficient, expand from %d to %d, page size:%d"
,
pResultBuf
,
prev
,
pResultBuf
->
inMemPages
,
pResultBuf
->
pageSize
);
pResultBuf
->
inMemPages
,
pResultBuf
->
pageSize
);
...
@@ -313,7 +313,7 @@ tFilePage* getNewDataBuf(SDiskbasedResultBuf* pResultBuf, int32_t groupId, int32
...
@@ -313,7 +313,7 @@ tFilePage* getNewDataBuf(SDiskbasedResultBuf* pResultBuf, int32_t groupId, int32
((
void
**
)
pi
->
pData
)[
0
]
=
pi
;
((
void
**
)
pi
->
pData
)[
0
]
=
pi
;
pi
->
used
=
true
;
pi
->
used
=
true
;
return
GET_DATA_PAYLOAD
(
pi
);
return
(
void
*
)(
GET_DATA_PAYLOAD
(
pi
)
);
}
}
tFilePage
*
getResBufPage
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
id
)
{
tFilePage
*
getResBufPage
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
id
)
{
...
@@ -327,7 +327,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
...
@@ -327,7 +327,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
// no need to update the LRU list if only one page exists
// no need to update the LRU list if only one page exists
if
(
pResultBuf
->
numOfPages
==
1
)
{
if
(
pResultBuf
->
numOfPages
==
1
)
{
(
*
pi
)
->
used
=
true
;
(
*
pi
)
->
used
=
true
;
return
GET_DATA_PAYLOAD
(
*
pi
);
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
)
);
}
}
SPageInfo
**
pInfo
=
(
SPageInfo
**
)
((
*
pi
)
->
pn
->
data
);
SPageInfo
**
pInfo
=
(
SPageInfo
**
)
((
*
pi
)
->
pn
->
data
);
...
@@ -336,7 +336,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
...
@@ -336,7 +336,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
lruListMoveToFront
(
pResultBuf
->
lruList
,
(
*
pi
));
lruListMoveToFront
(
pResultBuf
->
lruList
,
(
*
pi
));
(
*
pi
)
->
used
=
true
;
(
*
pi
)
->
used
=
true
;
return
GET_DATA_PAYLOAD
(
*
pi
);
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
)
);
}
else
{
// not in memory
}
else
{
// not in memory
assert
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
(
*
pi
)
->
info
.
length
>=
0
&&
(
*
pi
)
->
info
.
offset
>=
0
);
assert
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
(
*
pi
)
->
info
.
length
>=
0
&&
(
*
pi
)
->
info
.
offset
>=
0
);
...
@@ -358,7 +358,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
...
@@ -358,7 +358,7 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
(
*
pi
)
->
used
=
true
;
(
*
pi
)
->
used
=
true
;
loadPageFromDisk
(
pResultBuf
,
*
pi
);
loadPageFromDisk
(
pResultBuf
,
*
pi
);
return
GET_DATA_PAYLOAD
(
*
pi
);
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
)
);
}
}
}
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
3484f251
...
@@ -245,9 +245,9 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -245,9 +245,9 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
STableCheckInfo
info
=
{
STableCheckInfo
info
=
{
.
lastKey
=
pKeyInfo
->
lastKey
,
.
lastKey
=
pKeyInfo
->
lastKey
,
.
tableId
=
((
STable
*
)(
pKeyInfo
->
pTable
))
->
tableId
,
.
pTableObj
=
pKeyInfo
->
pTable
,
.
pTableObj
=
pKeyInfo
->
pTable
,
};
};
info
.
tableId
=
((
STable
*
)(
pKeyInfo
->
pTable
))
->
tableId
;
assert
(
info
.
pTableObj
!=
NULL
&&
(
info
.
pTableObj
->
type
==
TSDB_NORMAL_TABLE
||
assert
(
info
.
pTableObj
!=
NULL
&&
(
info
.
pTableObj
->
type
==
TSDB_NORMAL_TABLE
||
info
.
pTableObj
->
type
==
TSDB_CHILD_TABLE
||
info
.
pTableObj
->
type
==
TSDB_STREAM_TABLE
));
info
.
pTableObj
->
type
==
TSDB_CHILD_TABLE
||
info
.
pTableObj
->
type
==
TSDB_STREAM_TABLE
));
...
...
src/util/src/hash.c
浏览文件 @
3484f251
...
@@ -167,7 +167,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
...
@@ -167,7 +167,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
void
*
p
=
calloc
(
pHashObj
->
capacity
,
sizeof
(
SHashEntry
));
void
*
p
=
calloc
(
pHashObj
->
capacity
,
sizeof
(
SHashEntry
));
for
(
int32_t
i
=
0
;
i
<
pHashObj
->
capacity
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pHashObj
->
capacity
;
++
i
)
{
pHashObj
->
hashList
[
i
]
=
p
+
i
*
sizeof
(
SHashEntry
);
pHashObj
->
hashList
[
i
]
=
(
void
*
)((
char
*
)
p
+
i
*
sizeof
(
SHashEntry
)
);
}
}
taosArrayPush
(
pHashObj
->
pMemBlock
,
&
p
);
taosArrayPush
(
pHashObj
->
pMemBlock
,
&
p
);
...
@@ -179,7 +179,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
...
@@ -179,7 +179,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
size_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
return
(
pHashObj
==
NULL
)
?
0
:
pHashObj
->
size
;
}
size_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
return
(
pHashObj
==
NULL
)
?
0
:
pHashObj
->
size
;
}
int32_t
taosHashPut
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
*
data
,
size_t
size
)
{
int32_t
taosHashPut
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
*
data
,
size_t
size
)
{
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
keyLen
);
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
SHashNode
*
pNewNode
=
doCreateHashNode
(
key
,
keyLen
,
data
,
size
,
hashVal
);
SHashNode
*
pNewNode
=
doCreateHashNode
(
key
,
keyLen
,
data
,
size
,
hashVal
);
if
(
pNewNode
==
NULL
)
{
if
(
pNewNode
==
NULL
)
{
return
-
1
;
return
-
1
;
...
@@ -263,7 +263,7 @@ void *taosHashGetCB(SHashObj *pHashObj, const void *key, size_t keyLen, void (*f
...
@@ -263,7 +263,7 @@ void *taosHashGetCB(SHashObj *pHashObj, const void *key, size_t keyLen, void (*f
return
NULL
;
return
NULL
;
}
}
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
keyLen
);
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
// only add the read lock to disable the resize process
// only add the read lock to disable the resize process
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
...
@@ -317,7 +317,7 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
...
@@ -317,7 +317,7 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
return
-
1
;
return
-
1
;
}
}
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
keyLen
);
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
// disable the resize process
// disable the resize process
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
...
@@ -418,7 +418,7 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
...
@@ -418,7 +418,7 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
// disable the resize process
// disable the resize process
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
__rd_lock
(
&
pHashObj
->
lock
,
pHashObj
->
type
);
int32_t
numOfEntries
=
pHashObj
->
capacity
;
int32_t
numOfEntries
=
(
int32_t
)
pHashObj
->
capacity
;
for
(
int32_t
i
=
0
;
i
<
numOfEntries
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfEntries
;
++
i
)
{
SHashEntry
*
pEntry
=
pHashObj
->
hashList
[
i
];
SHashEntry
*
pEntry
=
pHashObj
->
hashList
[
i
];
if
(
pEntry
->
num
==
0
)
{
if
(
pEntry
->
num
==
0
)
{
...
@@ -649,7 +649,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
...
@@ -649,7 +649,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
SHashNode
*
pNode
=
NULL
;
SHashNode
*
pNode
=
NULL
;
SHashNode
*
pNext
=
NULL
;
SHashNode
*
pNext
=
NULL
;
int32_t
newSize
=
pHashObj
->
capacity
<<
1u
;
int32_t
newSize
=
(
int32_t
)(
pHashObj
->
capacity
<<
1u
)
;
if
(
newSize
>
HASH_MAX_CAPACITY
)
{
if
(
newSize
>
HASH_MAX_CAPACITY
)
{
// uDebug("current capacity:%d, maximum capacity:%d, no resize applied due to limitation is reached",
// uDebug("current capacity:%d, maximum capacity:%d, no resize applied due to limitation is reached",
// pHashObj->capacity, HASH_MAX_CAPACITY);
// pHashObj->capacity, HASH_MAX_CAPACITY);
...
@@ -669,7 +669,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
...
@@ -669,7 +669,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
void
*
p
=
calloc
(
inc
,
sizeof
(
SHashEntry
));
void
*
p
=
calloc
(
inc
,
sizeof
(
SHashEntry
));
for
(
int32_t
i
=
0
;
i
<
inc
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
inc
;
++
i
)
{
pHashObj
->
hashList
[
i
+
pHashObj
->
capacity
]
=
p
+
i
*
sizeof
(
SHashEntry
);
pHashObj
->
hashList
[
i
+
pHashObj
->
capacity
]
=
(
void
*
)((
char
*
)
p
+
i
*
sizeof
(
SHashEntry
)
);
}
}
taosArrayPush
(
pHashObj
->
pMemBlock
,
&
p
);
taosArrayPush
(
pHashObj
->
pMemBlock
,
&
p
);
...
@@ -762,7 +762,7 @@ SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, s
...
@@ -762,7 +762,7 @@ SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *pData, s
pNewNode
->
key
=
pNewNode
->
data
+
dsize
;
pNewNode
->
key
=
pNewNode
->
data
+
dsize
;
memcpy
(
pNewNode
->
key
,
key
,
keyLen
);
memcpy
(
pNewNode
->
key
,
key
,
keyLen
);
pNewNode
->
keyLen
=
keyLen
;
pNewNode
->
keyLen
=
(
uint32_t
)
keyLen
;
pNewNode
->
hashVal
=
hashVal
;
pNewNode
->
hashVal
=
hashVal
;
return
pNewNode
;
return
pNewNode
;
}
}
...
...
src/util/src/tcache.c
浏览文件 @
3484f251
...
@@ -95,7 +95,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo
...
@@ -95,7 +95,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo
}
}
pCacheObj
->
totalSize
-=
pNode
->
size
;
pCacheObj
->
totalSize
-=
pNode
->
size
;
int32_t
size
=
taosHashGetSize
(
pCacheObj
->
pHashTable
);
int32_t
size
=
(
int32_t
)
taosHashGetSize
(
pCacheObj
->
pHashTable
);
assert
(
size
>
0
);
assert
(
size
>
0
);
uDebug
(
"cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, num:%d size:%"
PRId64
"bytes"
,
uDebug
(
"cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, num:%d size:%"
PRId64
"bytes"
,
...
@@ -388,7 +388,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
...
@@ -388,7 +388,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
}
else
{
// ref == 0
}
else
{
// ref == 0
atomic_sub_fetch_64
(
&
pCacheObj
->
totalSize
,
pNode
->
size
);
atomic_sub_fetch_64
(
&
pCacheObj
->
totalSize
,
pNode
->
size
);
int32_t
size
=
taosHashGetSize
(
pCacheObj
->
pHashTable
);
int32_t
size
=
(
int32_t
)
taosHashGetSize
(
pCacheObj
->
pHashTable
);
uDebug
(
"cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, num:%d size:%"
PRId64
"bytes"
,
uDebug
(
"cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, num:%d size:%"
PRId64
"bytes"
,
pCacheObj
->
name
,
pNode
->
key
,
pNode
->
data
,
pNode
->
size
,
size
,
pCacheObj
->
totalSize
);
pCacheObj
->
name
,
pNode
->
key
,
pNode
->
data
,
pNode
->
size
,
size
,
pCacheObj
->
totalSize
);
...
@@ -560,7 +560,7 @@ bool travHashTableFn(void* param, void* data) {
...
@@ -560,7 +560,7 @@ bool travHashTableFn(void* param, void* data) {
SCacheObj
*
pCacheObj
=
ps
->
pCacheObj
;
SCacheObj
*
pCacheObj
=
ps
->
pCacheObj
;
SCacheDataNode
*
pNode
=
*
(
SCacheDataNode
**
)
data
;
SCacheDataNode
*
pNode
=
*
(
SCacheDataNode
**
)
data
;
if
(
pNode
->
expireTime
<
ps
->
time
&&
T_REF_VAL_GET
(
pNode
)
<=
0
)
{
if
(
(
int64_t
)
pNode
->
expireTime
<
ps
->
time
&&
T_REF_VAL_GET
(
pNode
)
<=
0
)
{
taosCacheReleaseNode
(
pCacheObj
,
pNode
);
taosCacheReleaseNode
(
pCacheObj
,
pNode
);
// this node should be remove from hash table
// this node should be remove from hash table
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录