rebuild index at tag0

This commit is contained in:
yihaoDeng 2023-08-15 07:26:53 +00:00
parent 615e79d8b3
commit 0f0d0953cd
4 changed files with 63 additions and 14 deletions

View File

@ -696,8 +696,8 @@ int8_t mndCheckIndexNameByTagName(SMnode *pMnode, SIdxObj *pIdxObj) {
continue;
}
if (strncmp(pIdxObj->colName, pIdx->colName, TSDB_COL_NAME_LEN) == 0) {
sdbCancelFetch(pSdb, pIter);
sdbRelease(pSdb, pIdx);
sdbCancelFetch(pSdb, pIdx);
exist = 1;
break;
}
@ -854,8 +854,8 @@ int32_t mndDropIdxsByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
if (pIdx->stbUid == pStb->uid) {
if (mndSetDropIdxCommitLogs(pMnode, pTrans, pIdx) != 0) {
sdbCancelFetch(pSdb, pIter);
sdbRelease(pSdb, pIdx);
sdbCancelFetch(pSdb, pIdx);
return -1;
}
}

View File

@ -1204,6 +1204,9 @@
,,y,script,./test.sh -f tsim/tag/drop_tag.sim
,,y,script,./test.sh -f tsim/tag/tbNameIn.sim
,,y,script,./test.sh -f tmp/monitor.sim
,,y,script,./test.sh -f tsim/tagindex/add_index.sim
,,y,script,./test.sh -f tsim/tagindex/sma_and_tag_index.sim
#develop test
,,n,develop-test,python3 ./test.py -f 2-query/table_count_scan.py

View File

@ -7,7 +7,7 @@ print ======== step0
$dbPrefix = ta_3_db
$tbPrefix = ta_3_tb
$mtPrefix = ta_3_mt
$tbNum = 500
$tbNum = 50
$rowNum = 20
$totalNum = 200
@ -48,12 +48,16 @@ while $i < $tbNum
$i = $i + 1
endw
sql_error create index ti1 on $mtPrefix (t1)
sql create index ti2 on $mtPrefix (t2)
sql create index ti5 on $mtPrefix (t5)
print ==== test name conflict
#
sql_error create index ti1 on $mtPrefix(t1)
sql_error create index ti11 on $mtPrefix(t1)
sql_error create index ti3 on $mtPrefix(t2)
sql_error create index ti2 on $mtPrefix(t2)
@ -73,6 +77,15 @@ while $i < $tbNum
$i = $i + 1
endw
$i = 0
while $i < $tbNum
sql select * from $mtPrefix where t1= $i ;
if $rows != 1 then
return -1
endi
$i = $i + 1
endw
print ===== test operator great equal
@ -250,7 +263,7 @@ endw
print === show index
sql select * from information_schema.ins_indexes
if $rows != 1 then
if $rows != 2 then
return -1
endi
@ -259,12 +272,41 @@ print === drop index ti2
sql drop index ti2
print === drop not exist index
sql select * from information_schema.ins_indexes
if $rows != 1 then
return -1
endi
sql drop index $data[0][0]
if $rows != 0 then
return -1
endi
sql_error drop index t2
sql_error drop index t3
sql create index ti0 on $mtPrefix (t1)
$i = $interval
while $i < $limit
sql select * from $mtPrefix where t1 <= $i ;
$tmp = $i - $interval
$tmp = $tmp + 1
if $rows != $tmp then
return -1
endi
$i = $i + 1
endw
sql_error create index ti0 on $mtPrefix (t1)
sql_error create index ti2 on $mtPrefix (t1)
sql_error create index t2i on ta_3_tb17 (t2)

View File

@ -69,7 +69,7 @@ sql create sma index smat2i on $mtPrefix function(max(c1)) interval(6m,10s) slid
sql select * from information_schema.ins_indexes
if $rows != 2 then
if $rows != 3 then
return -1
endi
@ -84,7 +84,7 @@ while $i < 5
endw
sql select * from information_schema.ins_indexes
if $rows != 6 then
if $rows != 7 then
return -1
endi
@ -114,13 +114,13 @@ sql use $dbPrefix
sql create table if not exists $mtPrefix (ts timestamp, c1 int) tags (t1 int, t2 int, t3 int, t4 int, t5 int)
sql create index tagt2i on $mtPrefix (t2)
sql select * from information_schema.ins_indexes
if $rows != 1 then
if $rows != 2 then
return -1
endi
sql alter table $mtPrefix drop tag t2
sql select * from information_schema.ins_indexes
if $rows != 0 then
if $rows != 1 then
return -1
endi
@ -128,18 +128,22 @@ endi
print ==== rename tag name, and update index colName
sql create index tagt3i on $mtPrefix (t3)
sql select * from information_schema.ins_indexes
if $rows != 1 then
if $rows != 2 then
return -1
endi
sql alter table $mtPrefix rename tag t3 txxx
sql select * from information_schema.ins_indexes
if $rows != 1 then
if $rows != 2 then
return -1
endi
if $data05 != txxx then
return -1
if $data05 == txxx then
print "manual created index"
elif $data15 == txxx then
print "auto created index at tag0"
else
return -1;
endi
@ -153,7 +157,7 @@ sql create table if not exists $mtPrefix (ts timestamp, c1 int) tags (t1 int, t2
sql create index tagt3i on $mtPrefix (t3)
sql select * from information_schema.ins_indexes
if $rows != 2 then
if $rows != 4 then
return -1
endi