Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e53ebe94
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e53ebe94
编写于
8月 20, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1090 compile client in windows 32 platform
上级
2d02bb7e
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
139 addition
and
203 deletion
+139
-203
cmake/define.inc
cmake/define.inc
+1
-1
deps/MsvcLibX/include/msvclibx.h
deps/MsvcLibX/include/msvclibx.h
+1
-1
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+3
-3
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-2
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+64
-118
src/os/src/windows/w64Atomic.c
src/os/src/windows/w64Atomic.c
+41
-53
src/os/src/windows/w64Sysinfo.c
src/os/src/windows/w64Sysinfo.c
+7
-5
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+10
-10
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+1
-1
src/query/src/qFill.c
src/query/src/qFill.c
+1
-1
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+1
-1
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+2
-2
src/util/inc/tcoding.h
src/util/inc/tcoding.h
+2
-2
src/util/src/tkvstore.c
src/util/src/tkvstore.c
+2
-2
未找到文件。
cmake/define.inc
浏览文件 @
e53ebe94
...
@@ -110,7 +110,7 @@ IF (TD_WINDOWS)
...
@@ -110,7 +110,7 @@ IF (TD_WINDOWS)
ADD_DEFINITIONS
(
-
D_MBCS
-
D_CRT_SECURE_NO_DEPRECATE
-
D_CRT_NONSTDC_NO_DEPRECATE
)
ADD_DEFINITIONS
(
-
D_MBCS
-
D_CRT_SECURE_NO_DEPRECATE
-
D_CRT_NONSTDC_NO_DEPRECATE
)
SET
(
CMAKE_GENERATOR
"NMake Makefiles"
CACHE
INTERNAL
""
FORCE
)
SET
(
CMAKE_GENERATOR
"NMake Makefiles"
CACHE
INTERNAL
""
FORCE
)
IF
(
NOT
TD_GODLL
)
IF
(
NOT
TD_GODLL
)
SET
(
COMMON_FLAGS
"/nologo /WX /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-"
)
SET
(
COMMON_FLAGS
"/nologo /WX /
wd4018 /wd2220 /
Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-"
)
SET
(
DEBUG_FLAGS
"/Zi /W3 /GL"
)
SET
(
DEBUG_FLAGS
"/Zi /W3 /GL"
)
SET
(
RELEASE_FLAGS
"/W0 /GL"
)
SET
(
RELEASE_FLAGS
"/W0 /GL"
)
ENDIF
()
ENDIF
()
...
...
deps/MsvcLibX/include/msvclibx.h
浏览文件 @
e53ebe94
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
/* Generate the OS-and-debug-mode-specific library name */
/* Generate the OS-and-debug-mode-specific library name */
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
#pragma comment(lib, _MSVCLIBX_LIB)
//
#pragma comment(lib, _MSVCLIBX_LIB)
/* Library-specific routine used internally by many standard routines */
/* Library-specific routine used internally by many standard routines */
#if defined(_WIN32)
#if defined(_WIN32)
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
e53ebe94
...
@@ -907,7 +907,7 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer,
...
@@ -907,7 +907,7 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer,
savePrevRecordAndSetupFillInfo
(
pLocalReducer
,
pQueryInfo
,
pLocalReducer
->
pFillInfo
);
savePrevRecordAndSetupFillInfo
(
pLocalReducer
,
pQueryInfo
,
pLocalReducer
->
pFillInfo
);
}
}
memcpy
(
pRes
->
data
,
pBeforeFillData
->
data
,
pRes
->
numOfRows
*
pLocalReducer
->
finalRowSize
);
memcpy
(
pRes
->
data
,
pBeforeFillData
->
data
,
(
size_t
)(
pRes
->
numOfRows
*
pLocalReducer
->
finalRowSize
)
);
pRes
->
numOfClauseTotal
+=
pRes
->
numOfRows
;
pRes
->
numOfClauseTotal
+=
pRes
->
numOfRows
;
pBeforeFillData
->
num
=
0
;
pBeforeFillData
->
num
=
0
;
...
@@ -943,7 +943,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
...
@@ -943,7 +943,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
memmove
(
pResPages
[
i
]
->
data
,
pResPages
[
i
]
->
data
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
memmove
(
pResPages
[
i
]
->
data
,
pResPages
[
i
]
->
data
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
newRows
*
pField
->
bytes
);
(
size_t
)(
newRows
*
pField
->
bytes
)
);
}
}
}
}
...
@@ -988,7 +988,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
...
@@ -988,7 +988,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
int16_t
offset
=
getColumnModelOffset
(
pLocalReducer
->
resColModel
,
i
);
int16_t
offset
=
getColumnModelOffset
(
pLocalReducer
->
resColModel
,
i
);
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
]
->
data
,
pField
->
bytes
*
pRes
->
numOfRows
);
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
]
->
data
,
(
size_t
)(
pField
->
bytes
*
pRes
->
numOfRows
)
);
}
}
}
else
{
// todo bug??
}
else
{
// todo bug??
reversedCopyFromInterpolationToDstBuf
(
pQueryInfo
,
pRes
,
pResPages
,
pLocalReducer
);
reversedCopyFromInterpolationToDstBuf
(
pQueryInfo
,
pRes
,
pResPages
,
pLocalReducer
);
...
...
src/client/src/tscServer.c
浏览文件 @
e53ebe94
...
@@ -708,7 +708,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -708,7 +708,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pColFilter
->
filterstr
)
{
if
(
pColFilter
->
filterstr
)
{
pFilterMsg
->
len
=
htobe64
(
pColFilter
->
len
);
pFilterMsg
->
len
=
htobe64
(
pColFilter
->
len
);
memcpy
(
pMsg
,
(
void
*
)
pColFilter
->
pz
,
pColFilter
->
len
+
1
);
memcpy
(
pMsg
,
(
void
*
)
pColFilter
->
pz
,
(
size_t
)(
pColFilter
->
len
+
1
)
);
pMsg
+=
(
pColFilter
->
len
+
1
);
// append the additional filter binary info
pMsg
+=
(
pColFilter
->
len
+
1
);
// append the additional filter binary info
}
else
{
}
else
{
pFilterMsg
->
lowerBndi
=
htobe64
(
pColFilter
->
lowerBndi
);
pFilterMsg
->
lowerBndi
=
htobe64
(
pColFilter
->
lowerBndi
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
e53ebe94
...
@@ -623,7 +623,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
...
@@ -623,7 +623,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
// keep the results in memory
// keep the results in memory
if
(
numOfRows
>
0
)
{
if
(
numOfRows
>
0
)
{
size_t
validLen
=
pSupporter
->
tagSize
*
pRes
->
numOfRows
;
size_t
validLen
=
(
size_t
)(
pSupporter
->
tagSize
*
pRes
->
numOfRows
)
;
size_t
length
=
pSupporter
->
totalLen
+
validLen
;
size_t
length
=
pSupporter
->
totalLen
+
validLen
;
// todo handle memory error
// todo handle memory error
...
@@ -748,7 +748,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
...
@@ -748,7 +748,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
}
}
if
(
numOfRows
>
0
)
{
// write the compressed timestamp to disk file
if
(
numOfRows
>
0
)
{
// write the compressed timestamp to disk file
fwrite
(
pRes
->
data
,
pRes
->
numOfRows
,
1
,
pSupporter
->
f
);
fwrite
(
pRes
->
data
,
(
size_t
)
pRes
->
numOfRows
,
1
,
pSupporter
->
f
);
fclose
(
pSupporter
->
f
);
fclose
(
pSupporter
->
f
);
pSupporter
->
f
=
NULL
;
pSupporter
->
f
=
NULL
;
...
...
src/os/inc/osWindows.h
浏览文件 @
e53ebe94
...
@@ -230,8 +230,12 @@ void wordfree(wordexp_t *pwordexp);
...
@@ -230,8 +230,12 @@ void wordfree(wordexp_t *pwordexp);
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
#ifdef _InterlockedExchangePointer
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
#else
#define atomic_exchange_ptr(ptr, val) _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
#endif
#ifdef _TD_GO_DLL_
#ifdef _TD_GO_DLL_
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
#else
#else
...
@@ -247,162 +251,104 @@ void wordfree(wordexp_t *pwordexp);
...
@@ -247,162 +251,104 @@ void wordfree(wordexp_t *pwordexp);
long
interlocked_add_fetch_32
(
long
volatile
*
ptr
,
long
val
);
long
interlocked_add_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_add_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_add_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
char
interlocked_and_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_and_fetch_16
(
short
volatile
*
ptr
,
short
val
);
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_fetch_and_64
(
__int64
volatile
*
ptr
,
__int64
val
);
char
interlocked_or_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_or_fetch_16
(
short
volatile
*
ptr
,
short
val
);
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
char
interlocked_xor_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_xor_fetch_16
(
short
volatile
*
ptr
,
short
val
);
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
__int64
interlocked_fetch_xor_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#define atomic_add_fetch_ptr atomic_add_fetch_64
#else
#define atomic_add_fetch_ptr atomic_add_fetch_32
#endif
#ifdef _TD_GO_DLL_
#ifdef _TD_GO_DLL_
#define atomic_fetch_add_8 __sync_fetch_and_ad
#define atomic_fetch_add_8 __sync_fetch_and_ad
#define atomic_fetch_add_16 __sync_fetch_and_add
#define atomic_fetch_add_16 __sync_fetch_and_add
#else
#else
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
#endif
#endif
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#define atomic_fetch_add_ptr atomic_fetch_add_64
#else
#define atomic_fetch_add_ptr atomic_fetch_add_32
#endif
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
#ifdef _WIN64
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
#else
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
#endif
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
#ifdef _WIN64
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
#else
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
#endif
#ifndef _TD_GO_DLL_
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
char
interlocked_and_fetch_8
(
char
volatile
*
ptr
,
char
val
);
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
short
interlocked_and_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#ifndef _TD_GO_DLL_
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#define atomic_and_fetch_ptr atomic_and_fetch_64
#else
#define atomic_and_fetch_ptr atomic_and_fetch_32
#endif
#ifndef _TD_GO_DLL_
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
#ifdef _M_IX86
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
__int64
interlocked_fetch_and_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
#else
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_and_64(ptr, val) _InterlockedAnd64((__int64 volatile*)(ptr), (__int64)(val))
#endif
#ifdef _WIN64
#define atomic_fetch_and_ptr atomic_fetch_and_64
#else
#define atomic_fetch_and_ptr atomic_fetch_and_32
#endif
#ifndef _TD_GO_DLL_
char
interlocked_or_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_or_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#ifndef _TD_GO_DLL_
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#define atomic_or_fetch_ptr atomic_or_fetch_64
#else
#define atomic_or_fetch_ptr atomic_or_fetch_32
#endif
#ifndef _TD_GO_DLL_
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
#ifdef _M_IX86
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
__int64
interlocked_fetch_or_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
#else
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_fetch_or_64(ptr, val) _InterlockedOr64((__int64 volatile*)(ptr), (__int64)(val))
#endif
#ifdef _WIN64
#define atomic_fetch_or_ptr atomic_fetch_or_64
#else
#define atomic_fetch_or_ptr atomic_fetch_or_32
#endif
#ifndef _TD_GO_DLL_
char
interlocked_xor_fetch_8
(
char
volatile
*
ptr
,
char
val
);
short
interlocked_xor_fetch_16
(
short
volatile
*
ptr
,
short
val
);
#endif
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
);
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#ifndef _TD_GO_DLL_
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _WIN64
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
#else
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
#endif
#ifndef _TD_GO_DLL_
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
#endif
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
#ifdef _M_IX86
__int64
interlocked_fetch_xor_64
(
__int64
volatile
*
ptr
,
__int64
val
);
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
#else
#define atomic_fetch_xor_64(ptr, val) _InterlockedXor64((__int64 volatile*)(ptr), (__int64)(val))
#endif
#ifdef _WIN64
#ifdef _WIN64
#define atomic_add_fetch_ptr atomic_add_fetch_64
#define atomic_fetch_add_ptr atomic_fetch_add_64
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
#define atomic_and_fetch_ptr atomic_and_fetch_64
#define atomic_fetch_and_ptr atomic_fetch_and_64
#define atomic_or_fetch_ptr atomic_or_fetch_64
#define atomic_fetch_or_ptr atomic_fetch_or_64
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
#else
#else
#define atomic_add_fetch_ptr atomic_add_fetch_32
#define atomic_fetch_add_ptr atomic_fetch_add_32
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
#define atomic_and_fetch_ptr atomic_and_fetch_32
#define atomic_fetch_and_ptr atomic_fetch_and_32
#define atomic_or_fetch_ptr atomic_or_fetch_32
#define atomic_fetch_or_ptr atomic_fetch_or_32
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/os/src/windows/w64Atomic.c
浏览文件 @
e53ebe94
...
@@ -23,19 +23,19 @@
...
@@ -23,19 +23,19 @@
// add
// add
char
interlocked_add_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
char
interlocked_add_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
#ifdef _TD_GO_DLL_
#ifdef _TD_GO_DLL_
return
__sync_fetch_and_add
(
ptr
,
val
)
+
val
;
return
__sync_fetch_and_add
(
ptr
,
val
)
+
val
;
#else
#else
return
_InterlockedExchangeAdd8
(
ptr
,
val
)
+
val
;
return
_InterlockedExchangeAdd8
(
ptr
,
val
)
+
val
;
#endif
#endif
}
}
short
interlocked_add_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
short
interlocked_add_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
#ifdef _TD_GO_DLL_
#ifdef _TD_GO_DLL_
return
__sync_fetch_and_add
(
ptr
,
val
)
+
val
;
return
__sync_fetch_and_add
(
ptr
,
val
)
+
val
;
#else
#else
return
_InterlockedExchangeAdd16
(
ptr
,
val
)
+
val
;
return
_InterlockedExchangeAdd16
(
ptr
,
val
)
+
val
;
#endif
#endif
}
}
long
interlocked_add_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
long
interlocked_add_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
...
@@ -43,15 +43,13 @@ long interlocked_add_fetch_32(long volatile* ptr, long val) {
...
@@ -43,15 +43,13 @@ long interlocked_add_fetch_32(long volatile* ptr, long val) {
}
}
__int64
interlocked_add_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_add_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _WIN64
//
#ifdef _WIN64
return
_InterlockedExchangeAdd64
(
ptr
,
val
)
+
val
;
return
_InterlockedExchangeAdd64
(
ptr
,
val
)
+
val
;
#else
//
#else
return
_InterlockedExchangeAdd
(
ptr
,
val
)
+
val
;
//
return _InterlockedExchangeAdd(ptr, val) + val;
#endif
//
#endif
}
}
// and
#ifndef _TD_GO_DLL_
char
interlocked_and_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
char
interlocked_and_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
return
_InterlockedAnd8
(
ptr
,
val
)
&
val
;
return
_InterlockedAnd8
(
ptr
,
val
)
&
val
;
}
}
...
@@ -59,41 +57,37 @@ char interlocked_and_fetch_8(char volatile* ptr, char val) {
...
@@ -59,41 +57,37 @@ char interlocked_and_fetch_8(char volatile* ptr, char val) {
short
interlocked_and_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
short
interlocked_and_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
return
_InterlockedAnd16
(
ptr
,
val
)
&
val
;
return
_InterlockedAnd16
(
ptr
,
val
)
&
val
;
}
}
#endif
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
long
interlocked_and_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
return
_InterlockedAnd
(
ptr
,
val
)
&
val
;
return
_InterlockedAnd
(
ptr
,
val
)
&
val
;
}
}
#ifndef _M_IX86
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifndef _M_IX86
return
_InterlockedAnd64
(
ptr
,
val
)
&
val
;
return
_InterlockedAnd64
(
ptr
,
val
)
&
val
;
}
#else
#else
__int64
interlocked_and_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
old
,
res
;
__int64
old
,
res
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
res
=
old
&
val
;
res
=
old
&
val
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
return
res
;
return
res
;
#endif
}
}
__int64
interlocked_fetch_and_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_fetch_and_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _M_IX86
__int64
old
;
__int64
old
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
&
val
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
&
val
,
old
)
!=
old
);
return
old
;
return
old
;
}
#else
return
_InterlockedAnd64
((
__int64
volatile
*
)(
ptr
),
(
__int64
)(
val
));
#endif
#endif
}
// or
#ifndef _TD_GO_DLL_
char
interlocked_or_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
char
interlocked_or_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
return
_InterlockedOr8
(
ptr
,
val
)
|
val
;
return
_InterlockedOr8
(
ptr
,
val
)
|
val
;
}
}
...
@@ -101,40 +95,36 @@ char interlocked_or_fetch_8(char volatile* ptr, char val) {
...
@@ -101,40 +95,36 @@ char interlocked_or_fetch_8(char volatile* ptr, char val) {
short
interlocked_or_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
short
interlocked_or_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
return
_InterlockedOr16
(
ptr
,
val
)
|
val
;
return
_InterlockedOr16
(
ptr
,
val
)
|
val
;
}
}
#endif
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
long
interlocked_or_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
return
_InterlockedOr
(
ptr
,
val
)
|
val
;
return
_InterlockedOr
(
ptr
,
val
)
|
val
;
}
}
#ifndef _M_IX86
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
return
_InterlockedOr64
(
ptr
,
val
)
&
val
;
}
#else
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_or_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _M_IX86
__int64
old
,
res
;
__int64
old
,
res
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
res
=
old
|
val
;
res
=
old
|
val
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
return
res
;
return
res
;
#else
return
_InterlockedOr64
(
ptr
,
val
)
&
val
;
#endif
}
}
__int64
interlocked_fetch_or_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_fetch_or_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _M_IX86
__int64
old
;
__int64
old
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
|
val
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
|
val
,
old
)
!=
old
);
return
old
;
return
old
;
}
#else
return
_InterlockedOr64
((
__int64
volatile
*
)(
ptr
),
(
__int64
)(
val
));
#endif
#endif
}
// xor
#ifndef _TD_GO_DLL_
char
interlocked_xor_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
char
interlocked_xor_fetch_8
(
char
volatile
*
ptr
,
char
val
)
{
return
_InterlockedXor8
(
ptr
,
val
)
^
val
;
return
_InterlockedXor8
(
ptr
,
val
)
^
val
;
}
}
...
@@ -142,35 +132,33 @@ char interlocked_xor_fetch_8(char volatile* ptr, char val) {
...
@@ -142,35 +132,33 @@ char interlocked_xor_fetch_8(char volatile* ptr, char val) {
short
interlocked_xor_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
short
interlocked_xor_fetch_16
(
short
volatile
*
ptr
,
short
val
)
{
return
_InterlockedXor16
(
ptr
,
val
)
^
val
;
return
_InterlockedXor16
(
ptr
,
val
)
^
val
;
}
}
#endif
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
long
interlocked_xor_fetch_32
(
long
volatile
*
ptr
,
long
val
)
{
return
_InterlockedXor
(
ptr
,
val
)
^
val
;
return
_InterlockedXor
(
ptr
,
val
)
^
val
;
}
}
#ifndef _M_IX86
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
return
_InterlockedXor64
(
ptr
,
val
)
^
val
;
}
#else
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_xor_fetch_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _M_IX86
__int64
old
,
res
;
__int64
old
,
res
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
res
=
old
^
val
;
res
=
old
^
val
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
res
,
old
)
!=
old
);
return
res
;
return
res
;
#else
return
_InterlockedXor64
(
ptr
,
val
)
^
val
;
#endif
}
}
__int64
interlocked_fetch_xor_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
__int64
interlocked_fetch_xor_64
(
__int64
volatile
*
ptr
,
__int64
val
)
{
#ifdef _M_IX86
__int64
old
;
__int64
old
;
do
{
do
{
old
=
*
ptr
;
old
=
*
ptr
;
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
^
val
,
old
)
!=
old
);
}
while
(
_InterlockedCompareExchange64
(
ptr
,
old
^
val
,
old
)
!=
old
);
return
old
;
return
old
;
}
#else
return
_InterlockedXor64
((
__int64
volatile
*
)(
ptr
),
(
__int64
)(
val
));
#endif
#endif
}
src/os/src/windows/w64Sysinfo.c
浏览文件 @
e53ebe94
...
@@ -154,13 +154,15 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
...
@@ -154,13 +154,15 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
bool
taosGetProcMemory
(
float
*
memoryUsedMB
)
{
bool
taosGetProcMemory
(
float
*
memoryUsedMB
)
{
unsigned
bytes_used
=
0
;
unsigned
bytes_used
=
0
;
#if 0
#if defined(_WIN32) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
PROCESS_MEMORY_COUNTERS
pmc
;
PROCESS_MEMORY_COUNTERS pmc;
HANDLE
cur_proc
=
GetCurrentProcess
();
HANDLE cur_proc = GetCurrentProcess();
if
(
GetProcessMemoryInfo
(
cur_proc
,
&
pmc
,
sizeof
(
pmc
)))
{
if (GetProcessMemoryInfo(cur_proc, &pmc, sizeof(pmc))) {
bytes_used
=
(
unsigned
)(
pmc
.
WorkingSetSize
+
pmc
.
PagefileUsage
);
bytes_used = (unsigned)(pmc.WorkingSetSize + pmc.PagefileUsage);
}
}
#endif
#endif
#endif
*
memoryUsedMB
=
(
float
)
bytes_used
/
1024
/
1024
;
*
memoryUsedMB
=
(
float
)
bytes_used
/
1024
/
1024
;
...
...
src/query/src/qExecutor.c
浏览文件 @
e53ebe94
...
@@ -410,7 +410,7 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
...
@@ -410,7 +410,7 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
newCap
=
(
int64_t
)(
pWindowResInfo
->
capacity
*
1
.
5
);
newCap
=
(
int64_t
)(
pWindowResInfo
->
capacity
*
1
.
5
);
}
}
char
*
t
=
realloc
(
pWindowResInfo
->
pResult
,
newCap
*
sizeof
(
SWindowResult
));
char
*
t
=
realloc
(
pWindowResInfo
->
pResult
,
(
size_t
)(
newCap
*
sizeof
(
SWindowResult
)
));
pRuntimeEnv
->
summary
.
internalSupSize
+=
(
newCap
-
pWindowResInfo
->
capacity
)
*
sizeof
(
SWindowResult
);
pRuntimeEnv
->
summary
.
internalSupSize
+=
(
newCap
-
pWindowResInfo
->
capacity
)
*
sizeof
(
SWindowResult
);
if
(
t
==
NULL
)
{
if
(
t
==
NULL
)
{
...
@@ -2257,7 +2257,7 @@ static void ensureOutputBuffer(SQueryRuntimeEnv* pRuntimeEnv, SDataBlockInfo* pB
...
@@ -2257,7 +2257,7 @@ static void ensureOutputBuffer(SQueryRuntimeEnv* pRuntimeEnv, SDataBlockInfo* pB
if
(
tmp
==
NULL
)
{
// todo handle the oom
if
(
tmp
==
NULL
)
{
// todo handle the oom
assert
(
0
);
assert
(
0
);
}
else
{
}
else
{
memset
(
tmp
+
sizeof
(
tFilePage
)
+
bytes
*
pRec
->
rows
,
0
,
(
newSize
-
pRec
->
rows
)
*
bytes
);
memset
(
tmp
+
sizeof
(
tFilePage
)
+
bytes
*
pRec
->
rows
,
0
,
(
size_t
)((
newSize
-
pRec
->
rows
)
*
bytes
)
);
pQuery
->
sdata
[
i
]
=
(
tFilePage
*
)
tmp
;
pQuery
->
sdata
[
i
]
=
(
tFilePage
*
)
tmp
;
}
}
...
@@ -2725,7 +2725,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
...
@@ -2725,7 +2725,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
char
*
pDest
=
pQuery
->
sdata
[
i
]
->
data
;
char
*
pDest
=
pQuery
->
sdata
[
i
]
->
data
;
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
,
(
size_t
)(
bytes
*
pData
->
num
)
);
}
}
offset
+=
(
int32_t
)
pData
->
num
;
offset
+=
(
int32_t
)
pData
->
num
;
...
@@ -2946,7 +2946,7 @@ int32_t flushFromResultBuf(SQInfo *pQInfo) {
...
@@ -2946,7 +2946,7 @@ int32_t flushFromResultBuf(SQInfo *pQInfo) {
buf
->
num
=
r
;
buf
->
num
=
r
;
memcpy
(
buf
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
buf
->
num
,
((
char
*
)
pQuery
->
sdata
[
i
]
->
data
)
+
offset
*
bytes
,
memcpy
(
buf
->
data
+
pRuntimeEnv
->
offset
[
i
]
*
buf
->
num
,
((
char
*
)
pQuery
->
sdata
[
i
]
->
data
)
+
offset
*
bytes
,
buf
->
num
*
bytes
);
(
size_t
)(
buf
->
num
*
bytes
)
);
}
}
offset
+=
r
;
offset
+=
r
;
...
@@ -3119,7 +3119,7 @@ void resetCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -3119,7 +3119,7 @@ void resetCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv) {
pCtx
->
ptsOutputBuf
=
pRuntimeEnv
->
pCtx
[
0
].
aOutputBuf
;
pCtx
->
ptsOutputBuf
=
pRuntimeEnv
->
pCtx
[
0
].
aOutputBuf
;
}
}
memset
(
pQuery
->
sdata
[
i
]
->
data
,
0
,
(
size_t
)
pQuery
->
pSelectExpr
[
i
].
bytes
*
pQuery
->
rec
.
capacity
);
memset
(
pQuery
->
sdata
[
i
]
->
data
,
0
,
(
size_t
)
(
pQuery
->
pSelectExpr
[
i
].
bytes
*
pQuery
->
rec
.
capacity
)
);
}
}
initCtxOutputBuf
(
pRuntimeEnv
);
initCtxOutputBuf
(
pRuntimeEnv
);
...
@@ -3198,7 +3198,7 @@ void skipResults(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -3198,7 +3198,7 @@ void skipResults(SQueryRuntimeEnv *pRuntimeEnv) {
int32_t
functionId
=
pQuery
->
pSelectExpr
[
i
].
base
.
functionId
;
int32_t
functionId
=
pQuery
->
pSelectExpr
[
i
].
base
.
functionId
;
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
int32_t
bytes
=
pRuntimeEnv
->
pCtx
[
i
].
outputBytes
;
memmove
(
pQuery
->
sdata
[
i
]
->
data
,
(
char
*
)
pQuery
->
sdata
[
i
]
->
data
+
bytes
*
numOfSkip
,
pQuery
->
rec
.
rows
*
bytes
);
memmove
(
pQuery
->
sdata
[
i
]
->
data
,
(
char
*
)
pQuery
->
sdata
[
i
]
->
data
+
bytes
*
numOfSkip
,
(
size_t
)(
pQuery
->
rec
.
rows
*
bytes
)
);
pRuntimeEnv
->
pCtx
[
i
].
aOutputBuf
=
((
char
*
)
pQuery
->
sdata
[
i
]
->
data
)
+
pQuery
->
rec
.
rows
*
bytes
;
pRuntimeEnv
->
pCtx
[
i
].
aOutputBuf
=
((
char
*
)
pQuery
->
sdata
[
i
]
->
data
)
+
pQuery
->
rec
.
rows
*
bytes
;
if
(
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
if
(
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
...
@@ -5384,8 +5384,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
...
@@ -5384,8 +5384,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
if
(
pColFilter
->
filterstr
)
{
if
(
pColFilter
->
filterstr
)
{
pColFilter
->
len
=
htobe64
(
pFilterMsg
->
len
);
pColFilter
->
len
=
htobe64
(
pFilterMsg
->
len
);
pColFilter
->
pz
=
(
int64_t
)
calloc
(
1
,
pColFilter
->
len
+
1
*
TSDB_NCHAR_SIZE
);
// note: null-terminator
pColFilter
->
pz
=
(
int64_t
)
calloc
(
1
,
(
size_t
)(
pColFilter
->
len
+
1
*
TSDB_NCHAR_SIZE
)
);
// note: null-terminator
memcpy
((
void
*
)
pColFilter
->
pz
,
pMsg
,
pColFilter
->
len
);
memcpy
((
void
*
)
pColFilter
->
pz
,
pMsg
,
(
size_t
)
pColFilter
->
len
);
pMsg
+=
(
pColFilter
->
len
+
1
);
pMsg
+=
(
pColFilter
->
len
+
1
);
}
else
{
}
else
{
pColFilter
->
lowerBndi
=
htobe64
(
pFilterMsg
->
lowerBndi
);
pColFilter
->
lowerBndi
=
htobe64
(
pFilterMsg
->
lowerBndi
);
...
@@ -5889,7 +5889,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
...
@@ -5889,7 +5889,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
assert
(
pExprs
[
col
].
interBytes
>=
pExprs
[
col
].
bytes
);
assert
(
pExprs
[
col
].
interBytes
>=
pExprs
[
col
].
bytes
);
// allocate additional memory for interResults that are usually larger then final results
// allocate additional memory for interResults that are usually larger then final results
size_t
size
=
(
pQuery
->
rec
.
capacity
+
1
)
*
pExprs
[
col
].
bytes
+
pExprs
[
col
].
interBytes
+
sizeof
(
tFilePage
);
size_t
size
=
(
size_t
)((
pQuery
->
rec
.
capacity
+
1
)
*
pExprs
[
col
].
bytes
+
pExprs
[
col
].
interBytes
+
sizeof
(
tFilePage
)
);
pQuery
->
sdata
[
col
]
=
(
tFilePage
*
)
calloc
(
1
,
size
);
pQuery
->
sdata
[
col
]
=
(
tFilePage
*
)
calloc
(
1
,
size
);
if
(
pQuery
->
sdata
[
col
]
==
NULL
)
{
if
(
pQuery
->
sdata
[
col
]
==
NULL
)
{
goto
_cleanup
;
goto
_cleanup
;
...
@@ -6162,7 +6162,7 @@ static size_t getResultSize(SQInfo *pQInfo, int64_t *numOfRows) {
...
@@ -6162,7 +6162,7 @@ static size_t getResultSize(SQInfo *pQInfo, int64_t *numOfRows) {
return
0
;
return
0
;
}
}
}
else
{
}
else
{
return
pQuery
->
rowSize
*
(
*
numOfRows
);
return
(
size_t
)(
pQuery
->
rowSize
*
(
*
numOfRows
)
);
}
}
}
}
...
...
src/query/src/qExtbuffer.c
浏览文件 @
e53ebe94
...
@@ -990,7 +990,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
...
@@ -990,7 +990,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
SSchemaEx
*
pSchemaEx
=
&
pModel
->
pFields
[
i
];
SSchemaEx
*
pSchemaEx
=
&
pModel
->
pFields
[
i
];
memmove
(
inputBuffer
->
data
+
pSchemaEx
->
offset
*
inputBuffer
->
num
,
memmove
(
inputBuffer
->
data
+
pSchemaEx
->
offset
*
inputBuffer
->
num
,
inputBuffer
->
data
+
pSchemaEx
->
offset
*
maxElemsCapacity
,
inputBuffer
->
data
+
pSchemaEx
->
offset
*
maxElemsCapacity
,
pSchemaEx
->
field
.
bytes
*
inputBuffer
->
num
);
(
size_t
)(
pSchemaEx
->
field
.
bytes
*
inputBuffer
->
num
)
);
}
}
}
}
...
...
src/query/src/qFill.c
浏览文件 @
e53ebe94
...
@@ -153,7 +153,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu
...
@@ -153,7 +153,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
char
*
data
=
pInput
->
data
+
pCol
->
col
.
offset
*
pInput
->
num
;
char
*
data
=
pInput
->
data
+
pCol
->
col
.
offset
*
pInput
->
num
;
memcpy
(
pFillInfo
->
pData
[
i
],
data
,
pInput
->
num
*
pCol
->
col
.
bytes
);
memcpy
(
pFillInfo
->
pData
[
i
],
data
,
(
size_t
)(
pInput
->
num
*
pCol
->
col
.
bytes
)
);
if
(
pCol
->
flag
==
TSDB_COL_TAG
)
{
// copy the tag value to tag value buffer
if
(
pCol
->
flag
==
TSDB_COL_TAG
)
{
// copy the tag value to tag value buffer
for
(
int32_t
j
=
0
;
j
<
pFillInfo
->
numOfTags
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pFillInfo
->
numOfTags
;
++
j
)
{
...
...
src/query/src/qResultbuf.c
浏览文件 @
e53ebe94
...
@@ -381,7 +381,7 @@ size_t getNumOfRowsPerPage(const SDiskbasedResultBuf* pResultBuf) { return pResu
...
@@ -381,7 +381,7 @@ size_t getNumOfRowsPerPage(const SDiskbasedResultBuf* pResultBuf) { return pResu
size_t
getNumOfResultBufGroupId
(
const
SDiskbasedResultBuf
*
pResultBuf
)
{
return
taosHashGetSize
(
pResultBuf
->
groupSet
);
}
size_t
getNumOfResultBufGroupId
(
const
SDiskbasedResultBuf
*
pResultBuf
)
{
return
taosHashGetSize
(
pResultBuf
->
groupSet
);
}
size_t
getResBufSize
(
const
SDiskbasedResultBuf
*
pResultBuf
)
{
return
pResultBuf
->
totalBufSize
;
}
size_t
getResBufSize
(
const
SDiskbasedResultBuf
*
pResultBuf
)
{
return
(
size_t
)
pResultBuf
->
totalBufSize
;
}
SIDList
getDataBufPagesIdList
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
SIDList
getDataBufPagesIdList
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
assert
(
pResultBuf
!=
NULL
);
assert
(
pResultBuf
!=
NULL
);
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
e53ebe94
...
@@ -908,7 +908,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
...
@@ -908,7 +908,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
// Add the sub-block
// Add the sub-block
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
size_t
tsize
=
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
);
size_t
tsize
=
(
size_t
)(
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
)
);
if
(
tsize
>
0
)
{
if
(
tsize
>
0
)
{
memmove
((
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
+
pSCompBlock
->
len
+
sizeof
(
SCompBlock
)),
memmove
((
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
+
pSCompBlock
->
len
+
sizeof
(
SCompBlock
)),
(
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
(
void
*
)((
char
*
)(
pHelper
->
pCompInfo
)
+
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
...
@@ -988,7 +988,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
...
@@ -988,7 +988,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
// Delete the sub blocks it has
// Delete the sub blocks it has
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
if
(
pSCompBlock
->
numOfSubBlocks
>
1
)
{
size_t
tsize
=
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
);
size_t
tsize
=
(
size_t
)(
pIdx
->
len
-
(
pSCompBlock
->
offset
+
pSCompBlock
->
len
)
);
if
(
tsize
>
0
)
{
if
(
tsize
>
0
)
{
memmove
(
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
),
memmove
(
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
),
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
POINTER_SHIFT
(
pHelper
->
pCompInfo
,
pSCompBlock
->
offset
+
pSCompBlock
->
len
),
tsize
);
...
...
src/util/inc/tcoding.h
浏览文件 @
e53ebe94
...
@@ -355,9 +355,9 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
...
@@ -355,9 +355,9 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
uint64_t
size
=
0
;
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
*
value
=
(
char
*
)
malloc
(
size
+
1
);
*
value
=
(
char
*
)
malloc
(
(
size_t
)
size
+
1
);
if
(
*
value
==
NULL
)
return
NULL
;
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
size
);
memcpy
(
*
value
,
buf
,
(
size_t
)
size
);
(
*
value
)[
size
]
=
'\0'
;
(
*
value
)[
size
]
=
'\0'
;
...
...
src/util/src/tkvstore.c
浏览文件 @
e53ebe94
...
@@ -575,7 +575,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
...
@@ -575,7 +575,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
}
}
}
}
buf
=
malloc
(
maxBufSize
);
buf
=
malloc
(
(
size_t
)
maxBufSize
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
uError
(
"failed to allocate %"
PRId64
" bytes in KV store %s"
,
maxBufSize
,
pStore
->
fname
);
uError
(
"failed to allocate %"
PRId64
" bytes in KV store %s"
,
maxBufSize
,
pStore
->
fname
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
@@ -598,7 +598,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
...
@@ -598,7 +598,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
goto
_err
;
goto
_err
;
}
}
if
(
taosTRead
(
pStore
->
fd
,
buf
,
pRecord
->
size
)
<
pRecord
->
size
)
{
if
(
taosTRead
(
pStore
->
fd
,
buf
,
(
size_t
)
pRecord
->
size
)
<
pRecord
->
size
)
{
uError
(
"failed to read %"
PRId64
" bytes from file %s since %s, offset %"
PRId64
,
pRecord
->
size
,
pStore
->
fname
,
uError
(
"failed to read %"
PRId64
" bytes from file %s since %s, offset %"
PRId64
,
pRecord
->
size
,
pStore
->
fname
,
strerror
(
errno
),
pRecord
->
offset
);
strerror
(
errno
),
pRecord
->
offset
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录