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

Merge pull request #17589 from taosdata/fix/sysTableIdx

fix: fix sys idx bug
......@@ -122,7 +122,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, in
if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) {
__compar_fn_t fn = (order == TSDB_ORDER_ASC) ? resultrowComparAsc : resultrowComparDesc;
int32_t size = POINTER_BYTES;
int32_t size = POINTER_BYTES;
taosSort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), size, fn);
}
......@@ -752,8 +752,8 @@ end:
}
static int tableUidCompare(const void* a, const void* b) {
uint64_t u1 = *(uint64_t*)a;
uint64_t u2 = *(uint64_t*)b;
int64_t u1 = *(uint64_t*)a;
int64_t u2 = *(uint64_t*)b;
if (u1 == u2) {
return 0;
}
......
......@@ -3191,12 +3191,24 @@ static int32_t optSysCheckOper(SNode* pOpear) {
}
return 0;
}
static int tableUidCompare(const void* a, const void* b) {
int64_t u1 = *(int64_t*)a;
int64_t u2 = *(int64_t*)b;
if (u1 == u2) {
return 0;
}
return u1 < u2 ? -1 : 1;
}
static int32_t optSysMergeRslt(SArray* mRslt, SArray* rslt) {
// TODO, find comm mem from mRslt
for (int i = 0; i < taosArrayGetSize(mRslt); i++) {
SArray* aRslt = taosArrayGetP(mRslt, i);
taosArrayAddAll(rslt, aRslt);
}
taosArraySort(rslt, tableUidCompare);
taosArrayRemoveDuplicate(rslt, tableUidCompare, NULL);
return 0;
}
......@@ -3455,7 +3467,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
if (i >= taosArrayGetSize(pIdx->uids)) {
doSetOperatorCompleted(pOperator);
} else {
pIdx->lastIdx = i;
pIdx->lastIdx = i + 1;
}
blockDataDestroy(p);
......@@ -3464,7 +3476,9 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes;
}
static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
qError("%p buildUserTable", pTaskInfo);
SSysTableScanInfo* pInfo = pOperator->info;
if (pInfo->pCur == NULL) {
pInfo->pCur = metaOpenTbCursor(pInfo->readHandle.meta);
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
$dbPrefix = m_me_db_idx
$tbPrefix = m_me_tb_idx
$mtPrefix = m_me_mt_idx
print =============== step1
$i = 0
$db = $dbPrefix
$mt = $mtPrefix
sql drop database if exists $db
sql create database $db
sql use $db
sql create table $mt (ts timestamp, speed int) TAGS(sp int)
$tbNum = 10000
while $i < $tbNum
$tb = $tbPrefix . $i
sql insert into $tb using $mt tags( $i ) values(now, $i )
$i = $i + 1
endw
sql use information_schema
sql select count(*) from ins_tables where db_name = "m_me_db_idx" and create_time > now() - 10m
if $data[0][0] != $tbNum then
return -1
endi
sql select count(*) from ins_tables where db_name = "m_me_db_idx" and create_time < now();
if $data[0][0] != $tbNum then
return -1
endi
sleep 1000
sql use $db
$doubletbNum = 20000
while $i < $doubletbNum
$tb = $tbPrefix . $i
sql insert into $tb using $mt tags( $i ) values(now, $i )
$i = $i + 1
endw
sql use information_schema
sql select count(*) from ins_tables where db_name = "m_me_db_idx" and create_time < now();
if $data[0][0] != $doubletbNum then
print ==== $data[0][0]
return -1
endi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册