[CP] [DATA_DICT] Fix dump base data_dictionary with 500 tenant_id

This commit is contained in:
SanmuWangZJU
2023-12-27 07:18:37 +00:00
committed by ob-robot
parent abbc4fcab3
commit 09c9eb33e7
2 changed files with 13 additions and 6 deletions

View File

@ -415,6 +415,7 @@ int ObDataDictService::generate_dict_and_dump_(const share::SCN &snapshot_scn)
int64_t schema_version = OB_INVALID_VERSION;
ObArray<uint64_t> database_ids;
ObArray<uint64_t> table_ids;
int64_t filter_table_count = 0;
if (OB_FAIL(sql_client_.get_schema_version(tenant_id_, snapshot_scn, schema_version))) {
ret = OB_SCHEMA_EAGAIN;
@ -424,7 +425,7 @@ int ObDataDictService::generate_dict_and_dump_(const share::SCN &snapshot_scn)
DDLOG(WARN, "handle_tenant_meta_ failed", KR(ret), K(snapshot_scn));
} else if (OB_FAIL(handle_database_metas_(schema_version, database_ids))) {
DDLOG(WARN, "handle_database_metas_ failed", KR(ret), K(snapshot_scn));
} else if (OB_FAIL(handle_table_metas_(schema_version, table_ids))) {
} else if (OB_FAIL(handle_table_metas_(schema_version, table_ids, filter_table_count))) {
DDLOG(WARN, "handle_table_metas_ failed", KR(ret), K(snapshot_scn), K(schema_version));
}
@ -433,7 +434,8 @@ int ObDataDictService::generate_dict_and_dump_(const share::SCN &snapshot_scn)
K(snapshot_scn),
K(schema_version),
"database_count", database_ids.count(),
"table_count", table_ids.count());
"table_count", table_ids.count(),
K(filter_table_count));
return ret;
}
@ -602,12 +604,15 @@ int ObDataDictService::handle_database_metas_(
int ObDataDictService::handle_table_metas_(
const int64_t schema_version,
const ObIArray<uint64_t> &table_ids)
const ObIArray<uint64_t> &table_ids,
int64_t &filter_table_count)
{
int ret = OB_SUCCESS;
ObArenaAllocator tb_meta_allocator("ObDatDictTbMeta");
schema::ObSchemaGetterGuard schema_guard; // will reset while getting schem_guard
lib::ObMemAttr mem_attr(tenant_id_, "ObDatDictTbMeta");
ObArenaAllocator tb_meta_allocator(mem_attr);
static const int64_t batch_table_meta_size = 200;
filter_table_count = 0;
schema::ObSchemaGetterGuard schema_guard; // will reset while getting schem_guard
for (int i = 0; OB_SUCC(ret) && ! stop_flag_ && i < table_ids.count(); i++) {
const ObTableSchema *table_schema = NULL;
@ -633,6 +638,7 @@ int ObDataDictService::handle_table_metas_(
} else if (OB_FAIL(filter_table_(*table_schema, is_filtered))) {
DDLOG(WARN, "filter_table_ failed", KR(ret), K(is_filtered), KPC(table_schema));
} else if (is_filtered) {
filter_table_count++;
DDLOG(DEBUG, "filter_table_",
K(schema_version),
"table_id", table_schema->get_table_id(),

View File

@ -104,7 +104,8 @@ private:
const ObIArray<uint64_t> &database_ids);
int handle_table_metas_(
const int64_t schema_version,
const ObIArray<uint64_t> &table_ids);
const ObIArray<uint64_t> &table_ids,
int64_t &filter_table_count);
int filter_table_(const share::schema::ObTableSchema &table_schema, bool &is_filtered);
private:
static const int64_t TIMER_TASK_INTERVAL;