diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index e9f0372752b76bebc617b3d899dd644d668b08f0..091103a911d7195d28761bf4ff053b9ac1f33725 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -119,9 +119,14 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { } int32_t vnodeDrop(int32_t vgId) { + if (tsDnodeVnodesHash == NULL) { + vTrace("vgId:%d, failed to drop, vgId not exist", vgId); + return TSDB_CODE_INVALID_VGROUP_ID; + } + SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); if (ppVnode == NULL || *ppVnode == NULL) { - vTrace("vgId:%d, failed to drop, vgId not exist", vgId); + vTrace("vgId:%d, failed to drop, vgId not find", vgId); return TSDB_CODE_INVALID_VGROUP_ID; } @@ -347,6 +352,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SDMStatusMsg *pStatus) { pLoad->status = pVnode->status; pLoad->role = pVnode->role; pLoad->replica = pVnode->syncCfg.replica; + pStatus->openVnodes++; } void vnodeBuildStatusMsg(void *param) { @@ -359,7 +365,6 @@ void vnodeBuildStatusMsg(void *param) { if (*pVnode == NULL) continue; vnodeBuildVloadMsg(*pVnode, pStatus); - pStatus++; } taosHashDestroyIter(pIter); @@ -412,6 +417,7 @@ static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) { static void vnodeNotifyRole(void *ahandle, int8_t role) { SVnodeObj *pVnode = ahandle; + vPrint("vgId:%d, sync role changed from %d to %d", pVnode->vgId, pVnode->role, role); pVnode->role = role; if (pVnode->role == TAOS_SYNC_ROLE_MASTER) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index db7a3d6757cf5eebbfcabd62a4f25da9e282d3ee..c9cb6960168be34d8e573729c7f219f000d2507b 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -15,7 +15,7 @@ cd ../../../debug; make ./test.sh -f general/cache/restart_metrics.sim ./test.sh -f general/cache/restart_table.sim -./test.sh -f general/connection/connections.sim +./test.sh -f general/connection/connection.sim ./test.sh -f general/column/commit.sim ./test.sh -f general/column/metrics.sim @@ -267,12 +267,12 @@ cd ../../../debug; make ##./test.sh -u -f unique/dnode/balancex.sim ##./test.sh -u -f unique/dnode/offline1.sim ##./test.sh -u -f unique/dnode/offline2.sim -#./test.sh -u -f unique/dnode/remove1.sim -#./test.sh -u -f unique/dnode/remove2.sim +./test.sh -u -f unique/dnode/remove1.sim +#hongze ./test.sh -u -f unique/dnode/remove2.sim #./test.sh -u -f unique/dnode/vnode_clean.sim -##./test.sh -u -f unique/http/admin.sim -##./test.sh -u -f unique/http/opentsdb.sim +./test.sh -u -f unique/http/admin.sim +./test.sh -u -f unique/http/opentsdb.sim #./test.sh -u -f unique/import/replica2.sim #./test.sh -u -f unique/import/replica3.sim @@ -293,8 +293,7 @@ cd ../../../debug; make ./test.sh -u -f unique/mnode/mgmt26.sim ./test.sh -u -f unique/mnode/mgmt33.sim ./test.sh -u -f unique/mnode/mgmt34.sim -#./test.sh -u -f unique/mnode/mgmtr2.sim -#./test.sh -u -f unique/mnode/secondIp.sim +./test.sh -u -f unique/mnode/mgmtr2.sim ##./test.sh -u -f unique/table/delete_part.sim diff --git a/tests/script/unique/dnode/remove1.sim b/tests/script/unique/dnode/remove1.sim index 545c28a4ea14cd3c1d29a4d19a3011158f522850..6b23014b0348c9149bd301cf97dd1b7e7210c6c3 100644 --- a/tests/script/unique/dnode/remove1.sim +++ b/tests/script/unique/dnode/remove1.sim @@ -17,8 +17,8 @@ system sh/cfg.sh -n dnode4 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) @@ -59,17 +59,17 @@ $x = 0 show2: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 10 then return -1 endi sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 -if $data2_1 != 3 then +if $data2_1 != 1 then goto show2 endi -if $data2_2 != 1 then +if $data2_2 != 3 then goto show2 endi @@ -81,7 +81,7 @@ $x = 0 show3: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 10 then return -1 endi @@ -97,7 +97,7 @@ $x = 0 show4: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 10 then return -1 endi @@ -105,7 +105,7 @@ sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 print dnode3 openVnodes $data2_3 -if $data2_2 != NULL then +if $data2_2 != null then goto show4 endi @@ -118,8 +118,8 @@ system sh/exec_up.sh -n dnode4 -s start $x = 0 show5: $x = $x + 1 - sleep 3000 - if $x == 20 then + sleep 2000 + if $x == 10 then return -1 endi sql show dnodes @@ -127,10 +127,10 @@ print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 print dnode3 openVnodes $data2_3 print dnode4 openVnodes $data2_4 -if $data2_1 != 4 then +if $data2_1 != 0 then goto show5 endi -if $data2_2 != NULL then +if $data2_2 != null then goto show5 endi if $data2_3 != 2 then diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim index 972b77a35d240cd3f491c156daa310e8279780c2..77ec1fa630d409b391f72b7733959c1eee29059d 100644 --- a/tests/script/unique/dnode/remove2.sim +++ b/tests/script/unique/dnode/remove2.sim @@ -10,15 +10,15 @@ 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 dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 print ========== step1 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) @@ -59,46 +59,51 @@ $x = 0 show2: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 10 then return -1 endi sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 -if $data2_1 != 3 then +if $data2_1 != 1 then goto show2 endi -if $data2_2 != 1 then +if $data2_2 != 3 then goto show2 endi print ========== step3 system sh/exec_up.sh -n dnode2 -s stop -x SIGINT sql drop dnode $hostname2 -sleep 7001 +sleep 4000 -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 30 then - return -1 - endi - sql show dnodes print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 $data5_192.168.0.2 +print dnode2 openVnodes $data2_2 print ========== step4 sql create dnode $hostname3 system sh/exec_up.sh -n dnode3 -s start +sleep 5000 + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +print dnode3 openVnodes $data2_3 +if $data2_3 != 0 then + return -1 +endi + +print ============ step 4.1 +system sh/exec_up.sh -n dnode2 -s start + $x = 0 show4: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 10 then return -1 endi @@ -106,13 +111,13 @@ sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 print dnode3 openVnodes $data2_3 -if $data2_2 != NULL then +if $data2_2 != null then goto show4 endi -if $data2_1 != 3 then +if $data2_1 != 1 then goto show4 endi -if $data2_3 != 1 then +if $data2_3 != 3 then goto show4 endi diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index 914838361ae8dddcddf5d5e2cf21fcd31fb020cb..ad044e3984486d851391c96622a5d31e18c6e910 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -1,7 +1,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec_up.sh -n dnode1 -s start sleep 3000 @@ -12,7 +14,7 @@ print ============================ dnode1 start print =============== step1 - parse system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":1057,"desc":"database name can not be NULL"}@ then +if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then return -1 endi @@ -24,7 +26,7 @@ endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":1057,"desc":"database name can not be NULL"}@ then +if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then return -1 endi @@ -73,7 +75,7 @@ endi system_content curl -u root:taosdata -d '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1065,"desc":"metric name length can not more than 22"}@ then +if $system_content != @{"errors":[{"datapoint":{"metric":"ab1234567890123456789012345678ab1234567890123456789012345678","stable":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb","table":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb_lga_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"status":"error","code":-2147483389}}],"failed":1,"success":0,"affected_rows":0}@ then return -1 endi @@ -123,13 +125,13 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1071,"desc":"tags size too long"}@ then +if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbbbbbb","table":"sys_cpu_d_bbbbbbb_lga_1_1_1_1_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","group1":"1","group1":"1","group1":"1","group1":"1","host":"web01"},"status":"error","code":-2147483445}}],"failed":1,"success":0,"affected_rows":0}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1073,"desc":"tag name is NULL"}@ then +if $system_content != @{"status":"error","code":1073,"desc":"tag name is null"}@ then return -1 endi @@ -147,7 +149,7 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1076,"desc":"tag value is NULL"}@ then +if $system_content != @{"status":"error","code":1076,"desc":"tag value is null"}@ then return -1 endi @@ -162,7 +164,7 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":0,"status":"succ"}}],"failed":0,"success":1,"affected_rows":0}@ then +if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then return -1 endi @@ -202,7 +204,7 @@ system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 134 print $system_content -if $system_content != @{"failed":0,"success":2}@ then +if $system_content != @{"failed":1,"success":1}@ then return -1 endi diff --git a/tests/script/unique/mnode/mgmtr2.sim b/tests/script/unique/mnode/mgmtr2.sim index 56a4b305737cf0fb22a0aafbb7ae5357f425bd28..625e42a334dc9de7cb85111e17257878e8d2552c 100644 --- a/tests/script/unique/mnode/mgmtr2.sim +++ b/tests/script/unique/mnode/mgmtr2.sim @@ -9,8 +9,8 @@ system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 print ============== step1 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect sql show mnodes $dnode1Role = $data2_1 @@ -23,16 +23,15 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != NULL then +if $dnode2Role != null then return -1 endi -if $dnode3Role != NULL then +if $dnode3Role != null then return -1 endi print ============== step2 sql create dnode $hostname2 -sleep 1700 sql create dnode $hostname3 print ============== step3 @@ -68,10 +67,10 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $rows != 2 then +if $dnode2Role != slave then return -1 endi -if $dnode3Role != NULL then +if $dnode3Role != null then return -1 endi diff --git a/tests/script/unique/mnode/secondIp.sim b/tests/script/unique/mnode/secondIp.sim deleted file mode 100644 index cfe75ffc842859d325ee589055513466f02ceb5c..0000000000000000000000000000000000000000 --- a/tests/script/unique/mnode/secondIp.sim +++ /dev/null @@ -1,44 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -print ========== step1 dnode2 start -system sh/exec_up.sh -n dnode2 -s start -sql connect - -print ========== step2 connect to dnode2 -sql create dnode $hostname1 -system sh/exec_up.sh -n dnode1 -s start -sleep 3000 - -print ========== step3 -sql show dnodes -print dnode1 openvnodes $data3_1 -print dnode2 openvnodes $data3_2 -print dnode1 totalvnodes $data4_1 -print dnode2 totalvnodes $data4_2 - -if $rows != 2 then - return -1 -endi -if $data3_1 != 0 then - return -1 -endi -if $data3_2 != 0 then - return -1 -endi -if $data4_1 != 4 then - return -1 -endi -if $data4_2 != 4 then - return -1 -endi - -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -system sh/exec_up.sh -n dnode4 -s stop -x SIGINT -system sh/exec_up.sh -n dnode5 -s stop -x SIGINT -system sh/exec_up.sh -n dnode6 -s stop -x SIGINT -system sh/exec_up.sh -n dnode7 -s stop -x SIGINT -system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/testSuite.sim b/tests/script/unique/mnode/testSuite.sim index 34d3ce7e53ddbda0ab328324a1a1a622a0941e9b..33df24b860d90ffd9d168a6788998b0955b2f347 100644 --- a/tests/script/unique/mnode/testSuite.sim +++ b/tests/script/unique/mnode/testSuite.sim @@ -5,5 +5,4 @@ run unique/mnode/mgmt25.sim run unique/mnode/mgmt26.sim run unique/mnode/mgmt33.sim run unique/mnode/mgmt34.sim -#run unique/mnode/mgmtr2.sim -#run unique/mnode/secondIp.sim +run unique/mnode/mgmtr2.sim