enh: more code

This commit is contained in:
Hongze Cheng 2025-02-27 14:06:30 +08:00
parent f1470cd79c
commit b3ae5df8ac
2 changed files with 19 additions and 3 deletions

View File

@ -168,7 +168,7 @@ int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tb
int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp);
int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs);
SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
int64_t metaGetTableCreateTime(SMeta *pMeta, tb_uid_t uid, int lock);
int64_t metaGetTableCreateTime(SMeta* pMeta, tb_uid_t uid, int lock);
int32_t metaGetTbTSchemaNotNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
int32_t metaGetTbTSchemaMaybeNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema);
STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock);
@ -488,8 +488,9 @@ struct SVnode {
SVATaskID commitTask;
struct {
SMeta* pMeta;
SMeta* pNewMeta;
SMeta* pMeta;
SMeta* pNewMeta;
SVATaskID metaCompactTask;
};
SSma* pSma;

View File

@ -12,6 +12,7 @@ from util.dnodes import tdDnodes
from util.sql import *
from util.cases import *
from util.log import *
import inspect
sys.path.append("../tests/pytest")
@ -41,6 +42,8 @@ class TestCompactMeta:
1. Alter child table tags
2. Make sure compact meta works
"""
tdLog.info(f'case {inspect.currentframe().f_code.co_name} start')
db_name = 'db1'
stb_name = 'stb1'
ctb_name_prefix = 'ctb'
@ -59,16 +62,28 @@ class TestCompactMeta:
tdSql.execute(sql)
# Create child tables
tdLog.info(
f'case {inspect.currentframe().f_code.co_name}: create {num_child_tables} child tables')
for i in range(1, num_child_tables+1):
if i % 100 == 0:
tdLog.info(
f'case {inspect.currentframe().f_code.co_name}: create {i} child tables')
sql = f'create table {db_name}.{ctb_name_prefix}{i} using {db_name}.{stb_name} tags({i})'
tdSql.execute(sql)
# Alter child table tags
tdLog.info(
f'case {inspect.currentframe().f_code.co_name}: alter child table tags')
for i in range(1, num_child_tables+1):
if i % 100 == 0:
tdLog.info(
f'case {inspect.currentframe().f_code.co_name}: altered {i} child tables')
sql = f'alter table {db_name}.{ctb_name_prefix}{i} set tag t1 = {i+1}'
tdSql.execute(sql)
# Compact meta
tdLog.info(
f'case {inspect.currentframe().f_code.co_name}: start to compact meta')
sql = f'compact database {db_name} meta_only'
tdSql.execute(sql)