fix taosd crash query ins_tags with empty nchar tag
This commit is contained in:
parent
da4c84d297
commit
c2afd95c4e
|
@ -983,7 +983,10 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
|
||||||
: (3 + DBL_MANT_DIG - DBL_MIN_EXP + VARSTR_HEADER_SIZE);
|
: (3 + DBL_MANT_DIG - DBL_MIN_EXP + VARSTR_HEADER_SIZE);
|
||||||
tagVarChar = taosMemoryCalloc(1, bufSize + 1);
|
tagVarChar = taosMemoryCalloc(1, bufSize + 1);
|
||||||
int32_t len = -1;
|
int32_t len = -1;
|
||||||
|
if (tagLen > 0)
|
||||||
convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len);
|
convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len);
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
varDataSetLen(tagVarChar, len);
|
varDataSetLen(tagVarChar, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,11 @@ class TDTestCase:
|
||||||
self.tbnum = 20
|
self.tbnum = 20
|
||||||
self.rowNum = 10
|
self.rowNum = 10
|
||||||
self.tag_dict = {
|
self.tag_dict = {
|
||||||
't0':'int'
|
't0':'int',
|
||||||
|
't1':f'nchar({self.nchar_length})'
|
||||||
}
|
}
|
||||||
self.tag_values = [
|
self.tag_values = [
|
||||||
f'1'
|
f'1', '""'
|
||||||
]
|
]
|
||||||
self.binary_str = 'taosdata'
|
self.binary_str = 'taosdata'
|
||||||
self.nchar_str = '涛思数据'
|
self.nchar_str = '涛思数据'
|
||||||
|
@ -72,7 +73,7 @@ class TDTestCase:
|
||||||
tdSql.execute(f'use {self.dbname}')
|
tdSql.execute(f'use {self.dbname}')
|
||||||
tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict))
|
tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict))
|
||||||
for i in range(self.tbnum):
|
for i in range(self.tbnum):
|
||||||
tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]})")
|
tdSql.execute(f"create table {self.stbname}_{i} using {self.stbname} tags({self.tag_values[0]}, {self.tag_values[1]})")
|
||||||
self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum)
|
self.insert_data(self.column_dict,f'{self.stbname}_{i}',self.rowNum)
|
||||||
def count_check(self):
|
def count_check(self):
|
||||||
tdSql.query('select count(*) from information_schema.ins_tables')
|
tdSql.query('select count(*) from information_schema.ins_tables')
|
||||||
|
@ -313,6 +314,11 @@ class TDTestCase:
|
||||||
tdSql.error('alter cluster "activeCode" ""')
|
tdSql.error('alter cluster "activeCode" ""')
|
||||||
tdSql.execute('alter cluster "activeCode" "revoked"')
|
tdSql.execute('alter cluster "activeCode" "revoked"')
|
||||||
|
|
||||||
|
def test_query_ins_tags(self):
|
||||||
|
sql = f'select tag_name, tag_value from information_schema.ins_tags where table_name = "{self.stbname}_0"'
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.prepare_data()
|
self.prepare_data()
|
||||||
self.count_check()
|
self.count_check()
|
||||||
|
@ -322,6 +328,7 @@ class TDTestCase:
|
||||||
self.ins_stable_check2()
|
self.ins_stable_check2()
|
||||||
self.ins_dnodes_check()
|
self.ins_dnodes_check()
|
||||||
self.ins_grants_check()
|
self.ins_grants_check()
|
||||||
|
self.test_query_ins_tags()
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
Loading…
Reference in New Issue