Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/TD-22023

This commit is contained in:
54liuyao 2024-02-05 18:37:47 +08:00
commit d40dfa973b
9 changed files with 50 additions and 9 deletions

View File

@ -4457,7 +4457,7 @@ static int32_t findVgroupsFromEqualTbname(STranslateContext* pCxt, SEqCondTbName
SName snameTb;
char* tbName = taosArrayGetP(pInfo->aTbnames, j);
toName(pCxt->pParseCxt->acctId, dbName, tbName, &snameTb);
SVgroupInfo vgInfo;
SVgroupInfo vgInfo = {0};
bool bExists;
int32_t code = catalogGetCachedTableHashVgroup(pCxt->pParseCxt->pCatalog, &snameTb, &vgInfo, &bExists);
if (code == TSDB_CODE_SUCCESS && bExists) {
@ -8275,13 +8275,13 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta
return TSDB_CODE_OUT_OF_MEMORY;
}
code = nodesListAppend(pNode1->pParameterList, (SNode*)pFunc1);
code = nodesListStrictAppend(pNode1->pParameterList, nodesCloneNode((SNode*)pFunc1));
if (code) {
nodesDestroyNode((SNode*)pNode1);
return code;
}
code = nodesListAppend((*pSelect1)->pGroupByList, nodesCloneNode((const SNode*)pNode1));
code = nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode1);
if (code) {
return code;
}
@ -8298,7 +8298,7 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta
return TSDB_CODE_OUT_OF_MEMORY;
}
code = nodesListAppend(pNode2->pParameterList, nodesCloneNode((const SNode*)pFunc2));
code = nodesListStrictAppend(pNode2->pParameterList, nodesCloneNode((SNode*)pFunc2));
if (code) {
nodesDestroyNode((SNode*)pNode2);
return code;

View File

@ -755,6 +755,7 @@ void MockCatalogService::destoryCatalogReq(SCatalogReq* pReq) {
taosArrayDestroy(pReq->pUser);
taosArrayDestroy(pReq->pTableIndex);
taosArrayDestroy(pReq->pTableCfg);
taosArrayDestroyEx(pReq->pView, destoryTablesReq);
delete pReq;
}
@ -781,6 +782,7 @@ void MockCatalogService::destoryMetaData(SMetaData* pData) {
taosArrayDestroyEx(pData->pQnodeList, destoryMetaRes);
taosArrayDestroyEx(pData->pTableCfg, destoryMetaRes);
taosArrayDestroyEx(pData->pDnodeList, destoryMetaArrayRes);
taosArrayDestroyEx(pData->pView, destoryMetaRes);
taosMemoryFree(pData->pSvrVer);
delete pData;
}

View File

@ -73,6 +73,7 @@ TEST_F(ParserInitialATest, alterDnode) {
ASSERT_EQ(req.dnodeId, expect.dnodeId);
ASSERT_EQ(std::string(req.config), std::string(expect.config));
ASSERT_EQ(std::string(req.value), std::string(expect.value));
tFreeSMCfgDnodeReq(&req);
});
setCfgDnodeReq(1, "resetLog");
@ -183,6 +184,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
ASSERT_EQ(req.minRows, expect.minRows);
ASSERT_EQ(req.walRetentionPeriod, expect.walRetentionPeriod);
ASSERT_EQ(req.walRetentionSize, expect.walRetentionSize);
tFreeSAlterDbReq(&req);
});
const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE;
@ -827,6 +829,7 @@ TEST_F(ParserInitialATest, alterUser) {
ASSERT_EQ(std::string(req.user), std::string(expect.user));
ASSERT_EQ(std::string(req.pass), std::string(expect.pass));
ASSERT_EQ(std::string(req.objname), std::string(expect.objname));
tFreeSAlterUserReq(&req);
});
setAlterUserReq("wxy", TSDB_ALTER_USER_PASSWD, "123456");
@ -853,6 +856,7 @@ TEST_F(ParserInitialATest, balanceVgroup) {
ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_BALANCE_VGROUP);
SBalanceVgroupReq req = {0};
ASSERT_EQ(tDeserializeSBalanceVgroupReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS);
tFreeSBalanceVgroupReq(&req);
});
run("BALANCE VGROUP");
@ -870,6 +874,7 @@ TEST_F(ParserInitialATest, balanceVgroupLeader) {
SBalanceVgroupLeaderReq req = {0};
ASSERT_EQ(tDeserializeSBalanceVgroupLeaderReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req),
TSDB_CODE_SUCCESS);
tFreeSBalanceVgroupLeaderReq(&req);
});
run("BALANCE VGROUP LEADER");

View File

@ -52,6 +52,7 @@ TEST_F(ParserExplainToSyncdbTest, grant) {
ASSERT_EQ(req.alterType, expect.alterType);
ASSERT_EQ(string(req.user), string(expect.user));
ASSERT_EQ(string(req.objname), string(expect.objname));
tFreeSAlterUserReq(&req);
});
setAlterUserReq(TSDB_ALTER_USER_ADD_PRIVILEGES, PRIVILEGE_TYPE_ALL, "wxy", "0.*");
@ -183,6 +184,7 @@ TEST_F(ParserExplainToSyncdbTest, redistributeVgroup) {
ASSERT_EQ(req.dnodeId1, expect.dnodeId1);
ASSERT_EQ(req.dnodeId2, expect.dnodeId2);
ASSERT_EQ(req.dnodeId3, expect.dnodeId3);
tFreeSRedistributeVgroupReq(&req);
});
setRedistributeVgroupReqFunc(3, 1);
@ -228,6 +230,7 @@ TEST_F(ParserExplainToSyncdbTest, restoreDnode) {
ASSERT_EQ(tDeserializeSRestoreDnodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS);
ASSERT_EQ(req.dnodeId, expect.dnodeId);
ASSERT_EQ(req.restoreType, expect.restoreType);
tFreeSRestoreDnodeReq(&req);
});
setRestoreDnodeReq(1, RESTORE_TYPE__ALL);
@ -272,6 +275,7 @@ TEST_F(ParserExplainToSyncdbTest, revoke) {
ASSERT_EQ(req.alterType, expect.alterType);
ASSERT_EQ(string(req.user), string(expect.user));
ASSERT_EQ(string(req.objname), string(expect.objname));
tFreeSAlterUserReq(&req);
});
setAlterUserReq(TSDB_ALTER_USER_DEL_PRIVILEGES, PRIVILEGE_TYPE_ALL, "wxy", "0.*");

