Merge pull request #15173 from taosdata/fix/mnode

fix: definite lost while get sma meta
This commit is contained in:
Shengliang Guan 2022-07-20 12:51:58 +08:00 committed by GitHub
commit 6a78e63953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 122 additions and 90 deletions

View File

@ -2803,6 +2803,7 @@ typedef struct {
int32_t tSerializeSTableIndexRsp(void* buf, int32_t bufLen, const STableIndexRsp* pRsp); int32_t tSerializeSTableIndexRsp(void* buf, int32_t bufLen, const STableIndexRsp* pRsp);
int32_t tDeserializeSTableIndexRsp(void* buf, int32_t bufLen, STableIndexRsp* pRsp); int32_t tDeserializeSTableIndexRsp(void* buf, int32_t bufLen, STableIndexRsp* pRsp);
void tFreeSerializeSTableIndexRsp(STableIndexRsp* pRsp);
void tFreeSTableIndexInfo(void* pInfo); void tFreeSTableIndexInfo(void* pInfo);

View File

@ -2933,6 +2933,13 @@ int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp
return tlen; return tlen;
} }
void tFreeSerializeSTableIndexRsp(STableIndexRsp *pRsp) {
if (pRsp->pIndex != NULL) {
taosArrayDestroy(pRsp->pIndex);
pRsp->pIndex = NULL;
}
}
int32_t tDeserializeSTableIndexInfo(SDecoder *pDecoder, STableIndexInfo *pInfo) { int32_t tDeserializeSTableIndexInfo(SDecoder *pDecoder, STableIndexInfo *pInfo) {
if (tDecodeI8(pDecoder, &pInfo->intervalUnit) < 0) return -1; if (tDecodeI8(pDecoder, &pInfo->intervalUnit) < 0) return -1;
if (tDecodeI8(pDecoder, &pInfo->slidingUnit) < 0) return -1; if (tDecodeI8(pDecoder, &pInfo->slidingUnit) < 0) return -1;

View File

@ -1153,6 +1153,7 @@ _OVER:
mError("failed to get table index %s since %s", indexReq.tbFName, terrstr()); mError("failed to get table index %s since %s", indexReq.tbFName, terrstr());
} }
tFreeSerializeSTableIndexRsp(&rsp);
return code; return code;
} }

View File

@ -1,6 +1,5 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c debugflag -v 131
system sh/exec.sh -n dnode1 -s start -v system sh/exec.sh -n dnode1 -s start -v
sql connect sql connect
@ -23,65 +22,87 @@ if $data(1)[4] != ready then
endi endi
print =============== step2: create db print =============== step2: create db
sql create database d1 vgroups 2 buffer 3 sql create database db
sql show databases sql use db
sql use d1 sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd"
sql show vgroups sql create table db.c1 using db.stb tags(101, 102, "103")
print =============== step3: create show stable print =============== step3: alter stb
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) sql_error alter table db.stb add column ts int
sql show stables sql alter table db.stb add column c3 int
if $rows != 1 then sql alter table db.stb add column c4 bigint
return -1 sql alter table db.stb add column c5 binary(12)
endi sql alter table db.stb drop column c1
sql alter table db.stb drop column c4
sql alter table db.stb MODIFY column c2 binary(32)
sql alter table db.stb add tag t4 bigint
sql alter table db.stb add tag c1 int
sql alter table db.stb add tag t5 binary(12)
sql alter table db.stb drop tag c1
sql alter table db.stb drop tag t5
sql alter table db.stb MODIFY tag t3 binary(32)
sql alter table db.stb rename tag t1 tx
sql alter table db.stb comment 'abcde' ;
sql drop table db.stb
print =============== step4: create show table print =============== step4: alter tb
sql create table ct1 using stb tags(1000) sql create table tb (ts timestamp, a int)
sql create table ct2 using stb tags(2000) sql insert into tb values(now-28d, -28)
sql create table ct3 using stb tags(3000) sql select count(a) from tb
sql show tables sql alter table tb add column b smallint
if $rows != 3 then sql insert into tb values(now-25d, -25, 0)
return -1 sql select count(b) from tb
endi sql alter table tb add column c tinyint
sql insert into tb values(now-22d, -22, 3, 0)
sql select count(c) from tb
sql alter table tb add column d int
sql insert into tb values(now-19d, -19, 6, 0, 0)
sql select count(d) from tb
sql alter table tb add column e bigint
sql alter table tb add column f float
sql alter table tb add column g double
sql alter table tb add column h binary(10)
sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb
sql select * from tb order by ts desc
print =============== step5: insert data print =============== step5: alter stb and insert data
sql insert into ct1 values(now+0s, 10, 2.0, 3.0) sql create table stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd"
sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) sql show db.stables
sql insert into ct2 values(now+0s, 10, 2.0, 3.0) sql describe stb
sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) sql_error alter table stb add column ts int
sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
sql create table db.ctb using db.stb tags(101, 102, "103")
sql insert into db.ctb values(now, 1, "2")
sql show db.tables
sql select * from db.stb
sql select * from tb
sql alter table stb add column c3 int
sql describe stb
sql select * from db.stb
sql select * from tb
sql insert into db.ctb values(now+1s, 1, 2, 3)
sql select * from db.stb
sql alter table db.stb add column c4 bigint
sql select * from db.stb
sql insert into db.ctb values(now+2s, 1, 2, 3, 4)
sql alter table db.stb drop column c1
sql reset query cache
sql select * from tb
sql insert into db.ctb values(now+3s, 2, 3, 4)
sql select * from db.stb
sql alter table db.stb add tag t4 bigint
sql select * from db.stb
sql select * from db.stb
sql_error create table db.ctb2 using db.stb tags(101, "102")
sql create table db.ctb2 using db.stb tags(101, 102, "103", 104)
sql insert into db.ctb2 values(now, 1, 2, 3)
print =============== step6: query data print =============== step6: query data
sql select * from ct1 sql select * from db.stb where tbname = 'ctb2';
sql select * from stb
sql select c1, c2, c3 from ct1
sql select ts, c1, c2, c3 from stb
print =============== step7: count
sql select count(*) from ct1;
sql select count(*) from stb;
sql select count(ts), count(c1), count(c2), count(c3) from ct1
sql select count(ts), count(c1), count(c2), count(c3) from stb
print =============== step8: func
sql select first(ts), first(c1), first(c2), first(c3) from ct1
sql select min(c1), min(c2), min(c3) from ct1
sql select max(c1), max(c2), max(c3) from ct1
sql select sum(c1), sum(c2), sum(c3) from ct1
print =============== step9: insert select
sql create table ct4 using stb tags(4000);
sql insert into ct4 select * from ct1;
sql select * from ct4;
sql insert into ct4 select ts,c1,c2,c3 from stb;
sql create table tb1 (ts timestamp, c1 int, c2 float, c3 double);
sql insert into tb1 (ts, c1, c2, c3) select * from ct1;
sql select * from tb1;
sql create table tb2 (ts timestamp, f1 binary(10), c1 int, c2 double);
sql insert into tb2 (c2, c1, ts) select c2+1, c1, ts+3 from ct2;
sql select * from tb2;
_OVER: _OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
@ -90,7 +111,7 @@ $null=
system_content sh/checkValgrind.sh -n dnode1 system_content sh/checkValgrind.sh -n dnode1
print cmd return result ----> [ $system_content ] print cmd return result ----> [ $system_content ]
if $system_content > 1 then if $system_content > 0 then
return -1 return -1
endi endi

