Merge pull request #29228 from taosdata/fix/TD-33284-compact-coverage
Fix/td 33284 compact coverage
This commit is contained in:
commit
91a9bc30e2
|
@ -348,6 +348,7 @@ static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pC
|
||||||
req.compactId = compactId;
|
req.compactId = compactId;
|
||||||
req.vgId = pVgroup->vgId;
|
req.vgId = pVgroup->vgId;
|
||||||
req.dnodeId = dnodeid;
|
req.dnodeId = dnodeid;
|
||||||
|
terrno = 0;
|
||||||
|
|
||||||
mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId);
|
mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId);
|
||||||
int32_t contLen = tSerializeSVKillCompactReq(NULL, 0, &req);
|
int32_t contLen = tSerializeSVKillCompactReq(NULL, 0, &req);
|
||||||
|
@ -367,8 +368,10 @@ static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pC
|
||||||
pHead->contLen = htonl(contLen);
|
pHead->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
pHead->vgId = htonl(pVgroup->vgId);
|
||||||
|
|
||||||
if ((contLen = tSerializeSVKillCompactReq((char *)pReq + sizeof(SMsgHead), contLen, &req)) < 0) {
|
mTrace("vgId:%d, build compact vnode config req, contLen:%d", pVgroup->vgId, contLen);
|
||||||
terrno = contLen;
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSVKillCompactReq((char *)pReq + sizeof(SMsgHead), contLen, &req)) < 0) {
|
||||||
|
terrno = ret;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*pContLen = contLen;
|
*pContLen = contLen;
|
||||||
|
@ -401,6 +404,8 @@ static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *p
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_VND_KILL_COMPACT;
|
action.msgType = TDMT_VND_KILL_COMPACT;
|
||||||
|
|
||||||
|
mTrace("trans:%d, kill compact msg len:%d", pTrans->id, contLen);
|
||||||
|
|
||||||
if ((code = mndTransAppendRedoAction(pTrans, &action)) != 0) {
|
if ((code = mndTransAppendRedoAction(pTrans, &action)) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
|
|
|
@ -607,9 +607,9 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 ", state.applyTerm:%" PRId64
|
vDebug("vgId:%d, start to process write request %s, index:%" PRId64 ", applied:%" PRId64 ", state.applyTerm:%" PRId64
|
||||||
", conn.applyTerm:%" PRId64,
|
", conn.applyTerm:%" PRId64 ", contLen:%d",
|
||||||
TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, pVnode->state.applyTerm,
|
TD_VID(pVnode), TMSG_INFO(pMsg->msgType), ver, pVnode->state.applied, pVnode->state.applyTerm,
|
||||||
pMsg->info.conn.applyTerm);
|
pMsg->info.conn.applyTerm, pMsg->contLen);
|
||||||
|
|
||||||
if (!(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm)) {
|
if (!(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm)) {
|
||||||
return terrno = TSDB_CODE_INTERNAL_ERROR;
|
return terrno = TSDB_CODE_INTERNAL_ERROR;
|
||||||
|
|
|
@ -407,7 +407,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/persisit_config.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/persisit_config.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/qmemCtrl.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/qmemCtrl.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/compact_vgroups.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/compact_vgroups.py
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/compact.py -N 3
|
||||||
|
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_create.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_create.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_insert.py
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.dnodes import *
|
||||||
|
from util.sql import *
|
||||||
|
|
||||||
|
import socket
|
||||||
|
import taos
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
|
||||||
|
tdSql.query("CREATE DATABASE power KEEP 365 DURATION 10 BUFFER 16 WAL_LEVEL 1 vgroups 1 replica 1;")
|
||||||
|
|
||||||
|
tdSql.query("CREATE DATABASE power1 KEEP 365 DURATION 10 BUFFER 16 WAL_LEVEL 1 vgroups 1 replica 1;")
|
||||||
|
|
||||||
|
#first
|
||||||
|
tdSql.query("compact database power;")
|
||||||
|
|
||||||
|
tdLog.info("compact id:%d"%tdSql.queryResult[0][1])
|
||||||
|
|
||||||
|
tdSql.query("show compact %d;"%tdSql.queryResult[0][1])
|
||||||
|
|
||||||
|
tdLog.info("detail:%d"%tdSql.queryRows)
|
||||||
|
|
||||||
|
#second
|
||||||
|
tdSql.query("compact database power1;")
|
||||||
|
|
||||||
|
tdLog.info("compact id:%d"%tdSql.queryResult[0][1])
|
||||||
|
|
||||||
|
tdSql.query("show compact %d;"%tdSql.queryResult[0][1])
|
||||||
|
|
||||||
|
tdLog.info("detail:%d"%tdSql.queryRows)
|
||||||
|
|
||||||
|
|
||||||
|
#kill
|
||||||
|
tdSql.query("show compacts;")
|
||||||
|
number1 = tdSql.queryResult[0][0]
|
||||||
|
number2 = tdSql.queryResult[1][0]
|
||||||
|
|
||||||
|
#first
|
||||||
|
tdLog.info("kill compact %d;"%number1)
|
||||||
|
tdSql.query("kill compact %d;"%number1)
|
||||||
|
|
||||||
|
#second
|
||||||
|
tdLog.info("kill compact %d;"%number2)
|
||||||
|
tdSql.query("kill compact %d;"%number2)
|
||||||
|
|
||||||
|
|
||||||
|
#show
|
||||||
|
count = 0
|
||||||
|
tdLog.info("query progress")
|
||||||
|
while count < 50:
|
||||||
|
tdSql.query("show compact %d;"%number1)
|
||||||
|
|
||||||
|
row1 = tdSql.queryRows
|
||||||
|
|
||||||
|
tdSql.query("show compact %d;"%number2)
|
||||||
|
|
||||||
|
row2 = tdSql.queryRows
|
||||||
|
|
||||||
|
tdLog.info("compact%d:detail count:%d"%(number1, row1))
|
||||||
|
tdLog.info("compact%d:detail count:%d"%(number2, row2))
|
||||||
|
|
||||||
|
if row1 == 0 and row2 == 0 :
|
||||||
|
break
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
count +=1
|
||||||
|
#tdLog.info("loop%d"%count)
|
||||||
|
|
||||||
|
if row1 != 0 or row2 != 0:
|
||||||
|
tdLog.exit("compact failed")
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
Loading…
Reference in New Issue