Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
47319184
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看板
未验证
提交
47319184
编写于
4月 28, 2020
作者:
S
slguan
提交者:
GitHub
4月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1744 from taosdata/feature/alter
Feature/alter
上级
dbe86710
998a7416
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
359 addition
and
451 deletion
+359
-451
src/client/src/tscServer.c
src/client/src/tscServer.c
+6
-6
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/client/src/tscSub.c
src/client/src/tscSub.c
+4
-4
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+3
-3
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+4
-4
src/common/src/tglobal.c
src/common/src/tglobal.c
+6
-6
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+8
-8
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+7
-1
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+1
-1
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+37
-35
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+2
-4
src/os/darwin/src/darwinEnv.c
src/os/darwin/src/darwinEnv.c
+4
-4
src/os/linux/src/linuxEnv.c
src/os/linux/src/linuxEnv.c
+4
-4
src/os/linux/src/linuxSysPara.c
src/os/linux/src/linuxSysPara.c
+12
-9
src/os/windows/src/twinenv.c
src/os/windows/src/twinenv.c
+4
-4
src/plugins/http/src/httpSystem.c
src/plugins/http/src/httpSystem.c
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+1
-1
src/util/src/hash.c
src/util/src/hash.c
+1
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+1
-1
src/util/src/tlog.c
src/util/src/tlog.c
+4
-4
src/util/src/tnote.c
src/util/src/tnote.c
+2
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+16
-10
tests/script/sh/exec_up.sh
tests/script/sh/exec_up.sh
+6
-15
tests/script/unique/db/commit.sim
tests/script/unique/db/commit.sim
+6
-6
tests/script/unique/db/delete.sim
tests/script/unique/db/delete.sim
+3
-3
tests/script/unique/db/delete_part.sim
tests/script/unique/db/delete_part.sim
+4
-4
tests/script/unique/db/replica_add12.sim
tests/script/unique/db/replica_add12.sim
+39
-21
tests/script/unique/db/replica_add13.sim
tests/script/unique/db/replica_add13.sim
+27
-30
tests/script/unique/db/replica_add23.sim
tests/script/unique/db/replica_add23.sim
+31
-45
tests/script/unique/db/replica_part.sim
tests/script/unique/db/replica_part.sim
+31
-78
tests/script/unique/db/replica_reduce21.sim
tests/script/unique/db/replica_reduce21.sim
+7
-11
tests/script/unique/db/replica_reduce31.sim
tests/script/unique/db/replica_reduce31.sim
+44
-78
tests/script/unique/db/replica_reduce32.sim
tests/script/unique/db/replica_reduce32.sim
+22
-37
tests/script/unique/db/testSuite.sim
tests/script/unique/db/testSuite.sim
+2
-2
tests/tsim/inc/sim.h
tests/tsim/inc/sim.h
+1
-1
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+4
-4
tests/tsim/src/simParse.c
tests/tsim/src/simParse.c
+1
-1
未找到文件。
src/client/src/tscServer.c
浏览文件 @
47319184
...
@@ -294,11 +294,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
...
@@ -294,11 +294,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
}
}
}
}
}
}
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
tscTrace
(
"%p reset retry counter to be 0 due to success rsp, old:%d"
,
pSql
,
pSql
->
retry
);
pSql
->
retry
=
0
;
}
pRes
->
rspLen
=
0
;
pRes
->
rspLen
=
0
;
...
@@ -308,6 +303,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
...
@@ -308,6 +303,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
tscTrace
(
"%p query is cancelled, code:%d"
,
pSql
,
tstrerror
(
pRes
->
code
));
tscTrace
(
"%p query is cancelled, code:%d"
,
pSql
,
tstrerror
(
pRes
->
code
));
}
}
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
tscTrace
(
"%p reset retry counter to be 0 due to success rsp, old:%d"
,
pSql
,
pSql
->
retry
);
pSql
->
retry
=
0
;
}
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
assert
(
rpcMsg
->
msgType
==
pCmd
->
msgType
+
1
);
assert
(
rpcMsg
->
msgType
==
pCmd
->
msgType
+
1
);
pRes
->
code
=
rpcMsg
->
code
;
pRes
->
code
=
rpcMsg
->
code
;
...
@@ -569,7 +569,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -569,7 +569,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tscSetDnodeIpList
(
pSql
,
pTableMeta
);
tscSetDnodeIpList
(
pSql
,
pTableMeta
);
tscTrace
(
"%p build submit msg, vgId:%d numOfVgroup:%d
"
,
pSql
,
vgId
,
htonl
(
pMsgDesc
->
numOfVnodes
)
);
tscTrace
(
"%p build submit msg, vgId:%d numOfVgroup:%d
numberOfIP:%d"
,
pSql
,
vgId
,
htonl
(
pMsgDesc
->
numOfVnodes
),
pSql
->
ipList
.
numOfIps
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/client/src/tscSql.c
浏览文件 @
47319184
...
@@ -939,7 +939,7 @@ char *taos_errstr(TAOS *taos) {
...
@@ -939,7 +939,7 @@ char *taos_errstr(TAOS *taos) {
void
taos_config
(
int
debug
,
char
*
log_path
)
{
void
taos_config
(
int
debug
,
char
*
log_path
)
{
uDebugFlag
=
debug
;
uDebugFlag
=
debug
;
strcpy
(
l
ogDir
,
log_path
);
strcpy
(
tsL
ogDir
,
log_path
);
}
}
char
*
taos_get_server_info
(
TAOS
*
taos
)
{
char
*
taos_get_server_info
(
TAOS
*
taos
)
{
...
...
src/client/src/tscSub.c
浏览文件 @
47319184
...
@@ -220,7 +220,7 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
...
@@ -220,7 +220,7 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
static
int
tscLoadSubscriptionProgress
(
SSub
*
pSub
)
{
static
int
tscLoadSubscriptionProgress
(
SSub
*
pSub
)
{
char
buf
[
TSDB_MAX_SQL_LEN
];
char
buf
[
TSDB_MAX_SQL_LEN
];
sprintf
(
buf
,
"%s/subscribe/%s"
,
d
ataDir
,
pSub
->
topic
);
sprintf
(
buf
,
"%s/subscribe/%s"
,
tsD
ataDir
,
pSub
->
topic
);
FILE
*
fp
=
fopen
(
buf
,
"r"
);
FILE
*
fp
=
fopen
(
buf
,
"r"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
...
@@ -281,12 +281,12 @@ void tscSaveSubscriptionProgress(void* sub) {
...
@@ -281,12 +281,12 @@ void tscSaveSubscriptionProgress(void* sub) {
SSub
*
pSub
=
(
SSub
*
)
sub
;
SSub
*
pSub
=
(
SSub
*
)
sub
;
char
path
[
256
];
char
path
[
256
];
sprintf
(
path
,
"%s/subscribe"
,
d
ataDir
);
sprintf
(
path
,
"%s/subscribe"
,
tsD
ataDir
);
if
(
access
(
path
,
0
)
!=
0
)
{
if
(
access
(
path
,
0
)
!=
0
)
{
mkdir
(
path
,
0777
);
mkdir
(
path
,
0777
);
}
}
sprintf
(
path
,
"%s/subscribe/%s"
,
d
ataDir
,
pSub
->
topic
);
sprintf
(
path
,
"%s/subscribe/%s"
,
tsD
ataDir
,
pSub
->
topic
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
tscError
(
"failed to create progress file for subscription: %s"
,
pSub
->
topic
);
tscError
(
"failed to create progress file for subscription: %s"
,
pSub
->
topic
);
...
@@ -416,7 +416,7 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
...
@@ -416,7 +416,7 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
tscSaveSubscriptionProgress
(
pSub
);
tscSaveSubscriptionProgress
(
pSub
);
}
else
{
}
else
{
char
path
[
256
];
char
path
[
256
];
sprintf
(
path
,
"%s/subscribe/%s"
,
d
ataDir
,
pSub
->
topic
);
sprintf
(
path
,
"%s/subscribe/%s"
,
tsD
ataDir
,
pSub
->
topic
);
remove
(
path
);
remove
(
path
);
}
}
...
...
src/client/src/tscSystem.c
浏览文件 @
47319184
...
@@ -121,11 +121,11 @@ void taos_init_imp() {
...
@@ -121,11 +121,11 @@ void taos_init_imp() {
taosReadGlobalLogCfg
();
taosReadGlobalLogCfg
();
// For log directory
// For log directory
if
(
stat
(
logDir
,
&
dirstat
)
<
0
)
mkdir
(
l
ogDir
,
0755
);
if
(
stat
(
tsLogDir
,
&
dirstat
)
<
0
)
mkdir
(
tsL
ogDir
,
0755
);
sprintf
(
temp
,
"%s/taoslog"
,
l
ogDir
);
sprintf
(
temp
,
"%s/taoslog"
,
tsL
ogDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
10
)
<
0
)
{
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
10
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
l
ogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsL
ogDir
);
}
}
taosReadGlobalCfg
();
taosReadGlobalCfg
();
...
...
src/common/inc/tglobal.h
浏览文件 @
47319184
...
@@ -24,10 +24,10 @@ extern char configDir[];
...
@@ -24,10 +24,10 @@ extern char configDir[];
extern
char
tsVnodeDir
[];
extern
char
tsVnodeDir
[];
extern
char
tsDnodeDir
[];
extern
char
tsDnodeDir
[];
extern
char
tsMnodeDir
[];
extern
char
tsMnodeDir
[];
extern
char
d
ataDir
[];
extern
char
tsD
ataDir
[];
extern
char
l
ogDir
[];
extern
char
tsL
ogDir
[];
extern
char
s
criptDir
[];
extern
char
tsS
criptDir
[];
extern
char
o
sName
[];
extern
char
tsO
sName
[];
// system info
// system info
extern
int64_t
tsPageSize
;
extern
int64_t
tsPageSize
;
...
...
src/common/src/tglobal.c
浏览文件 @
47319184
...
@@ -30,9 +30,9 @@ char configDir[TSDB_FILENAME_LEN] = "/etc/taos";
...
@@ -30,9 +30,9 @@ char configDir[TSDB_FILENAME_LEN] = "/etc/taos";
char
tsVnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsVnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsDnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsDnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsMnodeDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
d
ataDir
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
tsD
ataDir
[
TSDB_FILENAME_LEN
]
=
"/var/lib/taos"
;
char
s
criptDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
char
tsS
criptDir
[
TSDB_FILENAME_LEN
]
=
"/etc/taos"
;
char
o
sName
[
10
]
=
"Linux"
;
char
tsO
sName
[
10
]
=
"Linux"
;
// system info, not configurable
// system info, not configurable
int64_t
tsPageSize
;
int64_t
tsPageSize
;
...
@@ -407,7 +407,7 @@ static void doInitGlobalConfig() {
...
@@ -407,7 +407,7 @@ static void doInitGlobalConfig() {
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"logDir"
;
cfg
.
option
=
"logDir"
;
cfg
.
ptr
=
l
ogDir
;
cfg
.
ptr
=
tsL
ogDir
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_LOG
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_LOG
;
cfg
.
minValue
=
0
;
cfg
.
minValue
=
0
;
...
@@ -417,7 +417,7 @@ static void doInitGlobalConfig() {
...
@@ -417,7 +417,7 @@ static void doInitGlobalConfig() {
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"scriptDir"
;
cfg
.
option
=
"scriptDir"
;
cfg
.
ptr
=
s
criptDir
;
cfg
.
ptr
=
tsS
criptDir
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
0
;
cfg
.
minValue
=
0
;
...
@@ -427,7 +427,7 @@ static void doInitGlobalConfig() {
...
@@ -427,7 +427,7 @@ static void doInitGlobalConfig() {
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"dataDir"
;
cfg
.
option
=
"dataDir"
;
cfg
.
ptr
=
d
ataDir
;
cfg
.
ptr
=
tsD
ataDir
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
valType
=
TAOS_CFG_VTYPE_DIRECTORY
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
;
cfg
.
minValue
=
0
;
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
47319184
...
@@ -144,12 +144,12 @@ static int32_t dnodeInitSystem() {
...
@@ -144,12 +144,12 @@ static int32_t dnodeInitSystem() {
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGPIPE
,
SIG_IGN
);
struct
stat
dirstat
;
struct
stat
dirstat
;
if
(
stat
(
l
ogDir
,
&
dirstat
)
<
0
)
{
if
(
stat
(
tsL
ogDir
,
&
dirstat
)
<
0
)
{
mkdir
(
l
ogDir
,
0755
);
mkdir
(
tsL
ogDir
,
0755
);
}
}
char
temp
[
TSDB_FILENAME_LEN
];
char
temp
[
TSDB_FILENAME_LEN
];
sprintf
(
temp
,
"%s/taosdlog"
,
l
ogDir
);
sprintf
(
temp
,
"%s/taosdlog"
,
tsL
ogDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
1
)
<
0
)
{
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
1
)
<
0
)
{
printf
(
"failed to init log file
\n
"
);
printf
(
"failed to init log file
\n
"
);
}
}
...
@@ -218,13 +218,13 @@ static void dnodeCheckDataDirOpenned(char *dir) {
...
@@ -218,13 +218,13 @@ static void dnodeCheckDataDirOpenned(char *dir) {
static
int32_t
dnodeInitStorage
()
{
static
int32_t
dnodeInitStorage
()
{
struct
stat
dirstat
;
struct
stat
dirstat
;
if
(
stat
(
d
ataDir
,
&
dirstat
)
<
0
)
{
if
(
stat
(
tsD
ataDir
,
&
dirstat
)
<
0
)
{
mkdir
(
d
ataDir
,
0755
);
mkdir
(
tsD
ataDir
,
0755
);
}
}
sprintf
(
tsMnodeDir
,
"%s/mnode"
,
d
ataDir
);
sprintf
(
tsMnodeDir
,
"%s/mnode"
,
tsD
ataDir
);
sprintf
(
tsVnodeDir
,
"%s/vnode"
,
d
ataDir
);
sprintf
(
tsVnodeDir
,
"%s/vnode"
,
tsD
ataDir
);
sprintf
(
tsDnodeDir
,
"%s/dnode"
,
d
ataDir
);
sprintf
(
tsDnodeDir
,
"%s/dnode"
,
tsD
ataDir
);
mkdir
(
tsVnodeDir
,
0755
);
mkdir
(
tsVnodeDir
,
0755
);
mkdir
(
tsDnodeDir
,
0755
);
mkdir
(
tsDnodeDir
,
0755
);
...
...
src/inc/taosmsg.h
浏览文件 @
47319184
...
@@ -265,6 +265,7 @@ typedef struct {
...
@@ -265,6 +265,7 @@ typedef struct {
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
db
[
TSDB_DB_NAME_LEN
+
1
];
char
db
[
TSDB_DB_NAME_LEN
+
1
];
int8_t
igExists
;
int8_t
igExists
;
int8_t
getMeta
;
int16_t
numOfTags
;
int16_t
numOfTags
;
int16_t
numOfColumns
;
int16_t
numOfColumns
;
int16_t
sqlLen
;
// the length of SQL, it starts after schema , sql is a null-terminated string
int16_t
sqlLen
;
// the length of SQL, it starts after schema , sql is a null-terminated string
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
47319184
...
@@ -40,7 +40,7 @@ History history;
...
@@ -40,7 +40,7 @@ History history;
*/
*/
TAOS
*
shellInit
(
struct
arguments
*
args
)
{
TAOS
*
shellInit
(
struct
arguments
*
args
)
{
printf
(
"
\n
"
);
printf
(
"
\n
"
);
printf
(
CLIENT_VERSION
,
o
sName
,
taos_get_client_info
());
printf
(
CLIENT_VERSION
,
tsO
sName
,
taos_get_client_info
());
fflush
(
stdout
);
fflush
(
stdout
);
// set options before initializing
// set options before initializing
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
47319184
...
@@ -770,11 +770,17 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
...
@@ -770,11 +770,17 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
mTrace
(
"db:%s, replications:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
replications
,
replications
);
mTrace
(
"db:%s, replications:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
replications
,
replications
);
newCfg
.
replications
=
replications
;
newCfg
.
replications
=
replications
;
}
}
if
(
replications
>
mgmtGetDnodesNum
())
{
if
(
replications
>
mgmtGetDnodesNum
())
{
mError
(
"db:%s, no enough dnode to change replica:%d"
,
pDb
->
name
,
replications
);
mError
(
"db:%s, no enough dnode to change replica:%d"
,
pDb
->
name
,
replications
);
terrno
=
TSDB_CODE_NO_ENOUGH_DNODES
;
terrno
=
TSDB_CODE_NO_ENOUGH_DNODES
;
}
}
if
(
pDb
->
cfg
.
replications
-
replications
>=
2
)
{
mError
(
"db:%s, replica number can't change from 3 to 1"
,
pDb
->
name
,
replications
);
terrno
=
TSDB_CODE_INVALID_OPTION
;
}
return
newCfg
;
return
newCfg
;
}
}
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
47319184
...
@@ -336,7 +336,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
...
@@ -336,7 +336,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
if
(
pStatus
->
dnodeId
==
0
)
{
if
(
pStatus
->
dnodeId
==
0
)
{
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
}
else
{
}
else
{
//
mTrace("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess);
mTrace
(
"dnode:%d, status received, access times %d"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
);
}
}
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
47319184
...
@@ -74,6 +74,7 @@ static void mgmtProcessTableCfgMsg(SRpcMsg *rpcMsg);
...
@@ -74,6 +74,7 @@ static void mgmtProcessTableCfgMsg(SRpcMsg *rpcMsg);
static
void
mgmtProcessTableMetaMsg
(
SQueuedMsg
*
queueMsg
);
static
void
mgmtProcessTableMetaMsg
(
SQueuedMsg
*
queueMsg
);
static
void
mgmtGetSuperTableMeta
(
SQueuedMsg
*
pMsg
);
static
void
mgmtGetSuperTableMeta
(
SQueuedMsg
*
pMsg
);
static
void
mgmtGetChildTableMeta
(
SQueuedMsg
*
pMsg
);
static
void
mgmtGetChildTableMeta
(
SQueuedMsg
*
pMsg
);
static
void
mgmtAutoCreateChildTable
(
SQueuedMsg
*
pMsg
);
static
void
mgmtProcessAlterTableMsg
(
SQueuedMsg
*
queueMsg
);
static
void
mgmtProcessAlterTableMsg
(
SQueuedMsg
*
queueMsg
);
static
void
mgmtProcessAlterTableRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mgmtProcessAlterTableRsp
(
SRpcMsg
*
rpcMsg
);
...
@@ -612,9 +613,12 @@ static void mgmtExtractTableName(char* tableId, char* name) {
...
@@ -612,9 +613,12 @@ static void mgmtExtractTableName(char* tableId, char* name) {
static
void
mgmtProcessCreateTableMsg
(
SQueuedMsg
*
pMsg
)
{
static
void
mgmtProcessCreateTableMsg
(
SQueuedMsg
*
pMsg
)
{
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
pMsg
->
pTable
=
mgmtGetTable
(
pCreate
->
tableId
);
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mgmtGetTable
(
pCreate
->
tableId
);
if
(
pMsg
->
pTable
!=
NULL
&&
pMsg
->
retry
==
0
)
{
if
(
pMsg
->
pTable
!=
NULL
&&
pMsg
->
retry
==
0
)
{
if
(
pCreate
->
igExists
)
{
if
(
pCreate
->
getMeta
)
{
mTrace
(
"table:%s, continue to get meta"
,
pCreate
->
tableId
);
mgmtProcessTableMetaMsg
(
pMsg
);
}
else
if
(
pCreate
->
igExists
)
{
mTrace
(
"table:%s, is already exist"
,
pCreate
->
tableId
);
mTrace
(
"table:%s, is already exist"
,
pCreate
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SUCCESS
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SUCCESS
);
}
else
{
}
else
{
...
@@ -624,7 +628,7 @@ static void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
...
@@ -624,7 +628,7 @@ static void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
return
;
return
;
}
}
pMsg
->
pDb
=
mgmtGetDb
(
pCreate
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mgmtGetDb
(
pCreate
->
db
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"table:%s, failed to create, db not selected"
,
pCreate
->
tableId
);
mError
(
"table:%s, failed to create, db not selected"
,
pCreate
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_DB_NOT_SELECTED
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_DB_NOT_SELECTED
);
...
@@ -681,15 +685,21 @@ static void mgmtProcessTableMetaMsg(SQueuedMsg *pMsg) {
...
@@ -681,15 +685,21 @@ static void mgmtProcessTableMetaMsg(SQueuedMsg *pMsg) {
SCMTableInfoMsg
*
pInfo
=
pMsg
->
pCont
;
SCMTableInfoMsg
*
pInfo
=
pMsg
->
pCont
;
mTrace
(
"table:%s, table meta msg is received from thandle:%p"
,
pInfo
->
tableId
,
pMsg
->
thandle
);
mTrace
(
"table:%s, table meta msg is received from thandle:%p"
,
pInfo
->
tableId
,
pMsg
->
thandle
);
pMsg
->
pDb
=
mgmtGetDbByTableId
(
pInfo
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mgmtGetDbByTableId
(
pInfo
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"table:%s, failed to get table meta, db not selected"
,
pInfo
->
tableId
);
mError
(
"table:%s, failed to get table meta, db not selected"
,
pInfo
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_DB_NOT_SELECTED
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_DB_NOT_SELECTED
);
return
;
return
;
}
}
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mgmtGetTable
(
pInfo
->
tableId
);
if
(
pMsg
->
pTable
==
NULL
)
{
if
(
pMsg
->
pTable
==
NULL
)
{
mgmtGetChildTableMeta
(
pMsg
);
if
(
htons
(
pInfo
->
createFlag
)
!=
1
)
{
mError
(
"table:%s, failed to get table meta, table not exist"
,
pInfo
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_INVALID_TABLE
);
}
else
{
mgmtAutoCreateChildTable
(
pMsg
);
}
}
else
{
}
else
{
if
(
pMsg
->
pTable
->
type
!=
TSDB_SUPER_TABLE
)
{
if
(
pMsg
->
pTable
->
type
!=
TSDB_SUPER_TABLE
)
{
mgmtGetChildTableMeta
(
pMsg
);
mgmtGetChildTableMeta
(
pMsg
);
...
@@ -1654,42 +1664,34 @@ static int32_t mgmtDoGetChildTableMeta(SQueuedMsg *pMsg, STableMetaMsg *pMeta) {
...
@@ -1654,42 +1664,34 @@ static int32_t mgmtDoGetChildTableMeta(SQueuedMsg *pMsg, STableMetaMsg *pMeta) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
mgmtGetChildTableMeta
(
SQueuedMsg
*
pMsg
)
{
static
void
mgmtAutoCreateChildTable
(
SQueuedMsg
*
pMsg
)
{
SChildTableObj
*
pTable
=
(
SChildTableObj
*
)
pMsg
->
pTable
;
SCMTableInfoMsg
*
pInfo
=
pMsg
->
pCont
;
SCMTableInfoMsg
*
pInfo
=
pMsg
->
pCont
;
int32_t
contLen
=
sizeof
(
SCMCreateTableMsg
)
+
sizeof
(
STagData
);
if
(
pTable
==
NULL
)
{
SCMCreateTableMsg
*
pCreateMsg
=
rpcMallocCont
(
contLen
);
if
(
htons
(
pInfo
->
createFlag
)
!=
1
)
{
if
(
pCreateMsg
==
NULL
)
{
mError
(
"table:%s, failed to get table meta, table not exist"
,
pInfo
->
tableId
);
mError
(
"table:%s, failed to create table while get meta info, no enough memory"
,
pInfo
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_INVALID_TABLE
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
return
;
return
;
}
else
{
}
//TODO: on demand create table from super table if table does not exists
int32_t
contLen
=
sizeof
(
SCMCreateTableMsg
)
+
sizeof
(
STagData
);
SCMCreateTableMsg
*
pCreateMsg
=
rpcMallocCont
(
contLen
);
if
(
pCreateMsg
==
NULL
)
{
mError
(
"table:%s, failed to create table while get meta info, no enough memory"
,
pInfo
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
return
;
}
memcpy
(
pCreateMsg
->
schema
,
pInfo
->
tags
,
sizeof
(
STagData
));
strncpy
(
pCreateMsg
->
tableId
,
pInfo
->
tableId
,
tListLen
(
pInfo
->
tableId
));
SQueuedMsg
*
newMsg
=
malloc
(
sizeof
(
SQueuedMsg
));
strncpy
(
pCreateMsg
->
tableId
,
pInfo
->
tableId
,
tListLen
(
pInfo
->
tableId
));
memcpy
(
newMsg
,
pMsg
,
sizeof
(
SQueuedMsg
));
strcpy
(
pCreateMsg
->
db
,
pMsg
->
pDb
->
name
);
pMsg
->
pCont
=
NULL
;
pCreateMsg
->
igExists
=
1
;
pCreateMsg
->
getMeta
=
1
;
memcpy
(
pCreateMsg
->
schema
,
pInfo
->
tags
,
sizeof
(
STagData
));
newMsg
->
ahandle
=
newMsg
->
pCont
;
SQueuedMsg
*
newMsg
=
mgmtCloneQueuedMsg
(
pMsg
)
;
newMsg
->
pCont
=
pCreateMsg
;
pMsg
->
pCont
=
newMsg
->
pCont
;
mTrace
(
"table:%s, start to create in demand"
,
pInfo
->
tableId
)
;
newMsg
->
pCont
=
pCreateMsg
;
mgmtAddToShellQueue
(
newMsg
);
return
;
mTrace
(
"table:%s, start to create on demand"
,
pInfo
->
tableId
)
;
}
mgmtAddToShellQueue
(
newMsg
);
}
}
static
void
mgmtGetChildTableMeta
(
SQueuedMsg
*
pMsg
)
{
STableMetaMsg
*
pMeta
=
rpcMallocCont
(
sizeof
(
STableMetaMsg
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
);
STableMetaMsg
*
pMeta
=
rpcMallocCont
(
sizeof
(
STableMetaMsg
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
);
if
(
pMeta
==
NULL
)
{
if
(
pMeta
==
NULL
)
{
mError
(
"table:%s, failed to get table meta, no enough memory"
,
p
Table
->
info
.
tableId
);
mError
(
"table:%s, failed to get table meta, no enough memory"
,
p
Msg
->
pTable
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
return
;
return
;
}
}
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
47319184
...
@@ -745,16 +745,14 @@ void mgmtDropAllVgroups(SDbObj *pDropDb) {
...
@@ -745,16 +745,14 @@ void mgmtDropAllVgroups(SDbObj *pDropDb) {
void
*
pNode
=
NULL
;
void
*
pNode
=
NULL
;
void
*
pLastNode
=
NULL
;
void
*
pLastNode
=
NULL
;
int32_t
numOfVgroups
=
0
;
int32_t
numOfVgroups
=
0
;
int32_t
dbNameLen
=
strlen
(
pDropDb
->
name
);
SVgObj
*
pVgroup
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
mPrint
(
"db:%s, all vgroups will be dropped from sdb"
,
pDropDb
->
name
);
mPrint
(
"db:%s, all vgroups will be dropped from sdb"
,
pDropDb
->
name
);
while
(
1
)
{
while
(
1
)
{
pNode
=
sdbFetchRow
(
tsVgroupSdb
,
pNode
,
(
void
**
)
&
pVgroup
);
pNode
=
sdbFetchRow
(
tsVgroupSdb
,
pNode
,
(
void
**
)
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
==
NULL
)
break
;
if
(
strncmp
(
pDropDb
->
name
,
pVgroup
->
dbName
,
dbNameLen
)
==
0
)
{
if
(
pVgroup
->
pDb
==
pDropDb
)
{
SSdbOper
oper
=
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_LOCAL
,
.
type
=
SDB_OPER_LOCAL
,
.
table
=
tsVgroupSdb
,
.
table
=
tsVgroupSdb
,
...
@@ -763,9 +761,9 @@ void mgmtDropAllVgroups(SDbObj *pDropDb) {
...
@@ -763,9 +761,9 @@ void mgmtDropAllVgroups(SDbObj *pDropDb) {
sdbDeleteRow
(
&
oper
);
sdbDeleteRow
(
&
oper
);
pNode
=
pLastNode
;
pNode
=
pLastNode
;
numOfVgroups
++
;
numOfVgroups
++
;
mgmtSendDropVgroupMsg
(
pVgroup
,
NULL
);
}
}
mgmtSendDropVgroupMsg
(
pVgroup
,
NULL
);
mgmtDecVgroupRef
(
pVgroup
);
mgmtDecVgroupRef
(
pVgroup
);
}
}
...
...
src/os/darwin/src/darwinEnv.c
浏览文件 @
47319184
...
@@ -23,8 +23,8 @@ void osInit() {
...
@@ -23,8 +23,8 @@ void osInit() {
strcpy
(
tsVnodeDir
,
""
);
strcpy
(
tsVnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
d
ataDir
,
"/var/lib/taos"
);
strcpy
(
tsD
ataDir
,
"/var/lib/taos"
);
strcpy
(
l
ogDir
,
"~/TDengineLog"
);
strcpy
(
tsL
ogDir
,
"~/TDengineLog"
);
strcpy
(
s
criptDir
,
"/etc/taos"
);
strcpy
(
tsS
criptDir
,
"/etc/taos"
);
strcpy
(
o
sName
,
"Darwin"
);
strcpy
(
tsO
sName
,
"Darwin"
);
}
}
src/os/linux/src/linuxEnv.c
浏览文件 @
47319184
...
@@ -23,8 +23,8 @@ void osInit() {
...
@@ -23,8 +23,8 @@ void osInit() {
strcpy
(
tsVnodeDir
,
""
);
strcpy
(
tsVnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
d
ataDir
,
"/var/lib/taos"
);
strcpy
(
tsD
ataDir
,
"/var/lib/taos"
);
strcpy
(
l
ogDir
,
"/var/log/taos"
);
strcpy
(
tsL
ogDir
,
"/var/log/taos"
);
strcpy
(
s
criptDir
,
"/etc/taos"
);
strcpy
(
tsS
criptDir
,
"/etc/taos"
);
strcpy
(
o
sName
,
"Linux"
);
strcpy
(
tsO
sName
,
"Linux"
);
}
}
\ No newline at end of file
src/os/linux/src/linuxSysPara.c
浏览文件 @
47319184
...
@@ -290,11 +290,12 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
...
@@ -290,11 +290,12 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
bool
taosGetDisk
()
{
bool
taosGetDisk
()
{
struct
statvfs
info
;
struct
statvfs
info
;
const
double
unit
=
1024
*
1024
*
1024
;
const
double
unit
=
1024
*
1024
*
1024
;
if
(
tscEmbedded
)
{
if
(
tscEmbedded
)
{
if
(
statvfs
(
dataDir
,
&
info
))
{
if
(
statvfs
(
tsDataDir
,
&
info
))
{
tsTotalDataDirGB
=
0
;
//tsTotalDataDirGB = 0;
tsAvailDataDirGB
=
0
;
//tsAvailDataDirGB = 0;
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
return
false
;
return
false
;
}
else
{
}
else
{
tsTotalDataDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
tsTotalDataDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
...
@@ -302,9 +303,10 @@ bool taosGetDisk() {
...
@@ -302,9 +303,10 @@ bool taosGetDisk() {
}
}
}
}
if
(
statvfs
(
logDir
,
&
info
))
{
if
(
statvfs
(
tsLogDir
,
&
info
))
{
tsTotalLogDirGB
=
0
;
//tsTotalLogDirGB = 0;
tsAvailLogDirGB
=
0
;
//tsAvailLogDirGB = 0;
uError
(
"failed to get disk size, logDir:%s errno:%s"
,
tsLogDir
,
strerror
(
errno
));
return
false
;
return
false
;
}
else
{
}
else
{
tsTotalLogDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
tsTotalLogDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
...
@@ -312,8 +314,9 @@ bool taosGetDisk() {
...
@@ -312,8 +314,9 @@ bool taosGetDisk() {
}
}
if
(
statvfs
(
"/tmp"
,
&
info
))
{
if
(
statvfs
(
"/tmp"
,
&
info
))
{
tsTotalTmpDirGB
=
0
;
//tsTotalTmpDirGB = 0;
tsAvailTmpDirGB
=
0
;
//tsAvailTmpDirGB = 0;
uError
(
"failed to get disk size, tmpDir:/tmp errno:%s"
,
strerror
(
errno
));
return
false
;
return
false
;
}
else
{
}
else
{
tsTotalTmpDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
tsTotalTmpDirGB
=
(
float
)((
double
)
info
.
f_blocks
*
(
double
)
info
.
f_frsize
/
unit
);
...
...
src/os/windows/src/twinenv.c
浏览文件 @
47319184
...
@@ -23,8 +23,8 @@ void osInit() {
...
@@ -23,8 +23,8 @@ void osInit() {
strcpy
(
tsVnodeDir
,
"C:/TDengine/data"
);
strcpy
(
tsVnodeDir
,
"C:/TDengine/data"
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
d
ataDir
,
"C:/TDengine/data"
);
strcpy
(
tsD
ataDir
,
"C:/TDengine/data"
);
strcpy
(
l
ogDir
,
"C:/TDengine/log"
);
strcpy
(
tsL
ogDir
,
"C:/TDengine/log"
);
strcpy
(
s
criptDir
,
"C:/TDengine/script"
);
strcpy
(
tsS
criptDir
,
"C:/TDengine/script"
);
strcpy
(
o
sName
,
"Windows"
);
strcpy
(
tsO
sName
,
"Windows"
);
}
}
\ No newline at end of file
src/plugins/http/src/httpSystem.c
浏览文件 @
47319184
...
@@ -117,7 +117,7 @@ void httpCleanUpSystem() {
...
@@ -117,7 +117,7 @@ void httpCleanUpSystem() {
httpPrint
(
"http service cleanup"
);
httpPrint
(
"http service cleanup"
);
httpStopSystem
();
httpStopSystem
();
#if
1
#if
0
if (httpServer == NULL) {
if (httpServer == NULL) {
return;
return;
}
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
47319184
...
@@ -915,7 +915,7 @@ _exit:
...
@@ -915,7 +915,7 @@ _exit:
}
}
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SSkipListIterator
**
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
)
{
static
int
tsdbCommitToFile
(
STsdbRepo
*
pRepo
,
int
fid
,
SSkipListIterator
**
iters
,
SRWHelper
*
pHelper
,
SDataCols
*
pDataCols
)
{
char
dataDir
[
128
]
=
{
0
};
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbFileH
*
pFileH
=
pRepo
->
tsdbFileH
;
STsdbFileH
*
pFileH
=
pRepo
->
tsdbFileH
;
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
...
...
src/util/src/hash.c
浏览文件 @
47319184
...
@@ -540,7 +540,7 @@ bool taosHashIterNext(SHashMutableIterator *pIter) {
...
@@ -540,7 +540,7 @@ bool taosHashIterNext(SHashMutableIterator *pIter) {
}
}
size_t
size
=
taosHashGetSize
(
pIter
->
pHashObj
);
size_t
size
=
taosHashGetSize
(
pIter
->
pHashObj
);
if
(
size
==
0
||
pIter
->
num
>=
size
)
{
if
(
size
==
0
)
{
return
false
;
return
false
;
}
}
...
...
src/util/src/tconfig.c
浏览文件 @
47319184
...
@@ -249,7 +249,7 @@ void taosReadGlobalLogCfg() {
...
@@ -249,7 +249,7 @@ void taosReadGlobalLogCfg() {
}
}
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
taosReadLogOption
(
"
logDir"
,
l
ogDir
);
taosReadLogOption
(
"
tsLogDir"
,
tsL
ogDir
);
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
fp
=
fopen
(
fileName
,
"r"
);
fp
=
fopen
(
fileName
,
"r"
);
...
...
src/util/src/tlog.c
浏览文件 @
47319184
...
@@ -66,7 +66,7 @@ int32_t tsAsyncLog = 1;
...
@@ -66,7 +66,7 @@ int32_t tsAsyncLog = 1;
float
tsTotalLogDirGB
=
0
;
float
tsTotalLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsMinimalLogDirGB
=
0
.
1
;
float
tsMinimalLogDirGB
=
0
.
1
;
char
l
ogDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/taos"
;
char
tsL
ogDir
[
TSDB_FILENAME_LEN
]
=
"/var/log/taos"
;
static
SLogObj
tsLogObj
=
{
.
fileNum
=
1
};
static
SLogObj
tsLogObj
=
{
.
fileNum
=
1
};
static
void
*
taosAsyncOutputLog
(
void
*
param
);
static
void
*
taosAsyncOutputLog
(
void
*
param
);
...
@@ -298,7 +298,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
...
@@ -298,7 +298,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
void
taosPrintLog
(
const
char
*
const
flags
,
int32_t
dflag
,
const
char
*
const
format
,
...)
{
void
taosPrintLog
(
const
char
*
const
flags
,
int32_t
dflag
,
const
char
*
const
format
,
...)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop print log.
\n
"
,
l
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop print log.
\n
"
,
tsL
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
fflush
(
stdout
);
return
;
return
;
}
}
...
@@ -356,7 +356,7 @@ void taosPrintLog(const char *const flags, int32_t dflag, const char *const form
...
@@ -356,7 +356,7 @@ void taosPrintLog(const char *const flags, int32_t dflag, const char *const form
void
taosDumpData
(
unsigned
char
*
msg
,
int32_t
len
)
{
void
taosDumpData
(
unsigned
char
*
msg
,
int32_t
len
)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop dump log.
\n
"
,
l
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop dump log.
\n
"
,
tsL
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
fflush
(
stdout
);
return
;
return
;
}
}
...
@@ -385,7 +385,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
...
@@ -385,7 +385,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
void
taosPrintLongString
(
const
char
*
const
flags
,
int32_t
dflag
,
const
char
*
const
format
,
...)
{
void
taosPrintLongString
(
const
char
*
const
flags
,
int32_t
dflag
,
const
char
*
const
format
,
...)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
if
(
tsTotalLogDirGB
!=
0
&&
tsAvailLogDirGB
<
tsMinimalLogDirGB
)
{
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop write log.
\n
"
,
l
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
printf
(
"server disk:%s space remain %.3f GB, total %.1f GB, stop write log.
\n
"
,
tsL
ogDir
,
tsAvailLogDirGB
,
tsTotalLogDirGB
);
fflush
(
stdout
);
fflush
(
stdout
);
return
;
return
;
}
}
...
...
src/util/src/tnote.c
浏览文件 @
47319184
...
@@ -27,10 +27,10 @@ void taosInitNote(int numOfNoteLines, int maxNotes, char* lable)
...
@@ -27,10 +27,10 @@ void taosInitNote(int numOfNoteLines, int maxNotes, char* lable)
if
(
strcasecmp
(
lable
,
"http_note"
)
==
0
)
{
if
(
strcasecmp
(
lable
,
"http_note"
)
==
0
)
{
pNote
=
&
m_HttpNote
;
pNote
=
&
m_HttpNote
;
sprintf
(
temp
,
"%s/httpnote"
,
l
ogDir
);
sprintf
(
temp
,
"%s/httpnote"
,
tsL
ogDir
);
}
else
if
(
strcasecmp
(
lable
,
"tsc_note"
)
==
0
)
{
}
else
if
(
strcasecmp
(
lable
,
"tsc_note"
)
==
0
)
{
pNote
=
&
m_TscNote
;
pNote
=
&
m_TscNote
;
sprintf
(
temp
,
"%s/tscnote-%d"
,
l
ogDir
,
getpid
());
sprintf
(
temp
,
"%s/tscnote-%d"
,
tsL
ogDir
,
getpid
());
}
else
{
}
else
{
return
;
return
;
}
}
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
47319184
...
@@ -311,7 +311,7 @@ void *vnodeGetWqueue(int32_t vgId) {
...
@@ -311,7 +311,7 @@ void *vnodeGetWqueue(int32_t vgId) {
SVnodeObj
*
pVnode
=
vnodeAccquireVnode
(
vgId
);
SVnodeObj
*
pVnode
=
vnodeAccquireVnode
(
vgId
);
if
(
pVnode
==
NULL
)
return
NULL
;
if
(
pVnode
==
NULL
)
return
NULL
;
return
pVnode
->
wqueue
;
return
pVnode
->
wqueue
;
}
}
void
*
vnodeGetWal
(
void
*
pVnode
)
{
void
*
vnodeGetWal
(
void
*
pVnode
)
{
return
((
SVnodeObj
*
)
pVnode
)
->
wal
;
return
((
SVnodeObj
*
)
pVnode
)
->
wal
;
...
@@ -341,10 +341,13 @@ static void vnodeBuildVloadMsg(char *pNode, void * param) {
...
@@ -341,10 +341,13 @@ static void vnodeBuildVloadMsg(char *pNode, void * param) {
}
}
static
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
)
{
static
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
)
{
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
//syncStop(pVnode->sync);
if
(
pVnode
->
sync
)
{
syncStop
(
pVnode
->
sync
);
pVnode
->
sync
=
NULL
;
}
tsdbCloseRepo
(
pVnode
->
tsdb
);
tsdbCloseRepo
(
pVnode
->
tsdb
);
walClose
(
pVnode
->
wal
);
walClose
(
pVnode
->
wal
);
vnodeSaveVersion
(
pVnode
);
vnodeSaveVersion
(
pVnode
);
...
@@ -379,7 +382,8 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
...
@@ -379,7 +382,8 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
sprintf
(
cfgFile
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnodeCfg
->
cfg
.
vgId
);
sprintf
(
cfgFile
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnodeCfg
->
cfg
.
vgId
);
FILE
*
fp
=
fopen
(
cfgFile
,
"w"
);
FILE
*
fp
=
fopen
(
cfgFile
,
"w"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
dError
(
"vgId:%d, failed to open vnode cfg file for write, error:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
strerror
(
errno
));
dError
(
"vgId:%d, failed to open vnode cfg file for write, file:%s error:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
cfgFile
,
strerror
(
errno
));
return
errno
;
return
errno
;
}
}
...
@@ -444,7 +448,8 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
...
@@ -444,7 +448,8 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
sprintf
(
cfgFile
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
sprintf
(
cfgFile
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
cfgFile
,
"r"
);
FILE
*
fp
=
fopen
(
cfgFile
,
"r"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode cfg file for read, error:%s"
,
pVnode
,
pVnode
->
vgId
,
strerror
(
errno
));
dError
(
"pVnode:%p vgId:%d, failed to open vnode cfg file for read, file:%s, error:%s"
,
pVnode
,
pVnode
->
vgId
,
cfgFile
,
strerror
(
errno
));
return
errno
;
return
errno
;
}
}
...
@@ -645,13 +650,13 @@ PARSE_OVER:
...
@@ -645,13 +650,13 @@ PARSE_OVER:
return
ret
;
return
ret
;
}
}
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
)
{
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
)
{
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
,
strerror
(
errno
));
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, file:%s error:%s"
,
pVnode
,
pVnode
->
vgId
,
versionFile
,
strerror
(
errno
));
return
errno
;
return
errno
;
}
}
...
@@ -667,7 +672,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
...
@@ -667,7 +672,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
fclose
(
fp
);
fclose
(
fp
);
free
(
content
);
free
(
content
);
dPrint
(
"pVnode:%p vgId:%d, save vnode version
successed"
,
pVnode
,
pVnode
->
vgId
);
dPrint
(
"pVnode:%p vgId:%d, save vnode version
:%"
PRId64
" successed"
,
pVnode
,
pVnode
->
vgId
,
pVnode
->
version
);
return
0
;
return
0
;
}
}
...
@@ -675,9 +680,10 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
...
@@ -675,9 +680,10 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
static
bool
vnodeReadVersion
(
SVnodeObj
*
pVnode
)
{
static
bool
vnodeReadVersion
(
SVnodeObj
*
pVnode
)
{
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"
w
"
);
FILE
*
fp
=
fopen
(
versionFile
,
"
r
"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
,
strerror
(
errno
));
dTrace
(
"pVnode:%p vgId:%d, failed to open version file:%s error:%s"
,
pVnode
,
pVnode
->
vgId
,
versionFile
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
...
...
tests/script/sh/exec_up.sh
浏览文件 @
47319184
...
@@ -70,24 +70,15 @@ if [ "$CLEAR_OPTION" = "clear" ]; then
...
@@ -70,24 +70,15 @@ if [ "$CLEAR_OPTION" = "clear" ]; then
rm
-rf
$MGMT_DIR
rm
-rf
$MGMT_DIR
fi
fi
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
echo
"ExcuteCmd:"
$EXE_DIR
/taosd
-c
$CFG_DIR
echo
"ExcuteCmd:"
$EXE_DIR
/taos
-c
$CFG_DIR
-u
$USERS
-p
$EXE_DIR
/taos
-c
$CFG_DIR
-u
$USERS
-p
if
[
"
$SHELL_OPTION
"
=
"true"
]
;
then
nohup
valgrind
--log-file
=
${
LOG_DIR
}
/valgrind.log
--tool
=
memcheck
--leak-check
=
full
--show-reachable
=
no
--track-origins
=
yes
--show-leak-kinds
=
all
-v
--workaround-gcc296-bugs
=
yes
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
else
else
#relative path
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
RCFG_DIR
=
sim/
$NODE_NAME
/cfg
PID
=
`
ps
-ef
|grep
-v
taosd |
grep
taos |
grep
$RCFG_DIR
|
grep
-v
grep
|
awk
'{print $2}'
`
if
[
-n
"
$PID
"
]
;
then
sudo kill
-9
$PID
fi
fi
fi
return
fi
if
[
"
$EXEC_OPTON
"
=
"start"
]
;
then
echo
"ExcuteCmd:"
$EXE_DIR
/taosd
-c
$CFG_DIR
nohup
$EXE_DIR
/taosd
-c
$CFG_DIR
>
/dev/null 2>&1 &
#TT=`date +%s`
#TT=`date +%s`
#mkdir ${LOG_DIR}/${TT}
#mkdir ${LOG_DIR}/${TT}
#echo valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR
#echo valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR
...
...
tests/script/unique/db/commit.sim
浏览文件 @
47319184
...
@@ -17,13 +17,13 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
...
@@ -17,13 +17,13 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4
print ========= start dnode1 as master
print ========= start dnode1 as master
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sleep 3000
sleep 3000
print ========= start other dnodes
print ========= start other dnodes
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 3000
sleep 3000
print ======== step1 create db
print ======== step1 create db
...
@@ -50,9 +50,9 @@ if $data01 != 40 then
...
@@ -50,9 +50,9 @@ if $data01 != 40 then
endi
endi
print ======== step2 stop dnode
print ======== step2 stop dnode
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 3000
sleep 3000
sql select * from tb order by ts desc
sql select * from tb order by ts desc
...
@@ -101,9 +101,9 @@ if $data01 != 40 then
...
@@ -101,9 +101,9 @@ if $data01 != 40 then
endi
endi
print ======== step5 stop dnode
print ======== step5 stop dnode
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 3000
sleep 3000
sql select * from tb
sql select * from tb
...
...
tests/script/unique/db/delete.sim
浏览文件 @
47319184
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200
system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200
system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
...
tests/script/unique/db/delete_part.sim
浏览文件 @
47319184
...
@@ -35,10 +35,10 @@ system sh/cfg.sh -n dnode3 -c tables -v 4
...
@@ -35,10 +35,10 @@ system sh/cfg.sh -n dnode3 -c tables -v 4
system sh/cfg.sh -n dnode4 -c tables -v 4
system sh/cfg.sh -n dnode4 -c tables -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 3000
sleep 3000
$loop = 0
$loop = 0
...
@@ -59,13 +59,13 @@ begin:
...
@@ -59,13 +59,13 @@ begin:
endw
endw
print ======== step2
print ======== step2
system sh/exec.sh -n dnode2 -s stop
system sh/exec
_up
.sh -n dnode2 -s stop
sql drop database $db
sql drop database $db
print ======== step3
print ======== step3
sleep 3000
sleep 3000
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 20000
sleep 20000
print ===> test times : $loop
print ===> test times : $loop
...
...
tests/script/unique/db/replica_add12.sim
浏览文件 @
47319184
...
@@ -145,7 +145,9 @@ if $rows != 2 then
...
@@ -145,7 +145,9 @@ if $rows != 2 then
return -1
return -1
endi
endi
sql reset query cache
sleep 2000
sleep 2000
print ========= step5
print ========= step5
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -155,7 +157,7 @@ if $rows != 2 then
...
@@ -155,7 +157,7 @@ if $rows != 2 then
return -1
return -1
endi
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows != 2 then
if $rows != 2 then
return -1
return -1
endi
endi
...
@@ -172,11 +174,12 @@ endi
...
@@ -172,11 +174,12 @@ endi
print ===== insert data
print ===== insert data
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
# no master
sql_error insert into d2.t2 values(now, 3)
sql insert into d3.t3 values(now, 3)
sql insert into d3.t3 values(now, 3)
sql insert into d4.t4 values(now, 3)
# no master
sql_error insert into d4.t4 values(now, 3)
sql select * from d1.t1
sql select * from d1.t1
if $rows != 3 then
if $rows != 3 then
...
@@ -184,7 +187,7 @@ if $rows != 3 then
...
@@ -184,7 +187,7 @@ if $rows != 3 then
endi
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows !=
3
then
if $rows !=
2
then
return -1
return -1
endi
endi
...
@@ -194,32 +197,49 @@ if $rows != 3 then
...
@@ -194,32 +197,49 @@ if $rows != 3 then
endi
endi
sql select * from d4.t4
sql select * from d4.t4
if $rows !=
3
then
if $rows !=
2
then
return -1
return -1
endi
endi
print ========= step6
print ========= step6
system sh/exec_up.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode2 -s start
sleep 10000
sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 10000
sql insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
sql insert into d3.t3 values(now, 4)
sql insert into d4.t4 values(now, 4)
sql insert into d2.t2 values(now, 3)
sql insert into d4.t4 values(now, 3)
sql select * from d1.t1
sql select * from d1.t1
if $rows !=
4
then
if $rows !=
3
then
return -1
return -1
endi
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows !=
4
then
if $rows !=
3
then
return -1
return -1
endi
endi
sql select * from d3.t3
sql select * from d3.t3
if $rows != 3 then
return -1
endi
sql select * from d4.t4
if $rows != 3 then
return -1
endi
print ========= step61
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 5000
# no master
sql_error insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
# no master
sql_error insert into d3.t3 values(now, 4)
sql insert into d4.t4 values(now, 4)
sql select * from d2.t2
if $rows != 4 then
if $rows != 4 then
return -1
return -1
endi
endi
...
@@ -231,9 +251,7 @@ endi
...
@@ -231,9 +251,7 @@ endi
print ========= step7
print ========= step7
system sh/exec_up.sh -n dnode3 -s start
system sh/exec_up.sh -n dnode3 -s start
sleep 10000
sleep 5000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 10000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d2.t2 values(now, 5)
...
@@ -241,7 +259,7 @@ sql insert into d3.t3 values(now, 5)
...
@@ -241,7 +259,7 @@ sql insert into d3.t3 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql select * from d1.t1
sql select * from d1.t1
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
...
@@ -251,7 +269,7 @@ if $rows != 5 then
...
@@ -251,7 +269,7 @@ if $rows != 5 then
endi
endi
sql select * from d3.t3
sql select * from d3.t3
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
...
...
tests/script/unique/db/replica_add13.sim
浏览文件 @
47319184
...
@@ -30,14 +30,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
...
@@ -30,14 +30,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sql create dnode 192.168.0.4
sql create dnode 192.168.0.4
system sh/exec.sh -n dnode4 -s start
system sh/exec
_up
.sh -n dnode4 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -81,7 +81,7 @@ sql alter database d1 replica 3
...
@@ -81,7 +81,7 @@ sql alter database d1 replica 3
sql alter database d2 replica 3
sql alter database d2 replica 3
sql alter database d3 replica 3
sql alter database d3 replica 3
sql alter database d4 replica 3
sql alter database d4 replica 3
sleep 1
2
000
sleep 1
0
000
print ======== step3
print ======== step3
$x = 0
$x = 0
...
@@ -93,29 +93,25 @@ show3:
...
@@ -93,29 +93,25 @@ show3:
endi
endi
sql show dnodes
sql show dnodes
print dnode192.168.0.1 ==> openVnodes: $data2_192.168.0.1 freeVnodes: $data3_192.168.0.1
print dnode192.168.0.1 ==> openVnodes: $data3_1
print dnode192.168.0.2 ==> openVnodes: $data2_192.168.0.2 freeVnodes: $data3_192.168.0.2
print dnode192.168.0.2 ==> openVnodes: $data3_2
print dnode192.168.0.3 ==> openVnodes: $data2_192.168.0.3 freeVnodes: $data3_192.168.0.3
print dnode192.168.0.3 ==> openVnodes: $data3_3
print dnode192.168.0.4 ==> openVnodes: $data2_192.168.0.4 freeVnodes: $data3_192.168.0.4
print dnode192.168.0.4 ==> openVnodes: $data3_4
if $data2_192.168.0.1 != 0 then
goto show3
endi
if $data3_1
92.168.0.1 != 4
then
if $data3_1
!= 0
then
goto show3
return -1
endi
endi
if $data3_
192.168.0.2 != 0
then
if $data3_
2 != 4
then
goto show3
return -1
endi
endi
if $data3_
192.168.0.3 != 0
then
if $data3_
3 != 4
then
goto show3
return -1
endi
endi
if $data3_
192.168.0.4 != 0
then
if $data3_
3 != 4
then
goto show3
return -1
endi
endi
print ======== step4
print ======== step4
...
@@ -145,9 +141,10 @@ if $rows != 2 then
...
@@ -145,9 +141,10 @@ if $rows != 2 then
endi
endi
print ========= step5
print ========= step5
sleep 10000
sql reset query cache
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 1000
sleep 3000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d2.t2 values(now, 3)
...
@@ -175,9 +172,9 @@ if $rows != 3 then
...
@@ -175,9 +172,9 @@ if $rows != 3 then
endi
endi
print ========= step6
print ========= step6
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sleep 3000
sql insert into d1.t1 values(now, 4)
sql insert into d1.t1 values(now, 4)
...
@@ -206,9 +203,9 @@ if $rows != 4 then
...
@@ -206,9 +203,9 @@ if $rows != 4 then
endi
endi
print ========= step7
print ========= step7
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode4 -s stop -x SIGINT
sleep 3000
sleep 3000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
...
@@ -237,9 +234,9 @@ if $rows != 5 then
...
@@ -237,9 +234,9 @@ if $rows != 5 then
endi
endi
print ========= step8
print ========= step8
system sh/exec.sh -n dnode4 -s start
system sh/exec
_up
.sh -n dnode4 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sleep 3000
sql insert into d1.t1 values(now, 6)
sql insert into d1.t1 values(now, 6)
...
...
tests/script/unique/db/replica_add23.sim
浏览文件 @
47319184
...
@@ -30,14 +30,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
...
@@ -30,14 +30,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sql create dnode 192.168.0.4
sql create dnode 192.168.0.4
system sh/exec.sh -n dnode4 -s start
system sh/exec
_up
.sh -n dnode4 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -81,7 +81,7 @@ sql alter database d1 replica 3
...
@@ -81,7 +81,7 @@ sql alter database d1 replica 3
sql alter database d2 replica 3
sql alter database d2 replica 3
sql alter database d3 replica 3
sql alter database d3 replica 3
sql alter database d4 replica 3
sql alter database d4 replica 3
sleep 1
2
000
sleep 1
0
000
print ======== step3
print ======== step3
$x = 0
$x = 0
...
@@ -93,41 +93,25 @@ show3:
...
@@ -93,41 +93,25 @@ show3:
endi
endi
sql show dnodes
sql show dnodes
print dnode192.168.0.1 ==> openVnodes: $data2_192.168.0.1 freeVnodes: $data3_192.168.0.1
print dnode192.168.0.1 ==> openVnodes: $data3_1
print dnode192.168.0.2 ==> openVnodes: $data2_192.168.0.2 freeVnodes: $data3_192.168.0.2
print dnode192.168.0.2 ==> openVnodes: $data3_2
print dnode192.168.0.3 ==> openVnodes: $data2_192.168.0.3 freeVnodes: $data3_192.168.0.3
print dnode192.168.0.3 ==> openVnodes: $data3_3
print dnode192.168.0.4 ==> openVnodes: $data2_192.168.0.4 freeVnodes: $data3_192.168.0.4
print dnode192.168.0.4 ==> openVnodes: $data3_4
if $data2_192.168.0.1 != 0 then
goto show3
endi
if $data2_192.168.0.2 != 4 then
goto show3
endi
if $data
2_192.168.0.3 != 4
then
if $data
3_1 != 0
then
goto show3
return -1
endi
endi
if $data
2_192.168.0.4
!= 4 then
if $data
3_2
!= 4 then
goto show3
return -1
endi
endi
if $data3_
192.168.0.1
!= 4 then
if $data3_
3
!= 4 then
goto show3
return -1
endi
endi
if $data3_192.168.0.2 != 0 then
if $data3_3 != 4 then
goto show3
return -1
endi
if $data3_192.168.0.3 != 0 then
goto show3
endi
if $data3_192.168.0.4 != 0 then
goto show3
endi
endi
print ======== step4
print ======== step4
...
@@ -156,10 +140,12 @@ if $rows != 2 then
...
@@ -156,10 +140,12 @@ if $rows != 2 then
return -1
return -1
endi
endi
sleep 10000
sql reset query cache
sleep 1000
print ========= step5
print ========= step5
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep
3
000
sleep
5
000
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d2.t2 values(now, 3)
...
@@ -187,10 +173,10 @@ if $rows != 3 then
...
@@ -187,10 +173,10 @@ if $rows != 3 then
endi
endi
print ========= step6
print ========= step6
system sh/exec.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode2 -s start
sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 4)
sql insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
sql insert into d2.t2 values(now, 4)
...
@@ -218,10 +204,10 @@ if $rows != 4 then
...
@@ -218,10 +204,10 @@ if $rows != 4 then
endi
endi
print ========= step7
print ========= step7
system sh/exec.sh -n dnode3 -s start
system sh/exec_up.sh -n dnode3 -s start
sleep 5000
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode4 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d2.t2 values(now, 5)
...
@@ -249,10 +235,10 @@ if $rows != 5 then
...
@@ -249,10 +235,10 @@ if $rows != 5 then
endi
endi
print ========= step8
print ========= step8
system sh/exec.sh -n dnode4 -s start
system sh/exec_up.sh -n dnode4 -s start
sleep 5000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 6)
sql insert into d1.t1 values(now, 6)
sql insert into d2.t2 values(now, 6)
sql insert into d2.t2 values(now, 6)
...
...
tests/script/unique/db/replica_part.sim
浏览文件 @
47319184
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -65,16 +65,16 @@ if $rows != 1 then
...
@@ -65,16 +65,16 @@ if $rows != 1 then
endi
endi
print ========= step2 alter db
print ========= step2 alter db
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep
3
000
sleep
5
000
sql alter database d1 replica 2
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d3 replica 2
sql alter database d4 replica 2
sql alter database d4 replica 2
sleep
3
000
sleep
5
000
print ========= step3
print ========= step3
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 10000
sleep 10000
print ========= step4
print ========= step4
...
@@ -104,70 +104,39 @@ if $rows != 2 then
...
@@ -104,70 +104,39 @@ if $rows != 2 then
endi
endi
print ========= step5
print ========= step5
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sleep 5000
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d3.t3 values(now, 3)
sql insert into d4.t4 values(now, 3)
sql select * from d1.t1
if $rows != 3 then
return -1
endi
sql select * from d2.t2
if $rows != 3 then
return -1
endi
sql select * from d3.t3
sql reset query cache
if $rows != 3 then
sleep 1000
return -1
endi
sql select * from d4.t4
sql insert into d1.t1 values(now, 3) -x s1
if $rows != 3 then
s1:
return -1
sql insert into d2.t2 values(now, 3) -x s2
endi
s2:
sql insert into d3.t3 values(now, 3) -x s3
s3:
sql insert into d4.t4 values(now, 3) -x s4
s4:
print ========= step6
print ========= step6
system sh/exec.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode2 -s start
sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
sql insert into d3.t3 values(now, 4)
sql insert into d4.t4 values(now, 4)
sql select * from d1.t1
if $rows != 4 then
return -1
endi
sql select * from d2.t2
if $rows != 4 then
return -1
endi
sql select * from d3.t3
if $rows != 4 then
return -1
endi
sql select * from d4.t4
sql insert into d1.t1 values(now, 4) -x s5
if $rows != 4 then
s5:
return -1
sql insert into d2.t2 values(now, 4) -x s6
endi
s6:
sql insert into d3.t3 values(now, 4) -x s7
s7:
sql insert into d4.t4 values(now, 4) -x s8
s8:
print ========= step7
print ========= step7
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d2.t2 values(now, 5)
...
@@ -175,22 +144,6 @@ sql insert into d3.t3 values(now, 5)
...
@@ -175,22 +144,6 @@ sql insert into d3.t3 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql select * from d1.t1
sql select * from d1.t1
if $rows != 5 then
return -1
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows != 5 then
return -1
endi
sql select * from d3.t3
sql select * from d3.t3
if $rows != 5 then
return -1
endi
sql select * from d4.t4
sql select * from d4.t4
if $rows != 5 then
return -1
endi
tests/script/unique/db/replica_reduce21.sim
浏览文件 @
47319184
...
@@ -20,10 +20,10 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
...
@@ -20,10 +20,10 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -70,7 +70,7 @@ error1:
...
@@ -70,7 +70,7 @@ error1:
print ========= step3 alter d1
print ========= step3 alter d1
sql alter database d1 replica 1
sql alter database d1 replica 1
sleep
8
000
sleep
12
000
print ========= step4 query d1
print ========= step4 query d1
sql insert into d1.t1 values(now, 2)
sql insert into d1.t1 values(now, 2)
...
@@ -86,16 +86,12 @@ sql select * from d5.t5
...
@@ -86,16 +86,12 @@ sql select * from d5.t5
if $rows != 1 then
if $rows != 1 then
return -1
return -1
endi
endi
return
print ========= step6 alter d5
sql alter database d5 replica 2 -x error2
return -1
error2:
print ========= step7 drop d1
print ========= step7 drop d1
sql drop database d1
sql drop database d1
sleep
12
000
sleep
5
000
sql reset query cache
print ========= step8
print ========= step8
sql insert into d5.t5 values(now, 2)
sql insert into d5.t5 values(now, 2)
sql insert into d2.t2 values(now, 2)
sql insert into d2.t2 values(now, 2)
...
@@ -123,7 +119,7 @@ if $rows != 2 then
...
@@ -123,7 +119,7 @@ if $rows != 2 then
endi
endi
print ======== step9 stop dnode2
print ======== step9 stop dnode2
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sleep 3000
sql insert into d5.t5 values(now, 3)
sql insert into d5.t5 values(now, 3)
...
...
tests/script/unique/db/replica_reduce31.sim
浏览文件 @
47319184
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -39,8 +39,8 @@ sql create table d2.t2 (ts timestamp, i int)
...
@@ -39,8 +39,8 @@ sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql insert into d2.t2 values(now, 1)
sql insert into d1.t1 values(now, 1)
sql insert into d1.t1 values(now, 1)
sql insert into d2.t2 values(now, 1)
sql insert into d3.t3 values(now, 1)
sql insert into d3.t3 values(now, 1)
sql insert into d4.t4 values(now, 1)
sql insert into d4.t4 values(now, 1)
...
@@ -65,12 +65,25 @@ if $rows != 1 then
...
@@ -65,12 +65,25 @@ if $rows != 1 then
endi
endi
print ========= step2 alter db
print ========= step2 alter db
sql_error alter database d1 replica 1
sql_error alter database d2 replica 1
sql_error alter database d3 replica 1
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sleep 8000
sql alter database d1 replica 1
sql alter database d1 replica 1
sql alter database d2 replica 1
sql alter database d2 replica 1
sql alter database d3 replica 1
sql alter database d3 replica 1
sleep 12000
sleep 8000
print ========= step3
print ========= step3
sql reset query cache
sleep 1000
sql insert into d1.t1 values(now, 2)
sql insert into d1.t1 values(now, 2)
sql insert into d2.t2 values(now, 2)
sql insert into d2.t2 values(now, 2)
sql insert into d3.t3 values(now, 2)
sql insert into d3.t3 values(now, 2)
...
@@ -100,7 +113,7 @@ print ========= step4 alter db
...
@@ -100,7 +113,7 @@ print ========= step4 alter db
sql alter database d1 replica 2
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d3 replica 2
sleep
12
000
sleep
8
000
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d2.t2 values(now, 3)
...
@@ -128,93 +141,46 @@ if $rows != 3 then
...
@@ -128,93 +141,46 @@ if $rows != 3 then
endi
endi
print ========= step4
print ========= step4
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sleep 5000
sql insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
sql insert into d3.t3 values(now, 4)
sql insert into d4.t4 values(now, 4)
sql select * from d1.t1
if $rows != 4 then
return -1
endi
sql select * from d2.t2
if $rows != 4 then
return -1
endi
sql select * from d3.t3
if $rows != 4 then
return -1
endi
sql select * from d4.t4
sql reset query cache
if $rows != 4 then
sleep 1000
return -1
endi
sql insert into d1.t1 values(now, 4) -x step1
step1:
sql insert into d2.t2 values(now, 4) -x step2
step2:
sql insert into d3.t3 values(now, 4) -x step3
step3:
sql insert into d4.t4 values(now, 4) -x step4
step4:
print ========= step5
print ========= step5
system sh/exec.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode2 -s start
sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d3.t3 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql select * from d1.t1
if $rows != 5 then
return -1
endi
sql select * from d2.t2
if $rows != 5 then
return -1
endi
sql select * from d3.t3
if $rows != 5 then
return -1
endi
sql select * from d4.t4
if $rows != 5 then
return -1
endi
sql insert into d1.t1 values(now, 5) -x step5
step5:
sql insert into d2.t2 values(now, 5) -x step6
step6:
sql insert into d3.t3 values(now, 5) -x step7
step7:
sql insert into d4.t4 values(now, 5) -x step8
step8:
print ========= step6
print ========= step6
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 6)
sql insert into d1.t1 values(now, 6)
sql insert into d2.t2 values(now, 6)
sql insert into d2.t2 values(now, 6)
sql insert into d3.t3 values(now, 6)
sql insert into d3.t3 values(now, 6)
sql insert into d4.t4 values(now, 6)
sql insert into d4.t4 values(now, 6)
sql select * from d1.t1
sql select * from d1.t1
if $rows != 6 then
return -1
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows != 6 then
return -1
endi
sql select * from d3.t3
sql select * from d3.t3
if $rows != 6 then
return -1
endi
sql select * from d4.t4
sql select * from d4.t4
if $rows != 6 then
return -1
endi
tests/script/unique/db/replica_reduce32.sim
浏览文件 @
47319184
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
...
@@ -20,12 +20,12 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
print ========= start dnodes
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql connect
sql connect
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 3000
sleep 3000
print ======== step1
print ======== step1
...
@@ -68,6 +68,7 @@ print ========= step2 alter db
...
@@ -68,6 +68,7 @@ print ========= step2 alter db
sql alter database d1 replica 2
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d3 replica 2
sql alter database d4 replica 2
sleep 12000
sleep 12000
print ========= step3
print ========= step3
...
@@ -97,8 +98,8 @@ if $rows != 2 then
...
@@ -97,8 +98,8 @@ if $rows != 2 then
endi
endi
print ========= step4
print ========= step4
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep
3
000
sleep
5
000
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d2.t2 values(now, 3)
...
@@ -126,40 +127,24 @@ if $rows != 3 then
...
@@ -126,40 +127,24 @@ if $rows != 3 then
endi
endi
print ========= step5
print ========= step5
system sh/exec.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode2 -s start
sleep 5000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 3000
sql insert into d1.t1 values(now, 4)
sql insert into d2.t2 values(now, 4)
sql insert into d3.t3 values(now, 4)
sql insert into d4.t4 values(now, 4)
sql select * from d1.t1
if $rows != 4 then
return -1
endi
sql select * from d2.t2
sleep 5000
if $rows != 4 then
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
return -1
sleep 5000
endi
sql select * from d3.t3
sql reset query cache
if $rows != 4 then
sleep 1000
return -1
endi
sql
select * from d4.t4
sql
_error insert into d1.t1 values(now, 4)
if $rows != 4 then
sql_error insert into d2.t2 values(now, 4)
return -1
sql_error insert into d3.t3 values(now, 4)
endi
sql_error insert into d4.t4 values(now, 4)
print ========= step6
print ========= step6
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sleep 5000
sleep 5000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec
_up
.sh -n dnode2 -s stop -x SIGINT
sleep 3000
sleep 3000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
...
@@ -168,21 +153,21 @@ sql insert into d3.t3 values(now, 5)
...
@@ -168,21 +153,21 @@ sql insert into d3.t3 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql select * from d1.t1
sql select * from d1.t1
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
sql select * from d2.t2
sql select * from d2.t2
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
sql select * from d3.t3
sql select * from d3.t3
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
sql select * from d4.t4
sql select * from d4.t4
if $rows !=
5
then
if $rows !=
4
then
return -1
return -1
endi
endi
tests/script/unique/db/testSuite.sim
浏览文件 @
47319184
#run unique/db/commit.sim
#run unique/db/commit.sim
run unique/db/delete.sim
#
run unique/db/delete.sim
run unique/db/replica_add12.sim
run unique/db/replica_add12.sim
run unique/db/replica_add13.sim
run unique/db/replica_add13.sim
run unique/db/replica_add23.sim
run unique/db/replica_add23.sim
...
@@ -7,4 +7,4 @@ run unique/db/replica_reduce21.sim
...
@@ -7,4 +7,4 @@ run unique/db/replica_reduce21.sim
run unique/db/replica_reduce32.sim
run unique/db/replica_reduce32.sim
run unique/db/replica_reduce31.sim
run unique/db/replica_reduce31.sim
run unique/db/replica_part.sim
run unique/db/replica_part.sim
run unique/db/delete_part.sim
#
run unique/db/delete_part.sim
tests/tsim/inc/sim.h
浏览文件 @
47319184
...
@@ -160,7 +160,7 @@ extern SCommand simCmdList[];
...
@@ -160,7 +160,7 @@ extern SCommand simCmdList[];
extern
int
simScriptPos
;
extern
int
simScriptPos
;
extern
int
simScriptSucced
;
extern
int
simScriptSucced
;
extern
int
simDebugFlag
;
extern
int
simDebugFlag
;
extern
char
s
criptDir
[];
extern
char
tsS
criptDir
[];
extern
bool
simAsyncQuery
;
extern
bool
simAsyncQuery
;
SScript
*
simParseScript
(
char
*
fileName
);
SScript
*
simParseScript
(
char
*
fileName
);
...
...
tests/tsim/src/simExe.c
浏览文件 @
47319184
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
void
simLogSql
(
char
*
sql
)
{
void
simLogSql
(
char
*
sql
)
{
static
FILE
*
fp
=
NULL
;
static
FILE
*
fp
=
NULL
;
char
filename
[
256
];
char
filename
[
256
];
sprintf
(
filename
,
"%s/sim.sql"
,
s
criptDir
);
sprintf
(
filename
,
"%s/sim.sql"
,
tsS
criptDir
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
fp
=
fopen
(
filename
,
"w"
);
fp
=
fopen
(
filename
,
"w"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
...
@@ -270,7 +270,7 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
...
@@ -270,7 +270,7 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
bool
simExecuteSystemCmd
(
SScript
*
script
,
char
*
option
)
{
bool
simExecuteSystemCmd
(
SScript
*
script
,
char
*
option
)
{
char
buf
[
4096
]
=
{
0
};
char
buf
[
4096
]
=
{
0
};
sprintf
(
buf
,
"cd %s; "
,
s
criptDir
);
sprintf
(
buf
,
"cd %s; "
,
tsS
criptDir
);
simVisuallizeOption
(
script
,
option
,
buf
+
strlen
(
buf
));
simVisuallizeOption
(
script
,
option
,
buf
+
strlen
(
buf
));
int
code
=
system
(
buf
);
int
code
=
system
(
buf
);
...
@@ -306,9 +306,9 @@ void simStoreSystemContentResult(SScript *script, char *filename) {
...
@@ -306,9 +306,9 @@ void simStoreSystemContentResult(SScript *script, char *filename) {
bool
simExecuteSystemContentCmd
(
SScript
*
script
,
char
*
option
)
{
bool
simExecuteSystemContentCmd
(
SScript
*
script
,
char
*
option
)
{
char
buf
[
4096
]
=
{
0
};
char
buf
[
4096
]
=
{
0
};
char
filename
[
400
]
=
{
0
};
char
filename
[
400
]
=
{
0
};
sprintf
(
filename
,
"%s/%s.tmp"
,
s
criptDir
,
script
->
fileName
);
sprintf
(
filename
,
"%s/%s.tmp"
,
tsS
criptDir
,
script
->
fileName
);
sprintf
(
buf
,
"cd %s; "
,
s
criptDir
);
sprintf
(
buf
,
"cd %s; "
,
tsS
criptDir
);
simVisuallizeOption
(
script
,
option
,
buf
+
strlen
(
buf
));
simVisuallizeOption
(
script
,
option
,
buf
+
strlen
(
buf
));
sprintf
(
buf
,
"%s > %s 2>/dev/null"
,
buf
,
filename
);
sprintf
(
buf
,
"%s > %s 2>/dev/null"
,
buf
,
filename
);
...
...
tests/tsim/src/simParse.c
浏览文件 @
47319184
...
@@ -186,7 +186,7 @@ SScript *simParseScript(char *fileName) {
...
@@ -186,7 +186,7 @@ SScript *simParseScript(char *fileName) {
if
((
fileName
[
0
]
==
'.'
)
||
(
fileName
[
0
]
==
'/'
))
{
if
((
fileName
[
0
]
==
'.'
)
||
(
fileName
[
0
]
==
'/'
))
{
strcpy
(
name
,
fileName
);
strcpy
(
name
,
fileName
);
}
else
{
}
else
{
sprintf
(
name
,
"%s/%s"
,
s
criptDir
,
fileName
);
sprintf
(
name
,
"%s/%s"
,
tsS
criptDir
,
fileName
);
}
}
if
((
fd
=
fopen
(
name
,
"r"
))
==
NULL
)
{
if
((
fd
=
fopen
(
name
,
"r"
))
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录