Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions rust/config/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1785,13 +1785,6 @@
edit_level: DYNAMIC_EFFECTIVE
description: "Enable topn runtime filter."

- name: _enable_async_load_sys_package
type: BOOL
default: "True"
section: OBSERVER
edit_level: DYNAMIC_EFFECTIVE
description: "Controls the ability to enable/disable async load sys package"

- name: _enable_px_task_rebalance
type: BOOL
default: "False"
Expand Down
2 changes: 2 additions & 0 deletions src/observer/ob_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class ObServer::StandbyHostAdapter final : public standby::IStandbyHost
LOG_WARN("failed to wait for schema readiness", KR(ret));
} else if (OB_FAIL(server_.check_if_timezone_usable())) {
LOG_WARN("failed to wait for timezone readiness", KR(ret));
} else if (OB_FAIL(server_.system_package_load_service()->start())) {
LOG_WARN("failed to schedule system package installation", KR(ret));
}
return ret;
}
Expand Down
6 changes: 0 additions & 6 deletions src/observer/ob_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "rootserver/ob_bootstrap.h"
#include "observer/ob_server.h"
#include "observer/ob_system_package_load_task.h"
#include "share/ob_structured_event_logger.h"
#include "storage/ddl/ob_delete_lob_meta_row_task.h" // delete lob meta row for drop vec index
#include "storage/ddl/ob_build_index_task.h"
Expand Down Expand Up @@ -770,11 +769,6 @@ int ObService::get_build_version(char *buf, int64_t buf_len)
return ret;
}

int ObService::wait_system_package_ready(const common::ObTimeoutCtx &ctx)
{
return ObSystemPackageLoadTask::wait_system_package_ready(ctx);
}

int ObService::clear_expired_deadlock_events()
{
int ret = OB_SUCCESS;
Expand Down
1 change: 0 additions & 1 deletion src/observer/ob_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ class ObService : public rootserver::ObIRootserverLocalRuntime,
static int get_build_version(share::ObBuildVersion &build_version);
int get_build_version(char *buf, int64_t buf_len) override;
int load_all_special_system_packages() override;
int wait_system_package_ready(const common::ObTimeoutCtx &ctx) override;
int load_leader_cluster_login_info();
// ObCallSetDebugSyncActionP @RS::admin to set debug sync action
int set_ds_action(const obcall::ObDebugSyncActionArg &arg) override;
Expand Down
3 changes: 2 additions & 1 deletion src/observer/ob_system_package_load_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define USING_LOG_PREFIX RS

#include "observer/ob_system_package_load_service.h"
#include "share/ob_server_struct.h"
#include "share/rc/ob_server_runtime.h"

namespace oceanbase
Expand Down Expand Up @@ -106,7 +107,7 @@ int ObSystemPackageLoadService::activate()
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
} else if (OB_FAIL(start())) {
} else if (GCTX.status_ == share::SS_SERVING && OB_FAIL(start())) {
}
return ret;
}
Expand Down
64 changes: 18 additions & 46 deletions src/observer/ob_system_package_load_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const int64_t ObSystemPackageLoadTask::SCHEDULE_INTERVAL_US;

ObSystemPackageLoadTask::ObSystemPackageLoadTask()
: inited_(false),
fail_count_(0)
timer_(nullptr)
{
}

Expand All @@ -91,21 +91,21 @@ int ObSystemPackageLoadTask::init()
ret = OB_INIT_TWICE;
} else {
inited_ = true;
fail_count_ = 0;
timer_ = nullptr;
}
return ret;
}

