test: add test case for auto compact
This commit is contained in:
parent
640a0c4c78
commit
78018b3a16
|
@ -123,6 +123,9 @@ static const SSysDbTableSchema userDBSchema[] = {
|
|||
{.name = "s3_compact", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||
{.name = "with_arbitrator", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||
{.name = "encrypt_algorithm", .bytes = TSDB_ENCRYPT_ALGO_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "compact_interval", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "compact_time_range", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "compact_time_offset", .bytes = 4 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
};
|
||||
|
||||
static const SSysDbTableSchema userFuncSchema[] = {
|
||||
|
|
|
@ -2435,6 +2435,7 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)strictVstr, false), &lino, _OVER);
|
||||
|
||||
char durationStr[128] = {0};
|
||||
char durationVstr[128] = {0};
|
||||
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], sizeof(durationVstr) - VARSTR_HEADER_SIZE,
|
||||
pDb->cfg.daysPerFile);
|
||||
|
@ -2443,10 +2444,10 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||
|
||||
char keepVstr[512] = {0};
|
||||
char keep0Str[128] = {0};
|
||||
char keep1Str[128] = {0};
|
||||
char keep2Str[128] = {0};
|
||||
char keepVstr[128] = {0};
|
||||
char keep0Str[32] = {0};
|
||||
char keep1Str[32] = {0};
|
||||
char keep2Str[32] = {0};
|
||||
|
||||
int32_t lenKeep0 = formatDurationOrKeep(keep0Str, sizeof(keep0Str), pDb->cfg.daysToKeep0);
|
||||
int32_t lenKeep1 = formatDurationOrKeep(keep1Str, sizeof(keep1Str), pDb->cfg.daysToKeep1);
|
||||
|
@ -2559,6 +2560,27 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
|||
STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24);
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false), &lino, _OVER);
|
||||
|
||||
formatDurationOrKeep(durationStr, sizeof(durationStr), pDb->cfg.compactInterval);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(durationVstr, durationStr, sizeof(durationVstr));
|
||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
if (pColInfo) {
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||
}
|
||||
|
||||
len = formatDurationOrKeep(durationStr, sizeof(durationStr), pDb->cfg.compactStartTime);
|
||||
formatDurationOrKeep(durationVstr, sizeof(durationVstr), pDb->cfg.compactEndTime);
|
||||
snprintf(durationStr + len, sizeof(durationStr) - len, ",%s", durationVstr);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(durationVstr, durationStr, sizeof(durationVstr));
|
||||
if ((pColInfo = taosArrayGet(pBlock->pDataBlock, cols++))) {
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||
}
|
||||
|
||||
snprintf(durationStr, sizeof(durationStr), "%dh", pDb->cfg.compactTimeOffset);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(durationVstr, durationStr, sizeof(durationVstr));
|
||||
if ((pColInfo = taosArrayGet(pBlock->pDataBlock, cols++))) {
|
||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||
}
|
||||
}
|
||||
_OVER:
|
||||
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||
|
|
|
@ -222,7 +222,7 @@ class TDTestCase:
|
|||
|
||||
tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'")
|
||||
tdLog.info(len(tdSql.queryResult))
|
||||
tdSql.checkEqual(True, len(tdSql.queryResult) in range(309, 310))
|
||||
tdSql.checkEqual(True, len(tdSql.queryResult) in range(312, 313))
|
||||
|
||||
tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'")
|
||||
tdSql.checkEqual(61, len(tdSql.queryResult))
|
||||
|
|
|
@ -75,6 +75,10 @@ class TDTestCase:
|
|||
tdSql.checkEqual("Invalid option encrypt_algorithm: none ", tdSql.error('alter database db encrypt_algorithm \'none \''))
|
||||
tdSql.execute('drop database db')
|
||||
|
||||
def alter_compact(self):
|
||||
tdSql.error('create database db compact_time_range 60,61', expectErrInfo="Invalid option compact_time_range: 86400m, start_time should be in range: [-5256000m, -14400m]", fullMatched=True)
|
||||
tdSql.execute('drop database db')
|
||||
|
||||
def alter_same_options(self):
|
||||
tdSql.execute('drop database if exists db')
|
||||
tdSql.execute('create database db')
|
||||
|
@ -101,10 +105,11 @@ class TDTestCase:
|
|||
|
||||
def run(self):
|
||||
|
||||
self.alter_buffer()
|
||||
self.alter_pages()
|
||||
self.alter_encrypt_alrogithm()
|
||||
self.alter_same_options()
|
||||
# self.alter_buffer()
|
||||
# self.alter_pages()
|
||||
# self.alter_encrypt_alrogithm()
|
||||
# self.alter_same_options()
|
||||
self.alter_compact()
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
Loading…
Reference in New Issue