View File

@ -43,6 +43,7 @@ TEST_F(ParserInitialCTest, compact) {
ASSERT_EQ(std::string(req.db), std::string(expect.db));
ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey);
ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey);
tFreeSCompactDbReq(&req);
});
setCompactDbReq("test");
@ -374,6 +375,7 @@ TEST_F(ParserInitialCTest, createDnode) {
ASSERT_EQ(std::string(req.fqdn), std::string(expect.fqdn));
ASSERT_EQ(req.port, expect.port);
tFreeSCreateDnodeReq(&req);
});
setCreateDnodeReq("abc1", 7030);
@ -599,6 +601,7 @@ TEST_F(ParserInitialCTest, createMnode) {
tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(req.dnodeId, expect.dnodeId);
tFreeSMCreateQnodeReq(&req);
});
setCreateMnodeReq(1);
@ -622,6 +625,7 @@ TEST_F(ParserInitialCTest, createQnode) {
tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(req.dnodeId, expect.dnodeId);
tFreeSMCreateQnodeReq(&req);
});
setCreateQnodeReq(1);
@ -1326,6 +1330,7 @@ TEST_F(ParserInitialCTest, createUser) {
ASSERT_EQ(req.enable, expect.enable);
ASSERT_EQ(std::string(req.user), std::string(expect.user));
ASSERT_EQ(std::string(req.pass), std::string(expect.pass));
tFreeSCreateUserReq(&req);
});
setCreateUserReq("wxy", "123456");

View File

@ -117,6 +117,7 @@ TEST_F(ParserInitialDTest, dropDnode) {
ASSERT_EQ(req.port, expect.port);
ASSERT_EQ(req.force, expect.force);
ASSERT_EQ(req.unsafe, expect.unsafe);
tFreeSDropDnodeReq(&req);
});
setDropDnodeReqById(1);
@ -208,6 +209,7 @@ TEST_F(ParserInitialDTest, dropQnode) {
tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(req.dnodeId, expect.dnodeId);
tFreeSDDropQnodeReq(&req);
});
setDropQnodeReq(1);
@ -245,6 +247,7 @@ TEST_F(ParserInitialDTest, dropStream) {
ASSERT_EQ(std::string(req.name), std::string(expect.name));
ASSERT_EQ(req.igNotExists, expect.igNotExists);
tFreeMDropStreamReq(&req);
});
setDropStreamReq("s1");
@ -285,6 +288,7 @@ TEST_F(ParserInitialDTest, dropUser) {
ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSDropUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
ASSERT_EQ(std::string(req.user), std::string(expect.user));
tFreeSDropUserReq(&req);
});
setDropUserReq("wxy");

View File

@ -2977,6 +2977,7 @@ static int32_t lastRowScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogic
}
nodesClearList(cxt.pLastCols);
}
nodesClearList(cxt.pOtherCols);
pAgg->hasLastRow = false;
pAgg->hasLast = false;

View File

@ -42,18 +42,38 @@ class TDTestCase:
def run(self):
binPath = self.getPath()
tdLog.debug("insert full data block and flush db")
tdLog.debug("insert full data block that has first time '2021-10-02 00:00:00.001' and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json")
tdSql.execute("flush database db;")
tdLog.debug("insert disorder data and flush db")
tdLog.debug("insert only a piece of data that is behind the time that already exists and flush db")
tdSql.execute("insert into db.d0 values ('2021-10-01 23:59:59.990',12.793,208,0.84) ;")
tdSql.execute("flush database db;")
tdLog.debug("check data")
sleep(1)
tdSql.query("select count(*) from db.d0;")
tdSql.checkData(0,0,10001)
tdSql.execute("drop database db;")
tdLog.debug("insert full data block that has first time '2021-10-02 00:00:00.001' and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json")
tdSql.execute("flush database db;")
tdLog.debug("insert four pieces of disorder data, and the time range covers the data file that was previously placed on disk and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
tdSql.execute("flush database db;")
tdLog.debug("check data")
tdSql.query("select count(*) from db.d0;",queryTimes=3)
tdSql.checkData(0,0,10004)
tdSql.query("select ts from db.d0 limit 5;")
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')
tdSql.checkData(1, 0, '2021-10-02 00:01:00.000')
tdLog.debug("update disorder data and flush db")
tdLog.debug("update the same disorder data and flush db")
os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json")
tdSql.query("select ts from db.d0 limit 5;")
tdSql.checkData(0, 0, '2021-10-02 00:00:00.001')

View File

@ -58,8 +58,8 @@ class TDTestCase:
tdSql.query(f'select wstart, {self.tdCom.stb_output_select_str} from {tbname}')
else:
tdSql.query(f'select wstart, {self.tdCom.tb_output_select_str} from {tbname}')
if not fill_history_value:
tdSql.checkEqual(tdSql.queryRows, init_num)
# if not fill_history_value:
# tdSql.checkEqual(tdSql.queryRows, init_num)
self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=window_close_ts)
self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=window_close_ts)