int ObSystemPackageLoadTask::start(common::ObTimer &timer)
{
int ret = OB_SUCCESS;
const bool did_repeat = true;
timer_ = &timer;
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
} else {
if (timer.task_exist(*this)) {
// ignore duplicate schedule
} else if (OB_FAIL(timer.schedule(*this, SCHEDULE_INTERVAL_US, did_repeat))) {
} else if (OB_FAIL(timer.schedule_repeate_task_immediately(*this, SCHEDULE_INTERVAL_US))) {
} else {
LOG_INFO("finish schedule timer task", K(SCHEDULE_INTERVAL_US));
}
Expand All @@ -127,7 +127,7 @@ void ObSystemPackageLoadTask::stop(common::ObTimer &timer)
void ObSystemPackageLoadTask::destroy()
{
inited_ = false;
fail_count_ = 0;
timer_ = nullptr;
}

int ObSystemPackageLoadTask::load_system_package_()
Expand All @@ -141,7 +141,7 @@ int ObSystemPackageLoadTask::load_system_package_()
ret = OB_ERR_UNEXPECTED;
} else if (OB_FAIL(GET_ADMIN_JOB_COUNT(LOAD_MYSQL_SYS_PACKAGE, job_count))) {
} else if (0 == job_count) {
// job not exists, try insert inprogress job
// Continue with the new job in this callback.
if (OB_FAIL(ADMIN_JOB_CREATE_WITH_RET(job_id, JOB_TYPE_LOAD_MYSQL_SYS_PACKAGE))) {
}
} else if (OB_FAIL(ADMIN_JOB_FIND(LOAD_MYSQL_SYS_PACKAGE, job_id))) {
Expand All @@ -151,20 +151,23 @@ int ObSystemPackageLoadTask::load_system_package_()
LOG_INFO("find a success job or job_id not exist", KR(ret), K(job_id));
} else {
}
} else if (OB_FAIL(pl::ObPLPackageManager::load_all_common_sys_package(
}
if (OB_SUCC(ret) && !packages_loaded) {
if (OB_FAIL(pl::ObPLPackageManager::load_all_common_sys_package(
*sql_proxy,
false/*from_file*/))) {
} else if (OB_FAIL(ADMIN_JOB_COMPLETE(job_id, 0/*result_code*/))) {
} else {
packages_loaded = true;
} else if (OB_FAIL(ADMIN_JOB_COMPLETE(job_id, 0/*result_code*/))) {
} else {
packages_loaded = true;
}
}
if (OB_SUCC(ret) && packages_loaded) {
// Old data directories keep a completed common-package job. Use the
// persisted spec AND body properties as the migration marker, so a failed
// body reload is retried rather than mistaken for a completed refresh.
if (OB_FAIL(ensure_scheduler_invoker_rights(*sql_proxy))) {
} else {
GCTX.sys_package_ready_ = true;
LOG_INFO("system package catalog is ready");
}
}
return ret;
Expand All @@ -177,44 +180,13 @@ void ObSystemPackageLoadTask::runTimerTask()
ret = OB_NOT_INIT;
} else if (!share::server_is_write_enabled()) {
LOG_INFO("read-only server skips loading sys package");
} else if (GCTX.sys_package_ready_) {
LOG_INFO("sys package already loaded");
} else if (OB_FAIL(load_system_package_())) {
fail_count_++;
if (fail_count_ >= 5) {
LOG_ERROR("failed to execute system package load task, will retry", KR(ret), K_(fail_count));
} else {
}
LOG_WARN("system package installation failed, timer will retry", K(ret));
} else if (OB_FAIL(timer_->cancel(*this))) {
LOG_WARN("failed to retire system package timer", K(ret));
} else {
fail_count_ = 0;
LOG_INFO("finish loading sys packages");
}
}

