enh: test case to delete mutiple tables

This commit is contained in:
kailixu 2023-11-10 16:41:41 +08:00
parent 57f7ff5b9c
commit 11c0427b22
2 changed files with 109 additions and 8 deletions

View File

@ -711,8 +711,10 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
continue;
}
smaDebug("vgId:%d, result block, uid:%" PRIu64 ", groupid:%" PRIu64 ", rows:%" PRIi64, SMA_VID(pSma),
output->info.id.uid, output->info.id.groupId, output->info.rows);
smaDebug("vgId:%d, result block, execType:%d, ver:%" PRIi64 ", submitReqVer:%" PRIi64 ", fetchResultVer:%" PRIi64
", suid:%" PRIi64 ", level:%" PRIi8 ", uid:%" PRIu64 ", groupid:%" PRIu64 ", rows:%" PRIi64,
SMA_VID(pSma), execType, output->info.version, pItem->submitReqVer, pItem->fetchResultVer, suid,
pItem->level, output->info.id.uid, output->info.id.groupId, output->info.rows);
if (STREAM_GET_ALL == execType) {
/**
@ -723,7 +725,11 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
// submitReqVer keeps unchanged since tdExecuteRSmaImpl and tdRSmaFetchAllResult are executed synchronously
output->info.version = pItem->submitReqVer;
} else if (output->info.version == pItem->fetchResultVer) {
ASSERTS(0, "duplicated fetch version:%" PRIi64, pItem->fetchResultVer);
smaWarn("vgId:%d, result block, skip dup version, execType:%d, ver:%" PRIi64 ", submitReqVer:%" PRIi64
", fetchResultVer:%" PRIi64 ", suid:%" PRIi64 ", level:%" PRIi8 ", uid:%" PRIu64 ", groupid:%" PRIu64
", rows:%" PRIi64,
SMA_VID(pSma), execType, output->info.version, pItem->submitReqVer, pItem->fetchResultVer, suid,
pItem->level, output->info.id.uid, output->info.id.groupId, output->info.rows);
continue;
}
}
@ -752,8 +758,9 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
atomic_store_64(&pItem->fetchResultVer, output->info.version);
}
smaDebug("vgId:%d, process submit req for rsma suid:%" PRIu64 ",uid:%" PRIu64 ", level %" PRIi8 " ver %" PRIi64,
SMA_VID(pSma), suid, output->info.id.groupId, pItem->level, output->info.version);
smaDebug("vgId:%d, process submit req for rsma suid:%" PRIu64 ",uid:%" PRIu64 ", level:%" PRIi8
", execType:%d, ver:%" PRIi64,
SMA_VID(pSma), suid, output->info.id.groupId, pItem->level, execType, output->info.version);
if (pReq) {
tDestroySubmitReq(pReq, TSDB_MSG_FLG_ENCODE);
@ -881,8 +888,8 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t msgSize,
return TSDB_CODE_FAILED;
}
smaDebug("vgId:%d, execute rsma %" PRIi8 " task for qTaskInfo:%p suid:%" PRIu64 " nMsg:%d", SMA_VID(pSma), level,
RSMA_INFO_QTASK(pInfo, idx), pInfo->suid, msgSize);
smaDebug("vgId:%d, execute rsma %" PRIi8 " task for qTaskInfo:%p, suid:%" PRIu64 ", nMsg:%d, submitReqVer:%" PRIi64 ", inputType:%d", SMA_VID(pSma), level,
RSMA_INFO_QTASK(pInfo, idx), pInfo->suid, msgSize, version, inputType);
if ((terrno = qSetSMAInput(qTaskInfo, pMsg, msgSize, inputType)) < 0) {
smaError("vgId:%d, rsma %" PRIi8 " qSetStreamInput failed since %s", SMA_VID(pSma), level, tstrerror(terrno));

View File

@ -5,7 +5,7 @@ sleep 50
sql connect
print =============== create database with retentions
sql create database d0 retentions -:7d,10s:21d,15s:365d;
sql create database d0 retentions -:7d,10s:21d,15s:365d vgroups 1;
sql use d0
print =============== create super table and register rsma
@ -441,6 +441,100 @@ if $rows != 0 then
return -1
endi
print =============== check delete multiple tables
sql create table ct2 using stb tags("BeiJing", "HaiDian");
sql create table ct3 using stb tags("ShangHai", "PuDong");
sql insert into ct2 values(now, 10, NULL);
sql insert into ct2 values(now+60m, 1, NULL);
sql insert into ct2 values(now+120m, 100, NULL);
sql insert into ct3 values(now, 10, NULL);
sql insert into ct3 values(now+60m, 1, NULL);
sql insert into ct3 values(now+120m, 100, NULL);
print =============== wait 5 seconds for results
sleep 5000
print =============== select * from retention level 2 from memory
sql select * from ct2;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
if $rows != 3 then
print retention level 2 file rows $rows != 3
return -1
endi
if $data01 != 10.00000 then
return -1
endi
if $data02 != NULL then
return -1
endi
if $data11 != 1.00000 then
return -1
endi
if $data12 != NULL then
return -1
endi
if $data21 != 100.00000 then
return -1
endi
if $data22 != NULL then
return -1
endi
sql delete from ct1 where ts < now + 120m;
sql delete from ct3 where ts < now;
sql delete from ct2 where ts < now + 60m;
sql delete from ct2 where ts < now + 120m;
sql delete from ct3 where ts < now + 60m;
sql delete from ct3 where ts < now + 120m;
sql delete from ct3 where ts < now;
print =============== wait 5 seconds for results
sleep 5000
print =============== select * from retention level 2 from memory after delete ct2
sql select * from ct2;
print $data00 $data01 $data02
if $rows != 0 then
print retention level 2 file rows $rows != 0
return -1
endi
print =============== select * from retention level 1 from memory after delete ct3
sql select * from ct3 where ts > now - 8d;
print $data00 $data01 $data02
if $rows != 0 then
print retention level 2 file rows $rows != 0
return -1
endi
#===================================================================
system sh/exec.sh -n dnode1 -s stop -x SIGINT
#===================================================================
system sh/exec.sh -n dnode1 -s start
print =============== wait 5 seconds for results after reboot
sleep 5000
print =============== select * from retention level 1 from memory after delete ct2
sql select * from ct2 where ts > now - 8d;
print $data00 $data01 $data02
if $rows != 0 then
print retention level 2 file rows $rows != 0
return -1
endi
print =============== select * from retention level 2 from memory after delete ct3
sql select * from ct3 where ts > now - 365d;
print $data00 $data01 $data02
if $rows != 0 then
print retention level 2 file rows $rows != 0
return -1
endi
#===================================================================
system sh/exec.sh -n dnode1 -s stop -x SIGINT
#===================================================================