ErrSim: Large_Co_SSTable threshold, for test only

This commit is contained in:
gaishun 2024-11-14 10:44:09 +00:00 committed by ob-robot
parent 7d786f69d1
commit 26f9fb2124
2 changed files with 18 additions and 2 deletions

View File

@ -1185,6 +1185,10 @@ ERRSIM_DEF_INT(errsim_tablet_batch_count, OB_CLUSTER_PARAMETER, "0", "[0,)",
"batch tablet count when in errsim mode"
"Range: [0,) in integer",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
ERRSIM_DEF_INT(errsim_large_co_sstable_threshold, OB_CLUSTER_PARAMETER, "0", "[0, 1966080]",
"large_co_sstable size threshold (byte) when in errsim mode"
"Range: [0, 1966080] in integer",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
ERRSIM_DEF_INT(errsim_backup_ls_id, OB_CLUSTER_PARAMETER, "0", "[0,)",
"the ls id that backup want to insert error"
"Range: [0,) in integer",

View File

@ -1299,6 +1299,12 @@ int ObTabletPersister::fetch_and_persist_large_co_sstable(
{
int ret = OB_SUCCESS;
ObCOSSTableV2 *co_sstable = nullptr;
#ifdef ERRSIM
const int64_t large_co_sstable_threshold_config = GCONF.errsim_large_co_sstable_threshold;
const int64_t large_co_sstable_threshold = 0 == large_co_sstable_threshold_config ? SSTABLE_MAX_SERIALIZE_SIZE : large_co_sstable_threshold_config;
#else
const int64_t large_co_sstable_threshold = SSTABLE_MAX_SERIALIZE_SIZE;
#endif
if (OB_ISNULL(table) || !table->is_co_sstable() || !sstable_persist_ctx.is_inited()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", KR(ret), KP(table), KPC(table));
@ -1306,7 +1312,7 @@ int ObTabletPersister::fetch_and_persist_large_co_sstable(
} else if (OB_ISNULL(co_sstable)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to cast table to co_sstalbe", KR(ret));
} else if (co_sstable->get_serialize_size() <= SSTABLE_MAX_SERIALIZE_SIZE) {
} else if (co_sstable->get_serialize_size() <= large_co_sstable_threshold) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("normal co_sstable should not been there", KR(ret), KPC(co_sstable), K(co_sstable->get_serialize_size()));
} else {
@ -1561,6 +1567,12 @@ int ObTabletPersister::fetch_and_persist_sstable(
const int64_t ctx_id = share::is_reserve_mode()
? ObCtxIds::MERGE_RESERVE_CTX_ID
: ObCtxIds::DEFAULT_CTX_ID;
#ifdef ERRSIM
const int64_t large_co_sstable_threshold_config = GCONF.errsim_large_co_sstable_threshold;
const int64_t large_co_sstable_threshold = 0 == large_co_sstable_threshold_config ? SSTABLE_MAX_SERIALIZE_SIZE : large_co_sstable_threshold_config;
#else
const int64_t large_co_sstable_threshold = SSTABLE_MAX_SERIALIZE_SIZE;
#endif
common::ObSEArray<ObSharedObjectsWriteCtx, 8> write_ctxs;
common::ObSEArray<ObMetaDiskAddr, 8> addrs;
addrs.set_attr(lib::ObMemAttr(MTL_ID(), "PerstAddrs", ctx_id));
@ -1586,7 +1598,7 @@ int ObTabletPersister::fetch_and_persist_sstable(
cur_macro_seq_,
sstable_meta_write_ctxs))) {
LOG_WARN("fail to persist sstable linked_block if need", K(ret), K(param_), KPC(table), K(cur_macro_seq_));
} else if (table->is_co_sstable() && table->get_serialize_size() > SSTABLE_MAX_SERIALIZE_SIZE) {
} else if (table->is_co_sstable() && table->get_serialize_size() > large_co_sstable_threshold) {
// large co sstable
if(OB_FAIL(fetch_and_persist_large_co_sstable(tmp_allocator, table, sstable_persist_ctx))) {
LOG_WARN("fail to fetch and persist large co sstable", K(ret), KPC(table), K(sstable_persist_ctx));