int ObSystemPackageLoadTask::wait_system_package_ready(const common::ObTimeoutCtx &ctx)
{
int ret = OB_SUCCESS;
const int64_t retry_interval_us = 500l * 1000l;
int64_t job_id = OB_INVALID_ID;
bool finish = false;
int64_t inprogress_job_count = 0;
while (OB_SUCC(ret) && !finish) {
int tmp_ret = OB_SUCCESS;
if (ctx.is_timeouted()) {
ret = OB_TIMEOUT;
} else {
inprogress_job_count = 0;
if (OB_ENTRY_NOT_EXIST != (tmp_ret = ADMIN_JOB_FIND(LOAD_MYSQL_SYS_PACKAGE, job_id))) {
inprogress_job_count++;
}
if (inprogress_job_count == 0) {
finish = true;
} else {
ob_usleep(retry_interval_us);
}
}
LOG_INFO("system package installation timer retired");
}
return ret;
}

} // namespace rootserver
Expand Down
5 changes: 1 addition & 4 deletions src/observer/ob_system_package_load_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#ifndef _OCEANBASE_ROOTSERVER_OB_SYSTEM_PACKAGE_LOAD_TASK_H_
#define _OCEANBASE_ROOTSERVER_OB_SYSTEM_PACKAGE_LOAD_TASK_H_ 1

#include "common/ob_timeout_ctx.h"
#include "lib/task/ob_timer.h"
#include "lib/utility/ob_macro_utils.h"
#include "share/ob_define.h"
Expand All @@ -39,14 +38,12 @@ class ObSystemPackageLoadTask : public common::ObTimerTask

virtual void runTimerTask() override;

static int wait_system_package_ready(const common::ObTimeoutCtx &ctx);

private:
int load_system_package_();

private:
bool inited_;
int64_t fail_count_;
common::ObTimer *timer_;
static const int64_t SCHEDULE_INTERVAL_US = 3 * 1000 * 1000L; // 3s

private:
Expand Down
5 changes: 0 additions & 5 deletions src/query/api/query/command/ob_local_command_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ struct ObFlushOptStatArg;
struct ObSetTracepointParam;
struct ObUpdateStatCacheArg;
}
namespace common
{
class ObTimeoutCtx;
}
namespace query
{

Expand All @@ -43,7 +39,6 @@ class ObILocalCommandService
virtual int set_tracepoint(const obcall::ObSetTracepointParam &arg) = 0;
virtual int cancel_sys_task(const share::ObTaskId &task_id) = 0;
virtual int load_all_special_system_packages() = 0;
virtual int wait_system_package_ready(const common::ObTimeoutCtx &ctx) = 0;
virtual int get_build_version(char *buf, int64_t buf_len) = 0;
virtual int set_ds_action(const obcall::ObDebugSyncActionArg &arg) = 0;
virtual int refresh_stat_cache(const obcall::ObUpdateStatCacheArg &arg) = 0;
Expand Down
15 changes: 0 additions & 15 deletions src/rootserver/ob_local_management_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ int ObLocalManagementService::execute_bootstrap()
BOOTSTRAP_LOG(INFO, "start local services");
ObGlobalStatProxy global_proxy(sql_proxy_);
ObArray<ObAddr> self_addr;
ObTimeoutCtx ctx;
if (OB_FAIL(ret)) {
// load all sys packages after local schema and DDL services are ready
} else if (OB_FAIL(start_local_services_())) {
Expand All @@ -434,20 +433,6 @@ int ObLocalManagementService::execute_bootstrap()
baseline_schema_version_))) {
} else if (OB_FAIL(set_config_after_bootstrap_())) {
}
if (OB_SUCC(ret)) {
LOG_DBA_INFO_V2(OB_BOOTSTRAP_WAIT_SYS_PACKAGE_BEGIN,
DBA_STEP_INC_INFO(bootstrap),
"bootstrap wait sys package begin.");
if (OB_FAIL(ObShareUtil::set_default_timeout_ctx(ctx, config::_ob_ddl_timeout()))) {
} else if (!config::_enable_async_load_sys_package() &&
OB_FAIL(local_command_service_->wait_system_package_ready(ctx))) {
} else {
LOG_DBA_INFO_V2(OB_BOOTSTRAP_WAIT_SYS_PACKAGE_SUCCESS,
DBA_STEP_INC_INFO(bootstrap),
"bootstrap wait sys package success.");
}
}

