fix:error in lock meta if group by json tag, need unlock if error happens

This commit is contained in:
wangmm0220 2022-06-30 17:10:34 +08:00
parent e751e20c76
commit 77fcf17ae1
2 changed files with 42 additions and 42 deletions

View File

@ -4041,6 +4041,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
} else {
taosMemoryFree(keyBuf);
nodesClearList(groupNew);
metaReaderClear(&mr);
return code;
}
@ -4058,6 +4059,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
taosMemoryFree(keyBuf);
nodesClearList(groupNew);
metaReaderClear(&mr);
return terrno;
}
int32_t len = getJsonValueLen(data);

View File

@ -471,7 +471,6 @@ class TDTestCase:
tdSql.query("select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc")
tdSql.checkRows(8)
tdSql.checkData(0, 0, 2)
tdSql.checkData(0, 1, None)
tdSql.checkData(2, 0, 1)
tdSql.checkData(2, 1, "false")
@ -483,7 +482,6 @@ class TDTestCase:
# test stddev with group by json tag
tdSql.query("select stddev(dataint),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'")
tdSql.checkRows(8)
tdSql.checkData(0, 0, 10)
tdSql.checkData(0, 1, None)
tdSql.checkData(4, 0, 0)
tdSql.checkData(4, 1, "5.000000000")
@ -687,47 +685,47 @@ class TDTestCase:
tdSql.checkRows(1)
# #test TD-12077
# tdSql.execute("insert into jsons1_16 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')")
# tdSql.query("select jtag->'tag3' from jsons1_16")
# tdSql.checkData(0, 0, '-2.111000000')
#test TD-12077
tdSql.execute("insert into jsons1_16 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')")
tdSql.query("select jtag->'tag3' from jsons1_16")
tdSql.checkData(0, 0, '-2.111000000')
# test TD-12452
tdSql.execute("ALTER TABLE jsons1_1 SET TAG jtag=NULL")
tdSql.query("select jtag from jsons1_1")
tdSql.checkData(0, 0, None)
tdSql.execute("CREATE TABLE if not exists jsons1_20 using jsons1 tags(NULL)")
tdSql.query("select jtag from jsons1_20")
tdSql.checkData(0, 0, None)
tdSql.execute("insert into jsons1_21 using jsons1 tags(NULL) values(1591061628000, 11, false, '你就会','')")
tdSql.query("select jtag from jsons1_21")
tdSql.checkData(0, 0, None)
#
# # test TD-12452
# tdSql.execute("ALTER TABLE jsons1_1 SET TAG jtag=NULL")
# tdSql.query("select jtag from jsons1_1")
# tdSql.checkData(0, 0, None)
# tdSql.execute("CREATE TABLE if not exists jsons1_20 using jsons1 tags(NULL)")
# tdSql.query("select jtag from jsons1_20")
# tdSql.checkData(0, 0, None)
# tdSql.execute("insert into jsons1_21 using jsons1 tags(NULL) values(1591061628000, 11, false, '你就会','')")
# tdSql.query("select jtag from jsons1_21")
# tdSql.checkData(0, 0, None)
# #
# # #test TD-12389
# tdSql.query("describe jsons1")
# tdSql.checkData(5, 2, 4095)
# tdSql.query("describe jsons1_1")
# tdSql.checkData(5, 2, 4095)
# #
# # #test TD-13918
# tdSql.execute("drop table if exists jsons_13918_1")
# tdSql.execute("drop table if exists jsons_13918_2")
# tdSql.execute("drop table if exists jsons_13918_3")
# tdSql.execute("drop table if exists jsons_13918_4")
# tdSql.execute("drop table if exists jsons_stb")
# tdSql.execute("create table jsons_stb (ts timestamp, dataInt int) tags (jtag json)")
# tdSql.error("create table jsons_13918_1 using jsons_stb tags ('nullx')")
# tdSql.error("create table jsons_13918_2 using jsons_stb tags (nullx)")
# tdSql.error("insert into jsons_13918_3 using jsons_stb tags('NULLx') values(1591061628001, 11)")
# tdSql.error("insert into jsons_13918_4 using jsons_stb tags(NULLx) values(1591061628002, 11)")
# tdSql.execute("create table jsons_13918_1 using jsons_stb tags ('null')")
# tdSql.execute("create table jsons_13918_2 using jsons_stb tags (null)")
# tdSql.execute("insert into jsons_13918_1 values(1591061628003, 11)")
# tdSql.execute("insert into jsons_13918_2 values(1591061628004, 11)")
# tdSql.execute("insert into jsons_13918_3 using jsons_stb tags('NULL') values(1591061628005, 11)")
# tdSql.execute("insert into jsons_13918_4 using jsons_stb tags(\"NULL\") values(1591061628006, 11)")
# tdSql.query("select * from jsons_stb")
# tdSql.checkRows(4)
# #test TD-12389
tdSql.query("describe jsons1")
tdSql.checkData(5, 2, 4095)
tdSql.query("describe jsons1_1")
tdSql.checkData(5, 2, 4095)
#
# #test TD-13918
tdSql.execute("drop table if exists jsons_13918_1")
tdSql.execute("drop table if exists jsons_13918_2")
tdSql.execute("drop table if exists jsons_13918_3")
tdSql.execute("drop table if exists jsons_13918_4")
tdSql.execute("drop table if exists jsons_stb")
tdSql.execute("create table jsons_stb (ts timestamp, dataInt int) tags (jtag json)")
tdSql.error("create table jsons_13918_1 using jsons_stb tags ('nullx')")
tdSql.error("create table jsons_13918_2 using jsons_stb tags (nullx)")
tdSql.error("insert into jsons_13918_3 using jsons_stb tags('NULLx') values(1591061628001, 11)")
tdSql.error("insert into jsons_13918_4 using jsons_stb tags(NULLx) values(1591061628002, 11)")
tdSql.execute("create table jsons_13918_1 using jsons_stb tags ('null')")
tdSql.execute("create table jsons_13918_2 using jsons_stb tags (null)")
tdSql.execute("insert into jsons_13918_1 values(1591061628003, 11)")
tdSql.execute("insert into jsons_13918_2 values(1591061628004, 11)")
tdSql.execute("insert into jsons_13918_3 using jsons_stb tags('NULL') values(1591061628005, 11)")
tdSql.execute("insert into jsons_13918_4 using jsons_stb tags(\"NULL\") values(1591061628006, 11)")
tdSql.query("select * from jsons_stb")
tdSql.checkRows(4)
def stop(self):
tdSql.close()