未验证 提交 af84f8de 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2307 from taosdata/hotfix/test

[TD-421]
......@@ -235,14 +235,12 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
size_t size = sizeof(pConnObj->user);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port);
size = sizeof(ipStr);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
......@@ -356,18 +354,16 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId));
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, QUERY_ID_SIZE);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
size_t size = sizeof(pConnObj->user);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port);
size = sizeof(ipStr);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
......@@ -379,7 +375,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, TSDB_SHOW_SQL_LEN);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]);
cols++;
numOfRows++;
......@@ -479,18 +475,16 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->streamId));
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, QUERY_ID_SIZE);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
size_t size = sizeof(pConnObj->user);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port);
size = sizeof(ipStr);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
......@@ -506,7 +500,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, TSDB_SHOW_SQL_LEN);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
......
# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode
# step 1: start dnode1
# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode)
# step 3: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841)
# step 4: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc
# step 5: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2
# step 6: insert two data rows: now-21d, now-41d
# step 7: restart dnode2, waiting sync end
# step 2: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841)
# step 3: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc
# step 4: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2
# step 5: insert two data rows: now-21d, now-41d
# step 6: restart dnode2, waiting sync end
# expect: in dnode2, the files 1837 and 1839 will be removed
system sh/stop_dnodes.sh
......@@ -113,15 +113,15 @@ sql insert into $tb values ( now - 20d , -20 )
sql insert into $tb values ( now - 40d , -40 )
$totalRows = $totalRows + 2
print ============== step4: stop dnode2, so date rows falling disc, generate two new files in dnode2
system sh/exec.sh -n dnode2 -s stop -x SIGINT
print ============== step4: stop dnode3, so date rows falling disc, generate two new files in dnode3
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep $sleepTimer
wait_dnode2_offline:
wait_dnode3_offline:
sql show dnodes
if $rows != 3 then
sleep 2000
goto wait_dnode2_offline
goto wait_dnode3_offline
endi
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
......@@ -135,13 +135,13 @@ $dnode3Status = $data4_3
#$dnode4Status = $data4_4
#$dnode5Status = $data4_5
if $dnode2Status != offline then
if $dnode3Status != offline then
sleep 2000
goto wait_dnode2_offline
goto wait_dnode3_offline
endi
if $dnode3Status != ready then
if $dnode2Status != ready then
sleep 2000
goto wait_dnode2_offline
goto wait_dnode3_offline
endi
sleep $sleepTimer # waitting for move master vnode of dnode2 to dnode3
......@@ -152,6 +152,12 @@ if $data00 != $totalRows then
return -1
endi
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ---->dnode3 data files: $system_content , expect is 9
#if $system_content != @9@ then
# return -1
#endi
print ============== step5: insert two data rows: now-16d, now+16d,
sql insert into $tb values ( now - 21d , -21 )
sql insert into $tb values ( now - 41d , -41 )
......@@ -163,4 +169,47 @@ if $data00 != $totalRows then
return -1
endi
print ============== step6: please check there should be 3 file in sim/dnode2/data/vnode/vnode2/tsdb/data/, and 1 file sim/dnode3/data/vnode/vnode2/tsdb/data/
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ---->dnode2 data files: $system_content , expect is 3
#if $system_content != @3@ then
# return -1
#endi
print ============== step7: restart dnode3, waiting sync end
system sh/exec.sh -n dnode3 -s start
sleep 3000
wait_dnode3_ready:
sql show dnodes
if $rows != 3 then
sleep 2000
goto wait_dnode3_ready
endi
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
$dnode1Status = $data4_1
$dnode2Status = $data4_2
$dnode3Status = $data4_3
if $dnode3Status != ready then
sleep 2000
goto wait_dnode3_ready
endi
sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ---->dnode2 data files: $system_content , expect is 3
#if $system_content != @3@ then
# return -1
#endi
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ---->dnode3 data files: $system_content , expect is 3
#if $system_content != @3@ then
# return -1
#endi
\ No newline at end of file
......@@ -93,7 +93,7 @@ if $data00 != $totalRows then
return -1
endi
print ============== step3: stop dnode3, then corrupt vnode data file in dnode3
print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep $sleepTimer
wait_dnode3_offline_0:
......@@ -141,13 +141,26 @@ if $dnode2Vtatus != master then
goto wait_dnode3_vgroup_offline
endi
# del the second row
system sed '2d' ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v1849.data
sleep 1000
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | sed 's/^[ \t]*//g'
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | sed 's/[ \t]*$//g'
#print --2-->dnode3 data files: [ $system_content ]
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l
print ---->dnode2 data files: [ $system_content ], expect is 0
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l
print ---->dnode3 data files: [ $system_content ], expect is 3
#if $system_content != 3 then
# return -1
#endi
#system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/f1643.data
#sleep 1000
print ============== step4: restart dnode3, and run query
system sh/exec.sh -n dnode3 -s start
sleep $sleepTimer
wait_dnode3_reready:
sql show dnodes
if $rows != 3 then
......@@ -171,12 +184,49 @@ if $dnode3Status != ready then
goto wait_dnode3_reready
endi
wait_dnode3_vgroup_slave:
sql show vgroups
if $rows != 1 then
sleep 2000
goto wait_dnode3_vgroup_slave
endi
print show vgroups:
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
$dnode2Vtatus = $data7_2
$dnode3Vtatus = $data4_2
if $dnode2Vtatus != master then
sleep 2000
goto wait_dnode3_vgroup_slave
endi
if $dnode3Vtatus != slave then
sleep 2000
goto wait_dnode3_vgroup_slave
endi
sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ----> dnode2 data files: [ $system_content ], expect is 0
#if $system_content != 0 then
# return -1
#endi
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l
print ----> dnode3 data files: [ $system_content ], expect is 0
#if $system_content != 0 then
# print there should be no data file in dnode3 after sync
# return -1
#endi
return -1
print ============== step5: stop dnode2, and check if dnode3 sync ok
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep $sleepTimer
......@@ -229,4 +279,101 @@ sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi
\ No newline at end of file
endi
print ============== step6: stop dnode3 for falling disck
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep $sleepTimer
sql show dnodes
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
sql show vgroups
print show vgroups:
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
print ============== step7: restart dnode3, and run query
system sh/exec.sh -n dnode3 -s start
sleep $sleepTimer
$loopCnt = 0
wait_dnode3_reready_2:
$loopCnt = $loopCnt + 1
if $loopCnt == 10 then
return -1
endi
sql show dnodes
if $rows != 3 then
sleep 2000
goto wait_dnode3_reready_2
endi
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
$dnode1Status = $data4_1
$dnode2Status = $data4_2
$dnode3Status = $data4_3
if $dnode3Status != ready then
sleep 2000
goto wait_dnode3_reready_2
endi
$loopCnt = 0
wait_dnode3_vgroup_master_2:
$loopCnt = $loopCnt + 1
if $loopCnt == 10 then
return -1
endi
sql show vgroups
if $rows != 1 then
sleep 2000
goto wait_dnode3_vgroup_master_2
endi
print show vgroups:
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
$dnode2Vtatus = $data7_2
$dnode3Vtatus = $data4_2
if $dnode2Vtatus != offline then
sleep 2000
goto wait_dnode3_vgroup_master_2
endi
if $dnode3Vtatus != master then
sleep 2000
goto wait_dnode3_vgroup_master_2
endi
sql select count(*) from $stb
print data00 $data00
if $data00 != $totalRows then
return -1
endi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册