if (OB_SUCC(ret)) {
char data_format_version[OB_SERVER_VERSION_LENGTH] = {'\0'};
const uint64_t current_data_version = DATA_CURRENT_VERSION;
Expand Down
1 change: 0 additions & 1 deletion src/share/ob_server_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct ObGlobalContext
share::ObSchemaStatusProxy *schema_status_proxy_;
int64_t ssl_key_expired_time_;
bool in_bootstrap_;
bool sys_package_ready_;
// Process-wide primary/standby mode.
share::ObServerRole::Role server_role_;

Expand Down
2 changes: 0 additions & 2 deletions src/sql/resolver/cmd/ob_call_procedure_resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ int ObCallProcedureResolver::resolve(const ParseNode &parse_tree)
ObLibCacheNameSpace::NS_CALLSTMT));
OX (call_proc_info = static_cast<ObCallProcedureInfo*>(stmt->get_cacheobj_guard().get_cache_obj()));
CK (OB_NOT_NULL(call_proc_info));
// Wait for sys package to be loaded if not ready yet
OZ (ObResolverUtils::wait_for_sys_package_ready(*session_info_));
// Parsing process name
if (OB_SUCC(ret)) {
if (T_SP_ACCESS_NAME != name_node->type_) {
Expand Down
33 changes: 0 additions & 33 deletions src/sql/resolver/ob_resolver_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5293,37 +5293,6 @@ int ObResolverUtils::set_parallel_info(sql::ObSQLSessionInfo &session_info,
return ret;
}

int ObResolverUtils::wait_for_sys_package_ready(ObSQLSessionInfo &session_info)
{
int ret = OB_SUCCESS;
if (config::_enable_async_load_sys_package() && !GCTX.sys_package_ready_
&& session_info.is_user_session() && share::server_is_write_enabled()) {
const int64_t retry_interval_us = 100L * 1000L; // 100ms
bool waited = false;
while (!GCTX.sys_package_ready_ && OB_SUCC(ret)) {
if (NULL != session_info.get_cur_exec_ctx() && OB_FAIL(session_info.get_cur_exec_ctx()->check_status())) {
} else {
if (!waited) {
LOG_INFO("sys package not ready yet, waiting for loading completion");
waited = true;
}
ob_usleep(retry_interval_us);
}
}
if (OB_FAIL(ret)) {
} else if (!GCTX.sys_package_ready_) {
LOG_WARN("sys package not ready after waiting");
} else {
if (waited) {
LOG_INFO("sys package ready after waiting");
}
// Return OB_SCHEMA_EAGAIN to retry acquiring schema
ret = OB_SCHEMA_EAGAIN;
}
}
return ret;
}

int ObResolverUtils::resolve_external_symbol(common::ObIAllocator &allocator,
sql::ObRawExprFactory &expr_factory,
sql::ObSQLSessionInfo &session_info,
Expand Down Expand Up @@ -5361,8 +5330,6 @@ int ObResolverUtils::resolve_external_symbol(common::ObIAllocator &allocator,
}

if (OB_SUCC(ret)) {
// Wait for sys package to be loaded if not ready yet
OZ (wait_for_sys_package_ready(session_info));
if (OB_SUCC(ret)) {
pl::ObPLResolver pl_resolver(allocator,
session_info,
Expand Down
1 change: 0 additions & 1 deletion src/sql/resolver/ob_resolver_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ struct ObResolverUtils

// Wait for sys package to be loaded if not ready yet
// Returns OB_SCHEMA_EAGAIN if waiting succeeded and retry is needed, OB_SUCCESS if no waiting needed or already ready
static int wait_for_sys_package_ready(ObSQLSessionInfo &session_info);

static int resolve_external_symbol(common::ObIAllocator &allocator,
sql::ObRawExprFactory &expr_factory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ _display_non_session_cursor
_enable_adaptive_auto_dop
_enable_adaptive_compaction
_enable_add_fulltext_index_to_existing_table
_enable_async_load_sys_package
_enable_backtrace_function
_enable_block_file_punch_hole
_enable_compaction_diagnose
Expand Down
Loading