View File

@ -1,6 +1,5 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c debugflag -v 131
system sh/exec.sh -n dnode1 -s start -v system sh/exec.sh -n dnode1 -s start -v
sql connect sql connect
@ -22,40 +21,43 @@ if $data(1)[4] != ready then
goto step1 goto step1
endi endi
print =============== step2: create db $tbPrefix = tb
sql create database d1 vgroups 2 buffer 3 $tbNum = 5
sql show databases $rowNum = 10
sql use d1
sql show vgroups
print =============== step3: create show stable print =============== step2: prepare data
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) sql create database db vgroups 2
sql show stables sql use db
if $rows != 1 then sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned)
return -1
endi
print =============== step4: create show table $i = 0
sql create table ct1 using stb tags(1000) while $i < $tbNum
sql create table ct2 using stb tags(2000) $tb = $tbPrefix . $i
sql create table ct3 using stb tags(3000) sql create table $tb using stb tags( $i )
sql show tables $x = 0
if $rows != 3 then while $x < $rowNum
return -1 $cc = $x * 60000
endi $ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x , $x , $x )
$x = $x + 1
endw
$i = $i + 1
endw
print =============== step5: insert data print =============== step3: avg
sql insert into ct1 values(now+0d, 10, 2.0, 3.0) sql select avg(tbcol) from tb1
sql insert into ct1 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3) sql select avg(tbcol) from tb1 where ts <= 1601481840000
sql insert into ct2 values(now+0d, 10, 2.0, 3.0) sql select avg(tbcol) as b from tb1
sql insert into ct2 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3) sql select avg(tbcol) as b from tb1 interval(1d)
sql insert into ct3 values('2022-01-01 00:00:00.000', 10, 2.0, 3.0) sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m)
sql select avg(tbcol) as c from stb
print =============== step6: query data sql select avg(tbcol) as c from stb where ts <= 1601481840000
sql select * from ct1 where ts < now -1d and ts > now +1d sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000
sql select * from stb where ts < now -1d and ts > now +1d sql select avg(tbcol) as c from stb interval(1m)
sql select * from ct1 where ts < now -1d and ts > now +1d order by ts desc sql select avg(tbcol) as c from stb interval(1d)
sql select * from stb where ts < now -1d and ts > now +1d order by ts desc sql select avg(tbcol) as b from stb where ts <= 1601481840000s interval(1m)
sql select avg(tbcol) as c from stb group by tgcol
sql select avg(tbcol) as b from stb where ts <= 1601481840000s partition by tgcol interval(1m)
_OVER: _OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
@ -64,7 +66,7 @@ $null=
system_content sh/checkValgrind.sh -n dnode1 system_content sh/checkValgrind.sh -n dnode1
print cmd return result ----> [ $system_content ] print cmd return result ----> [ $system_content ]
if $system_content > 1 then if $system_content > 0 then
return -1 return -1
endi endi

View File

@ -68,7 +68,7 @@ $null=
system_content sh/checkValgrind.sh -n dnode1 system_content sh/checkValgrind.sh -n dnode1
print cmd return result ----> [ $system_content ] print cmd return result ----> [ $system_content ]
if $system_content > 3 then if $system_content > 0 then
return -1 return -1
endi endi