[CP] Fix schema & upgrade related problems

This commit is contained in:
tino247 2022-12-13 13:07:55 +00:00 committed by ob-robot
parent 4c7cfd9120
commit e603b2fe6a
8 changed files with 30 additions and 9 deletions

View File

@ -1403,7 +1403,7 @@ int ObAdminUpgradeCmd::execute(const Bool &upgrade)
}
}
if (OB_FAIL(ret)) {
} else if (admin_set_config.execute(set_config_arg)) {
} else if (OB_FAIL(admin_set_config.execute(set_config_arg))) {
LOG_WARN("execute set config failed", KR(ret));
} else {
LOG_INFO("change upgrade parameters",
@ -1434,7 +1434,7 @@ int ObAdminRollingUpgradeCmd::execute(const obrpc::ObAdminRollingUpgradeArg &arg
LOG_WARN("assign _upgrade_stage config value failed", KR(ret), K(arg));
} else if (OB_FAIL(set_config_arg.items_.push_back(upgrade_stage_item))) {
LOG_WARN("add _upgrade_stage config item failed", KR(ret), K(arg));
} else if (admin_set_config.execute(set_config_arg)) {
} else if (OB_FAIL(admin_set_config.execute(set_config_arg))) {
LOG_WARN("execute set config failed", KR(ret));
} else {
LOG_INFO("change upgrade parameters", KR(ret), "_upgrade_stage", arg.stage_);

View File

@ -40,7 +40,7 @@ static const char* upgrade_stage_str[OB_UPGRADE_STAGE_MAX] = {
"NONE",
"PREUPGRADE",
"DBUPGRADE",
"POSTUPRADE"
"POSTUPGRADE"
};
const char* get_upgrade_stage_str(ObUpgradeStage stage)

View File

@ -2309,7 +2309,7 @@ int ObMultiVersionSchemaService::refresh_and_add_schema(const ObIArray<uint64_t>
// Ensure that the memory on the stack requested during the refresh schema process also uses the default 500 tenant
ObArenaAllocator allocator(ObModIds::OB_MODULE_PAGE_ALLOCATOR, OB_MALLOC_BIG_BLOCK_SIZE, OB_SERVER_TENANT_ID);
schema_stack_allocator() = &allocator;
ObSchemaStackAllocatorGuard guard(&allocator);
ObArray<uint64_t> all_tenant_ids;
if (OB_FAIL(ret)) {
@ -2358,7 +2358,6 @@ int ObMultiVersionSchemaService::refresh_and_add_schema(const ObIArray<uint64_t>
}
}
}
schema_stack_allocator() = nullptr;
};
CREATE_WITH_TEMP_ENTITY_P(!ObSchemaService::g_liboblog_mode_, RESOURCE_OWNER, common::OB_SERVER_TENANT_ID)
{
@ -2465,7 +2464,7 @@ int ObMultiVersionSchemaService::auto_switch_mode_and_refresh_schema(
auto func = [&]() {
// Ensure that the memory on the stack requested during the refresh schema process also uses the default 500 tenant
ObArenaAllocator allocator(ObModIds::OB_MODULE_PAGE_ALLOCATOR, OB_MALLOC_BIG_BLOCK_SIZE, OB_SERVER_TENANT_ID);
schema_stack_allocator() = &allocator;
ObSchemaStackAllocatorGuard guard(&allocator);
bool need_refresh_schema = true; // The schema needs to be refreshed by default
// If the user configures expected_schema_version, first obtain the latest schema version.
@ -2568,7 +2567,6 @@ int ObMultiVersionSchemaService::auto_switch_mode_and_refresh_schema(
}
}
}
schema_stack_allocator() = nullptr;
};
if (OB_SUCCESS == ret) {

View File

@ -3011,6 +3011,7 @@ int ObSchemaMgr::rebuild_schema_meta_if_not_consistent()
}
// Check whether db and table are consistent
if (!check_schema_meta_consistent()) {
ret = OB_ERROR;
LOG_ERROR("schema meta is still not consistent after rebuild, need fixing", K(ret));
right_to_die_or_duty_to_live();
}

View File

@ -6651,6 +6651,19 @@ private:
};
common::ObIAllocator *&schema_stack_allocator();
class ObSchemaStackAllocatorGuard
{
public:
ObSchemaStackAllocatorGuard() = delete;
explicit ObSchemaStackAllocatorGuard(ObIAllocator *allocator)
{
schema_stack_allocator() = allocator;
}
~ObSchemaStackAllocatorGuard()
{
schema_stack_allocator() = NULL;
}
};
class ObLabelSePolicySchema : public ObSchema
{//simple schema

View File

@ -198,6 +198,9 @@ def check_upgrade_job_result(cur, version, max_used_job_id):
logging.warn("invalid job status: {0}".format(results[0][0]))
raise e
if times >= 180:
logging.warn("run upgrade job timeout")
raise e
times = times + 1
time.sleep(10)
except Exception, e:

View File

@ -1242,6 +1242,9 @@
# logging.warn("invalid job status: {0}".format(results[0][0]))
# raise e
#
# if times >= 180:
# logging.warn("run upgrade job timeout")
# raise e
# times = times + 1
# time.sleep(10)
# except Exception, e:
@ -2259,7 +2262,7 @@
#
#class UpgradeParams:
# log_filename = 'upgrade_post_checker.log'
# new_version = '4.0.0.0'
# new_version = '4.1.0.0'
##### --------------start : my_error.py --------------
#class MyError(Exception):
# def __init__(self, value):

View File

@ -1242,6 +1242,9 @@
# logging.warn("invalid job status: {0}".format(results[0][0]))
# raise e
#
# if times >= 180:
# logging.warn("run upgrade job timeout")
# raise e
# times = times + 1
# time.sleep(10)
# except Exception, e:
@ -2259,7 +2262,7 @@
#
#class UpgradeParams:
# log_filename = 'upgrade_post_checker.log'
# new_version = '4.0.0.0'
# new_version = '4.1.0.0'
##### --------------start : my_error.py --------------
#class MyError(Exception):
# def __init__(self, value):