Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
73e0e84b
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看板
提交
73e0e84b
编写于
8月 04, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1037 compilation of common module
上级
3c6ecff5
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
56 addition
and
38 deletion
+56
-38
src/common/CMakeLists.txt
src/common/CMakeLists.txt
+6
-0
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+4
-4
src/common/src/tglobal.c
src/common/src/tglobal.c
+13
-13
src/common/src/tname.c
src/common/src/tname.c
+4
-4
src/common/src/ttypes.c
src/common/src/ttypes.c
+2
-2
src/common/src/tvariant.c
src/common/src/tvariant.c
+10
-10
src/os/inc/osFile.h
src/os/inc/osFile.h
+4
-0
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+4
-1
src/os/src/windows/w64File.c
src/os/src/windows/w64File.c
+5
-0
src/os/src/windows/w64String.c
src/os/src/windows/w64String.c
+2
-2
src/util/inc/tstoken.h
src/util/inc/tstoken.h
+1
-1
src/util/src/tkvstore.c
src/util/src/tkvstore.c
+1
-1
未找到文件。
src/common/CMakeLists.txt
浏览文件 @
73e0e84b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
(
TD_WINDOWS
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/pthread
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/iconv
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/regex
)
ENDIF
()
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
...
...
src/common/src/tdataformat.c
浏览文件 @
73e0e84b
...
...
@@ -565,7 +565,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
nrow
=
malloc
(
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
if
(
nrow
==
NULL
)
return
-
1
;
kvRowSetLen
(
nrow
,
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
kvRowSetLen
(
nrow
,
kvRowLen
(
row
)
+
(
int16_t
)
sizeof
(
SColIdx
)
+
diff
);
kvRowSetNCols
(
nrow
,
kvRowNCols
(
row
)
+
1
);
if
(
ptr
==
NULL
)
{
...
...
@@ -573,10 +573,10 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
memcpy
(
kvRowValues
(
nrow
),
kvRowValues
(
row
),
POINTER_DISTANCE
(
kvRowEnd
(
row
),
kvRowValues
(
row
)));
int
colIdx
=
kvRowNCols
(
nrow
)
-
1
;
kvRowColIdxAt
(
nrow
,
colIdx
)
->
colId
=
colId
;
kvRowColIdxAt
(
nrow
,
colIdx
)
->
offset
=
POINTER_DISTANCE
(
kvRowEnd
(
row
),
kvRowValues
(
row
));
kvRowColIdxAt
(
nrow
,
colIdx
)
->
offset
=
(
int16_t
)(
POINTER_DISTANCE
(
kvRowEnd
(
row
),
kvRowValues
(
row
)
));
memcpy
(
kvRowColVal
(
nrow
,
kvRowColIdxAt
(
nrow
,
colIdx
)),
value
,
diff
);
}
else
{
int16_t
tlen
=
POINTER_DISTANCE
(
ptr
,
kvRowColIdx
(
row
));
int16_t
tlen
=
(
int16_t
)(
POINTER_DISTANCE
(
ptr
,
kvRowColIdx
(
row
)
));
if
(
tlen
>
0
)
{
memcpy
(
kvRowColIdx
(
nrow
),
kvRowColIdx
(
row
),
tlen
);
memcpy
(
kvRowValues
(
nrow
),
kvRowValues
(
row
),
((
SColIdx
*
)
ptr
)
->
offset
);
...
...
@@ -617,7 +617,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
kvRowSetNCols
(
nrow
,
kvRowNCols
(
row
));
// Copy part ahead
nlen
=
POINTER_DISTANCE
(
ptr
,
kvRowColIdx
(
row
));
nlen
=
(
int16_t
)(
POINTER_DISTANCE
(
ptr
,
kvRowColIdx
(
row
)
));
ASSERT
(
nlen
%
sizeof
(
SColIdx
)
==
0
);
if
(
nlen
>
0
)
{
ASSERT
(((
SColIdx
*
)
ptr
)
->
offset
>
0
);
...
...
src/common/src/tglobal.c
浏览文件 @
73e0e84b
...
...
@@ -92,7 +92,7 @@ int32_t tsStreamCompStartDelay = 10000;
int32_t
tsStreamCompRetryDelay
=
10
;
// The delayed computing ration. 10% of the whole computing time window by default.
float
tsStreamComputDelayRatio
=
0
.
1
;
float
tsStreamComputDelayRatio
=
0
.
1
f
;
int32_t
tsProjectExecInterval
=
10000
;
// every 10sec, the projection will be executed once
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
...
...
@@ -173,8 +173,8 @@ float tsTotalTmpDirGB = 0;
float
tsTotalDataDirGB
=
0
;
float
tsAvailTmpDirectorySpace
=
0
;
float
tsAvailDataDirGB
=
0
;
float
tsReservedTmpDirectorySpace
=
0
.
1
;
float
tsMinimalDataDirGB
=
0
.
5
;
float
tsReservedTmpDirectorySpace
=
0
.
1
f
;
float
tsMinimalDataDirGB
=
0
.
5
f
;
int32_t
tsTotalMemoryMB
=
0
;
int32_t
tsVersion
=
0
;
...
...
@@ -294,7 +294,7 @@ bool taosCfgDynamicOptions(char *msg) {
return
false
;
}
static
void
doInitGlobalConfig
()
{
static
void
doInitGlobalConfig
(
void
)
{
SGlobalCfg
cfg
=
{
0
};
// ip address
...
...
@@ -405,8 +405,8 @@ static void doInitGlobalConfig() {
cfg
.
ptr
=
&
tsRatioOfQueryThreads
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
.
1
;
cfg
.
maxValue
=
0
.
9
;
cfg
.
minValue
=
0
.
1
f
;
cfg
.
maxValue
=
0
.
9
f
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
@@ -607,8 +607,8 @@ static void doInitGlobalConfig() {
cfg
.
ptr
=
&
tsStreamComputDelayRatio
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
.
1
;
cfg
.
maxValue
=
0
.
9
;
cfg
.
minValue
=
0
.
1
f
;
cfg
.
maxValue
=
0
.
9
f
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
@@ -870,7 +870,7 @@ static void doInitGlobalConfig() {
cfg
.
ptr
=
&
tsMinimalLogDirGB
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
.
001
;
cfg
.
minValue
=
0
.
001
f
;
cfg
.
maxValue
=
10000000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_GB
;
...
...
@@ -880,7 +880,7 @@ static void doInitGlobalConfig() {
cfg
.
ptr
=
&
tsReservedTmpDirectorySpace
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
.
001
;
cfg
.
minValue
=
0
.
001
f
;
cfg
.
maxValue
=
10000000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_GB
;
...
...
@@ -890,7 +890,7 @@ static void doInitGlobalConfig() {
cfg
.
ptr
=
&
tsMinimalDataDirGB
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
.
001
;
cfg
.
minValue
=
0
.
001
f
;
cfg
.
maxValue
=
10000000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_GB
;
...
...
@@ -1256,7 +1256,7 @@ static void doInitGlobalConfig() {
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
1
;
cfg
.
maxValue
=
0x7fffffff
;
cfg
.
maxValue
=
65536
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
@@ -1338,7 +1338,7 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
*/
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeId
,
int32_t
*
dnodeId
)
{
int
len
=
strlen
(
option
);
int
len
=
(
int
)
strlen
(
option
);
if
(
strncasecmp
(
option
,
"vnode:"
,
6
)
!=
0
)
{
return
false
;
}
...
...
src/common/src/tname.c
浏览文件 @
73e0e84b
...
...
@@ -6,7 +6,7 @@
#include "ttokendef.h"
// todo refactor
__attribute__
((
unused
))
static
FORCE_INLINE
const
char
*
skipSegments
(
const
char
*
input
,
char
delim
,
int32_t
num
)
{
UNUSED_FUNC
static
FORCE_INLINE
const
char
*
skipSegments
(
const
char
*
input
,
char
delim
,
int32_t
num
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
while
(
*
input
!=
0
&&
*
input
++
!=
delim
)
{
};
...
...
@@ -14,7 +14,7 @@ __attribute__((unused)) static FORCE_INLINE const char* skipSegments(const char*
return
input
;
}
__attribute__
((
unused
))
static
FORCE_INLINE
size_t
copy
(
char
*
dst
,
const
char
*
src
,
char
delimiter
)
{
UNUSED_FUNC
static
FORCE_INLINE
size_t
copy
(
char
*
dst
,
const
char
*
src
,
char
delimiter
)
{
size_t
len
=
0
;
while
(
*
src
!=
delimiter
&&
*
src
!=
0
)
{
*
dst
++
=
*
src
++
;
...
...
@@ -120,11 +120,11 @@ void extractTableNameFromToken(SSQLToken* pToken, SSQLToken* pTable) {
char
*
r
=
strnchr
(
pToken
->
z
,
sep
,
pToken
->
n
,
false
);
if
(
r
!=
NULL
)
{
// record the table name token
pTable
->
n
=
r
-
pToken
->
z
;
pTable
->
n
=
(
uint32_t
)(
r
-
pToken
->
z
)
;
pTable
->
z
=
pToken
->
z
;
r
+=
1
;
pToken
->
n
-=
(
r
-
pToken
->
z
);
pToken
->
n
-=
(
uint32_t
)(
r
-
pToken
->
z
);
pToken
->
z
=
r
;
}
}
src/common/src/ttypes.c
浏览文件 @
73e0e84b
...
...
@@ -204,8 +204,8 @@ static void getStatics_i64(const TSKEY *primaryKey, const void *pData, int32_t n
static
void
getStatics_f
(
const
TSKEY
*
primaryKey
,
const
void
*
pData
,
int32_t
numOfRow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minIndex
,
int16_t
*
maxIndex
,
int16_t
*
numOfNull
)
{
float
*
data
=
(
float
*
)
pData
;
float
fmin
=
DBL
_MAX
;
float
fmax
=
-
DBL
_MAX
;
float
fmin
=
FLT
_MAX
;
float
fmax
=
-
FLT
_MAX
;
double
dsum
=
0
;
*
minIndex
=
0
;
*
maxIndex
=
0
;
...
...
src/common/src/tvariant.c
浏览文件 @
73e0e84b
...
...
@@ -101,19 +101,19 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
// here we get the nchar length from raw binary bits length
int32
_t
lenInwchar
=
len
/
TSDB_NCHAR_SIZE
;
size
_t
lenInwchar
=
len
/
TSDB_NCHAR_SIZE
;
pVar
->
wpz
=
calloc
(
1
,
(
lenInwchar
+
1
)
*
TSDB_NCHAR_SIZE
);
wcsncpy
(
pVar
->
wpz
,
(
wchar_t
*
)
pz
,
lenInwchar
);
pVar
->
wpz
[
lenInwchar
]
=
0
;
pVar
->
nLen
=
len
;
pVar
->
nLen
=
(
int32_t
)
len
;
break
;
}
case
TSDB_DATA_TYPE_BINARY
:
{
// todo refactor, extract a method
pVar
->
pz
=
calloc
(
len
,
sizeof
(
char
));
memcpy
(
pVar
->
pz
,
pz
,
len
);
pVar
->
nLen
=
len
;
pVar
->
nLen
=
(
int32_t
)
len
;
break
;
}
...
...
@@ -185,7 +185,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
case
TSDB_DATA_TYPE_NCHAR
:
{
dst
[
0
]
=
'\''
;
taosUcs4ToMbs
(
pVar
->
wpz
,
(
twcslen
(
pVar
->
wpz
)
+
1
)
*
TSDB_NCHAR_SIZE
,
dst
+
1
);
int32_t
len
=
strlen
(
dst
);
int32_t
len
=
(
int32_t
)
strlen
(
dst
);
dst
[
len
]
=
'\''
;
dst
[
len
+
1
]
=
0
;
return
len
+
1
;
...
...
@@ -361,11 +361,11 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
pBuf
=
realloc
(
pBuf
,
newSize
+
1
);
}
taosUcs4ToMbs
(
pVariant
->
wpz
,
newSize
,
pBuf
);
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
pBuf
);
free
(
pVariant
->
wpz
);
pBuf
[
newSize
]
=
0
;
}
else
{
taosUcs4ToMbs
(
pVariant
->
wpz
,
newSize
,
*
pDest
);
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
*
pDest
);
}
}
else
{
...
...
@@ -384,7 +384,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
*
pDest
=
pBuf
;
}
*
pDestSize
=
strlen
(
*
pDest
);
*
pDestSize
=
(
int32_t
)
strlen
(
*
pDest
);
return
0
;
}
...
...
@@ -428,7 +428,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
taosMbsToUcs4
(
pDst
,
nLen
,
*
pDest
,
(
nLen
+
1
)
*
TSDB_NCHAR_SIZE
,
&
output
);
if
(
pDestSize
!=
NULL
)
{
*
pDestSize
=
output
;
*
pDestSize
=
(
int32_t
)
output
;
}
}
...
...
@@ -682,7 +682,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
float
fv
=
(
float
)
pVariant
->
i64Key
;
SET_FLOAT_VAL_ALIGN
(
payload
,
&
fv
);
#else
*
((
float
*
)
payload
)
=
pVariant
->
i64Key
;
*
((
float
*
)
payload
)
=
(
float
)
pVariant
->
i64Key
;
#endif
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
#ifdef _TD_ARM_32_
...
...
@@ -735,7 +735,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu
double
dv
=
(
double
)(
pVariant
->
i64Key
);
SET_DOUBLE_VAL_ALIGN
(
payload
,
&
dv
);
#else
*
((
double
*
)
payload
)
=
pVariant
->
i64Key
;
*
((
double
*
)
payload
)
=
(
double
)
pVariant
->
i64Key
;
#endif
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
#ifdef _TD_ARM_32_
...
...
src/os/inc/osFile.h
浏览文件 @
73e0e84b
...
...
@@ -68,6 +68,10 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath);
#define S_ISLNK(m) 0
#endif
#ifndef TAOS_OS_FUNC_FILE_FTRUNCATE
#define taosFtruncate ftruncate
#endif
#ifdef __cplusplus
}
#endif
...
...
src/os/inc/osWindows.h
浏览文件 @
73e0e84b
...
...
@@ -67,6 +67,8 @@ extern "C" {
#define taosFSendFile(outfile, infile, offset, count) taosFSendFileImp(outfile, infile, offset, size)
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
#define TAOS_OS_FUNC_FILE_GETTMPFILEPATH
#define TAOS_OS_FUNC_FILE_FTRUNCATE
extern
int
taosFtruncate
(
int
fd
,
int64_t
length
);
#define TAOS_OS_FUNC_MATH
#define SWAP(a, b, c) \
...
...
@@ -90,6 +92,7 @@ extern "C" {
#define taosCloseSocket(fd) closesocket(fd)
#define TAOS_OS_FUNC_STRING_WCHAR
int
twcslen
(
const
wchar_t
*
wcs
);
#define TAOS_OS_FUNC_STRING_GETLINE
#define TAOS_OS_FUNC_STRING_STR2INT64
#ifdef _TD_GO_DLL_
...
...
src/os/src/windows/w64File.c
浏览文件 @
73e0e84b
...
...
@@ -79,3 +79,8 @@ ssize_t taosTSendFileImp(int dfd, int sfd, off_t *offset, size_t size) {
uError
(
"taosTSendFileImp no implemented yet"
);
return
0
;
}
int
taosFtruncate
(
int
fd
,
int64_t
length
)
{
uError
(
"taosFtruncate no implemented yet"
);
return
0
;
}
\ No newline at end of file
src/os/src/windows/w64String.c
浏览文件 @
73e0e84b
...
...
@@ -78,13 +78,13 @@ char *strndup(const char *s, size_t n) {
return
r
;
}
size_
t
twcslen
(
const
wchar_t
*
wcs
)
{
in
t
twcslen
(
const
wchar_t
*
wcs
)
{
int
*
wstr
=
(
int
*
)
wcs
;
if
(
NULL
==
wstr
)
{
return
0
;
}
size_
t
n
=
0
;
in
t
n
=
0
;
while
(
1
)
{
if
(
0
==
*
wstr
++
)
{
break
;
...
...
src/util/inc/tstoken.h
浏览文件 @
73e0e84b
...
...
@@ -82,7 +82,7 @@ static FORCE_INLINE int32_t isValidNumber(const SSQLToken* pToken) {
const
char
*
z
=
pToken
->
z
;
int32_t
type
=
TK_ILLEGAL
;
int32_t
i
=
0
;
u
int32_t
i
=
0
;
for
(;
i
<
pToken
->
n
;
++
i
)
{
switch
(
z
[
i
])
{
case
'+'
:
...
...
src/util/src/tkvstore.c
浏览文件 @
73e0e84b
...
...
@@ -114,7 +114,7 @@ SKVStore *tdOpenKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH
if
(
tdLoadKVStoreHeader
(
pStore
->
sfd
,
pStore
->
fsnap
,
&
info
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_COM_FILE_CORRUPTED
)
goto
_err
;
}
else
{
if
(
f
truncate
(
pStore
->
fd
,
info
.
size
)
<
0
)
{
if
(
taosF
truncate
(
pStore
->
fd
,
info
.
size
)
<
0
)
{
uError
(
"failed to truncate %s to %"
PRId64
" size since %s"
,
pStore
->
fname
,
info
.
size
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录