Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cdadfe42
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看板
提交
cdadfe42
编写于
12月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into enh/TD-21066
上级
66f4ee9a
28c18914
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
144 addition
and
51 deletion
+144
-51
include/os/os.h
include/os/os.h
+1
-0
include/os/osDef.h
include/os/osDef.h
+0
-6
include/os/osString.h
include/os/osString.h
+1
-1
include/os/osSystem.h
include/os/osSystem.h
+20
-0
include/util/tcoding.h
include/util/tcoding.h
+1
-0
include/util/tlog.h
include/util/tlog.h
+5
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+3
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+5
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/common/src/trow.c
source/common/src/trow.c
+1
-0
source/common/src/ttime.c
source/common/src/ttime.c
+2
-0
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+6
-1
source/dnode/mgmt/mgmt_snode/src/smWorker.c
source/dnode/mgmt/mgmt_snode/src/smWorker.c
+3
-2
source/libs/executor/src/tlinearhash.c
source/libs/executor/src/tlinearhash.c
+1
-0
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+1
-0
source/libs/sync/src/syncCommit.c
source/libs/sync/src/syncCommit.c
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+6
-6
source/libs/sync/src/syncPipeline.c
source/libs/sync/src/syncPipeline.c
+8
-8
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
+1
-1
source/libs/sync/test/syncTest.cpp
source/libs/sync/test/syncTest.cpp
+1
-1
source/libs/sync/test/sync_test_lib/inc/syncIO.h
source/libs/sync/test/sync_test_lib/inc/syncIO.h
+2
-0
source/libs/sync/test/sync_test_lib/src/syncIO.c
source/libs/sync/test/sync_test_lib/src/syncIO.c
+2
-0
source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c
source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c
+2
-2
source/libs/tdb/test/tdbExOVFLTest.cpp
source/libs/tdb/test/tdbExOVFLTest.cpp
+1
-0
source/libs/tdb/test/tdbTest.cpp
source/libs/tdb/test/tdbTest.cpp
+1
-0
source/os/src/osDir.c
source/os/src/osDir.c
+4
-4
source/os/src/osFile.c
source/os/src/osFile.c
+3
-3
source/os/src/osMemory.c
source/os/src/osMemory.c
+1
-1
source/os/src/osString.c
source/os/src/osString.c
+4
-2
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+3
-3
source/util/src/talgo.c
source/util/src/talgo.c
+1
-0
source/util/src/tjson.c
source/util/src/tjson.c
+12
-6
source/util/src/tlog.c
source/util/src/tlog.c
+35
-0
source/util/test/hashTest.cpp
source/util/test/hashTest.cpp
+1
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+1
-0
未找到文件。
include/os/os.h
浏览文件 @
cdadfe42
...
@@ -27,6 +27,7 @@ extern "C" {
...
@@ -27,6 +27,7 @@ extern "C" {
#if !defined(WINDOWS)
#if !defined(WINDOWS)
#include <dirent.h>
#include <dirent.h>
#include <execinfo.h>
#include <libgen.h>
#include <libgen.h>
#include <sched.h>
#include <sched.h>
#include <unistd.h>
#include <unistd.h>
...
...
include/os/osDef.h
浏览文件 @
cdadfe42
...
@@ -120,12 +120,6 @@ void syslog(int unused, const char *format, ...);
...
@@ -120,12 +120,6 @@ void syslog(int unused, const char *format, ...);
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
#ifndef NDEBUG
#define ASSERT(x) assert(x)
#else
#define ASSERT(x)
#endif
#ifndef UNUSED
#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#define UNUSED(x) ((void)(x))
#endif
#endif
...
...
include/os/osString.h
浏览文件 @
cdadfe42
...
@@ -62,7 +62,7 @@ typedef int32_t TdUcs4;
...
@@ -62,7 +62,7 @@ typedef int32_t TdUcs4;
int32_t
taosUcs4len
(
TdUcs4
*
ucs4
);
int32_t
taosUcs4len
(
TdUcs4
*
ucs4
);
int64_t
taosStr2int64
(
const
char
*
str
);
int64_t
taosStr2int64
(
const
char
*
str
);
void
taosConvInit
(
void
);
int32_t
taosConvInit
(
void
);
void
taosConvDestroy
();
void
taosConvDestroy
();
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbs_len
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
);
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbs_len
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
);
...
...
include/os/osSystem.h
浏览文件 @
cdadfe42
...
@@ -46,6 +46,26 @@ void taosSetTerminalMode();
...
@@ -46,6 +46,26 @@ void taosSetTerminalMode();
int32_t
taosGetOldTerminalMode
();
int32_t
taosGetOldTerminalMode
();
void
taosResetTerminalMode
();
void
taosResetTerminalMode
();
#if !defined(WINDOWS)
#define taosPrintTrace(flags, level, dflag) \
{ \
void* array[100]; \
int32_t size = backtrace(array, 100); \
char** strings = backtrace_symbols(array, size); \
if (strings != NULL) { \
taosPrintLog(flags, level, dflag, "obtained %d stack frames", size); \
for (int32_t i = 0; i < size; i++) { \
taosPrintLog(flags, level, dflag, "frame:%d, %s", i, strings[i]); \
} \
} \
\
taosMemoryFree(strings); \
}
#else
#define taosPrintTrace(flags, level, dflag) \
{}
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/util/tcoding.h
浏览文件 @
cdadfe42
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define _TD_UTIL_CODING_H_
#define _TD_UTIL_CODING_H_
#include "os.h"
#include "os.h"
#include "tlog.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
include/util/tlog.h
浏览文件 @
cdadfe42
...
@@ -38,6 +38,7 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content);
...
@@ -38,6 +38,7 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content);
extern
bool
tsLogEmbedded
;
extern
bool
tsLogEmbedded
;
extern
bool
tsAsyncLog
;
extern
bool
tsAsyncLog
;
extern
bool
tsAssert
;
extern
int32_t
tsNumOfLogLines
;
extern
int32_t
tsNumOfLogLines
;
extern
int32_t
tsLogKeepDays
;
extern
int32_t
tsLogKeepDays
;
extern
LogFp
tsLogFp
;
extern
LogFp
tsLogFp
;
...
@@ -82,6 +83,10 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
...
@@ -82,6 +83,10 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
#endif
#endif
;
;
bool
taosAssertLog
(
bool
condition
,
const
char
*
file
,
int32_t
line
,
const
char
*
format
,
...);
#define ASSERTS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__)
#define ASSERT(condition) ASSERTS(condition, "assert info not provided")
// clang-format off
// clang-format off
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
...
...
source/client/src/clientEnv.c
浏览文件 @
cdadfe42
...
@@ -407,7 +407,9 @@ void taos_init_imp(void) {
...
@@ -407,7 +407,9 @@ void taos_init_imp(void) {
initQueryModuleMsgHandle
();
initQueryModuleMsgHandle
();
taosConvInit
();
if
(
taosConvInit
()
!=
0
)
{
ASSERTS
(
0
,
"failed to init conv"
);
}
rpcInit
();
rpcInit
();
...
...
source/common/src/tglobal.c
浏览文件 @
cdadfe42
...
@@ -333,6 +333,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
...
@@ -333,6 +333,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
tsTimezoneStr
)
!=
0
)
return
-
1
;
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
tsTimezoneStr
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pCfg
,
"locale"
,
tsLocale
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pCfg
,
"locale"
,
tsLocale
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pCfg
,
"charset"
,
tsCharset
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pCfg
,
"charset"
,
tsCharset
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"assert"
,
1
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"enableCoreFile"
,
1
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"enableCoreFile"
,
1
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"numOfCores"
,
tsNumOfCores
,
1
,
100000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"numOfCores"
,
tsNumOfCores
,
1
,
100000
,
1
)
!=
0
)
return
-
1
;
...
@@ -693,6 +694,8 @@ static void taosSetSystemCfg(SConfig *pCfg) {
...
@@ -693,6 +694,8 @@ static void taosSetSystemCfg(SConfig *pCfg) {
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetCoreDump
(
enableCore
);
taosSetCoreDump
(
enableCore
);
tsAssert
=
cfgGetItem
(
pCfg
,
"assert"
)
->
bval
;
// todo
// todo
tsVersion
=
30000000
;
tsVersion
=
30000000
;
}
}
...
@@ -788,6 +791,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
...
@@ -788,6 +791,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
case
'a'
:
{
case
'a'
:
{
if
(
strcasecmp
(
"asyncLog"
,
name
)
==
0
)
{
if
(
strcasecmp
(
"asyncLog"
,
name
)
==
0
)
{
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
}
else
if
(
strcasecmp
(
"assert"
,
name
)
==
0
)
{
tsAssert
=
cfgGetItem
(
pCfg
,
"assert"
)
->
bval
;
}
}
break
;
break
;
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
cdadfe42
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#undef TD_MSG_SEG_CODE_
#undef TD_MSG_SEG_CODE_
#include "tmsgdef.h"
#include "tmsgdef.h"
#include "tlog.h"
int32_t
tInitSubmitMsgIter
(
const
SSubmitReq
*
pMsg
,
SSubmitMsgIter
*
pIter
)
{
int32_t
tInitSubmitMsgIter
(
const
SSubmitReq
*
pMsg
,
SSubmitMsgIter
*
pIter
)
{
if
(
pMsg
==
NULL
)
{
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP
;
terrno
=
TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP
;
...
...
source/common/src/trow.c
浏览文件 @
cdadfe42
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "trow.h"
#include "trow.h"
#include "tlog.h"
const
uint8_t
tdVTypeByte
[
2
][
3
]
=
{{
const
uint8_t
tdVTypeByte
[
2
][
3
]
=
{{
// 2 bits
// 2 bits
...
...
source/common/src/ttime.c
浏览文件 @
cdadfe42
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "ttime.h"
#include "ttime.h"
#include "tlog.h"
/*
/*
* mktime64 - Converts date to seconds.
* mktime64 - Converts date to seconds.
* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
cdadfe42
...
@@ -201,7 +201,12 @@ int mainWindows(int argc, char **argv) {
...
@@ -201,7 +201,12 @@ int mainWindows(int argc, char **argv) {
return
-
1
;
return
-
1
;
}
}
taosConvInit
();
if
(
taosConvInit
()
!=
0
)
{
dError
(
"failed to init conv"
);
taosCloseLog
();
taosCleanupArgs
();
return
-
1
;
}
if
(
global
.
dumpConfig
)
{
if
(
global
.
dumpConfig
)
{
dmDumpCfg
();
dmDumpCfg
();
...
...
source/dnode/mgmt/mgmt_snode/src/smWorker.c
浏览文件 @
cdadfe42
...
@@ -139,7 +139,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
...
@@ -139,7 +139,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
SSnode
*
pSnode
=
pMgmt
->
pSnode
;
SSnode
*
pSnode
=
pMgmt
->
pSnode
;
if
(
pSnode
==
NULL
)
{
if
(
pSnode
==
NULL
)
{
dError
(
"
snode: msg:%p failed to put into v
node queue since %s, type:%s qtype:%d"
,
pMsg
,
terrstr
(),
dError
(
"
msg:%p failed to put into s
node queue since %s, type:%s qtype:%d"
,
pMsg
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
),
qtype
);
TMSG_INFO
(
pMsg
->
msgType
),
qtype
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
rpcFreeCont
(
pRpc
->
pCont
);
rpcFreeCont
(
pRpc
->
pCont
);
...
@@ -161,7 +161,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
...
@@ -161,7 +161,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
smPutNodeMsgToWriteQueue
(
pMgmt
,
pMsg
);
smPutNodeMsgToWriteQueue
(
pMgmt
,
pMsg
);
break
;
break
;
default:
default:
ASSERT
(
0
);
ASSERTS
(
0
,
"msg:%p failed to put into snode queue since %s, type:%s qtype:%d"
,
pMsg
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
),
qtype
);
}
}
return
0
;
return
0
;
}
}
...
...
source/libs/executor/src/tlinearhash.c
浏览文件 @
cdadfe42
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "taoserror.h"
#include "taoserror.h"
#include "tdef.h"
#include "tdef.h"
#include "tpagedbuf.h"
#include "tpagedbuf.h"
#include "tlog.h"
#define LHASH_CAP_RATIO 0.85
#define LHASH_CAP_RATIO 0.85
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
cdadfe42
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "tpagedbuf.h"
#include "tpagedbuf.h"
#include "tpercentile.h"
#include "tpercentile.h"
#include "ttypes.h"
#include "ttypes.h"
#include "tlog.h"
#define DEFAULT_NUM_OF_SLOT 1024
#define DEFAULT_NUM_OF_SLOT 1024
...
...
source/libs/sync/src/syncCommit.c
浏览文件 @
cdadfe42
...
@@ -84,7 +84,7 @@ void syncOneReplicaAdvance(SSyncNode* pSyncNode) {
...
@@ -84,7 +84,7 @@ void syncOneReplicaAdvance(SSyncNode* pSyncNode) {
}
}
void
syncMaybeAdvanceCommitIndex
(
SSyncNode
*
pSyncNode
)
{
void
syncMaybeAdvanceCommitIndex
(
SSyncNode
*
pSyncNode
)
{
ASSERT
(
false
&&
"deprecated"
);
ASSERT
S
(
false
,
"deprecated"
);
if
(
pSyncNode
==
NULL
)
{
if
(
pSyncNode
==
NULL
)
{
sError
(
"pSyncNode is NULL"
);
sError
(
"pSyncNode is NULL"
);
return
;
return
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
cdadfe42
...
@@ -791,9 +791,9 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
...
@@ -791,9 +791,9 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
}
}
int32_t
syncNodeLogStoreRestoreOnNeed
(
SSyncNode
*
pNode
)
{
int32_t
syncNodeLogStoreRestoreOnNeed
(
SSyncNode
*
pNode
)
{
ASSERT
(
pNode
->
pLogStore
!=
NULL
&&
"log store not created"
);
ASSERT
S
(
pNode
->
pLogStore
!=
NULL
,
"log store not created"
);
ASSERT
(
pNode
->
pFsm
!=
NULL
&&
"pFsm not registered"
);
ASSERT
S
(
pNode
->
pFsm
!=
NULL
,
"pFsm not registered"
);
ASSERT
(
pNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
&&
"FpGetSnapshotInfo not registered"
);
ASSERT
S
(
pNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
,
"FpGetSnapshotInfo not registered"
);
SSnapshot
snapshot
;
SSnapshot
snapshot
;
if
(
pNode
->
pFsm
->
FpGetSnapshotInfo
(
pNode
->
pFsm
,
&
snapshot
)
<
0
)
{
if
(
pNode
->
pFsm
->
FpGetSnapshotInfo
(
pNode
->
pFsm
,
&
snapshot
)
<
0
)
{
sError
(
"vgId:%d, failed to get snapshot info since %s"
,
pNode
->
vgId
,
terrstr
());
sError
(
"vgId:%d, failed to get snapshot info since %s"
,
pNode
->
vgId
,
terrstr
());
...
@@ -1144,8 +1144,8 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) {
...
@@ -1144,8 +1144,8 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) {
}
}
int32_t
syncNodeRestore
(
SSyncNode
*
pSyncNode
)
{
int32_t
syncNodeRestore
(
SSyncNode
*
pSyncNode
)
{
ASSERT
(
pSyncNode
->
pLogStore
!=
NULL
&&
"log store not created"
);
ASSERT
S
(
pSyncNode
->
pLogStore
!=
NULL
,
"log store not created"
);
ASSERT
(
pSyncNode
->
pLogBuf
!=
NULL
&&
"ring log buffer not created"
);
ASSERT
S
(
pSyncNode
->
pLogBuf
!=
NULL
,
"ring log buffer not created"
);
SyncIndex
lastVer
=
pSyncNode
->
pLogStore
->
syncLogLastIndex
(
pSyncNode
->
pLogStore
);
SyncIndex
lastVer
=
pSyncNode
->
pLogStore
->
syncLogLastIndex
(
pSyncNode
->
pLogStore
);
SyncIndex
commitIndex
=
pSyncNode
->
pLogStore
->
syncLogCommitIndex
(
pSyncNode
->
pLogStore
);
SyncIndex
commitIndex
=
pSyncNode
->
pLogStore
->
syncLogCommitIndex
(
pSyncNode
->
pLogStore
);
...
@@ -2663,7 +2663,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
...
@@ -2663,7 +2663,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
int32_t
code
=
syncNodeAppend
(
ths
,
pEntry
);
int32_t
code
=
syncNodeAppend
(
ths
,
pEntry
);
if
(
code
<
0
&&
ths
->
vgId
!=
1
&&
vnodeIsMsgBlock
(
pEntry
->
originalRpcType
))
{
if
(
code
<
0
&&
ths
->
vgId
!=
1
&&
vnodeIsMsgBlock
(
pEntry
->
originalRpcType
))
{
ASSERT
(
false
&&
"failed to append blocking msg"
);
ASSERT
S
(
false
,
"failed to append blocking msg"
);
}
}
return
code
;
return
code
;
}
}
...
...
source/libs/sync/src/syncPipeline.c
浏览文件 @
cdadfe42
...
@@ -50,7 +50,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
...
@@ -50,7 +50,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
// initial log buffer with at least one item, e.g. commitIndex
// initial log buffer with at least one item, e.g. commitIndex
SSyncRaftEntry
*
pMatch
=
pBuf
->
entries
[(
index
-
1
+
pBuf
->
size
)
%
pBuf
->
size
].
pItem
;
SSyncRaftEntry
*
pMatch
=
pBuf
->
entries
[(
index
-
1
+
pBuf
->
size
)
%
pBuf
->
size
].
pItem
;
ASSERT
(
pMatch
!=
NULL
&&
"no matched log entry"
);
ASSERT
S
(
pMatch
!=
NULL
,
"no matched log entry"
);
ASSERT
(
pMatch
->
index
+
1
==
index
);
ASSERT
(
pMatch
->
index
+
1
==
index
);
SSyncLogBufEntry
tmp
=
{.
pItem
=
pEntry
,
.
prevLogIndex
=
pMatch
->
index
,
.
prevLogTerm
=
pMatch
->
term
};
SSyncLogBufEntry
tmp
=
{.
pItem
=
pEntry
,
.
prevLogIndex
=
pMatch
->
index
,
.
prevLogTerm
=
pMatch
->
term
};
...
@@ -86,14 +86,14 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
...
@@ -86,14 +86,14 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
if
(
prevIndex
>=
pBuf
->
startIndex
)
{
if
(
prevIndex
>=
pBuf
->
startIndex
)
{
pEntry
=
pBuf
->
entries
[(
prevIndex
+
pBuf
->
size
)
%
pBuf
->
size
].
pItem
;
pEntry
=
pBuf
->
entries
[(
prevIndex
+
pBuf
->
size
)
%
pBuf
->
size
].
pItem
;
ASSERT
(
pEntry
!=
NULL
&&
"no log entry found"
);
ASSERT
S
(
pEntry
!=
NULL
,
"no log entry found"
);
prevLogTerm
=
pEntry
->
term
;
prevLogTerm
=
pEntry
->
term
;
return
prevLogTerm
;
return
prevLogTerm
;
}
}
if
(
pMgr
&&
pMgr
->
startIndex
<=
prevIndex
&&
prevIndex
<
pMgr
->
endIndex
)
{
if
(
pMgr
&&
pMgr
->
startIndex
<=
prevIndex
&&
prevIndex
<
pMgr
->
endIndex
)
{
int64_t
timeMs
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
timeMs
;
int64_t
timeMs
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
timeMs
;
ASSERT
(
timeMs
!=
0
&&
"no log entry found"
);
ASSERT
S
(
timeMs
!=
0
,
"no log entry found"
);
prevLogTerm
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
term
;
prevLogTerm
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
term
;
ASSERT
(
prevIndex
==
0
||
prevLogTerm
!=
0
);
ASSERT
(
prevIndex
==
0
||
prevLogTerm
!=
0
);
return
prevLogTerm
;
return
prevLogTerm
;
...
@@ -141,9 +141,9 @@ int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex
...
@@ -141,9 +141,9 @@ int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex
}
}
int32_t
syncLogBufferInitWithoutLock
(
SSyncLogBuffer
*
pBuf
,
SSyncNode
*
pNode
)
{
int32_t
syncLogBufferInitWithoutLock
(
SSyncLogBuffer
*
pBuf
,
SSyncNode
*
pNode
)
{
ASSERT
(
pNode
->
pLogStore
!=
NULL
&&
"log store not created"
);
ASSERT
S
(
pNode
->
pLogStore
!=
NULL
,
"log store not created"
);
ASSERT
(
pNode
->
pFsm
!=
NULL
&&
"pFsm not registered"
);
ASSERT
S
(
pNode
->
pFsm
!=
NULL
,
"pFsm not registered"
);
ASSERT
(
pNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
&&
"FpGetSnapshotInfo not registered"
);
ASSERT
S
(
pNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
,
"FpGetSnapshotInfo not registered"
);
SSnapshot
snapshot
;
SSnapshot
snapshot
;
if
(
pNode
->
pFsm
->
FpGetSnapshotInfo
(
pNode
->
pFsm
,
&
snapshot
)
<
0
)
{
if
(
pNode
->
pFsm
->
FpGetSnapshotInfo
(
pNode
->
pFsm
,
&
snapshot
)
<
0
)
{
...
@@ -437,7 +437,7 @@ _out:
...
@@ -437,7 +437,7 @@ _out:
}
}
int32_t
syncLogFsmExecute
(
SSyncNode
*
pNode
,
SSyncFSM
*
pFsm
,
ESyncState
role
,
SyncTerm
term
,
SSyncRaftEntry
*
pEntry
)
{
int32_t
syncLogFsmExecute
(
SSyncNode
*
pNode
,
SSyncFSM
*
pFsm
,
ESyncState
role
,
SyncTerm
term
,
SSyncRaftEntry
*
pEntry
)
{
ASSERT
(
pFsm
->
FpCommitCb
!=
NULL
&&
"No commit cb registered for the FSM"
);
ASSERT
S
(
pFsm
->
FpCommitCb
!=
NULL
,
"No commit cb registered for the FSM"
);
if
((
pNode
->
replicaNum
==
1
)
&&
pNode
->
restoreFinish
&&
pNode
->
vgId
!=
1
)
{
if
((
pNode
->
replicaNum
==
1
)
&&
pNode
->
restoreFinish
&&
pNode
->
vgId
!=
1
)
{
return
0
;
return
0
;
...
@@ -900,7 +900,7 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
...
@@ -900,7 +900,7 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
ASSERT
(
pNode
->
logReplMgrs
[
i
]
==
NULL
);
ASSERT
(
pNode
->
logReplMgrs
[
i
]
==
NULL
);
pNode
->
logReplMgrs
[
i
]
=
syncLogReplMgrCreate
();
pNode
->
logReplMgrs
[
i
]
=
syncLogReplMgrCreate
();
pNode
->
logReplMgrs
[
i
]
->
peerId
=
i
;
pNode
->
logReplMgrs
[
i
]
->
peerId
=
i
;
ASSERT
(
pNode
->
logReplMgrs
[
i
]
!=
NULL
&&
"Out of memory."
);
ASSERT
S
(
pNode
->
logReplMgrs
[
i
]
!=
NULL
,
"Out of memory."
);
}
}
return
0
;
return
0
;
}
}
...
...
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
浏览文件 @
cdadfe42
...
@@ -19,7 +19,7 @@ SyncAppendEntriesReply *createMsg() {
...
@@ -19,7 +19,7 @@ SyncAppendEntriesReply *createMsg() {
pMsg
->
success
=
true
;
pMsg
->
success
=
true
;
pMsg
->
matchIndex
=
77
;
pMsg
->
matchIndex
=
77
;
pMsg
->
term
=
33
;
pMsg
->
term
=
33
;
pMsg
->
privateTerm
=
44
;
//
pMsg->privateTerm = 44;
pMsg
->
startTime
=
taosGetTimestampMs
();
pMsg
->
startTime
=
taosGetTimestampMs
();
return
pMsg
;
return
pMsg
;
}
}
...
...
source/libs/sync/test/syncTest.cpp
浏览文件 @
cdadfe42
#include "syncTest.h"
#include "syncTest.h"
#include <gtest/gtest.h>
//
#include <gtest/gtest.h>
/*
/*
typedef enum {
typedef enum {
...
...
source/libs/sync/test/sync_test_lib/inc/syncIO.h
浏览文件 @
cdadfe42
...
@@ -81,6 +81,8 @@ int32_t syncIOQTimerStop();
...
@@ -81,6 +81,8 @@ int32_t syncIOQTimerStop();
int32_t
syncIOPingTimerStart
();
int32_t
syncIOPingTimerStart
();
int32_t
syncIOPingTimerStop
();
int32_t
syncIOPingTimerStop
();
void
syncEntryDestory
(
SSyncRaftEntry
*
pEntry
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/sync/test/sync_test_lib/src/syncIO.c
浏览文件 @
cdadfe42
...
@@ -469,3 +469,5 @@ static void syncIOTickPing(void *param, void *tmrId) {
...
@@ -469,3 +469,5 @@ static void syncIOTickPing(void *param, void *tmrId) {
taosTmrReset
(
syncIOTickPing
,
io
->
pingTimerMS
,
io
,
io
->
timerMgr
,
&
io
->
pingTimer
);
taosTmrReset
(
syncIOTickPing
,
io
->
pingTimerMS
,
io
,
io
->
timerMgr
,
&
io
->
pingTimer
);
}
}
void
syncEntryDestory
(
SSyncRaftEntry
*
pEntry
)
{}
\ No newline at end of file
source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c
浏览文件 @
cdadfe42
...
@@ -1583,8 +1583,8 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) {
...
@@ -1583,8 +1583,8 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
//
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
//
cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
...
...
source/libs/tdb/test/tdbExOVFLTest.cpp
浏览文件 @
cdadfe42
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <string>
#include <string>
#include <thread>
#include <thread>
#include <vector>
#include <vector>
#include "tlog.h"
typedef
struct
SPoolMem
{
typedef
struct
SPoolMem
{
int64_t
size
;
int64_t
size
;
...
...
source/libs/tdb/test/tdbTest.cpp
浏览文件 @
cdadfe42
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <string>
#include <string>
#include <thread>
#include <thread>
#include <vector>
#include <vector>
#include "tlog.h"
typedef
struct
SPoolMem
{
typedef
struct
SPoolMem
{
int64_t
size
;
int64_t
size
;
...
...
source/os/src/osDir.c
浏览文件 @
cdadfe42
...
@@ -163,7 +163,7 @@ int32_t taosMulMkDir(const char *dirname) {
...
@@ -163,7 +163,7 @@ int32_t taosMulMkDir(const char *dirname) {
code
=
mkdir
(
temp
,
0755
);
code
=
mkdir
(
temp
,
0755
);
#endif
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
code
;
return
code
;
}
}
*
pos
=
TD_DIRSEP
[
0
];
*
pos
=
TD_DIRSEP
[
0
];
...
@@ -179,7 +179,7 @@ int32_t taosMulMkDir(const char *dirname) {
...
@@ -179,7 +179,7 @@ int32_t taosMulMkDir(const char *dirname) {
code
=
mkdir
(
temp
,
0755
);
code
=
mkdir
(
temp
,
0755
);
#endif
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
code
;
return
code
;
}
}
}
}
...
@@ -225,7 +225,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
...
@@ -225,7 +225,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
code
=
mkdir
(
temp
,
mode
);
code
=
mkdir
(
temp
,
mode
);
#endif
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
code
;
return
code
;
}
}
*
pos
=
TD_DIRSEP
[
0
];
*
pos
=
TD_DIRSEP
[
0
];
...
@@ -241,7 +241,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
...
@@ -241,7 +241,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
code
=
mkdir
(
temp
,
mode
);
code
=
mkdir
(
temp
,
mode
);
#endif
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
code
;
return
code
;
}
}
}
}
...
...
source/os/src/osFile.c
浏览文件 @
cdadfe42
...
@@ -313,7 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
...
@@ -313,7 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
assert
(
!
(
tdFileOptions
&
TD_FILE_EXCL
));
assert
(
!
(
tdFileOptions
&
TD_FILE_EXCL
));
fp
=
fopen
(
path
,
mode
);
fp
=
fopen
(
path
,
mode
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
NULL
;
return
NULL
;
}
}
}
else
{
}
else
{
...
@@ -336,14 +336,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
...
@@ -336,14 +336,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
#endif
#endif
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
NULL
;
return
NULL
;
}
}
}
}
TdFilePtr
pFile
=
(
TdFilePtr
)
taosMemoryMalloc
(
sizeof
(
TdFile
));
TdFilePtr
pFile
=
(
TdFilePtr
)
taosMemoryMalloc
(
sizeof
(
TdFile
));
if
(
pFile
==
NULL
)
{
if
(
pFile
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
//
terrno = TSDB_CODE_OUT_OF_MEMORY;
if
(
fd
>=
0
)
close
(
fd
);
if
(
fd
>=
0
)
close
(
fd
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
if
(
fp
!=
NULL
)
fclose
(
fp
);
return
NULL
;
return
NULL
;
...
...
source/os/src/osMemory.c
浏览文件 @
cdadfe42
...
@@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) {
...
@@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) {
void
*
taosMemoryMallocAlign
(
uint32_t
alignment
,
int64_t
size
)
{
void
*
taosMemoryMallocAlign
(
uint32_t
alignment
,
int64_t
size
)
{
#ifdef USE_TD_MEMORY
#ifdef USE_TD_MEMORY
ASSERT
(
0
);
assert
(
0
);
#else
#else
#if defined(LINUX)
#if defined(LINUX)
void
*
p
=
memalign
(
alignment
,
size
);
void
*
p
=
memalign
(
alignment
,
size
);
...
...
source/os/src/osString.c
浏览文件 @
cdadfe42
...
@@ -143,15 +143,17 @@ SConv *gConv = NULL;
...
@@ -143,15 +143,17 @@ SConv *gConv = NULL;
int32_t
convUsed
=
0
;
int32_t
convUsed
=
0
;
int32_t
gConvMaxNum
=
0
;
int32_t
gConvMaxNum
=
0
;
void
taosConvInit
(
void
)
{
int32_t
taosConvInit
(
void
)
{
gConvMaxNum
=
512
;
gConvMaxNum
=
512
;
gConv
=
taosMemoryCalloc
(
gConvMaxNum
,
sizeof
(
SConv
));
gConv
=
taosMemoryCalloc
(
gConvMaxNum
,
sizeof
(
SConv
));
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
gConv
[
i
].
conv
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
gConv
[
i
].
conv
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
if
((
iconv_t
)
-
1
==
gConv
[
i
].
conv
||
(
iconv_t
)
0
==
gConv
[
i
].
conv
)
{
if
((
iconv_t
)
-
1
==
gConv
[
i
].
conv
||
(
iconv_t
)
0
==
gConv
[
i
].
conv
)
{
ASSERT
(
0
)
;
return
-
1
;
}
}
}
}
return
0
;
}
}
void
taosConvDestroy
()
{
void
taosConvDestroy
()
{
...
...
source/os/src/osSysinfo.c
浏览文件 @
cdadfe42
...
@@ -617,14 +617,14 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
...
@@ -617,14 +617,14 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
return
0
;
return
0
;
}
else
{
}
else
{
// printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
// printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
-
1
;
return
-
1
;
}
}
#elif defined(_TD_DARWIN_64)
#elif defined(_TD_DARWIN_64)
struct
statvfs
info
;
struct
statvfs
info
;
if
(
statvfs
(
dataDir
,
&
info
))
{
if
(
statvfs
(
dataDir
,
&
info
))
{
// printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
// printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
-
1
;
return
-
1
;
}
else
{
}
else
{
diskSize
->
total
=
info
.
f_blocks
*
info
.
f_frsize
;
diskSize
->
total
=
info
.
f_blocks
*
info
.
f_frsize
;
...
@@ -635,7 +635,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
...
@@ -635,7 +635,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
#else
#else
struct
statvfs
info
;
struct
statvfs
info
;
if
(
statvfs
(
dataDir
,
&
info
))
{
if
(
statvfs
(
dataDir
,
&
info
))
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
//
terrno = TAOS_SYSTEM_ERROR(errno);
return
-
1
;
return
-
1
;
}
else
{
}
else
{
diskSize
->
total
=
info
.
f_blocks
*
info
.
f_frsize
;
diskSize
->
total
=
info
.
f_blocks
*
info
.
f_frsize
;
...
...
source/util/src/talgo.c
浏览文件 @
cdadfe42
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "talgo.h"
#include "talgo.h"
#include "tlog.h"
#define doswap(__left, __right, __size, __buf) \
#define doswap(__left, __right, __size, __buf) \
do { \
do { \
...
...
source/util/src/tjson.c
浏览文件 @
cdadfe42
...
@@ -181,7 +181,7 @@ int32_t tjsonGetObjectValueString(const SJson* pJson, char** pValueString) {
...
@@ -181,7 +181,7 @@ int32_t tjsonGetObjectValueString(const SJson* pJson, char** pValueString) {
int32_t
tjsonGetStringValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
char
*
pVal
)
{
int32_t
tjsonGetStringValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
char
*
pVal
)
{
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
if
(
NULL
==
p
)
{
if
(
NULL
==
p
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
strcpy
(
pVal
,
p
);
strcpy
(
pVal
,
p
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -190,7 +190,7 @@ int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) {
...
@@ -190,7 +190,7 @@ int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) {
int32_t
tjsonDupStringValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
char
**
pVal
)
{
int32_t
tjsonDupStringValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
char
**
pVal
)
{
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
if
(
NULL
==
p
)
{
if
(
NULL
==
p
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
*
pVal
=
strdup
(
p
);
*
pVal
=
strdup
(
p
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -199,7 +199,7 @@ int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal)
...
@@ -199,7 +199,7 @@ int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal)
int32_t
tjsonGetBigIntValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
int64_t
*
pVal
)
{
int32_t
tjsonGetBigIntValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
int64_t
*
pVal
)
{
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
if
(
NULL
==
p
)
{
if
(
NULL
==
p
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
#ifdef WINDOWS
#ifdef WINDOWS
sscanf
(
p
,
"%"
PRId64
,
pVal
);
sscanf
(
p
,
"%"
PRId64
,
pVal
);
...
@@ -233,7 +233,7 @@ int32_t tjsonGetTinyIntValue(const SJson* pJson, const char* pName, int8_t* pVal
...
@@ -233,7 +233,7 @@ int32_t tjsonGetTinyIntValue(const SJson* pJson, const char* pName, int8_t* pVal
int32_t
tjsonGetUBigIntValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
uint64_t
*
pVal
)
{
int32_t
tjsonGetUBigIntValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
uint64_t
*
pVal
)
{
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
char
*
p
=
cJSON_GetStringValue
(
tjsonGetObjectItem
((
cJSON
*
)
pJson
,
pName
));
if
(
NULL
==
p
)
{
if
(
NULL
==
p
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
#ifdef WINDOWS
#ifdef WINDOWS
sscanf
(
p
,
"%"
PRIu64
,
pVal
);
sscanf
(
p
,
"%"
PRIu64
,
pVal
);
...
@@ -259,6 +259,9 @@ int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pV
...
@@ -259,6 +259,9 @@ int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pV
int32_t
tjsonGetBoolValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
bool
*
pVal
)
{
int32_t
tjsonGetBoolValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
bool
*
pVal
)
{
const
SJson
*
pObject
=
tjsonGetObjectItem
(
pJson
,
pName
);
const
SJson
*
pObject
=
tjsonGetObjectItem
(
pJson
,
pName
);
if
(
NULL
==
pObject
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
cJSON_IsBool
(
pObject
))
{
if
(
!
cJSON_IsBool
(
pObject
))
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -268,6 +271,9 @@ int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) {
...
@@ -268,6 +271,9 @@ int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) {
int32_t
tjsonGetDoubleValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
double
*
pVal
)
{
int32_t
tjsonGetDoubleValue
(
const
SJson
*
pJson
,
const
char
*
pName
,
double
*
pVal
)
{
const
SJson
*
pObject
=
tjsonGetObjectItem
(
pJson
,
pName
);
const
SJson
*
pObject
=
tjsonGetObjectItem
(
pJson
,
pName
);
if
(
NULL
==
pObject
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
!
cJSON_IsNumber
(
pObject
))
{
if
(
!
cJSON_IsNumber
(
pObject
))
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -282,7 +288,7 @@ SJson* tjsonGetArrayItem(const SJson* pJson, int32_t index) { return cJSON_GetAr
...
@@ -282,7 +288,7 @@ SJson* tjsonGetArrayItem(const SJson* pJson, int32_t index) { return cJSON_GetAr
int32_t
tjsonToObject
(
const
SJson
*
pJson
,
const
char
*
pName
,
FToObject
func
,
void
*
pObj
)
{
int32_t
tjsonToObject
(
const
SJson
*
pJson
,
const
char
*
pName
,
FToObject
func
,
void
*
pObj
)
{
SJson
*
pJsonObj
=
tjsonGetObjectItem
(
pJson
,
pName
);
SJson
*
pJsonObj
=
tjsonGetObjectItem
(
pJson
,
pName
);
if
(
NULL
==
pJsonObj
)
{
if
(
NULL
==
pJsonObj
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
return
func
(
pJsonObj
,
pObj
);
return
func
(
pJsonObj
,
pObj
);
}
}
...
@@ -294,7 +300,7 @@ int32_t tjsonMakeObject(const SJson* pJson, const char* pName, FToObject func, v
...
@@ -294,7 +300,7 @@ int32_t tjsonMakeObject(const SJson* pJson, const char* pName, FToObject func, v
SJson
*
pJsonObj
=
tjsonGetObjectItem
(
pJson
,
pName
);
SJson
*
pJsonObj
=
tjsonGetObjectItem
(
pJson
,
pName
);
if
(
NULL
==
pJsonObj
)
{
if
(
NULL
==
pJsonObj
)
{
return
TSDB_CODE_
FAILED
;
return
TSDB_CODE_
SUCCESS
;
}
}
*
pObj
=
taosMemoryCalloc
(
1
,
objSize
);
*
pObj
=
taosMemoryCalloc
(
1
,
objSize
);
if
(
NULL
==
*
pObj
)
{
if
(
NULL
==
*
pObj
)
{
...
...
source/util/src/tlog.c
浏览文件 @
cdadfe42
...
@@ -72,6 +72,7 @@ static int32_t tsDaylightActive; /* Currently in daylight saving time. */
...
@@ -72,6 +72,7 @@ static int32_t tsDaylightActive; /* Currently in daylight saving time. */
bool
tsLogEmbedded
=
0
;
bool
tsLogEmbedded
=
0
;
bool
tsAsyncLog
=
true
;
bool
tsAsyncLog
=
true
;
bool
tsAssert
=
true
;
int32_t
tsNumOfLogLines
=
10000000
;
int32_t
tsNumOfLogLines
=
10000000
;
int32_t
tsLogKeepDays
=
0
;
int32_t
tsLogKeepDays
=
0
;
LogFp
tsLogFp
=
NULL
;
LogFp
tsLogFp
=
NULL
;
...
@@ -778,3 +779,37 @@ cmp_end:
...
@@ -778,3 +779,37 @@ cmp_end:
return
ret
;
return
ret
;
}
}
bool
taosAssertLog
(
bool
condition
,
const
char
*
file
,
int32_t
line
,
const
char
*
format
,
...)
{
if
(
condition
)
return
false
;
const
char
*
flags
=
"UTL FATAL "
;
ELogLevel
level
=
DEBUG_FATAL
;
int32_t
dflag
=
255
;
// tsLogEmbedded ? 255 : uDebugFlag
char
buffer
[
LOG_MAX_LINE_BUFFER_SIZE
];
int32_t
len
=
taosBuildLogHead
(
buffer
,
flags
);
va_list
argpointer
;
va_start
(
argpointer
,
format
);
len
=
len
+
vsnprintf
(
buffer
+
len
,
LOG_MAX_LINE_BUFFER_SIZE
-
len
,
format
,
argpointer
);
va_end
(
argpointer
);
buffer
[
len
++
]
=
'\n'
;
buffer
[
len
]
=
0
;
taosPrintLogImp
(
1
,
255
,
buffer
,
len
);
taosPrintLog
(
flags
,
level
,
dflag
,
"tAssert at file %s:%d exit:%d"
,
file
,
line
,
tsAssert
);
taosPrintTrace
(
flags
,
level
,
dflag
);
if
(
tsAssert
)
{
taosCloseLog
();
taosMsleep
(
300
);
#ifdef NDEBUG
abort
();
#else
assert
(
0
);
#endif
}
return
true
;
}
\ No newline at end of file
source/util/test/hashTest.cpp
浏览文件 @
cdadfe42
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "taos.h"
#include "taos.h"
#include "taosdef.h"
#include "taosdef.h"
#include "thash.h"
#include "thash.h"
#include "tlog.h"
namespace
{
namespace
{
...
...
tests/parallel_test/cases.task
浏览文件 @
cdadfe42
...
@@ -1022,9 +1022,9 @@
...
@@ -1022,9 +1022,9 @@
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py
#
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py
#
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
...
...
utils/test/c/sml_test.c
浏览文件 @
cdadfe42
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <time.h>
#include <time.h>
#include "taos.h"
#include "taos.h"
#include "types.h"
#include "types.h"
#include "tlog.h"
int
smlProcess_influx_Test
()
{
int
smlProcess_influx_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录