diff --git a/src/archive/ob_archive_pg_mgr.cpp b/src/archive/ob_archive_pg_mgr.cpp index 4896893464f95af4bed3f47801873aa7944ebd6e..b4fc5ea3e2e49cb635eb39a98db15dfdd734a20e 100644 --- a/src/archive/ob_archive_pg_mgr.cpp +++ b/src/archive/ob_archive_pg_mgr.cpp @@ -23,6 +23,7 @@ #include "storage/ob_i_partition_group.h" #include "share/ob_debug_sync.h" #include "storage/ob_pg_storage.h" +#include "share/backup/ob_backup_info_mgr.h" namespace oceanbase { using namespace oceanbase::common; @@ -33,7 +34,7 @@ public: : start_flag_(true), archive_round_(archive_round), incarnation_(incarnation) {} - bool operator()(const ObPGKey& pg_key, ObPGArchiveTask* task) + bool operator()(const ObPGKey &pg_key, ObPGArchiveTask *task) { int ret = OB_SUCCESS; bool bret = true; @@ -65,10 +66,10 @@ private: class ObArchivePGMgr::CheckDeletePGFunctor { public: - CheckDeletePGFunctor(ObArchivePGMgr* pg_mgr) : pg_mgr_(pg_mgr) + CheckDeletePGFunctor(ObArchivePGMgr *pg_mgr) : pg_mgr_(pg_mgr) {} - bool operator()(const ObPGKey& pg_key, ObPGArchiveTask* task) + bool operator()(const ObPGKey &pg_key, ObPGArchiveTask *task) { int ret = OB_SUCCESS; bool is_leader = true; @@ -103,7 +104,7 @@ public: } private: - ObArchivePGMgr* pg_mgr_; + ObArchivePGMgr *pg_mgr_; }; //============================== start of ObArchivePGMgr =============================// @@ -132,8 +133,8 @@ ObArchivePGMgr::~ObArchivePGMgr() ARCHIVE_LOG(INFO, "ObArchivePGMgr destroy"); } -int ObArchivePGMgr::init(ObArchiveAllocator* allocator, ObArchiveLogWrapper* log_wrapper, - ObPartitionService* partition_service, ObArchiveRoundMgr* archive_round_mgr, ObArchiveMgr* archive_mgr) +int ObArchivePGMgr::init(ObArchiveAllocator *allocator, ObArchiveLogWrapper *log_wrapper, + ObPartitionService *partition_service, ObArchiveRoundMgr *archive_round_mgr, ObArchiveMgr *archive_mgr) { int ret = OB_SUCCESS; @@ -198,14 +199,14 @@ int ObArchivePGMgr::reset_tasks() // reset queue_ for (int64_t i = 0; i < PG_MGR_QUEUE_SIZE; i++) { while (!pre_pg_queue_[i].is_empty()) { - ObLink* link = nullptr; + ObLink *link = nullptr; if (OB_FAIL(pre_pg_queue_[i].pop(link))) { ARCHIVE_LOG(ERROR, "pre_pg_queue_ pop fail", KR(ret), K(i)); } else if (OB_ISNULL(link)) { ret = OB_ERR_UNEXPECTED; ARCHIVE_LOG(WARN, "link is NULL", KR(ret), K(link)); } else { - ob_archive_free((void*)link); + ob_archive_free((void *)link); } } } @@ -256,7 +257,7 @@ void ObArchivePGMgr::wait() ObThreadPool::wait(); } -int ObArchivePGMgr::add_pg_archive_task(storage::ObIPartitionGroup* partition, bool& is_added) +int ObArchivePGMgr::add_pg_archive_task(storage::ObIPartitionGroup *partition, bool &is_added) { int ret = OB_SUCCESS; const bool is_add = true; @@ -264,7 +265,7 @@ int ObArchivePGMgr::add_pg_archive_task(storage::ObIPartitionGroup* partition, b int64_t epoch = OB_INVALID_TIMESTAMP; ObRole role = ObRole::INVALID_ROLE; int64_t takeover_ts = OB_INVALID_TIMESTAMP; - ObIPartitionLogService* pls = NULL; + ObIPartitionLogService *pls = NULL; ObIPartitionGroupGuard guard; is_added = false; @@ -275,7 +276,7 @@ int ObArchivePGMgr::add_pg_archive_task(storage::ObIPartitionGroup* partition, b ARCHIVE_LOG(WARN, "partition is NULL"); ret = OB_INVALID_ARGUMENT; } else { - const ObPGKey& pg_key = partition->get_partition_key(); + const ObPGKey &pg_key = partition->get_partition_key(); if (OB_SYS_TENANT_ID == pg_key.get_tenant_id()) { ret = OB_ERR_UNEXPECTED; ARCHIVE_LOG(WARN, "sys tenant do not need to do log archiving", KR(ret), K(pg_key)); @@ -320,13 +321,13 @@ int ObArchivePGMgr::add_all_pg_on_start_archive_task(const int64_t incarnation, K(incarnation_)); ret = OB_INVALID_ARGUMENT; } else { - ObIPartitionGroupIterator* iter = NULL; + ObIPartitionGroupIterator *iter = NULL; if (OB_ISNULL(iter = partition_service_->alloc_pg_iter())) { ret = OB_ALLOCATE_MEMORY_FAILED; ARCHIVE_LOG(WARN, "alloc_pg_iter fail", KR(ret)); } else { while (OB_SUCCESS == ret && !has_set_stop()) { - ObIPartitionGroup* partition = NULL; + ObIPartitionGroup *partition = NULL; bool is_added = false; if (OB_FAIL(iter->get_next(partition))) { if (OB_ITER_END == ret) { @@ -339,7 +340,7 @@ int ObArchivePGMgr::add_all_pg_on_start_archive_task(const int64_t incarnation, ARCHIVE_LOG(ERROR, "iterate partition fail", KR(ret), K(partition)); } else { const bool is_normal_pg = !partition->get_pg_storage().is_restore(); - const ObPGKey& pg_key = partition->get_partition_key(); + const ObPGKey &pg_key = partition->get_partition_key(); // sys and restoring tenant not do archive if ((OB_SYS_TENANT_ID != pg_key.get_tenant_id()) && is_normal_pg) { if (OB_FAIL(add_pg_archive_task(partition, is_added))) { @@ -367,7 +368,7 @@ int ObArchivePGMgr::add_all_pg_on_start_archive_task(const int64_t incarnation, return ret; } -int ObArchivePGMgr::delete_pg_archive_task(storage::ObIPartitionGroup* partition) +int ObArchivePGMgr::delete_pg_archive_task(storage::ObIPartitionGroup *partition) { int ret = OB_SUCCESS; const bool is_add = false; @@ -382,7 +383,7 @@ int ObArchivePGMgr::delete_pg_archive_task(storage::ObIPartitionGroup* partition ret = OB_INVALID_ARGUMENT; ARCHIVE_LOG(WARN, "partition is NULL", KR(ret), K(partition)); } else { - const ObPGKey& pg_key = partition->get_partition_key(); + const ObPGKey &pg_key = partition->get_partition_key(); if (OB_FAIL(put_pg_archive_task_(pg_key, unused_epoch, unused_takeover_ts, unused_create_ts, is_add))) { ARCHIVE_LOG(WARN, "put_pg_archive_task_ fail", KR(ret), K(pg_key)); } else { @@ -393,7 +394,7 @@ int ObArchivePGMgr::delete_pg_archive_task(storage::ObIPartitionGroup* partition return ret; } -int ObArchivePGMgr::inner_delete_pg_archive_task(const ObPGKey& pg_key) +int ObArchivePGMgr::inner_delete_pg_archive_task(const ObPGKey &pg_key) { int ret = OB_SUCCESS; const bool is_add = false; @@ -416,7 +417,7 @@ int ObArchivePGMgr::inner_delete_pg_archive_task(const ObPGKey& pg_key) return ret; } -int ObArchivePGMgr::revert_pg_archive_task(ObPGArchiveTask* pg_archive_task) +int ObArchivePGMgr::revert_pg_archive_task(ObPGArchiveTask *pg_archive_task) { int ret = OB_SUCCESS; @@ -441,10 +442,10 @@ bool ObArchivePGMgr::is_prepare_pg_empty() return bret; } -int ObArchivePGMgr::get_pg_archive_task_guard(const ObPGKey& key, ObPGArchiveTaskGuard& guard) +int ObArchivePGMgr::get_pg_archive_task_guard(const ObPGKey &key, ObPGArchiveTaskGuard &guard) { int ret = OB_SUCCESS; - ObPGArchiveTask* pg_archive_task = NULL; + ObPGArchiveTask *pg_archive_task = NULL; if (OB_UNLIKELY(!inited_)) { ARCHIVE_LOG(WARN, "ObArchivePGMgr not init"); @@ -464,10 +465,10 @@ int ObArchivePGMgr::get_pg_archive_task_guard(const ObPGKey& key, ObPGArchiveTas } // get pg_archive_task guard, return OB_ENTRY_NOT_EXIST if pg_archive_task mark delete -int ObArchivePGMgr::get_pg_archive_task_guard_with_status(const ObPGKey& key, ObPGArchiveTaskGuard& guard) +int ObArchivePGMgr::get_pg_archive_task_guard_with_status(const ObPGKey &key, ObPGArchiveTaskGuard &guard) { int ret = OB_SUCCESS; - ObPGArchiveTask* pg_archive_task = NULL; + ObPGArchiveTask *pg_archive_task = NULL; bool mark_delete = false; if (OB_UNLIKELY(!inited_)) { @@ -492,11 +493,11 @@ int ObArchivePGMgr::get_pg_archive_task_guard_with_status(const ObPGKey& key, Ob return ret; } -int ObArchivePGMgr::update_clog_split_progress(ObPGArchiveCLogTask* clog_task) +int ObArchivePGMgr::update_clog_split_progress(ObPGArchiveCLogTask *clog_task) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; if (OB_ISNULL(clog_task)) { ret = OB_INVALID_ARGUMENT; ARCHIVE_LOG(ERROR, "invalid clog task is NULL", KR(ret)); @@ -509,7 +510,7 @@ int ObArchivePGMgr::update_clog_split_progress(ObPGArchiveCLogTask* clog_task) const int64_t incarnation = clog_task->incarnation_; const int64_t log_archive_round = clog_task->log_archive_round_; - ObPGKey& pg_key = clog_task->pg_key_; + ObPGKey &pg_key = clog_task->pg_key_; if (OB_FAIL(get_pg_archive_task_guard_with_status(pg_key, guard))) { ARCHIVE_LOG(WARN, "get_pg_archive_task_guard_with_status fail", KR(ret), K(pg_key)); } else if (OB_ISNULL(task = guard.get_pg_archive_task())) { @@ -534,12 +535,12 @@ int ObArchivePGMgr::update_clog_split_progress(ObPGArchiveCLogTask* clog_task) return ret; } -int ObArchivePGMgr::get_clog_split_info(const ObPGKey& key, const int64_t epoch, const int64_t incarnation, - const int64_t round, uint64_t& last_split_log_id, int64_t& last_split_log_ts, int64_t& last_checkpoint_ts) +int ObArchivePGMgr::get_clog_split_info(const ObPGKey &key, const int64_t epoch, const int64_t incarnation, + const int64_t round, uint64_t &last_split_log_id, int64_t &last_split_log_ts, int64_t &last_checkpoint_ts) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; if (OB_FAIL(get_pg_archive_task_guard_with_status(key, guard))) { ARCHIVE_LOG(WARN, "get_pg_archive_task_guard_with_status fail", KR(ret), K(key)); @@ -584,11 +585,11 @@ int ObArchivePGMgr::set_server_start_archive_ts(const int64_t start_archive_ts) } int ObArchivePGMgr::mark_fatal_error( - const ObPGKey& pg_key, const int64_t epoch_id, const int64_t incarnation, const int64_t log_archive_round) + const ObPGKey &pg_key, const int64_t epoch_id, const int64_t incarnation, const int64_t log_archive_round) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; archive_mgr_->mark_encounter_fatal_err(pg_key, incarnation, log_archive_round); ARCHIVE_LOG(ERROR, "mark fatal error", K(pg_key), K(epoch_id), K(incarnation), K(log_archive_round)); @@ -615,7 +616,7 @@ int ObArchivePGMgr::mark_fatal_error( } int ObArchivePGMgr::check_if_task_expired( - const ObPGKey& pg_key, const int64_t incarnation, const int64_t log_archive_round, bool& is_expired) + const ObPGKey &pg_key, const int64_t incarnation, const int64_t log_archive_round, bool &is_expired) { int ret = OB_SUCCESS; if (OB_UNLIKELY(!inited_)) { @@ -628,7 +629,7 @@ int ObArchivePGMgr::check_if_task_expired( is_expired = true; } else { ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; if (OB_FAIL(get_pg_archive_task_guard_with_status(pg_key, guard))) { if (OB_ENTRY_NOT_EXIST != ret) { ARCHIVE_LOG(WARN, "get_pg_archive_task_guard fail", KR(ret), K(pg_key)); @@ -651,7 +652,7 @@ int ObArchivePGMgr::check_if_task_expired( return ret; } -int ObArchivePGMgr::get_archive_pg_map(PGArchiveMap*& map) +int ObArchivePGMgr::get_archive_pg_map(PGArchiveMap *&map) { int ret = OB_SUCCESS; @@ -669,12 +670,12 @@ int ObArchivePGMgr::get_archive_pg_map(PGArchiveMap*& map) //============================== start of private functions ========================// // put add/gc task into queue_ -int ObArchivePGMgr::put_pg_archive_task_(const ObPGKey& pg_key, const int64_t epoch, const int64_t takeover_ts, +int ObArchivePGMgr::put_pg_archive_task_(const ObPGKey &pg_key, const int64_t epoch, const int64_t takeover_ts, const int64_t create_timestamp, const bool is_add) { int ret = OB_SUCCESS; - PreArchiveLinkedPGKey* link = NULL; - void* data = NULL; + PreArchiveLinkedPGKey *link = NULL; + void *data = NULL; if (OB_UNLIKELY(!inited_)) { ARCHIVE_LOG(ERROR, "ObArchivePGMgr not init"); @@ -704,11 +705,11 @@ int ObArchivePGMgr::put_pg_archive_task_(const ObPGKey& pg_key, const int64_t ep return ret; } -int ObArchivePGMgr::check_pg_task_exist_(const ObPGKey& pg_key, bool& pg_exist) +int ObArchivePGMgr::check_pg_task_exist_(const ObPGKey &pg_key, bool &pg_exist) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; pg_exist = false; if (OB_UNLIKELY(!pg_key.is_valid())) { @@ -874,8 +875,8 @@ void ObArchivePGMgr::do_dispatch_pg_() ARCHIVE_LOG(ERROR, "archive_mgr_ is NULL"); } else { while (OB_SUCC(ret) && !has_set_stop() && archive_mgr_->is_in_archive_status() && !is_pre_task_empty_()) { - ObLink* link = nullptr; - PreArchiveLinkedPGKey* link_pg_key = nullptr; + ObLink *link = nullptr; + PreArchiveLinkedPGKey *link_pg_key = nullptr; if (OB_FAIL(pop_pre_task_(link))) { ARCHIVE_LOG(WARN, "pop_pre_task_ fail", KR(ret)); @@ -883,7 +884,7 @@ void ObArchivePGMgr::do_dispatch_pg_() ARCHIVE_LOG(WARN, "link is NULL"); ret = OB_ERR_UNEXPECTED; } else { - link_pg_key = static_cast(link); + link_pg_key = static_cast(link); const ObPGKey pg_key = link_pg_key->pg_key_; const bool is_add_task = link_pg_key->type_; const int64_t timestamp = link_pg_key->create_timestamp_; @@ -902,7 +903,7 @@ void ObArchivePGMgr::do_dispatch_pg_() // push back all failed pg task, pg not satisfied can be removed in next retry if (OB_SUCC(ret)) { link_pg_key->~PreArchiveLinkedPGKey(); - ob_archive_free((void*)link_pg_key); + ob_archive_free((void *)link_pg_key); link_pg_key = NULL; } else { (void)push_pre_task_(pg_key, link_pg_key); @@ -924,11 +925,11 @@ void ObArchivePGMgr::do_dispatch_pg_() // 3) write kickoff log // 4) push pg to ilog_fetch queue int ObArchivePGMgr::handle_add_task_( - const ObPGKey& pg_key, const int64_t create_timestamp, const int64_t leader_epoch, const int64_t leader_takeover_ts) + const ObPGKey &pg_key, const int64_t create_timestamp, const int64_t leader_epoch, const int64_t leader_takeover_ts) { int ret = OB_SUCCESS; bool is_leader = false; - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; bool pg_exist = false; bool compatible = false; @@ -987,11 +988,11 @@ int ObArchivePGMgr::handle_add_task_( return ret; } -int ObArchivePGMgr::check_active_pg_archive_task_exist_(const ObPGKey& pg_key, const int64_t epoch, bool& exist) +int ObArchivePGMgr::check_active_pg_archive_task_exist_(const ObPGKey &pg_key, const int64_t epoch, bool &exist) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; int64_t task_epoch = OB_INVALID_TIMESTAMP; exist = false; @@ -1016,7 +1017,7 @@ int ObArchivePGMgr::check_active_pg_archive_task_exist_(const ObPGKey& pg_key, c return ret; } -bool ObArchivePGMgr::get_and_check_compatible_(bool& compatible) +bool ObArchivePGMgr::get_and_check_compatible_(bool &compatible) { bool bret = true; int64_t incarnation = -1; @@ -1036,10 +1037,10 @@ bool ObArchivePGMgr::get_and_check_compatible_(bool& compatible) return bret; } -int ObArchivePGMgr::add_pg_to_ilog_fetch_queue_(StartArchiveHelper& helper) +int ObArchivePGMgr::add_pg_to_ilog_fetch_queue_(StartArchiveHelper &helper) { int ret = OB_SUCCESS; - const ObPGKey& pg_key = helper.pg_key_; + const ObPGKey &pg_key = helper.pg_key_; const uint64_t start_log_id = helper.get_start_log_id(); const file_id_t ilog_file_id = helper.start_ilog_file_id_; PGFetchTask task; @@ -1049,7 +1050,7 @@ int ObArchivePGMgr::add_pg_to_ilog_fetch_queue_(StartArchiveHelper& helper) task.epoch_ = helper.epoch_; task.start_log_id_ = start_log_id; task.ilog_file_id_ = helper.start_ilog_file_id_; - ObArchiveIlogFetchTaskMgr* ilog_fetch_task_mgr = NULL; + ObArchiveIlogFetchTaskMgr *ilog_fetch_task_mgr = NULL; if (OB_ISNULL(archive_mgr_) || OB_ISNULL(ilog_fetch_task_mgr = &archive_mgr_->ilog_fetch_task_mgr_)) { ret = OB_ERR_UNEXPECTED; @@ -1069,10 +1070,10 @@ int ObArchivePGMgr::add_pg_to_ilog_fetch_queue_(StartArchiveHelper& helper) return ret; } -int ObArchivePGMgr::generate_and_submit_first_log_(StartArchiveHelper& helper) +int ObArchivePGMgr::generate_and_submit_first_log_(StartArchiveHelper &helper) { int ret = OB_SUCCESS; - ObArchiveIlogFetcher* ilog_fetcher = NULL; + ObArchiveIlogFetcher *ilog_fetcher = NULL; if (OB_ISNULL(archive_mgr_) || OB_ISNULL(ilog_fetcher = &archive_mgr_->ilog_fetcher_) || OB_UNLIKELY(!helper.is_valid())) { @@ -1087,11 +1088,11 @@ int ObArchivePGMgr::generate_and_submit_first_log_(StartArchiveHelper& helper) return OB_SUCCESS; } -int ObArchivePGMgr::handle_gc_task_(const ObPGKey& pg_key) +int ObArchivePGMgr::handle_gc_task_(const ObPGKey &pg_key) { int ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; bool is_leader = false; if (OB_ISNULL(archive_round_mgr_)) { @@ -1122,7 +1123,7 @@ int ObArchivePGMgr::handle_gc_task_(const ObPGKey& pg_key) return ret; } -int ObArchivePGMgr::insert_or_update_pg_(StartArchiveHelper& helper, ObPGArchiveTask*& pg_task) +int ObArchivePGMgr::insert_or_update_pg_(StartArchiveHelper &helper, ObPGArchiveTask *&pg_task) { int ret = OB_SUCCESS; const ObPGKey pg_key = helper.pg_key_; @@ -1134,7 +1135,7 @@ int ObArchivePGMgr::insert_or_update_pg_(StartArchiveHelper& helper, ObPGArchive // update pg task info ret = OB_SUCCESS; ObPGArchiveTaskGuard guard(this); - ObPGArchiveTask* task = NULL; + ObPGArchiveTask *task = NULL; if (OB_FAIL(get_pg_archive_task_guard(pg_key, guard))) { ARCHIVE_LOG(WARN, "get_pg_archive_task_guard fail", KR(ret), K(pg_key)); } else if (OB_ISNULL(task = guard.get_pg_archive_task())) { @@ -1146,7 +1147,7 @@ int ObArchivePGMgr::insert_or_update_pg_(StartArchiveHelper& helper, ObPGArchive } } else if (OB_ENTRY_NOT_EXIST == ret) { ret = OB_SUCCESS; - ObPGArchiveTask* pg_archive_task = NULL; + ObPGArchiveTask *pg_archive_task = NULL; // const bool mandatory = true; if (OB_FAIL(pg_map_.alloc_value(pg_archive_task))) { ARCHIVE_LOG(WARN, "alloc_value fail", K(pg_key)); @@ -1178,7 +1179,7 @@ int ObArchivePGMgr::insert_or_update_pg_(StartArchiveHelper& helper, ObPGArchive return ret; } -int ObArchivePGMgr::remove_pg_(const ObPGKey& pg_key) +int ObArchivePGMgr::remove_pg_(const ObPGKey &pg_key) { int ret = OB_SUCCESS; @@ -1206,13 +1207,13 @@ int ObArchivePGMgr::reconfirm_pg_add_() ret = OB_INVALID_ARGUMENT; ARCHIVE_LOG(ERROR, "invalid argument", KR(ret), K(archive_mgr_), K(partition_service_)); } else { - ObIPartitionGroupIterator* iter = NULL; + ObIPartitionGroupIterator *iter = NULL; if (OB_ISNULL(iter = partition_service_->alloc_pg_iter())) { ret = OB_ALLOCATE_MEMORY_FAILED; ARCHIVE_LOG(WARN, "alloc_pg_iter fail", KR(ret)); } else { while (OB_SUCCESS == ret && !has_set_stop()) { - ObIPartitionGroup* partition = NULL; + ObIPartitionGroup *partition = NULL; bool pg_exist = false; bool is_added = false; if (OB_FAIL(iter->get_next(partition))) { @@ -1225,7 +1226,7 @@ int ObArchivePGMgr::reconfirm_pg_add_() ret = OB_ERR_UNEXPECTED; ARCHIVE_LOG(ERROR, "iterate partition fail", KR(ret), K(partition)); } else { - const ObPGKey& pg_key = partition->get_partition_key(); + const ObPGKey &pg_key = partition->get_partition_key(); const bool is_normal_pg = !partition->get_pg_storage().is_restore(); // sys tenant and restoring tenant can not start archive if ((OB_SYS_TENANT_ID != pg_key.get_tenant_id()) && is_normal_pg) { @@ -1278,13 +1279,13 @@ bool ObArchivePGMgr::is_pre_task_empty_() return pre_pg_queue_[thread_index - 1].is_empty(); } -int ObArchivePGMgr::pop_pre_task_(ObLink*& link) +int ObArchivePGMgr::pop_pre_task_(ObLink *&link) { const int64_t thread_index = thread_index_(); return pre_pg_queue_[thread_index - 1].pop(link); } -int ObArchivePGMgr::push_pre_task_(const ObPGKey& pg_key, ObLink* link) +int ObArchivePGMgr::push_pre_task_(const ObPGKey &pg_key, ObLink *link) { int ret = OB_SUCCESS; if (0 == queue_num_) { @@ -1301,7 +1302,7 @@ int ObArchivePGMgr::push_pre_task_(const ObPGKey& pg_key, ObLink* link) //====================== end of ObArchivePGMgr =====================// //===================== PreArchiveLinkedPGKey =====================// -PreArchiveLinkedPGKey::PreArchiveLinkedPGKey(const ObPGKey& pg_key, const int64_t epoch, const int64_t takeover_ts, +PreArchiveLinkedPGKey::PreArchiveLinkedPGKey(const ObPGKey &pg_key, const int64_t epoch, const int64_t takeover_ts, const int64_t create_timestamp, const bool is_add) { pg_key_ = pg_key; diff --git a/src/clog/ob_log_sliding_window.cpp b/src/clog/ob_log_sliding_window.cpp index f0e1f8b5dfdcfa9c284eb0bfd1ff1c3246c156fb..61180ecb733a95a10d32ac9ed55e77838c7e2c2a 100644 --- a/src/clog/ob_log_sliding_window.cpp +++ b/src/clog/ob_log_sliding_window.cpp @@ -12,6 +12,7 @@ #include "ob_log_sliding_window.h" #include "share/allocator/ob_tenant_mutil_allocator.h" +#include "share/backup/ob_backup_info_mgr.h" #include "lib/stat/ob_diagnose_info.h" #include "lib/statistic_event/ob_stat_event.h" #include "lib/compress/ob_compressor_pool.h" @@ -96,11 +97,11 @@ ObLogSlidingWindow::ObLogSlidingWindow() is_inited_(false) {} -int ObLogSlidingWindow::init(ObLogReplayEngineWrapper* replay_engine, ObILogEngine* log_engine, - ObILogStateMgrForSW* state_mgr, ObILogMembershipMgr* mm, ObLogCascadingMgr* cascading_mgr, - storage::ObPartitionService* partition_service, common::ObILogAllocator* alloc_mgr, ObILogChecksum* checksum, - ObILogCallbackEngine* cb_engine, ObLogRestoreMgr* restore_mgr, const common::ObAddr& self, - const common::ObPartitionKey& key, const int64_t epoch_id, const uint64_t last_replay_log_id, +int ObLogSlidingWindow::init(ObLogReplayEngineWrapper *replay_engine, ObILogEngine *log_engine, + ObILogStateMgrForSW *state_mgr, ObILogMembershipMgr *mm, ObLogCascadingMgr *cascading_mgr, + storage::ObPartitionService *partition_service, common::ObILogAllocator *alloc_mgr, ObILogChecksum *checksum, + ObILogCallbackEngine *cb_engine, ObLogRestoreMgr *restore_mgr, const common::ObAddr &self, + const common::ObPartitionKey &key, const int64_t epoch_id, const uint64_t last_replay_log_id, const int64_t last_submit_ts, const int64_t accum_checksum) { int ret = OB_SUCCESS; @@ -175,7 +176,7 @@ int ObLogSlidingWindow::init_aggre_buffer_(const uint64_t start_id, const uint64 aggre_buffer_cnt = 4; } if (0 < aggre_buffer_cnt) { - if (NULL == (aggre_buffer_ = (ObAggreBuffer*)ob_malloc(aggre_buffer_cnt * sizeof(ObAggreBuffer), mem_attr))) { + if (NULL == (aggre_buffer_ = (ObAggreBuffer *)ob_malloc(aggre_buffer_cnt * sizeof(ObAggreBuffer), mem_attr))) { ret = OB_ALLOCATE_MEMORY_FAILED; CLOG_LOG(WARN, "alloc memory failed", K(ret), K(start_id)); } else { @@ -268,12 +269,12 @@ uint64_t ObLogSlidingWindow::get_max_timestamp() const return max_log_meta_info_.get_timestamp(); } -void ObLogSlidingWindow::get_max_log_id_info(uint64_t& max_log_id, int64_t& max_log_ts) const +void ObLogSlidingWindow::get_max_log_id_info(uint64_t &max_log_id, int64_t &max_log_ts) const { (void)max_log_meta_info_.get_log_id_and_timestamp(max_log_id, max_log_ts); } -void ObLogSlidingWindow::get_next_replay_log_id_info(uint64_t& next_log_id, int64_t& next_log_ts) const +void ObLogSlidingWindow::get_next_replay_log_id_info(uint64_t &next_log_id, int64_t &next_log_ts) const { struct types::uint128_t next_log_id_info; LOAD128(next_log_id_info, &next_replay_log_id_info_); @@ -297,7 +298,7 @@ int ObLogSlidingWindow::try_update_max_log_id(const uint64_t log_id) return ret; } -int ObLogSlidingWindow::send_log_to_standby_cluster_(const uint64_t log_id, ObLogTask* log_task) +int ObLogSlidingWindow::send_log_to_standby_cluster_(const uint64_t log_id, ObLogTask *log_task) { // send log to standby cluster, caller guarantees this log has reached majority in local cluster. // caller need hold lock for log_task @@ -310,7 +311,7 @@ int ObLogSlidingWindow::send_log_to_standby_cluster_(const uint64_t log_id, ObLo ObReadBuf rbuf; ObLogEntry tmp_entry; if (log_task->is_submit_log_body_exist()) { - const char* log_buf = log_task->get_log_buf(); + const char *log_buf = log_task->get_log_buf(); int64_t log_buf_len = log_task->get_log_buf_len(); ObLogEntryHeader header; @@ -345,10 +346,10 @@ int ObLogSlidingWindow::send_log_to_standby_cluster_(const uint64_t log_id, ObLo } int64_t pos = 0; - char* serialize_buff = NULL; + char *serialize_buff = NULL; int64_t serialize_size = tmp_entry.get_serialize_size(); if (OB_SUCC(ret)) { - if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(serialize_size)))) { + if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(serialize_size)))) { CLOG_LOG(ERROR, "alloc failed", K_(partition_key)); ret = OB_ALLOCATE_MEMORY_FAILED; } else if (OB_SUCCESS != (ret = tmp_entry.serialize(serialize_buff, serialize_size, pos))) { @@ -370,7 +371,7 @@ int ObLogSlidingWindow::send_log_to_standby_cluster_(const uint64_t log_id, ObLo return ret; } -int ObLogSlidingWindow::send_confirmed_info_to_standby_children_(const uint64_t log_id, ObLogTask* log_task) +int ObLogSlidingWindow::send_confirmed_info_to_standby_children_(const uint64_t log_id, ObLogTask *log_task) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -409,7 +410,7 @@ int ObLogSlidingWindow::send_confirmed_info_to_standby_children_(const uint64_t return ret; } -bool ObLogSlidingWindow::is_primary_need_send_log_to_standby_(ObLogTask* log_task) const +bool ObLogSlidingWindow::is_primary_need_send_log_to_standby_(ObLogTask *log_task) const { // whether primary replica can transfer log to standby children bool bool_ret = false; @@ -422,7 +423,7 @@ bool ObLogSlidingWindow::is_primary_need_send_log_to_standby_(ObLogTask* log_tas return bool_ret; } -bool ObLogSlidingWindow::is_mp_leader_waiting_standby_ack_(ObLogTask* log_task) const +bool ObLogSlidingWindow::is_mp_leader_waiting_standby_ack_(ObLogTask *log_task) const { // whether primary leader has not received standby ack in max protection mode bool bool_ret = false; @@ -436,7 +437,7 @@ bool ObLogSlidingWindow::is_mp_leader_waiting_standby_ack_(ObLogTask* log_task) return bool_ret; } -bool ObLogSlidingWindow::is_follower_need_send_log_to_standby_(ObLogTask* log_task) const +bool ObLogSlidingWindow::is_follower_need_send_log_to_standby_(ObLogTask *log_task) const { // whether follower can transfer log to standby children // it must guarantee this log has been confirmed @@ -452,13 +453,13 @@ bool ObLogSlidingWindow::is_follower_need_send_log_to_standby_(ObLogTask* log_ta return bool_ret; } -int ObLogSlidingWindow::ack_log(const uint64_t log_id, const ObAddr& server, bool& majority) +int ObLogSlidingWindow::ack_log(const uint64_t log_id, const ObAddr &server, bool &majority) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; bool need_send_to_standby = false; if (IS_NOT_INIT) { ret = OB_NOT_INIT; @@ -468,7 +469,7 @@ int ObLogSlidingWindow::ack_log(const uint64_t log_id, const ObAddr& server, boo ret = OB_SUCCESS; } else if (OB_FAIL(ret)) { CLOG_LOG(WARN, "ack log: get log from sliding window failed", K_(partition_key), K(log_id), K(ret)); - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { ret = OB_ERR_NULL_VALUE; CLOG_LOG(WARN, "ack log: get null log", K_(partition_key), K(log_id)); } else if (!log_task->is_submit_log_exist()) { @@ -511,13 +512,13 @@ int ObLogSlidingWindow::ack_log(const uint64_t log_id, const ObAddr& server, boo return ret; } -int ObLogSlidingWindow::standby_ack_log(const uint64_t log_id, const ObAddr& server, bool& majority) +int ObLogSlidingWindow::standby_ack_log(const uint64_t log_id, const ObAddr &server, bool &majority) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (!server.is_valid() || OB_ISNULL(mm_)) { @@ -526,7 +527,7 @@ int ObLogSlidingWindow::standby_ack_log(const uint64_t log_id, const ObAddr& ser ret = OB_SUCCESS; } else if (OB_FAIL(ret)) { CLOG_LOG(WARN, "ack log: get log from sliding window failed", K_(partition_key), K(log_id), K(ret)); - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { ret = OB_ERR_NULL_VALUE; CLOG_LOG(WARN, "ack log: get null log", K_(partition_key), K(log_id)); } else if (!log_task->is_submit_log_exist()) { @@ -546,7 +547,7 @@ int ObLogSlidingWindow::standby_ack_log(const uint64_t log_id, const ObAddr& ser return ret; } -int ObLogSlidingWindow::fake_ack_log(const uint64_t log_id, const common::ObAddr& server, const int64_t receive_ts) +int ObLogSlidingWindow::fake_ack_log(const uint64_t log_id, const common::ObAddr &server, const int64_t receive_ts) { int ret = OB_SUCCESS; @@ -591,7 +592,7 @@ bool ObLogSlidingWindow::is_fake_info_need_revoke(const uint64_t log_id, const i fake_ack_info_mgr_.get_log_id()); } } else { - const common::ObMemberList& member_list = mm_->get_curr_member_list(); + const common::ObMemberList &member_list = mm_->get_curr_member_list(); const int64_t replica_num = mm_->get_replica_num(); bool_ret = fake_ack_info_mgr_.check_fake_info_need_revoke(log_id, current_time, self_, member_list, replica_num); if (bool_ret && REACH_TIME_INTERVAL(100 * 1000)) { @@ -603,7 +604,7 @@ bool ObLogSlidingWindow::is_fake_info_need_revoke(const uint64_t log_id, const i } // when base_timestamp !=0, it indicates that this log is transaction log. -int ObLogSlidingWindow::alloc_log_id_ts_(const int64_t base_timestamp, uint64_t& log_id, int64_t& submit_timestamp) +int ObLogSlidingWindow::alloc_log_id_ts_(const int64_t base_timestamp, uint64_t &log_id, int64_t &submit_timestamp) { int ret = OB_SUCCESS; int64_t wait_times = 0; @@ -621,7 +622,7 @@ int ObLogSlidingWindow::alloc_log_id_ts_(const int64_t base_timestamp, uint64_t& if (AGGRE_BUFFER_FLAG != tmp_offset) { ret = fill_aggre_buffer_(log_id - 1, tmp_offset, NULL, 0, 0, NULL); } - ObAggreBuffer* buffer = aggre_buffer_ + ((log_id - aggre_buffer_start_id_) % aggre_buffer_cnt_); + ObAggreBuffer *buffer = aggre_buffer_ + ((log_id - aggre_buffer_start_id_) % aggre_buffer_cnt_); buffer->wait(log_id, wait_times); if (wait_times > 0 && EXECUTE_COUNT_PER_SEC(4)) { CLOG_LOG(WARN, "clog wait aggre buffer", K_(partition_key), K(wait_times), K(log_id)); @@ -634,7 +635,7 @@ int ObLogSlidingWindow::alloc_log_id_ts_(const int64_t base_timestamp, uint64_t& } int ObLogSlidingWindow::alloc_log_id_ts_( - const int64_t base_timestamp, const int64_t size, uint64_t& log_id, int64_t& submit_timestamp, int64_t& offset) + const int64_t base_timestamp, const int64_t size, uint64_t &log_id, int64_t &submit_timestamp, int64_t &offset) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -646,7 +647,7 @@ int ObLogSlidingWindow::alloc_log_id_ts_( return ret; } -int ObLogSlidingWindow::submit_aggre_log_(ObAggreBuffer* buffer, const uint64_t log_id, const int64_t submit_timestamp) +int ObLogSlidingWindow::submit_aggre_log_(ObAggreBuffer *buffer, const uint64_t log_id, const int64_t submit_timestamp) { int ret = OB_SUCCESS; @@ -695,8 +696,8 @@ int ObLogSlidingWindow::submit_aggre_log_(ObAggreBuffer* buffer, const uint64_t return ret; } -int ObLogSlidingWindow::fill_aggre_buffer_(const uint64_t log_id, const int64_t offset, const char* data, - const int64_t data_size, const int64_t submit_timestamp, ObISubmitLogCb* cb) +int ObLogSlidingWindow::fill_aggre_buffer_(const uint64_t log_id, const int64_t offset, const char *data, + const int64_t data_size, const int64_t submit_timestamp, ObISubmitLogCb *cb) { int ret = OB_SUCCESS; int64_t wait_times = 0; @@ -705,7 +706,7 @@ int ObLogSlidingWindow::fill_aggre_buffer_(const uint64_t log_id, const int64_t CLOG_LOG(ERROR, "ObLogSlidingWindow is not inited", K(ret), K(partition_key_)); } else { int64_t ref_cnt = 0; - ObAggreBuffer* buffer = aggre_buffer_ + ((log_id - aggre_buffer_start_id_) % aggre_buffer_cnt_); + ObAggreBuffer *buffer = aggre_buffer_ + ((log_id - aggre_buffer_start_id_) % aggre_buffer_cnt_); buffer->wait(log_id, wait_times); if (wait_times > 0 && EXECUTE_COUNT_PER_SEC(4)) { CLOG_LOG(WARN, "clog wait aggre buffer", K_(partition_key), K(wait_times), K(log_id)); @@ -797,7 +798,7 @@ int ObLogSlidingWindow::submit_freeze_aggre_buffer_task_(const uint64_t log_id) return ret; } -int ObLogSlidingWindow::alloc_log_id(const int64_t base_timestamp, uint64_t& log_id, int64_t& submit_timestamp) +int ObLogSlidingWindow::alloc_log_id(const int64_t base_timestamp, uint64_t &log_id, int64_t &submit_timestamp) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -837,7 +838,7 @@ int ObLogSlidingWindow::try_update_submit_timestamp(const int64_t base_ts) // only called by ObExtLeaderHeartbeatHandler to get next served log_id and ts based on keepalive ts int ObLogSlidingWindow::get_next_served_log_info_by_next_replay_log_info( - uint64_t& next_served_log_id, int64_t& next_served_log_ts) + uint64_t &next_served_log_id, int64_t &next_served_log_ts) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -859,7 +860,7 @@ int ObLogSlidingWindow::get_next_served_log_info_by_next_replay_log_info( return ret; } -int ObLogSlidingWindow::submit_aggre_log(ObAggreBuffer* buffer, const int64_t base_timestamp) +int ObLogSlidingWindow::submit_aggre_log(ObAggreBuffer *buffer, const int64_t base_timestamp) { int ret = OB_SUCCESS; @@ -887,8 +888,8 @@ int ObLogSlidingWindow::submit_aggre_log(ObAggreBuffer* buffer, const int64_t ba return ret; } -int ObLogSlidingWindow::submit_log(const ObLogType& log_type, const char* buff, const int64_t size, - const int64_t base_timestamp, const bool is_trans_log, ObISubmitLogCb* cb, uint64_t& log_id, int64_t& log_timestamp) +int ObLogSlidingWindow::submit_log(const ObLogType &log_type, const char *buff, const int64_t size, + const int64_t base_timestamp, const bool is_trans_log, ObISubmitLogCb *cb, uint64_t &log_id, int64_t &log_timestamp) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1000,7 +1001,7 @@ int ObLogSlidingWindow::submit_log(const ObLogType& log_type, const char* buff, return ret; } -int ObLogSlidingWindow::submit_log(const ObLogEntryHeader& header, const char* buff, ObISubmitLogCb* cb) +int ObLogSlidingWindow::submit_log(const ObLogEntryHeader &header, const char *buff, ObISubmitLogCb *cb) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -1048,7 +1049,7 @@ int ObLogSlidingWindow::submit_log(const ObLogEntryHeader& header, const char* b } int ObLogSlidingWindow::need_update_log_task_( - const ObLogEntryHeader& header, const char* buff, ObLogTask& task, bool& log_need_update, bool& need_send_ack) + const ObLogEntryHeader &header, const char *buff, ObLogTask &task, bool &log_need_update, bool &need_send_ack) { int ret = OB_SUCCESS; const uint64_t log_id = header.get_log_id(); @@ -1099,8 +1100,8 @@ int ObLogSlidingWindow::need_update_log_task_( return ret; } -int ObLogSlidingWindow::update_log_task_(const ObLogEntryHeader& header, const char* buff, const bool need_copy, - ObLogTask& task, bool& log_is_updated, bool& need_send_ack) +int ObLogSlidingWindow::update_log_task_(const ObLogEntryHeader &header, const char *buff, const bool need_copy, + ObLogTask &task, bool &log_is_updated, bool &need_send_ack) { int ret = OB_SUCCESS; log_is_updated = false; @@ -1116,7 +1117,7 @@ int ObLogSlidingWindow::update_log_task_(const ObLogEntryHeader& header, const c return ret; } -int ObLogSlidingWindow::append_disk_log_to_sliding_window_(const ObLogEntry& log_entry, const ObLogCursor& log_cursor, +int ObLogSlidingWindow::append_disk_log_to_sliding_window_(const ObLogEntry &log_entry, const ObLogCursor &log_cursor, const int64_t accum_checksum, const bool batch_committed) { int ret = OB_SUCCESS; @@ -1124,9 +1125,9 @@ int ObLogSlidingWindow::append_disk_log_to_sliding_window_(const ObLogEntry& log const bool is_logonly_replica = (mm_->get_replica_type() == REPLICA_TYPE_LOGONLY); const int64_t MAX_COPY_LOG_SIZE = 4 * 1024; // 4k const uint64_t log_id = log_entry.get_header().get_log_id(); - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; bool need_copy = (log_entry.get_header().get_total_len() <= MAX_COPY_LOG_SIZE) && (log_id < ATOMIC_LOAD(&next_index_log_id_)) && (!is_logonly_replica); bool first_appended = false; @@ -1143,7 +1144,7 @@ int ObLogSlidingWindow::append_disk_log_to_sliding_window_(const ObLogEntry& log if (OB_FAIL(sw_.get(log_id, log_data, ref))) { CLOG_LOG(ERROR, "get log from sliding window failed", K(ret), K(partition_key_), K(log_id)); } else if (NULL != log_data) { - log_task = static_cast(log_data); + log_task = static_cast(log_data); break; } else if (OB_FAIL(quick_generate_log_task_(log_entry, need_copy, log_task))) { CLOG_LOG(ERROR, "quick_generate_log_task_ failed", K(ret), K(partition_key_), K(log_id)); @@ -1229,24 +1230,24 @@ int ObLogSlidingWindow::append_disk_log_to_sliding_window_(const ObLogEntry& log return ret; } -int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header, const char* buff, ObISubmitLogCb* cb, - const bool need_replay, const bool send_slave, const ObAddr& server, const int64_t cluster_id, +int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader &header, const char *buff, ObISubmitLogCb *cb, + const bool need_replay, const bool send_slave, const ObAddr &server, const int64_t cluster_id, const bool is_confirmed, const int64_t accum_checksum, const bool is_batch_committed) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; - ObLogFlushTask* flush_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; + ObLogFlushTask *flush_task = NULL; bool log_task_need_update = false; bool locked = false; const uint64_t log_id = header.get_log_id(); const bool need_copy = false; - char* out = NULL; + char *out = NULL; int64_t out_size = 0; - char* serialize_buff = NULL; + char *serialize_buff = NULL; ObLogEntry new_log; bool standby_need_handle_index_log = false; bool standby_need_send_follower = false; @@ -1264,7 +1265,7 @@ int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header CLOG_LOG(WARN, "get log from sliding window failed", K(ret), K_(partition_key), K(log_id)); } } else if (NULL != log_data) { - log_task = static_cast(log_data); + log_task = static_cast(log_data); if (log_task->is_on_success_cb_called()) { if (!log_task->is_checksum_verified(header.get_data_checksum())) { ret = OB_ERR_UNEXPECTED; @@ -1322,7 +1323,7 @@ int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header // if log exists, try to update it if (OB_SUCCESS == ret && !locked) { if (NULL != log_data) { - log_task = static_cast(log_data); + log_task = static_cast(log_data); } log_task->lock(); locked = true; @@ -1393,7 +1394,7 @@ int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header CLOG_LOG(ERROR, "generate_entry failed", K_(partition_key), K(ret)); } else if (OB_ISNULL(alloc_mgr_)) { ret = OB_INVALID_ARGUMENT; - } else if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(new_log.get_serialize_size())))) { + } else if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(new_log.get_serialize_size())))) { CLOG_LOG(WARN, "alloc memory failed", K_(partition_key), K(new_log)); ret = OB_ALLOCATE_MEMORY_FAILED; } else if (OB_FAIL(new_log.serialize(serialize_buff, new_log.get_serialize_size(), pos))) { @@ -1432,7 +1433,7 @@ int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header CLOG_LOG(ERROR, "serialize_buff is not null, unexpected", K_(partition_key), K(ret)); } else { int64_t serialize_size = new_log.get_serialize_size(); - if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(serialize_size)))) { + if (NULL == (serialize_buff = static_cast(alloc_mgr_->ge_alloc(serialize_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; CLOG_LOG(ERROR, "alloc failed", K(ret), K_(partition_key)); } else if (OB_FAIL(new_log.serialize(serialize_buff, serialize_size, pos))) { @@ -1532,13 +1533,13 @@ int ObLogSlidingWindow::submit_to_sliding_window_(const ObLogEntryHeader& header } int ObLogSlidingWindow::submit_confirmed_info_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool is_leader, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool is_leader, const bool batch_committed) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; bool locked = false; if (IS_NOT_INIT) { @@ -1602,7 +1603,7 @@ int ObLogSlidingWindow::submit_confirmed_info_( } } if (OB_SUCCESS == ret && !locked) { - log_task = static_cast(log_data); + log_task = static_cast(log_data); log_task->lock(); locked = true; if (log_task->is_confirmed_info_exist()) { @@ -1648,11 +1649,20 @@ int ObLogSlidingWindow::submit_confirmed_info_( // restore_leader check accum_checksum in physical restore log state if (log_task->get_accum_checksum() != confirmed_info.get_accum_checksum()) { ret = OB_ERR_UNEXPECTED; - CLOG_LOG(ERROR, "log_task and confirmed_info's accum_checksum not match", K(ret), K_(partition_key), - K(log_id), K(*log_task), K(confirmed_info)); + CLOG_LOG(ERROR, + "log_task and confirmed_info's accum_checksum not match", + K(ret), + K_(partition_key), + K(log_id), + K(*log_task), + K(confirmed_info)); // record error event - SERVER_EVENT_ADD("clog_restore", "clog accum_checksum is not match witch archived log", - "partition", partition_key_, "log_id", log_id); + SERVER_EVENT_ADD("clog_restore", + "clog accum_checksum is not match witch archived log", + "partition", + partition_key_, + "log_id", + log_id); // report restore error const uint64_t tenant_id = partition_key_.get_tenant_id(); int64_t job_id = 0; @@ -1663,9 +1673,10 @@ int ObLogSlidingWindow::submit_confirmed_info_( CLOG_LOG(WARN, "physical restore info not exist", K(tenant_id), KR(tmp_ret), KR(ret)); } } else if (OB_SUCCESS != (tmp_ret = ObRestoreFatalErrorReporter::get_instance().add_restore_error_task( - tenant_id, PHYSICAL_RESTORE_MOD_CLOG, ret, job_id, self_))) { + tenant_id, PHYSICAL_RESTORE_MOD_CLOG, ret, job_id, self_))) { CLOG_LOG(WARN, "failed to report restore error", KR(tmp_ret), K(tenant_id), KR(ret)); - } else {/*do nothing*/} + } else { /*do nothing*/ + } } } @@ -1707,17 +1718,17 @@ int ObLogSlidingWindow::submit_confirmed_info_( return ret; } -void* ObLogSlidingWindow::alloc_log_task_buf_() +void *ObLogSlidingWindow::alloc_log_task_buf_() { - void* log_task = NULL; + void *log_task = NULL; int tmp_ret = OB_SUCCESS; if (IS_NOT_INIT) { CLOG_LOG(WARN, "sw is not inited", K_(partition_key)); - } else if (NULL != (log_task = static_cast(alloc_mgr_->alloc_log_task_buf()))) { + } else if (NULL != (log_task = static_cast(alloc_mgr_->alloc_log_task_buf()))) { // alloc success } else if (REPLAY == state_mgr_->get_state()) { // try to alloc from tenant 500 when in REPLAY state - ObILogAllocator* server_tenant_allocator = NULL; + ObILogAllocator *server_tenant_allocator = NULL; if (OB_SUCCESS != (tmp_ret = TMA_MGR_INSTANCE.get_tenant_log_allocator(OB_SERVER_TENANT_ID, server_tenant_allocator))) { CLOG_LOG(WARN, "get_tenant_log_allocator failed", K(tmp_ret), K_(partition_key)); @@ -1729,14 +1740,14 @@ void* ObLogSlidingWindow::alloc_log_task_buf_() } int ObLogSlidingWindow::generate_null_log_task_( - const ObLogEntryHeader& header, const bool need_replay, ObLogTask*& log_task) + const ObLogEntryHeader &header, const bool need_replay, ObLogTask *&log_task) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (OB_ISNULL(alloc_mgr_)) { ret = OB_INVALID_ARGUMENT; - } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { + } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { ret = OB_ALLOCATE_MEMORY_FAILED; CLOG_LOG(WARN, "alloc memory failed", K(ret), K_(partition_key), K(header)); } else { @@ -1752,12 +1763,12 @@ int ObLogSlidingWindow::generate_null_log_task_( } int ObLogSlidingWindow::quick_generate_log_task_( - const ObLogEntry& log_entry, const bool need_copy, ObLogTask*& log_task) + const ObLogEntry &log_entry, const bool need_copy, ObLogTask *&log_task) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { ret = OB_NOT_INIT; - } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { + } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { ret = OB_ALLOCATE_MEMORY_FAILED; CLOG_LOG(ERROR, "alloc memory failed", K(ret), K(partition_key_)); } else { @@ -1772,8 +1783,8 @@ int ObLogSlidingWindow::quick_generate_log_task_( return ret; } -int ObLogSlidingWindow::generate_log_task_(const ObLogEntryHeader& header, const char* buff, const bool need_replay, - const bool need_copy, ObLogTask*& log_task) +int ObLogSlidingWindow::generate_log_task_(const ObLogEntryHeader &header, const char *buff, const bool need_replay, + const bool need_copy, ObLogTask *&log_task) { int ret = OB_SUCCESS; if (OB_FAIL(generate_null_log_task_(header, need_replay, log_task))) { @@ -1788,14 +1799,14 @@ int ObLogSlidingWindow::generate_log_task_(const ObLogEntryHeader& header, const } int ObLogSlidingWindow::generate_log_task_( - const ObConfirmedInfo& confirmed_info, const bool need_replay, const bool batch_committed, ObLogTask*& log_task) + const ObConfirmedInfo &confirmed_info, const bool need_replay, const bool batch_committed, ObLogTask *&log_task) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (OB_ISNULL(alloc_mgr_)) { ret = OB_INVALID_ARGUMENT; - } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { + } else if (NULL == (log_task = static_cast(alloc_log_task_buf_()))) { ret = OB_ALLOCATE_MEMORY_FAILED; CLOG_LOG(WARN, "alloc memory failed", K(ret), K_(partition_key), K(confirmed_info)); } else { @@ -1818,7 +1829,7 @@ int ObLogSlidingWindow::generate_log_task_( } int ObLogSlidingWindow::submit_confirmed_info_to_net_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1847,7 +1858,7 @@ int ObLogSlidingWindow::submit_confirmed_info_to_net_( // follower transfer confirmed_info to all children int ObLogSlidingWindow::follower_transfer_confirmed_info_to_net_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1876,7 +1887,7 @@ int ObLogSlidingWindow::follower_transfer_confirmed_info_to_net_( // send confirmed_info to curr_member_list int ObLogSlidingWindow::submit_confirmed_info_to_member_list_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; if (LEADER == state_mgr_->get_role() || @@ -1909,7 +1920,7 @@ int ObLogSlidingWindow::submit_confirmed_info_to_member_list_( // send confirmed info to children in same cluster int ObLogSlidingWindow::submit_confirmed_info_to_local_children_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; if (cascading_mgr_->has_valid_child() && can_transfer_confirmed_info_(log_id)) { @@ -1945,7 +1956,7 @@ int ObLogSlidingWindow::submit_confirmed_info_to_local_children_( } int ObLogSlidingWindow::submit_confirmed_info_to_standby_children_( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; @@ -2013,7 +2024,7 @@ int ObLogSlidingWindow::submit_confirmed_info_to_standby_children_( return ret; } -int ObLogSlidingWindow::submit_log_to_net_(const ObLogEntryHeader& header, const char* serialize_buff, +int ObLogSlidingWindow::submit_log_to_net_(const ObLogEntryHeader &header, const char *serialize_buff, const int64_t serialize_size, const bool is_log_majority) { int ret = OB_SUCCESS; @@ -2044,7 +2055,7 @@ int ObLogSlidingWindow::submit_log_to_net_(const ObLogEntryHeader& header, const } int ObLogSlidingWindow::submit_log_to_member_list_( - const ObLogEntryHeader& header, const char* serialize_buff, const int64_t serialize_size) + const ObLogEntryHeader &header, const char *serialize_buff, const int64_t serialize_size) { int ret = OB_SUCCESS; if (LEADER == state_mgr_->get_role() || STANDBY_LEADER == state_mgr_->get_role()) { @@ -2069,7 +2080,7 @@ int ObLogSlidingWindow::submit_log_to_member_list_( } int ObLogSlidingWindow::submit_log_to_local_children_( - const ObLogEntryHeader& header, const char* serialize_buff, const int64_t serialize_size) + const ObLogEntryHeader &header, const char *serialize_buff, const int64_t serialize_size) { int ret = OB_SUCCESS; ObLogNetTask net_task(state_mgr_->get_proposal_id(), serialize_buff, serialize_size); @@ -2093,7 +2104,7 @@ int ObLogSlidingWindow::submit_log_to_local_children_( } // send log to standby children(sync/async) -int ObLogSlidingWindow::submit_log_to_standby_children_(const ObLogEntryHeader& header, const char* serialize_buff, +int ObLogSlidingWindow::submit_log_to_standby_children_(const ObLogEntryHeader &header, const char *serialize_buff, const int64_t serialize_size, const bool is_log_majority) { int ret = OB_SUCCESS; @@ -2156,8 +2167,8 @@ int ObLogSlidingWindow::submit_log_to_standby_children_(const ObLogEntryHeader& return ret; } -int ObLogSlidingWindow::prepare_flush_task_(const ObLogEntryHeader& header, char* serialize_buff, - const int64_t serialize_size, const ObAddr& server, const int64_t cluster_id, ObLogFlushTask*& flush_task) +int ObLogSlidingWindow::prepare_flush_task_(const ObLogEntryHeader &header, char *serialize_buff, + const int64_t serialize_size, const ObAddr &server, const int64_t cluster_id, ObLogFlushTask *&flush_task) { int ret = OB_SUCCESS; int64_t pls_epoch = OB_INVALID_TIMESTAMP; @@ -2290,9 +2301,9 @@ int ObLogSlidingWindow::process_sync_standby_max_confirmed_id( uint64_t end_log_id = std::min(standby_max_confirmed_id, reconfirm_next_id - 1); end_log_id = std::min(end_log_id, max_log_id); for (uint64_t i = sw_.get_start_id(); i <= end_log_id; ++i) { - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; if (OB_SUCCESS != (tmp_ret = sw_.get(static_cast(i), log_data, ref))) { if (OB_ERROR_OUT_OF_RANGE != tmp_ret) { CLOG_LOG(WARN, @@ -2306,7 +2317,7 @@ int ObLogSlidingWindow::process_sync_standby_max_confirmed_id( "max_log_id", max_log_meta_info_.get_log_id()); } - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { // log_task is NULL, skip } else { log_task->lock(); @@ -2347,9 +2358,9 @@ int ObLogSlidingWindow::clean_log() } else { uint64_t need_reset_confirmed_info = false; for (uint64_t i = sw_.get_start_id(); i <= max_log_meta_info_.get_log_id(); ++i) { - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; if (OB_SUCCESS != (tmp_ret = sw_.get(static_cast(i), log_data, ref))) { CLOG_LOG(WARN, "get log task from sliding window failed", @@ -2361,7 +2372,7 @@ int ObLogSlidingWindow::clean_log() i, "max_log_id", max_log_meta_info_.get_log_id()); - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { // begin clean confirm_info when it encounters empty log slot if (GCTX.is_standby_cluster() && !ObMultiClusterUtil::is_cluster_private_table(partition_key_.get_table_id()) && !need_reset_confirmed_info) { @@ -2420,8 +2431,8 @@ int ObLogSlidingWindow::restore_leader_try_confirm_log() int64_t unused_version = OB_INVALID_TIMESTAMP; if (IS_NOT_INIT) { ret = OB_NOT_INIT; - } else if (OB_FAIL(partition_service_->get_restore_replay_info(partition_key_, - last_restore_log_id, unused_log_ts, unused_version))) { + } else if (OB_FAIL(partition_service_->get_restore_replay_info( + partition_key_, last_restore_log_id, unused_log_ts, unused_version))) { CLOG_LOG(WARN, "get_restore_replay_info failed", K_(partition_key), K(ret)); } else if (OB_INVALID_ID == last_restore_log_id) { ret = OB_ERR_UNEXPECTED; @@ -2472,7 +2483,7 @@ int ObLogSlidingWindow::set_log_archive_accum_checksum(const uint64_t log_id, co return ret; } -bool ObLogSlidingWindow::can_set_log_confirmed_(const ObLogTask* log_task) const +bool ObLogSlidingWindow::can_set_log_confirmed_(const ObLogTask *log_task) const { bool bool_ret = false; if (NULL != log_task) { @@ -2492,15 +2503,15 @@ int ObLogSlidingWindow::set_log_confirmed(const uint64_t log_id, const bool batc { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (OB_FAIL(sw_.get(static_cast(log_id), log_data, ref))) { CLOG_LOG(WARN, "get log task from sliding window failed", K_(partition_key), K(ret)); - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { CLOG_LOG(WARN, "get NULL log from sliding window", K_(partition_key), K(log_id)); ret = OB_ERR_UNEXPECTED; } else { @@ -2532,14 +2543,14 @@ int ObLogSlidingWindow::set_log_confirmed(const uint64_t log_id, const bool batc return ret; } -int ObLogSlidingWindow::get_log(const uint64_t log_id, const uint32_t log_attr, bool& log_confirmed, - ObLogCursor& log_cursor, int64_t& accum_checksum, bool& batch_committed) +int ObLogSlidingWindow::get_log(const uint64_t log_id, const uint32_t log_attr, bool &log_confirmed, + ObLogCursor &log_cursor, int64_t &accum_checksum, bool &batch_committed) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (OB_ERROR_OUT_OF_RANGE == (ret = sw_.get(static_cast(log_id), log_data, ref))) { @@ -2551,7 +2562,7 @@ int ObLogSlidingWindow::get_log(const uint64_t log_id, const uint32_t log_attr, sw_.get_start_id()); } else if (OB_FAIL(ret)) { CLOG_LOG(ERROR, "get log from sliding window failed,", K_(partition_key), K(ret)); - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { ret = OB_ERR_NULL_VALUE; CLOG_LOG(DEBUG, "ObLogSlidingWindow::get_log(), log in sliding window is NULL", @@ -2660,7 +2671,7 @@ bool ObLogSlidingWindow::can_transfer_confirmed_info_(const uint64_t log_id) // follower send confirmed log to standby children // same with set_log_flushed_succ() -int ObLogSlidingWindow::follower_send_log_to_standby_children_(const uint64_t log_id, ObLogTask* log_task) +int ObLogSlidingWindow::follower_send_log_to_standby_children_(const uint64_t log_id, ObLogTask *log_task) { int ret = OB_SUCCESS; @@ -2690,7 +2701,7 @@ int ObLogSlidingWindow::follower_send_log_to_standby_children_(const uint64_t lo } int ObLogSlidingWindow::receive_confirmed_info( - const uint64_t log_id, const ObConfirmedInfo& confirmed_info, const bool batch_committed) + const uint64_t log_id, const ObConfirmedInfo &confirmed_info, const bool batch_committed) { int ret = OB_SUCCESS; bool can_receive_log = true; @@ -2737,7 +2748,7 @@ int ObLogSlidingWindow::receive_confirmed_info( } int ObLogSlidingWindow::leader_submit_confirmed_info_( - const uint64_t log_id, const ObLogTask* log_task, const int64_t accum_checksum) + const uint64_t log_id, const ObLogTask *log_task, const int64_t accum_checksum) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -2775,7 +2786,7 @@ int ObLogSlidingWindow::leader_submit_confirmed_info_( return ret; } -int ObLogSlidingWindow::standby_leader_transfer_confirmed_info_(const uint64_t log_id, const ObLogTask* log_task) +int ObLogSlidingWindow::standby_leader_transfer_confirmed_info_(const uint64_t log_id, const ObLogTask *log_task) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -2816,7 +2827,7 @@ int ObLogSlidingWindow::standby_leader_transfer_confirmed_info_(const uint64_t l return ret; } -int ObLogSlidingWindow::append_disk_log(const ObLogEntry& log_entry, const ObLogCursor& log_cursor, +int ObLogSlidingWindow::append_disk_log(const ObLogEntry &log_entry, const ObLogCursor &log_cursor, const int64_t accum_checksum, const bool batch_committed) { int ret = OB_SUCCESS; @@ -2836,7 +2847,7 @@ int ObLogSlidingWindow::append_disk_log(const ObLogEntry& log_entry, const ObLog return ret; } -int ObLogSlidingWindow::get_next_replay_log_timestamp(int64_t& next_replay_log_timestamp) const +int ObLogSlidingWindow::get_next_replay_log_timestamp(int64_t &next_replay_log_timestamp) const { int ret = OB_SUCCESS; @@ -2851,21 +2862,20 @@ int ObLogSlidingWindow::get_next_replay_log_timestamp(int64_t& next_replay_log_t return ret; } -void ObLogSlidingWindow::get_last_replay_log_id_and_ts(uint64_t &last_replay_log_id, - int64_t &last_replay_log_ts) +void ObLogSlidingWindow::get_last_replay_log_id_and_ts(uint64_t &last_replay_log_id, int64_t &last_replay_log_ts) { last_replay_log_.get(last_replay_log_id, last_replay_log_ts); } int ObLogSlidingWindow::set_log_flushed_succ(const uint64_t log_id, const ObProposalID proposal_id, - const ObLogCursor& log_cursor, const int64_t after_consume_timestamp, bool& majority) + const ObLogCursor &log_cursor, const int64_t after_consume_timestamp, bool &majority) { UNUSED(after_consume_timestamp); int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; if (IS_NOT_INIT) { ret = OB_NOT_INIT; @@ -2883,7 +2893,7 @@ int ObLogSlidingWindow::set_log_flushed_succ(const uint64_t log_id, const ObProp } else { ret = OB_SUCCESS; } - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { ret = OB_ERR_NULL_VALUE; CLOG_LOG(ERROR, "log in sliding window is NULL", K_(partition_key), K(ret)); } else { @@ -2962,7 +2972,7 @@ int ObLogSlidingWindow::set_log_flushed_succ(const uint64_t log_id, const ObProp } int ObLogSlidingWindow::send_standby_log_ack_( - const ObAddr& server, const int64_t cluster_id, const uint64_t log_id, const ObProposalID& proposal_id) + const ObAddr &server, const int64_t cluster_id, const uint64_t log_id, const ObProposalID &proposal_id) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -2993,7 +3003,7 @@ int ObLogSlidingWindow::send_standby_log_ack_( return ret; } -int ObLogSlidingWindow::receive_log_(const ObLogEntry& log_entry, const ObAddr& server, const int64_t cluster_id) +int ObLogSlidingWindow::receive_log_(const ObLogEntry &log_entry, const ObAddr &server, const int64_t cluster_id) { int ret = OB_SUCCESS; const uint64_t log_id = log_entry.get_header().get_log_id(); @@ -3063,7 +3073,7 @@ int ObLogSlidingWindow::receive_log_(const ObLogEntry& log_entry, const ObAddr& } int ObLogSlidingWindow::receive_recovery_log( - const ObLogEntry& log_entry, const bool is_confirmed, const int64_t accum_checksum, const bool is_batch_committed) + const ObLogEntry &log_entry, const bool is_confirmed, const int64_t accum_checksum, const bool is_batch_committed) { int ret = OB_SUCCESS; const uint64_t log_id = log_entry.get_header().get_log_id(); @@ -3105,7 +3115,7 @@ int ObLogSlidingWindow::receive_recovery_log( } int ObLogSlidingWindow::receive_log( - const ObLogEntry& log_entry, const ObAddr& server, const int64_t cluster_id, const ReceiveLogType type) + const ObLogEntry &log_entry, const ObAddr &server, const int64_t cluster_id, const ReceiveLogType type) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -3134,9 +3144,9 @@ int ObLogSlidingWindow::majority_cb( { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; BG_MONITOR_GUARD_DEFAULT(1000 * 1000); if (IS_NOT_INIT) { ret = OB_NOT_INIT; @@ -3144,7 +3154,7 @@ int ObLogSlidingWindow::majority_cb( } else if (log_data == NULL) { ret = OB_ERR_NULL_VALUE; } else { - log_task = static_cast(log_data); + log_task = static_cast(log_data); try_update_max_majority_log(log_id, log_task->get_submit_timestamp()); if (OB_FAIL(log_task->submit_log_succ_cb(partition_key_, log_id, batch_committed, batch_first_participant))) { CLOG_LOG(WARN, "submit log majority_cb failed", K(ret), K_(partition_key), K(log_id), K(batch_committed)); @@ -3159,7 +3169,7 @@ int ObLogSlidingWindow::majority_cb( return ret; } -bool ObLogSlidingWindow::is_freeze_log_(const char* log_buf, const int64_t log_buf_len, int64_t& log_type) const +bool ObLogSlidingWindow::is_freeze_log_(const char *log_buf, const int64_t log_buf_len, int64_t &log_type) const { bool bool_ret = false; int ret = OB_SUCCESS; @@ -3173,7 +3183,7 @@ bool ObLogSlidingWindow::is_freeze_log_(const char* log_buf, const int64_t log_b return bool_ret; } -bool ObLogSlidingWindow::is_change_pg_log_(const char* log_buf, const int64_t log_buf_len, int64_t& log_type) const +bool ObLogSlidingWindow::is_change_pg_log_(const char *log_buf, const int64_t log_buf_len, int64_t &log_type) const { bool bool_ret = false; int ret = OB_SUCCESS; @@ -3189,7 +3199,7 @@ bool ObLogSlidingWindow::is_change_pg_log_(const char* log_buf, const int64_t lo } bool ObLogSlidingWindow::is_offline_partition_log_( - const char* log_buf, const int64_t log_buf_len, int64_t& log_type) const + const char *log_buf, const int64_t log_buf_len, int64_t &log_type) const { bool bool_ret = false; int ret = OB_SUCCESS; @@ -3203,7 +3213,7 @@ bool ObLogSlidingWindow::is_offline_partition_log_( return bool_ret; } -int ObLogSlidingWindow::get_replica_replay_type(ObReplicaReplayType& replay_type) const +int ObLogSlidingWindow::get_replica_replay_type(ObReplicaReplayType &replay_type) const { int ret = OB_SUCCESS; replay_type = INVALID_REPLICA_REPLAY_TYPE; @@ -3234,7 +3244,7 @@ int ObLogSlidingWindow::get_replica_replay_type(ObReplicaReplayType& replay_type return ret; } -int ObLogSlidingWindow::need_replay_for_data_or_log_replica_(const bool is_trans_log, bool& need_replay) const +int ObLogSlidingWindow::need_replay_for_data_or_log_replica_(const bool is_trans_log, bool &need_replay) const { int ret = OB_SUCCESS; ObReplicaReplayType replay_type = INVALID_REPLICA_REPLAY_TYPE; @@ -3251,12 +3261,12 @@ int ObLogSlidingWindow::need_replay_for_data_or_log_replica_(const bool is_trans return ret; } -int ObLogSlidingWindow::get_log_meta_info(uint64_t log_id, bool& is_meta_log, int64_t& log_ts, - int64_t& next_replay_log_ts_for_rg, int64_t& accum_checksum, ObLogType& log_type) const +int ObLogSlidingWindow::get_log_meta_info(uint64_t log_id, bool &is_meta_log, int64_t &log_ts, + int64_t &next_replay_log_ts_for_rg, int64_t &accum_checksum, ObLogType &log_type) const { int ret = OB_SUCCESS; is_meta_log = false; - ObICLogMgr* clog_mgr = NULL; + ObICLogMgr *clog_mgr = NULL; if (OB_ISNULL(partition_service_) || OB_ISNULL(clog_mgr = partition_service_->get_clog_mgr())) { ret = OB_ERR_UNEXPECTED; CLOG_LOG(WARN, "invalid argument", K(partition_key_), K(log_id), KP(partition_service_), KP(clog_mgr), KR(ret)); @@ -3300,7 +3310,7 @@ int ObLogSlidingWindow::get_log_meta_info(uint64_t log_id, bool& is_meta_log, in return ret; } -int ObLogSlidingWindow::try_submit_replay_task_(const uint64_t log_id, const ObLogTask& log_task) +int ObLogSlidingWindow::try_submit_replay_task_(const uint64_t log_id, const ObLogTask &log_task) { int ret = OB_SUCCESS; @@ -3343,7 +3353,7 @@ int ObLogSlidingWindow::try_submit_replay_task_(const uint64_t log_id, const ObL // skip logs those do not need replay } else if (OB_LOG_MEMBERSHIP == header_log_type || OB_LOG_START_MEMBERSHIP == header_log_type) { ObReadBuf rbuf; - const char* log_buf = NULL; + const char *log_buf = NULL; int64_t log_buf_len = 0; if (log_task.is_submit_log_body_exist()) { log_buf = log_task.get_log_buf(); @@ -3475,7 +3485,7 @@ int ObLogSlidingWindow::follower_update_leader_next_log_info( } int ObLogSlidingWindow::get_switchover_info( - int64_t& switchover_epoch, uint64_t& leader_max_log_id, int64_t& leader_next_log_ts) const + int64_t &switchover_epoch, uint64_t &leader_max_log_id, int64_t &leader_next_log_ts) const { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -3535,8 +3545,8 @@ bool ObLogSlidingWindow::is_standby_leader_need_fetch_log_(const uint64_t start_ } else if (STANDBY_LEADER != state_mgr_->get_role()) { // not standby_leader, skip } else { - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; int tmp_ret = OB_SUCCESS; if (OB_SUCCESS != (tmp_ret = get_log_task(start_log_id, log_task, ref))) { // slide out or null @@ -3555,7 +3565,7 @@ bool ObLogSlidingWindow::is_standby_leader_need_fetch_log_(const uint64_t start_ return bool_ret; } -bool ObLogSlidingWindow::check_need_fetch_log_(const uint64_t start_log_id, bool& need_check_rebuild) +bool ObLogSlidingWindow::check_need_fetch_log_(const uint64_t start_log_id, bool &need_check_rebuild) { bool bool_ret = true; bool is_tenant_out_of_mem = false; @@ -3677,7 +3687,7 @@ int ObLogSlidingWindow::follower_check_need_rebuild_(const uint64_t start_log_id return ret; } -void ObLogSlidingWindow::start_fetch_log_from_leader(bool& is_fetched) +void ObLogSlidingWindow::start_fetch_log_from_leader(bool &is_fetched) { int ret = OB_SUCCESS; const uint64_t start_id = sw_.get_start_id(); @@ -3693,7 +3703,7 @@ void ObLogSlidingWindow::start_fetch_log_from_leader(bool& is_fetched) } int ObLogSlidingWindow::do_fetch_log(const uint64_t start_id, const uint64_t end_id, - const enum ObFetchLogExecuteType& fetch_log_execute_type, bool& is_fetched) + const enum ObFetchLogExecuteType &fetch_log_execute_type, bool &is_fetched) { int ret = OB_SUCCESS; bool need_check_rebuild = false; @@ -3819,7 +3829,7 @@ int ObLogSlidingWindow::do_fetch_log(const uint64_t start_id, const uint64_t end return ret; } -int ObLogSlidingWindow::sliding_cb(const int64_t sn, const ObILogExtRingBufferData* data) +int ObLogSlidingWindow::sliding_cb(const int64_t sn, const ObILogExtRingBufferData *data) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -3830,7 +3840,7 @@ int ObLogSlidingWindow::sliding_cb(const int64_t sn, const ObILogExtRingBufferDa ret = OB_INVALID_ARGUMENT; CLOG_LOG(ERROR, "invalid argument", K_(partition_key), K(sn), K(ret)); } else if (state_mgr_->can_slide_sw()) { - const ObLogTask* log_task = dynamic_cast(data); + const ObLogTask *log_task = dynamic_cast(data); if (NULL == log_task) { ret = OB_ERR_UNEXPECTED; CLOG_LOG(ERROR, "dynamic_cast return NULL", K_(partition_key), K(ret)); @@ -3918,7 +3928,7 @@ int ObLogSlidingWindow::sliding_cb(const int64_t sn, const ObILogExtRingBufferDa return ret; } -int ObLogSlidingWindow::submit_replay_task(const bool need_async, bool& is_replayed, bool& is_replay_failed) +int ObLogSlidingWindow::submit_replay_task(const bool need_async, bool &is_replayed, bool &is_replay_failed) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -3951,10 +3961,10 @@ int ObLogSlidingWindow::submit_replay_task(const bool need_async, bool& is_repla return ret; } -int ObLogSlidingWindow::get_log_task(const uint64_t log_id, ObLogTask*& log_task, const int64_t*& ref) const +int ObLogSlidingWindow::get_log_task(const uint64_t log_id, ObLogTask *&log_task, const int64_t *&ref) const { int ret = OB_SUCCESS; - ObILogExtRingBufferData* log_data = NULL; + ObILogExtRingBufferData *log_data = NULL; if (IS_NOT_INIT) { ret = OB_NOT_INIT; } else if (OB_IS_INVALID_LOG_ID(log_id)) { @@ -3962,17 +3972,17 @@ int ObLogSlidingWindow::get_log_task(const uint64_t log_id, ObLogTask*& log_task } else if (OB_SUCCESS == (ret = sw_.get(log_id, log_data, ref)) && log_data == NULL) { ret = OB_ERR_NULL_VALUE; } else if (OB_SUCC(ret)) { - log_task = static_cast(log_data); + log_task = static_cast(log_data); } return ret; } -int ObLogSlidingWindow::check_left_bound_empty(bool& is_empty) +int ObLogSlidingWindow::check_left_bound_empty(bool &is_empty) { int ret = OB_SUCCESS; is_empty = false; - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; const uint64_t start_log_id = get_start_id(); if (OB_FAIL(get_log_task(start_log_id, log_task, ref))) { if (OB_ERR_NULL_VALUE == ret) { @@ -3994,7 +4004,7 @@ int ObLogSlidingWindow::check_left_bound_empty(bool& is_empty) return ret; } -int ObLogSlidingWindow::revert_log_task(const int64_t* ref) +int ObLogSlidingWindow::revert_log_task(const int64_t *ref) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -4010,7 +4020,7 @@ int ObLogSlidingWindow::revert_log_task(const int64_t* ref) } // This function may take a long time and does not lock during execution -int ObLogSlidingWindow::truncate_first_stage(const common::ObBaseStorageInfo& base_storage_info) +int ObLogSlidingWindow::truncate_first_stage(const common::ObBaseStorageInfo &base_storage_info) { int ret = OB_SUCCESS; const uint64_t new_start_id = base_storage_info.get_last_replay_log_id() + 1; @@ -4024,7 +4034,7 @@ int ObLogSlidingWindow::truncate_first_stage(const common::ObBaseStorageInfo& ba return ret; } -int ObLogSlidingWindow::truncate_second_stage(const common::ObBaseStorageInfo& base_storage_info) +int ObLogSlidingWindow::truncate_second_stage(const common::ObBaseStorageInfo &base_storage_info) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -4055,14 +4065,14 @@ int ObLogSlidingWindow::truncate_second_stage(const common::ObBaseStorageInfo& b set_next_replay_log_id_info( base_storage_info.get_last_replay_log_id() + 1, base_storage_info.get_submit_timestamp() + 1); - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; if (OB_SUCCESS != (tmp_ret = sw_.get(new_start_id, log_data, ref))) { if (OB_ERROR_OUT_OF_RANGE != tmp_ret) { CLOG_LOG(WARN, "get log from sliding window failed", K(tmp_ret), K(partition_key_), K(new_start_id)); } - } else if (NULL == (log_task = static_cast(log_data))) { + } else if (NULL == (log_task = static_cast(log_data))) { tmp_ret = OB_ERR_NULL_VALUE; CLOG_LOG(TRACE, "log in sliding window is NULL", K(tmp_ret), K(partition_key_)); } @@ -4120,7 +4130,7 @@ void ObLogSlidingWindow::destroy() } int ObLogSlidingWindow::handle_first_index_log_( - const uint64_t log_id, ObLogTask* log_task, const bool do_pop, bool& need_check_succeeding_log) + const uint64_t log_id, ObLogTask *log_task, const bool do_pop, bool &need_check_succeeding_log) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -4169,7 +4179,7 @@ int ObLogSlidingWindow::handle_succeeding_index_log_( int tmp_ret = OB_SUCCESS; uint64_t log_id = id; bool need_check_succeeding_log = check_succeeding_log; - ObLogTask* log_task = NULL; + ObLogTask *log_task = NULL; bool is_replay_failed = false; if (IS_NOT_INIT) { @@ -4178,12 +4188,12 @@ int ObLogSlidingWindow::handle_succeeding_index_log_( ret = OB_INVALID_ARGUMENT; } else { while (need_check_succeeding_log && OB_SUCCESS == ret) { - const int64_t* ref = NULL; - ObILogExtRingBufferData* data = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *data = NULL; ++log_id; if (ATOMIC_LOAD(&next_index_log_id_) == log_id && OB_SUCCESS == (ret = sw_.get(static_cast(log_id), data, ref)) && - NULL != (log_task = static_cast(data)) && log_task->is_flush_local_finished() && + NULL != (log_task = static_cast(data)) && log_task->is_flush_local_finished() && log_task->is_log_confirmed() && test_and_submit_index_log_(log_id, log_task, ret)) { // do nothing } else { @@ -4204,7 +4214,7 @@ int ObLogSlidingWindow::handle_succeeding_index_log_( return ret; } -bool ObLogSlidingWindow::test_and_set_index_log_submitted_(const uint64_t log_id, ObLogTask* log_task) +bool ObLogSlidingWindow::test_and_set_index_log_submitted_(const uint64_t log_id, ObLogTask *log_task) { // caller guarantees log_task is not NULL bool bool_ret = false; @@ -4230,7 +4240,7 @@ bool ObLogSlidingWindow::test_and_set_index_log_submitted_(const uint64_t log_id return bool_ret; } -bool ObLogSlidingWindow::test_and_submit_index_log_(const uint64_t log_id, ObLogTask* log_task, int& ret) +bool ObLogSlidingWindow::test_and_submit_index_log_(const uint64_t log_id, ObLogTask *log_task, int &ret) { // caller guarantees log_task is not NULL bool bool_ret = false; @@ -4305,7 +4315,7 @@ bool ObLogSlidingWindow::test_and_submit_index_log_(const uint64_t log_id, ObLog return bool_ret; } -int ObLogSlidingWindow::submit_index_log_(const uint64_t log_id, const ObLogTask* log_task, int64_t& accum_checksum) +int ObLogSlidingWindow::submit_index_log_(const uint64_t log_id, const ObLogTask *log_task, int64_t &accum_checksum) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -4411,8 +4421,8 @@ int ObLogSlidingWindow::set_next_index_log_id(const uint64_t log_id, const int64 return ret; } -int ObLogSlidingWindow::try_submit_mc_success_cb_(const ObLogType& log_type, const uint64_t log_id, const char* log_buf, - const int64_t log_buf_len, const common::ObProposalID& proposal_id) +int ObLogSlidingWindow::try_submit_mc_success_cb_(const ObLogType &log_type, const uint64_t log_id, const char *log_buf, + const int64_t log_buf_len, const common::ObProposalID &proposal_id) { int ret = OB_SUCCESS; if (IS_NOT_INIT) { @@ -4460,7 +4470,7 @@ bool ObLogSlidingWindow::check_can_receive_larger_log(const uint64_t log_id) return bool_ret; } -int ObLogSlidingWindow::get_end_log_id_(const uint64_t start_id, uint64_t& end_id) +int ObLogSlidingWindow::get_end_log_id_(const uint64_t start_id, uint64_t &end_id) { int ret = OB_SUCCESS; end_id = OB_INVALID_ID; @@ -4474,8 +4484,8 @@ int ObLogSlidingWindow::get_end_log_id_(const uint64_t start_id, uint64_t& end_i const uint64_t max_log_id = std::min(get_max_log_id(), start_id + clog_fetch_log_count - 1); bool found = false; for (uint64_t i = start_id; !found && i <= max_log_id; ++i) { - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; int tmp_ret = OB_SUCCESS; if (OB_SUCCESS != (tmp_ret = get_log_task(i, log_task, ref))) { if (OB_ERROR_OUT_OF_RANGE == tmp_ret) { @@ -4522,14 +4532,14 @@ int ObLogSlidingWindow::get_end_log_id_(const uint64_t start_id, uint64_t& end_i return ret; } -int ObLogSlidingWindow::get_slide_log_range_(const uint64_t start_id, uint64_t& ret_start_id, uint64_t& ret_end_id) +int ObLogSlidingWindow::get_slide_log_range_(const uint64_t start_id, uint64_t &ret_start_id, uint64_t &ret_end_id) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; ret_start_id = OB_INVALID_ID; ret_end_id = OB_INVALID_ID; - ObLogTask* log_task = NULL; - const int64_t* ref = NULL; + ObLogTask *log_task = NULL; + const int64_t *ref = NULL; const uint64_t clog_fetch_log_count = std::min(state_mgr_->get_fetch_window_size(), get_follower_max_unconfirmed_log_count()); if (IS_NOT_INIT) { @@ -4608,9 +4618,9 @@ int ObLogSlidingWindow::get_slide_log_range_(const uint64_t start_id, uint64_t& return ret; } -int ObLogSlidingWindow::backfill_log(const uint64_t log_id, const common::ObProposalID& proposal_id, - const char* serialize_buff, const int64_t serialize_size, const ObLogCursor& log_cursor, const bool is_leader, - ObISubmitLogCb* submit_cb) +int ObLogSlidingWindow::backfill_log(const uint64_t log_id, const common::ObProposalID &proposal_id, + const char *serialize_buff, const int64_t serialize_size, const ObLogCursor &log_cursor, const bool is_leader, + ObISubmitLogCb *submit_cb) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -4665,7 +4675,7 @@ int ObLogSlidingWindow::backfill_confirmed(const uint64_t log_id, const bool bat return ret; } -int ObLogSlidingWindow::resubmit_log(const ObLogInfo& log_info, ObISubmitLogCb* cb) +int ObLogSlidingWindow::resubmit_log(const ObLogInfo &log_info, ObISubmitLogCb *cb) { int ret = OB_SUCCESS; @@ -4682,15 +4692,15 @@ int ObLogSlidingWindow::resubmit_log(const ObLogInfo& log_info, ObISubmitLogCb* return ret; } -int ObLogSlidingWindow::backfill_log_(const char* serialize_buff, const int64_t serialize_size, - const ObLogCursor& log_cursor, const bool is_leader, ObISubmitLogCb* submit_cb) +int ObLogSlidingWindow::backfill_log_(const char *serialize_buff, const int64_t serialize_size, + const ObLogCursor &log_cursor, const bool is_leader, ObISubmitLogCb *submit_cb) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; const bool need_replay = !is_leader; // need_copy == false, this can save a memory copy const bool need_copy = false; @@ -4701,8 +4711,8 @@ int ObLogSlidingWindow::backfill_log_(const char* serialize_buff, const int64_t if (OB_FAIL(log_entry.deserialize(serialize_buff, serialize_size, pos))) { CLOG_LOG(ERROR, "log_entry deserialize failed", K(ret), K(partition_key_)); } - const ObLogEntryHeader& header = log_entry.get_header(); - const char* buff = log_entry.get_buf(); + const ObLogEntryHeader &header = log_entry.get_header(); + const char *buff = log_entry.get_buf(); const uint64_t log_id = header.get_log_id(); while (OB_SUCC(ret)) { @@ -4713,7 +4723,7 @@ int ObLogSlidingWindow::backfill_log_(const char* serialize_buff, const int64_t ret = OB_ERR_UNEXPECTED; CLOG_LOG(WARN, "leader backfill_log_, log exist", K(ret), K(partition_key_), K(log_id)); } else { - log_task = static_cast(log_data); + log_task = static_cast(log_data); log_task->lock(); // leader already resubmit_log when callback if (log_task->is_submit_log_exist()) { @@ -4803,10 +4813,10 @@ int ObLogSlidingWindow::backfill_confirmed_(const uint64_t log_id, const bool ba int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; - const common::ObMemberList& member_list = mm_->get_curr_member_list(); + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; + const common::ObMemberList &member_list = mm_->get_curr_member_list(); const bool batch_committed = true; bool majority = false; bool need_wait_standby_ack = false; @@ -4817,7 +4827,7 @@ int ObLogSlidingWindow::backfill_confirmed_(const uint64_t log_id, const bool ba ret = OB_ERR_UNEXPECTED; CLOG_LOG(ERROR, "the log not exist, unexpected", K(ret), K(partition_key_), K(log_id)); } else { - log_task = static_cast(log_data); + log_task = static_cast(log_data); log_task->lock(); // At this time, it has been confirmed that the log has formed a majority, // so don't care whether the ack_list is completely accurate @@ -4888,15 +4898,15 @@ int ObLogSlidingWindow::backfill_confirmed_(const uint64_t log_id, const bool ba return ret; } -int ObLogSlidingWindow::resubmit_log_(const ObLogInfo& log_info, ObISubmitLogCb* cb) +int ObLogSlidingWindow::resubmit_log_(const ObLogInfo &log_info, ObISubmitLogCb *cb) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; - const int64_t* ref = NULL; - ObILogExtRingBufferData* log_data = NULL; - ObLogTask* log_task = NULL; - const char* buff = log_info.get_buf(); + const int64_t *ref = NULL; + ObILogExtRingBufferData *log_data = NULL; + ObLogTask *log_task = NULL; + const char *buff = log_info.get_buf(); const int64_t size = log_info.get_size(); const uint64_t log_id = log_info.get_log_id(); const bool need_replay = false; @@ -4914,7 +4924,7 @@ int ObLogSlidingWindow::resubmit_log_(const ObLogInfo& log_info, ObISubmitLogCb* CLOG_LOG(WARN, "get log from sliding_window failed", K(ret), K(partition_key_), K(log_id)); } else if (NULL != log_data) { is_log_backfilled = true; - log_task = static_cast(log_data); + log_task = static_cast(log_data); log_task->reset_pinned(); is_log_majority = (log_task->is_local_majority_flushed() || log_task->is_log_confirmed()); } @@ -4952,9 +4962,9 @@ int ObLogSlidingWindow::resubmit_log_(const ObLogInfo& log_info, ObISubmitLogCb* return ret; } -int ObLogSlidingWindow::generate_backfill_log_task_(const ObLogEntryHeader& header, const char* buff, - const ObLogCursor& log_cursor, ObISubmitLogCb* submit_cb, const bool need_replay, const bool need_copy, - const bool need_pinned, ObLogTask*& log_task) +int ObLogSlidingWindow::generate_backfill_log_task_(const ObLogEntryHeader &header, const char *buff, + const ObLogCursor &log_cursor, ObISubmitLogCb *submit_cb, const bool need_replay, const bool need_copy, + const bool need_pinned, ObLogTask *&log_task) { int ret = OB_SUCCESS; if (OB_FAIL(generate_null_log_task_(header, need_replay, log_task))) { @@ -5021,7 +5031,7 @@ void ObLogSlidingWindow::try_update_max_majority_log(const uint64_t log_id, cons max_majority_log_.inc_update(log_id, log_ts); } -int ObLogSlidingWindow::check_if_all_log_replayed(bool& has_replayed) const +int ObLogSlidingWindow::check_if_all_log_replayed(bool &has_replayed) const { int ret = OB_SUCCESS; has_replayed = false; @@ -5059,7 +5069,7 @@ int ObLogSlidingWindow::try_freeze_aggre_buffer() } int ObLogSlidingWindow::set_confirmed_info_without_lock_( - const ObLogEntryHeader& header, const int64_t accum_checksum, const bool is_batch_committed, ObLogTask& log_task) + const ObLogEntryHeader &header, const int64_t accum_checksum, const bool is_batch_committed, ObLogTask &log_task) { int ret = OB_SUCCESS; ObConfirmedInfo confirmed_info; diff --git a/src/observer/virtual_table/ob_information_columns_table.cpp b/src/observer/virtual_table/ob_information_columns_table.cpp index cbad8cf6f7ad1cc7812cd753c485607d9fa35c98..e630fff99fa3e7a7ee26dc484d6c5e42dfc72010 100644 --- a/src/observer/virtual_table/ob_information_columns_table.cpp +++ b/src/observer/virtual_table/ob_information_columns_table.cpp @@ -48,7 +48,7 @@ void ObInfoSchemaColumnsTable::reset() tenant_id_ = OB_INVALID_ID; } -int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row) +int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow *&row) { int ret = OB_SUCCESS; @@ -60,7 +60,7 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row) SERVER_LOG(WARN, "tenant id is invalid_id", K(ret), K(tenant_id_)); } else { if (!start_to_read_) { - void* tmp_ptr = NULL; + void *tmp_ptr = NULL; // If there is no db filter (is_filter_db_: false), At most one loop // in check_database_table_filter: start_key=MIN,MIN, end_key=MAX,MAX if (!is_filter_db_ && OB_FAIL(check_database_table_filter())) { @@ -69,15 +69,17 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row) } else if (!is_filter_db_ && OB_FAIL(schema_guard_->get_database_schemas_in_tenant(tenant_id_, database_schema_array_))) { SERVER_LOG(WARN, "fail to get database schemas in tenant", K(ret), K(tenant_id_)); - } else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) { + } else if (OB_UNLIKELY( + NULL == (tmp_ptr = static_cast(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) { ret = OB_ALLOCATE_MEMORY_FAILED; SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); - } else if (FALSE_IT(data_type_str_ = static_cast(tmp_ptr))) { - } else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) { + } else if (FALSE_IT(data_type_str_ = static_cast(tmp_ptr))) { + } else if (OB_UNLIKELY( + NULL == (tmp_ptr = static_cast(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) { ret = OB_ALLOCATE_MEMORY_FAILED; SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); } else { - column_type_str_ = static_cast(tmp_ptr); + column_type_str_ = static_cast(tmp_ptr); column_type_str_len_ = OB_MAX_SYS_PARAM_NAME_LENGTH; } @@ -91,7 +93,7 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow*& row) } bool is_filter_table_schema = false; for (; OB_SUCC(ret) && i < database_schema_array_.count() && !has_more_; ++i) { - const ObDatabaseSchema* database_schema = database_schema_array_.at(i); + const ObDatabaseSchema *database_schema = database_schema_array_.at(i); if (OB_ISNULL(database_schema)) { ret = OB_ERR_UNEXPECTED; SERVER_LOG(WARN, "database_schema is NULL", K(ret)); @@ -143,8 +145,8 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array( const bool is_filter_table_schema, const int64_t last_db_schema_idx) { int ret = OB_SUCCESS; - const ObDatabaseSchema* database_schema = NULL; - ObArray table_schema_array; + const ObDatabaseSchema *database_schema = NULL; + ObArray table_schema_array; int64_t table_schema_array_size = 0; // Handling table_schema_array pagination int64_t i = 0; @@ -172,7 +174,7 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array( } } for (; OB_SUCC(ret) && i < table_schema_array_size && !has_more_; ++i) { - const ObTableSchema* table_schema = NULL; + const ObTableSchema *table_schema = NULL; if (is_filter_table_schema) { table_schema = filter_table_schema_array_.at(i); } else { @@ -206,8 +208,8 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array( return ret; } -int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString& database_name, - const share::schema::ObTableSchema& table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx, +int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString &database_name, + const share::schema::ObTableSchema &table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx, const bool is_filter_table_schema) { int ret = OB_SUCCESS; @@ -219,7 +221,7 @@ int ObInfoSchemaColumnsTable::iterate_column_schema_array(const ObString& databa last_column_idx_ = -1; } ObColumnIterByPrevNextID iter(table_schema); - const ObColumnSchemaV2* column_schema = NULL; + const ObColumnSchemaV2 *column_schema = NULL; for (int j = 0; OB_SUCC(ret) && j < logical_index && OB_SUCC(iter.next(column_schema)); j++) { // do nothing } @@ -282,10 +284,10 @@ int ObInfoSchemaColumnsTable::check_database_table_filter() { int ret = OB_SUCCESS; for (int64_t i = 0; OB_SUCC(ret) && i < key_ranges_.count(); ++i) { - const ObRowkey& start_key = key_ranges_.at(i).start_key_; - const ObRowkey& end_key = key_ranges_.at(i).end_key_; - const ObObj* start_key_obj_ptr = start_key.get_obj_ptr(); - const ObObj* end_key_obj_ptr = end_key.get_obj_ptr(); + const ObRowkey &start_key = key_ranges_.at(i).start_key_; + const ObRowkey &end_key = key_ranges_.at(i).end_key_; + const ObObj *start_key_obj_ptr = start_key.get_obj_ptr(); + const ObObj *end_key_obj_ptr = end_key.get_obj_ptr(); if (2 != start_key.get_obj_cnt() || 2 != end_key.get_obj_cnt()) { ret = OB_ERR_UNEXPECTED; SERVER_LOG(WARN, @@ -304,14 +306,14 @@ int ObInfoSchemaColumnsTable::check_database_table_filter() // is db_name + table_name, so there is no need to obtain all database_schema under the tenant is_filter_db_ = true; ObString database_name = start_key_obj_ptr[0].get_varchar(); - const ObDatabaseSchema* filter_database_schema = NULL; + const ObDatabaseSchema *filter_database_schema = NULL; if (OB_FAIL(schema_guard_->get_database_schema(tenant_id_, database_name, filter_database_schema))) { SERVER_LOG(WARN, "fail to get database schema", K(ret), K(tenant_id_), K(database_name)); } else if (NULL == filter_database_schema) { } else if (start_key_obj_ptr[1].is_varchar_or_char() && end_key_obj_ptr[1].is_varchar_or_char() && start_key_obj_ptr[1] == end_key_obj_ptr[1]) { // Specify db_name and tbl_name at the same time - const ObTableSchema* filter_table_schema = NULL; + const ObTableSchema *filter_table_schema = NULL; ObString table_name = start_key_obj_ptr[1].get_varchar(); if (OB_FAIL(schema_guard_->get_table_schema(tenant_id_, filter_database_schema->get_database_id(), @@ -333,8 +335,8 @@ int ObInfoSchemaColumnsTable::check_database_table_filter() return ret; } -int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAccuracy& accuracy, - const common::ObIArray& type_info, const int16_t default_length_semantics, int64_t& pos) +int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta &obj_meta, const ObAccuracy &accuracy, + const common::ObIArray &type_info, const int16_t default_length_semantics, int64_t &pos) { int ret = OB_SUCCESS; @@ -342,7 +344,7 @@ int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAc obj_meta, accuracy, type_info, default_length_semantics, column_type_str_, column_type_str_len_, pos))) { if (OB_MAX_SYS_PARAM_NAME_LENGTH == column_type_str_len_ && OB_SIZE_OVERFLOW == ret) { if (OB_UNLIKELY( - NULL == (column_type_str_ = static_cast(allocator_->realloc( + NULL == (column_type_str_ = static_cast(allocator_->realloc( column_type_str_, OB_MAX_SYS_PARAM_NAME_LENGTH, OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) { ret = OB_ALLOCATE_MEMORY_FAILED; SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); @@ -357,8 +359,8 @@ int ObInfoSchemaColumnsTable::get_type_str(const ObObjMeta& obj_meta, const ObAc return ret; } -int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, const ObTableSchema* table_schema, - const ObColumnSchemaV2* column_schema, const uint64_t ordinal_position) +int ObInfoSchemaColumnsTable::fill_row_cells(const ObString &database_name, const ObTableSchema *table_schema, + const ObColumnSchemaV2 *column_schema, const uint64_t ordinal_position) { int ret = OB_SUCCESS; @@ -370,7 +372,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons ret = OB_ERR_UNEXPECTED; SERVER_LOG(WARN, "table_schema or column_schema is NULL", K(ret)); } else { - ObObj* cells = NULL; + ObObj *cells = NULL; const int64_t col_count = output_column_ids_.count(); if (OB_ISNULL(cells = cur_row_.cells_)) { ret = OB_ERR_UNEXPECTED; @@ -416,17 +418,17 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons } case COLUMN_DEFAULT: { casted_cell.reset(); - const ObObj* res_cell = NULL; + const ObObj *res_cell = NULL; ObObj def_obj = column_schema->get_cur_default_value(); if (IS_DEFAULT_NOW_OBJ(def_obj)) { ObObj def_now_obj; def_now_obj.set_varchar(ObString::make_string(N_UPPERCASE_CUR_TIMESTAMP)); cells[cell_idx] = def_now_obj; } else if (def_obj.is_bit() || ob_is_enum_or_set_type(def_obj.get_type())) { - char* buf = NULL; + char *buf = NULL; int64_t buf_len = number::ObNumber::MAX_PRINTABLE_SIZE; int64_t pos = 0; - if (OB_UNLIKELY(NULL == (buf = static_cast(allocator_->alloc(buf_len))))) { + if (OB_UNLIKELY(NULL == (buf = static_cast(allocator_->alloc(buf_len))))) { ret = OB_ALLOCATE_MEMORY_FAILED; SERVER_LOG(ERROR, "fail to allocate memory", K(ret)); } else if (def_obj.is_bit()) { @@ -594,10 +596,10 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons if (0 == scale) { extra = ObString::make_string("on update current_timestamp"); } else { - char* buf = NULL; + char *buf = NULL; int64_t buf_len = 32; int64_t pos = 0; - if (OB_UNLIKELY(NULL == (buf = static_cast(allocator_->alloc(buf_len))))) { + if (OB_UNLIKELY(NULL == (buf = static_cast(allocator_->alloc(buf_len))))) { ret = OB_ALLOCATE_MEMORY_FAILED; SERVER_LOG(WARN, "fail to allocate memory", K(ret)); } else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "on update current_timestamp(%d)", scale))) { diff --git a/src/observer/virtual_table/ob_information_columns_table.h b/src/observer/virtual_table/ob_information_columns_table.h index e80c8dbc6d35e190cb1027cfcb7cb8ed9b180043..a6a3024ca619549c334f50d3b60caf37bfff9716 100644 --- a/src/observer/virtual_table/ob_information_columns_table.h +++ b/src/observer/virtual_table/ob_information_columns_table.h @@ -56,7 +56,7 @@ public: ObInfoSchemaColumnsTable(); virtual ~ObInfoSchemaColumnsTable(); - virtual int inner_get_next_row(common::ObNewRow*& row); + virtual int inner_get_next_row(common::ObNewRow *&row); virtual void reset(); inline void set_tenant_id(uint64_t tenant_id) @@ -66,8 +66,8 @@ public: private: DISALLOW_COPY_AND_ASSIGN(ObInfoSchemaColumnsTable); - int fill_row_cells(const common::ObString& database_name, const share::schema::ObTableSchema* table_schema, - const share::schema::ObColumnSchemaV2* column_schema, const uint64_t ordinal_position); + int fill_row_cells(const common::ObString &database_name, const share::schema::ObTableSchema *table_schema, + const share::schema::ObColumnSchemaV2 *column_schema, const uint64_t ordinal_position); int check_database_table_filter(); /** * Iterate through all the tables and fill row cells, @@ -76,8 +76,8 @@ private: */ int iterate_table_schema_array(const bool is_filter_table_schema, const int64_t last_db_schema_idx); // Iterate through all the columns and fill cells - int iterate_column_schema_array(const common::ObString& database_name, - const share::schema::ObTableSchema& table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx, + int iterate_column_schema_array(const common::ObString &database_name, + const share::schema::ObTableSchema &table_schema, const int64_t last_db_schema_idx, const int64_t last_table_idx, const bool is_filter_table_schema); /** * If ob_sql_type_str failed to call, and the error code returned is OB_SIZE_OVERFLOW. @@ -85,8 +85,8 @@ private: */ int get_type_str(const ObObjMeta &obj_meta, const ObAccuracy &accuracy, const common::ObIArray &type_info, const int16_t default_length_semantics, int64_t &pos); - int fill_col_privs(ObSessionPrivInfo &session_priv, ObNeedPriv &need_priv, ObPrivSet priv_set, const char *priv_str, - char *buf, const int64_t buf_len, int64_t &pos); + int fill_col_privs(share::schema::ObSessionPrivInfo &session_priv, share::schema::ObNeedPriv &need_priv, + ObPrivSet priv_set, const char *priv_str, char *buf, const int64_t buf_len, int64_t &pos); private: uint64_t tenant_id_; @@ -94,14 +94,14 @@ private: int64_t last_table_idx_; int64_t last_column_idx_; bool has_more_; - char* data_type_str_; - char* column_type_str_; + char *data_type_str_; + char *column_type_str_; int64_t column_type_str_len_; bool is_filter_db_; int64_t last_filter_table_idx_; int64_t last_filter_column_idx_; - common::ObSEArray database_schema_array_; - common::ObSEArray filter_table_schema_array_; + common::ObSEArray database_schema_array_; + common::ObSEArray filter_table_schema_array_; }; } // namespace observer } // namespace oceanbase diff --git a/src/rootserver/ob_log_archive_scheduler.cpp b/src/rootserver/ob_log_archive_scheduler.cpp index acea8bcdda1b494d52310a0b2e39c0d9f1a75476..bbafb165a919ab5f46a824936f2404b7323ef4af 100644 --- a/src/rootserver/ob_log_archive_scheduler.cpp +++ b/src/rootserver/ob_log_archive_scheduler.cpp @@ -17,6 +17,7 @@ #include "share/backup/ob_log_archive_backup_info_mgr.h" #include "share/backup/ob_backup_lease_info_mgr.h" #include "share/backup/ob_backup_manager.h" +#include "share/backup/ob_backup_operator.h" #include "ob_leader_coordinator.h" #include "ob_server_manager.h" #include "lib/utility/ob_tracepoint.h" @@ -29,7 +30,7 @@ using namespace share; using namespace obrpc; using namespace rootserver; -ObLogArchiveThreadIdling::ObLogArchiveThreadIdling(volatile bool& stop) +ObLogArchiveThreadIdling::ObLogArchiveThreadIdling(volatile bool &stop) : ObThreadIdling(stop), idle_time_us_(MIN_IDLE_INTERVAL_US) {} @@ -39,7 +40,7 @@ int64_t ObLogArchiveThreadIdling::get_idle_interval_us() } void ObLogArchiveThreadIdling::set_log_archive_checkpoint_interval( - const int64_t interval_us, const share::ObLogArchiveStatus::STATUS& status) + const int64_t interval_us, const share::ObLogArchiveStatus::STATUS &status) { const int64_t max_idle_us = interval_us / 2 - RESERVED_FETCH_US; int64_t idle_time_us = 0; @@ -84,9 +85,9 @@ ObLogArchiveScheduler::~ObLogArchiveScheduler() destroy(); } -int ObLogArchiveScheduler::init(ObServerManager& server_mgr, ObZoneManager& zone_mgr, - share::schema::ObMultiVersionSchemaService* schema_service, ObSrvRpcProxy& rpc_proxy, - common::ObMySQLProxy& sql_proxy, share::ObIBackupLeaseService& backup_lease_service) +int ObLogArchiveScheduler::init(ObServerManager &server_mgr, ObZoneManager &zone_mgr, + share::schema::ObMultiVersionSchemaService *schema_service, ObSrvRpcProxy &rpc_proxy, + common::ObMySQLProxy &sql_proxy, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; const int64_t thread_cnt = 1; @@ -195,7 +196,7 @@ int ObLogArchiveScheduler::handle_enable_log_archive(const bool is_enable) return ret; } -int ObLogArchiveScheduler::handle_stop_log_archive_(const ObBackupInnerTableVersion& inner_table_version) +int ObLogArchiveScheduler::handle_stop_log_archive_(const ObBackupInnerTableVersion &inner_table_version) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -255,7 +256,7 @@ int ObLogArchiveScheduler::handle_stop_log_archive_(const ObBackupInnerTableVers return ret; } -int ObLogArchiveScheduler::handle_start_log_archive_(const ObBackupInnerTableVersion& inner_table_version) +int ObLogArchiveScheduler::handle_start_log_archive_(const ObBackupInnerTableVersion &inner_table_version) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -360,7 +361,7 @@ int ObLogArchiveScheduler::check_gts_() } int ObLogArchiveScheduler::init_new_sys_info_( - const char* backup_dest, const int64_t max_piece_id, share::ObLogArchiveBackupInfo& sys_info) + const char *backup_dest, const int64_t max_piece_id, share::ObLogArchiveBackupInfo &sys_info) { int ret = OB_SUCCESS; bool is_backup_backup = false; @@ -398,7 +399,7 @@ int ObLogArchiveScheduler::init_new_sys_info_( } int ObLogArchiveScheduler::init_new_sys_piece_( - const share::ObLogArchiveBackupInfo& sys_info, share::ObBackupPieceInfo& sys_piece) + const share::ObLogArchiveBackupInfo &sys_info, share::ObBackupPieceInfo &sys_piece) { int ret = OB_SUCCESS; @@ -424,7 +425,7 @@ int ObLogArchiveScheduler::init_new_sys_piece_( } int ObLogArchiveScheduler::init_new_sys_piece_for_compat_( - const share::ObLogArchiveBackupInfo& sys_info, share::ObBackupPieceInfo& sys_piece) + const share::ObLogArchiveBackupInfo &sys_info, share::ObBackupPieceInfo &sys_piece) { int ret = OB_SUCCESS; @@ -448,9 +449,9 @@ int ObLogArchiveScheduler::init_new_sys_piece_for_compat_( return ret; } -int ObLogArchiveScheduler::init_next_sys_piece_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObBackupPieceInfo& sys_piece, share::ObLogArchiveBackupInfo& new_sys_info, - share::ObNonFrozenBackupPieceInfo& new_sys_pieces) +int ObLogArchiveScheduler::init_next_sys_piece_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObBackupPieceInfo &sys_piece, share::ObLogArchiveBackupInfo &new_sys_info, + share::ObNonFrozenBackupPieceInfo &new_sys_pieces) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -532,12 +533,12 @@ int ObLogArchiveScheduler::init_next_sys_piece_(const share::ObLogArchiveBackupI return ret; } -int ObLogArchiveScheduler::init_next_user_piece_array_(const share::ObNonFrozenBackupPieceInfo& new_sys_piece, - const TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, - common::ObArray& new_user_piece_array) +int ObLogArchiveScheduler::init_next_user_piece_array_(const share::ObNonFrozenBackupPieceInfo &new_sys_piece, + const TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, + common::ObArray &new_user_piece_array) { int ret = OB_SUCCESS; - share::ObServerTenantLogArchiveStatus* backup_status; + share::ObServerTenantLogArchiveStatus *backup_status; for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); @@ -558,8 +559,8 @@ int ObLogArchiveScheduler::init_next_user_piece_array_(const share::ObNonFrozenB return ret; } -int ObLogArchiveScheduler::init_next_user_piece_(const share::ObNonFrozenBackupPieceInfo& new_sys_piece, - const uint64_t tenant_id, const int64_t checkpoint_ts, ObNonFrozenBackupPieceInfo& user_piece) +int ObLogArchiveScheduler::init_next_user_piece_(const share::ObNonFrozenBackupPieceInfo &new_sys_piece, + const uint64_t tenant_id, const int64_t checkpoint_ts, ObNonFrozenBackupPieceInfo &user_piece) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -591,13 +592,13 @@ int ObLogArchiveScheduler::init_next_user_piece_(const share::ObNonFrozenBackupP } int ObLogArchiveScheduler::update_external_user_piece_( - const common::ObIArray& new_user_piece_array) + const common::ObIArray &new_user_piece_array) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; for (int64_t i = 0; OB_SUCC(ret) && i < new_user_piece_array.count(); ++i) { - const ObNonFrozenBackupPieceInfo& user_piece = new_user_piece_array.at(i); + const ObNonFrozenBackupPieceInfo &user_piece = new_user_piece_array.at(i); if (OB_FAIL(info_mgr.update_external_backup_piece(user_piece, *backup_lease_service_))) { LOG_WARN("failed to update external user piece", K(ret), K(user_piece)); } @@ -606,9 +607,9 @@ int ObLogArchiveScheduler::update_external_user_piece_( return ret; } -int ObLogArchiveScheduler::update_inner_freeze_piece_info_(const share::ObLogArchiveBackupInfo& cur_sys_info, - const share::ObLogArchiveBackupInfo& new_sys_info, const share::ObNonFrozenBackupPieceInfo& new_sys_piece, - const ObArray& new_user_piece_array) +int ObLogArchiveScheduler::update_inner_freeze_piece_info_(const share::ObLogArchiveBackupInfo &cur_sys_info, + const share::ObLogArchiveBackupInfo &new_sys_info, const share::ObNonFrozenBackupPieceInfo &new_sys_piece, + const ObArray &new_user_piece_array) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -642,7 +643,7 @@ int ObLogArchiveScheduler::update_inner_freeze_piece_info_(const share::ObLogArc } for (int64_t i = 0; OB_SUCC(ret) && i < new_user_piece_array.count(); ++i) { - const ObNonFrozenBackupPieceInfo& user_piece = new_user_piece_array.at(i); + const ObNonFrozenBackupPieceInfo &user_piece = new_user_piece_array.at(i); if (OB_FAIL(info_mgr.update_backup_piece(trans, user_piece))) { LOG_WARN("failed to update external user piece", K(ret), K(user_piece)); } @@ -677,7 +678,7 @@ int ObLogArchiveScheduler::update_inner_freeze_piece_info_(const share::ObLogArc return ret; } -int ObLogArchiveScheduler::wait_backup_dest_(char* buf, const int64_t buf_len) +int ObLogArchiveScheduler::wait_backup_dest_(char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; const int64_t SLEEP_INTERVAL_US = 1000 * 1000; // 1s @@ -884,7 +885,7 @@ int ObLogArchiveScheduler::upgrade_log_archive_status_() } int ObLogArchiveScheduler::upgrade_log_archive_status_( - const uint64_t tenant_id, const share::ObBackupPieceInfo& sys_piece) + const uint64_t tenant_id, const share::ObBackupPieceInfo &sys_piece) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -953,7 +954,7 @@ int ObLogArchiveScheduler::upgrade_frozen_piece_files_() LOG_WARN("failed to get all log archive history infos", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < infos.count(); ++i) { - ObLogArchiveBackupInfo& info = infos.at(i); + ObLogArchiveBackupInfo &info = infos.at(i); piece.reset(); if (OB_FAIL(check_can_do_work_())) { LOG_WARN("failed to check can backup", K(ret)); @@ -999,7 +1000,7 @@ int ObLogArchiveScheduler::upgrade_backupset_files_() LOG_WARN("failed to get all backup task infos", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < infos.count(); ++i) { - ObTenantBackupTaskItem& info = infos.at(i); + ObTenantBackupTaskItem &info = infos.at(i); file_info.reset(); if (OB_FAIL(check_can_do_work_())) { LOG_WARN("failed to check can backup", K(ret)); @@ -1093,7 +1094,7 @@ int ObLogArchiveScheduler::check_backup_info_() return ret; } -int ObLogArchiveScheduler::do_schedule_(share::ObLogArchiveStatus::STATUS& last_log_archive_status) +int ObLogArchiveScheduler::do_schedule_(share::ObLogArchiveStatus::STATUS &last_log_archive_status) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1207,7 +1208,7 @@ int ObLogArchiveScheduler::do_schedule_(share::ObLogArchiveStatus::STATUS& last_ return ret; } -int ObLogArchiveScheduler::check_mount_file_(share::ObLogArchiveBackupInfo& sys_info) +int ObLogArchiveScheduler::check_mount_file_(share::ObLogArchiveBackupInfo &sys_info) { int ret = OB_SUCCESS; bool need_check = false; @@ -1240,7 +1241,7 @@ int ObLogArchiveScheduler::check_mount_file_(share::ObLogArchiveBackupInfo& sys_ } int ObLogArchiveScheduler::start_log_archive_backup_( - share::ObLogArchiveBackupInfo& cur_sys_info, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + share::ObLogArchiveBackupInfo &cur_sys_info, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int64_t user_tenant_count = 0; @@ -1270,7 +1271,7 @@ int ObLogArchiveScheduler::start_log_archive_backup_( for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); - ObServerTenantLogArchiveStatus* status = nullptr; + ObServerTenantLogArchiveStatus *status = nullptr; if (tenant_id < OB_USER_TENANT_ID) { continue; } @@ -1324,7 +1325,7 @@ int ObLogArchiveScheduler::start_log_archive_backup_( } else { for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); - ObServerTenantLogArchiveStatus* status = nullptr; + ObServerTenantLogArchiveStatus *status = nullptr; ObLogArchiveBackupInfo tenant_info = sys_info; tenant_info.status_.tenant_id_ = tenant_id; @@ -1374,8 +1375,8 @@ int ObLogArchiveScheduler::start_log_archive_backup_( return ret; } -int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObNonFrozenBackupPieceInfo& non_frozen_piece, const common::ObArray& tenant_ids) +int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObNonFrozenBackupPieceInfo &non_frozen_piece, const common::ObArray &tenant_ids) { int ret = OB_SUCCESS; @@ -1413,8 +1414,8 @@ int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBac // 3. update inner piece info // 4. update inner backup info // The only exception is that, piece_id = 0 means use old procedure without piece, we will skip 1\3 steps. -int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, const uint64_t tenant_id) +int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, const uint64_t tenant_id) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1494,7 +1495,7 @@ int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBac } int ObLogArchiveScheduler::update_tenant_non_frozen_backup_piece_( - const share::ObNonFrozenBackupPieceInfo& non_frozen_piece) + const share::ObNonFrozenBackupPieceInfo &non_frozen_piece) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1527,7 +1528,7 @@ int ObLogArchiveScheduler::update_tenant_non_frozen_backup_piece_( return ret; } -int ObLogArchiveScheduler::check_need_prepare_new_tenant_status(const uint64_t tenant_id, bool& need_prepare) +int ObLogArchiveScheduler::check_need_prepare_new_tenant_status(const uint64_t tenant_id, bool &need_prepare) { int ret = OB_SUCCESS; const bool for_update = false; @@ -1550,9 +1551,9 @@ int ObLogArchiveScheduler::check_need_prepare_new_tenant_status(const uint64_t t return ret; } -int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, const uint64_t tenant_id, - share::ObLogArchiveBackupInfo& tenant_info, ObNonFrozenBackupPieceInfo& tenant_non_frozen_piece) +int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, const uint64_t tenant_id, + share::ObLogArchiveBackupInfo &tenant_info, ObNonFrozenBackupPieceInfo &tenant_non_frozen_piece) { int ret = OB_SUCCESS; int64_t create_tenant_ts = 0; @@ -1606,7 +1607,7 @@ int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBac } int ObLogArchiveScheduler::set_backup_piece_start_ts_( - const share::ObBackupPieceInfoKey& piece_key, const int64_t start_ts) + const share::ObBackupPieceInfoKey &piece_key, const int64_t start_ts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1652,7 +1653,7 @@ int ObLogArchiveScheduler::set_backup_piece_start_ts_( return ret; } -int ObLogArchiveScheduler::start_tenant_log_archive_backup_info_(share::ObLogArchiveBackupInfo& new_info) +int ObLogArchiveScheduler::start_tenant_log_archive_backup_info_(share::ObLogArchiveBackupInfo &new_info) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -1692,7 +1693,7 @@ int ObLogArchiveScheduler::start_tenant_log_archive_backup_info_(share::ObLogArc } int ObLogArchiveScheduler::update_log_archive_backup_process_( - share::ObLogArchiveBackupInfo& cur_sys_info, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + share::ObLogArchiveBackupInfo &cur_sys_info, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int64_t min_piece_id = INT64_MAX; @@ -1725,9 +1726,9 @@ int ObLogArchiveScheduler::update_log_archive_backup_process_( return ret; } -int ObLogArchiveScheduler::try_update_checkpoit_ts_(share::ObLogArchiveBackupInfo& cur_sys_info, - share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, ObIAllocator& allocator, - TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, int64_t& min_piece_id, int64_t& inactive_server_count) +int ObLogArchiveScheduler::try_update_checkpoit_ts_(share::ObLogArchiveBackupInfo &cur_sys_info, + share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, ObIAllocator &allocator, + TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, int64_t &min_piece_id, int64_t &inactive_server_count) { int ret = OB_SUCCESS; int64_t user_tenant_count = 0; @@ -1745,7 +1746,7 @@ int ObLogArchiveScheduler::try_update_checkpoit_ts_(share::ObLogArchiveBackupInf for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); - ObServerTenantLogArchiveStatus* status = nullptr; + ObServerTenantLogArchiveStatus *status = nullptr; ++user_tenant_count; if (tenant_id < OB_USER_TENANT_ID) { ret = OB_ERR_SYS; @@ -1838,16 +1839,16 @@ int ObLogArchiveScheduler::try_update_checkpoit_ts_(share::ObLogArchiveBackupInf return ret; } -int ObLogArchiveScheduler::try_update_backup_piece_(const share::ObLogArchiveBackupInfo& sys_info, - const TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, const int64_t inactive_server_count, - share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, int64_t& min_piece_id) +int ObLogArchiveScheduler::try_update_backup_piece_(const share::ObLogArchiveBackupInfo &sys_info, + const TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, const int64_t inactive_server_count, + share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, int64_t &min_piece_id) { int ret = OB_SUCCESS; bool is_backup_backup = false; ObBackupDestOpt backup_dest_opt; bool need_block_switch_piece_for_test = false; int64_t test_max_piece_id = 1; - ObBackupPieceInfo& sys_piece_info = sys_non_frozen_piece.cur_piece_info_; + ObBackupPieceInfo &sys_piece_info = sys_non_frozen_piece.cur_piece_info_; LOG_INFO("start try_update_backup_piece", K(sys_info), K(sys_non_frozen_piece)); @@ -1917,8 +1918,8 @@ int ObLogArchiveScheduler::try_update_backup_piece_(const share::ObLogArchiveBac return ret; } -int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_(const share::ObLogArchiveBackupInfo& sys_info, - const TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, share::ObBackupPieceInfo& sys_piece_info) +int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_(const share::ObLogArchiveBackupInfo &sys_info, + const TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, share::ObBackupPieceInfo &sys_piece_info) { int ret = OB_SUCCESS; share::ObBackupPieceInfoKey tenant_key; @@ -1933,7 +1934,7 @@ int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_(const share::ObLog } else { for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); - share::ObServerTenantLogArchiveStatus* status = nullptr; + share::ObServerTenantLogArchiveStatus *status = nullptr; tenant_key = sys_piece_info.key_; tenant_key.tenant_id_ = tenant_id; if (OB_FAIL(log_archive_status_map.get_refactored(tenant_id, status))) { @@ -1954,7 +1955,7 @@ int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_(const share::ObLog } int ObLogArchiveScheduler::update_sys_active_piece_checkpoint_ts_( - const int64_t checkpoint_ts, share::ObBackupPieceInfo& sys_piece_info) + const int64_t checkpoint_ts, share::ObBackupPieceInfo &sys_piece_info) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2001,7 +2002,7 @@ int ObLogArchiveScheduler::update_sys_active_piece_checkpoint_ts_( } int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_( - const share::ObBackupPieceInfoKey& piece_key, const int64_t checkpoint_ts) + const share::ObBackupPieceInfoKey &piece_key, const int64_t checkpoint_ts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2047,12 +2048,12 @@ int ObLogArchiveScheduler::update_active_piece_checkpoint_ts_( return ret; } -int ObLogArchiveScheduler::frozen_old_piece_(const bool force_stop, const common::ObIArray& tenant_ids, - const TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) +int ObLogArchiveScheduler::frozen_old_piece_(const bool force_stop, const common::ObIArray &tenant_ids, + const TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int64_t max_gts = 0; - share::ObServerTenantLogArchiveStatus* status = nullptr; + share::ObServerTenantLogArchiveStatus *status = nullptr; DEBUG_SYNC(BACKUP_BEFORE_FROZEN_PIECES); if (!is_inited_) { @@ -2098,8 +2099,8 @@ int ObLogArchiveScheduler::frozen_old_piece_(const bool force_stop, const common } int ObLogArchiveScheduler::frozen_old_piece_(const bool force_stop, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, const uint64_t tenant_id, - const int64_t server_tenant_max_ts, int64_t& max_ts) + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, const uint64_t tenant_id, + const int64_t server_tenant_max_ts, int64_t &max_ts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2158,7 +2159,7 @@ int ObLogArchiveScheduler::frozen_old_piece_(const bool force_stop, } int ObLogArchiveScheduler::frozen_sys_old_piece_( - const bool force_stop, const int64_t max_gts, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + const bool force_stop, const int64_t max_gts, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2216,8 +2217,8 @@ int ObLogArchiveScheduler::frozen_sys_old_piece_( // 4. update external sys piece info // 5. update external sys backup info // 6. update inner table user and sys piece in one transaction -int ObLogArchiveScheduler::trigger_freeze_pieces_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObBackupPieceInfo& sys_piece_info, const TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map) +int ObLogArchiveScheduler::trigger_freeze_pieces_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObBackupPieceInfo &sys_piece_info, const TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map) { int ret = OB_SUCCESS; share::ObLogArchiveBackupInfo new_sys_info; @@ -2246,9 +2247,9 @@ int ObLogArchiveScheduler::trigger_freeze_pieces_(const share::ObLogArchiveBacku return ret; } -int ObLogArchiveScheduler::update_tenant_log_archive_backup_process_(const share::ObLogArchiveBackupInfo& sys_info, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, - const share::ObServerTenantLogArchiveStatus& tenant_status) +int ObLogArchiveScheduler::update_tenant_log_archive_backup_process_(const share::ObLogArchiveBackupInfo &sys_info, + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, + const share::ObServerTenantLogArchiveStatus &tenant_status) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2331,7 +2332,7 @@ int ObLogArchiveScheduler::update_tenant_log_archive_backup_process_(const share } int ObLogArchiveScheduler::check_dropped_tenant_( - const common::ObIArray& tenant_ids, const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + const common::ObIArray &tenant_ids, const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -2370,8 +2371,8 @@ int ObLogArchiveScheduler::check_dropped_tenant_( } int ObLogArchiveScheduler::do_stop_log_archive_backup_v2_(const bool force_stop, - const common::ObIArray& tenant_ids, const share::ObLogArchiveBackupInfo& cur_sys_info, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + const common::ObIArray &tenant_ids, const share::ObLogArchiveBackupInfo &cur_sys_info, + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -2426,7 +2427,7 @@ int ObLogArchiveScheduler::do_stop_log_archive_backup_v2_(const bool force_stop, } int ObLogArchiveScheduler::do_stop_tenant_log_archive_backup_v2_( - const bool force_stop, const bool is_dropped_tenant, const share::ObBackupPieceInfoKey& cur_key, int64_t& max_ts) + const bool force_stop, const bool is_dropped_tenant, const share::ObBackupPieceInfoKey &cur_key, int64_t &max_ts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2529,7 +2530,7 @@ int ObLogArchiveScheduler::do_stop_tenant_log_archive_backup_v2_( } int ObLogArchiveScheduler::do_stop_sys_log_archive_backup_v2_(const bool force_stop, - const share::ObLogArchiveBackupInfo& cur_sys_info, const share::ObBackupPieceInfoKey& cur_key, const int64_t max_ts) + const share::ObLogArchiveBackupInfo &cur_sys_info, const share::ObBackupPieceInfoKey &cur_key, const int64_t max_ts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2612,8 +2613,8 @@ int ObLogArchiveScheduler::do_stop_sys_log_archive_backup_v2_(const bool force_s return ret; } -int ObLogArchiveScheduler::stop_log_archive_backup_(const bool force_stop, share::ObLogArchiveBackupInfo& cur_sys_info, - share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) +int ObLogArchiveScheduler::stop_log_archive_backup_(const bool force_stop, share::ObLogArchiveBackupInfo &cur_sys_info, + share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; common::ObArray tenant_ids; @@ -2654,12 +2655,12 @@ int ObLogArchiveScheduler::stop_log_archive_backup_(const bool force_stop, share return ret; } -int ObLogArchiveScheduler::get_tenant_ids_from_schema_(common::ObIArray& tenant_ids) +int ObLogArchiveScheduler::get_tenant_ids_from_schema_(common::ObIArray &tenant_ids) { int ret = OB_SUCCESS; int64_t user_tenant_count = 0; int64_t stop_tenant_count = 0; - hash::ObHashMap log_archive_status_map; + hash::ObHashMap log_archive_status_map; ObArenaAllocator allocator; ObLogArchiveBackupInfoMgr info_mgr; @@ -2689,7 +2690,7 @@ int ObLogArchiveScheduler::get_tenant_ids_from_schema_(common::ObIArray& tenant_ids, bool& is_all_stop) + share::ObLogArchiveBackupInfo &sys_info, common::ObIArray &tenant_ids, bool &is_all_stop) { int ret = OB_SUCCESS; ObArenaAllocator allocator; @@ -2711,7 +2712,7 @@ int ObLogArchiveScheduler::check_server_stop_backup_( for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids.count(); ++i) { const uint64_t tenant_id = tenant_ids.at(i); - ObServerTenantLogArchiveStatus* status = nullptr; + ObServerTenantLogArchiveStatus *status = nullptr; if (tenant_id < OB_USER_TENANT_ID) { ret = OB_ERR_SYS; @@ -2745,7 +2746,7 @@ int ObLogArchiveScheduler::check_server_stop_backup_( } int ObLogArchiveScheduler::frozen_active_piece_before_stop_(const bool force_stop, - share::ObLogArchiveBackupInfo& cur_sys_info, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + share::ObLogArchiveBackupInfo &cur_sys_info, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int64_t max_gts = 0; @@ -2777,7 +2778,7 @@ int ObLogArchiveScheduler::frozen_active_piece_before_stop_(const bool force_sto } int ObLogArchiveScheduler::frozen_active_piece_before_stop_(const bool force_stop, - const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece, const uint64_t tenant_id, int64_t& max_gts) + const share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece, const uint64_t tenant_id, int64_t &max_gts) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2836,7 +2837,7 @@ int ObLogArchiveScheduler::frozen_active_piece_before_stop_(const bool force_sto } int ObLogArchiveScheduler::frozen_sys_active_piece_before_stop_(const bool force_stop, const int64_t max_gts, - share::ObLogArchiveBackupInfo& cur_sys_info, share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece) + share::ObLogArchiveBackupInfo &cur_sys_info, share::ObNonFrozenBackupPieceInfo &sys_non_frozen_piece) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -2876,7 +2877,7 @@ int ObLogArchiveScheduler::frozen_sys_active_piece_before_stop_(const bool force } int ObLogArchiveScheduler::do_stop_log_archive_backup_(const bool force_stop, - const common::ObIArray& tenant_ids, const share::ObLogArchiveBackupInfo& cur_sys_info) + const common::ObIArray &tenant_ids, const share::ObLogArchiveBackupInfo &cur_sys_info) { int ret = OB_SUCCESS; int64_t user_tenant_count = 0; @@ -2897,7 +2898,7 @@ int ObLogArchiveScheduler::do_stop_log_archive_backup_(const bool force_stop, for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids.count(); ++i) { const uint64_t tenant_id = tenant_ids.at(i); - ObServerTenantLogArchiveStatus* status = nullptr; + ObServerTenantLogArchiveStatus *status = nullptr; if (tenant_id < OB_USER_TENANT_ID) { ret = OB_ERR_SYS; LOG_ERROR("invalid tenatn_id", K(ret), K(tenant_id), K(i), K(tenant_ids)); @@ -2956,7 +2957,7 @@ int ObLogArchiveScheduler::do_stop_log_archive_backup_(const bool force_stop, } int ObLogArchiveScheduler::do_stop_tenant_log_archive_backup_( - const uint64_t tenant_id, const ObLogArchiveBackupInfo& sys_info, const bool force_stop) + const uint64_t tenant_id, const ObLogArchiveBackupInfo &sys_info, const bool force_stop) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -3041,7 +3042,7 @@ int ObLogArchiveScheduler::do_stop_tenant_log_archive_backup_( return ret; } -int ObLogArchiveScheduler::set_log_archive_backup_interrupted_(const share::ObLogArchiveBackupInfo& cur_sys_info) +int ObLogArchiveScheduler::set_log_archive_backup_interrupted_(const share::ObLogArchiveBackupInfo &cur_sys_info) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -3067,7 +3068,7 @@ int ObLogArchiveScheduler::set_log_archive_backup_interrupted_(const share::ObLo return ret; } -int ObLogArchiveScheduler::set_tenants_log_archive_backup_interrupted_(share::ObLogArchiveBackupInfo& sys_info) +int ObLogArchiveScheduler::set_tenants_log_archive_backup_interrupted_(share::ObLogArchiveBackupInfo &sys_info) { int ret = OB_SUCCESS; ObLogArchiveBackupInfoMgr info_mgr; @@ -3079,7 +3080,7 @@ int ObLogArchiveScheduler::set_tenants_log_archive_backup_interrupted_(share::Ob for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids_.count(); ++i) { const uint64_t tenant_id = tenant_ids_.at(i); - ObTenantLogArchiveStatus* status = nullptr; + ObTenantLogArchiveStatus *status = nullptr; if (tenant_id < OB_USER_TENANT_ID) { continue; } @@ -3103,7 +3104,7 @@ int ObLogArchiveScheduler::set_tenants_log_archive_backup_interrupted_(share::Ob } int ObLogArchiveScheduler::set_tenant_log_archive_backup_interrupted_( - const uint64_t tenant_id, const ObLogArchiveBackupInfo& sys_info) + const uint64_t tenant_id, const ObLogArchiveBackupInfo &sys_info) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; @@ -3161,7 +3162,7 @@ int ObLogArchiveScheduler::set_tenant_log_archive_backup_interrupted_( return ret; } -int ObLogArchiveScheduler::check_server_status_(ObArray& inactive_server_list) +int ObLogArchiveScheduler::check_server_status_(ObArray &inactive_server_list) { int ret = OB_SUCCESS; common::ObZone inactive_zone; @@ -3180,7 +3181,7 @@ int ObLogArchiveScheduler::check_server_status_(ObArray& inactiv } for (int64_t i = 0; OB_SUCC(ret) && i < inactive_server_list.count(); ++i) { - const ObAddr& addr = inactive_server_list.at(i); + const ObAddr &addr = inactive_server_list.at(i); if (OB_FAIL(server_mgr_->get_server_zone(addr, tmp_zone))) { LOG_WARN("failed to get server zone", K(ret), K(addr)); } else if (inactive_zone.is_empty()) { @@ -3200,8 +3201,8 @@ int ObLogArchiveScheduler::check_server_status_(ObArray& inactiv return ret; } -int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObLogArchiveBackupInfo& sys_info, - ObIAllocator& allocator, TENANT_ARCHIVE_STATUS_MAP& log_archive_status_map, int64_t& inactive_server_count) +int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObLogArchiveBackupInfo &sys_info, + ObIAllocator &allocator, TENANT_ARCHIVE_STATUS_MAP &log_archive_status_map, int64_t &inactive_server_count) { int ret = OB_SUCCESS; int hash_ret = OB_SUCCESS; @@ -3235,7 +3236,7 @@ int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObL // TODO(): [backup2] use async rpc for (int64_t server_idx = 0; OB_SUCC(ret) && server_idx < active_server_list.count(); ++server_idx) { - const common::ObAddr& addr = active_server_list.at(server_idx); + const common::ObAddr &addr = active_server_list.at(server_idx); if (OB_FAIL(check_can_do_work_())) { LOG_WARN("failed to check can do work", K(ret)); } else if (OB_FAIL(fetch_server_tenant_log_archive_status_(addr, arg, result))) { @@ -3251,7 +3252,7 @@ int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObL } const int64_t count = result.status_array_.count(); for (int64_t i = 0; OB_SUCC(ret) && i < count; ++i) { - ObServerTenantLogArchiveStatus& status = result.status_array_.at(i); + ObServerTenantLogArchiveStatus &status = result.status_array_.at(i); if (!status.is_valid()) { ret = OB_ERR_UNEXPECTED; LOG_ERROR("invalid log archive status", K(ret), K(i), K(addr), K(status)); @@ -3278,7 +3279,7 @@ int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObL } #endif - ObServerTenantLogArchiveStatus* value = nullptr; + ObServerTenantLogArchiveStatus *value = nullptr; hash_ret = log_archive_status_map.get_refactored(status.tenant_id_, value); if (OB_SUCCESS == hash_ret) { if (value->status_ != status.status_) { @@ -3307,12 +3308,12 @@ int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObL } } } else if (OB_HASH_NOT_EXIST == hash_ret) { - void* tmp = allocator.alloc(sizeof(ObServerTenantLogArchiveStatus)); + void *tmp = allocator.alloc(sizeof(ObServerTenantLogArchiveStatus)); if (OB_ISNULL(tmp)) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret)); } else { - ObServerTenantLogArchiveStatus* ptr = new (tmp) ObServerTenantLogArchiveStatus; + ObServerTenantLogArchiveStatus *ptr = new (tmp) ObServerTenantLogArchiveStatus; *ptr = status; if (OB_FAIL(log_archive_status_map.set_refactored(status.tenant_id_, ptr))) { LOG_WARN("Failed to set log_archive_status_map", K(ret), K(*ptr)); @@ -3341,8 +3342,8 @@ int ObLogArchiveScheduler::fetch_log_archive_backup_status_map_(const share::ObL return ret; } -int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_(const common::ObAddr& addr, - const share::ObGetTenantLogArchiveStatusArg& arg, share::ObServerTenantLogArchiveStatusWrapper& result) +int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_(const common::ObAddr &addr, + const share::ObGetTenantLogArchiveStatusArg &arg, share::ObServerTenantLogArchiveStatusWrapper &result) { int ret = OB_SUCCESS; const uint64_t cluster_observer_version = GET_MIN_CLUSTER_VERSION(); @@ -3367,8 +3368,8 @@ int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_(const common: return ret; } -int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_v1_(const common::ObAddr& addr, - const share::ObGetTenantLogArchiveStatusArg& arg, share::ObServerTenantLogArchiveStatusWrapper& result) +int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_v1_(const common::ObAddr &addr, + const share::ObGetTenantLogArchiveStatusArg &arg, share::ObServerTenantLogArchiveStatusWrapper &result) { int ret = OB_SUCCESS; share::ObTenantLogArchiveStatusWrapper tmp_result; @@ -3393,8 +3394,8 @@ int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_v1_(const comm return ret; } -int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_v2_(const common::ObAddr& addr, - const share::ObGetTenantLogArchiveStatusArg& arg, share::ObServerTenantLogArchiveStatusWrapper& result) +int ObLogArchiveScheduler::fetch_server_tenant_log_archive_status_v2_(const common::ObAddr &addr, + const share::ObGetTenantLogArchiveStatusArg &arg, share::ObServerTenantLogArchiveStatusWrapper &result) { int ret = OB_SUCCESS; share::ObTenantLogArchiveStatusWrapper tmp_result; @@ -3423,7 +3424,7 @@ int ObLogArchiveScheduler::check_can_do_work_() return ret; } -int ObLogArchiveScheduler::commit_trans_(common::ObMySQLTransaction& trans) +int ObLogArchiveScheduler::commit_trans_(common::ObMySQLTransaction &trans) { int ret = OB_SUCCESS; @@ -3436,7 +3437,7 @@ int ObLogArchiveScheduler::commit_trans_(common::ObMySQLTransaction& trans) } int ObLogArchiveScheduler::update_sys_backup_info_( - const share::ObLogArchiveBackupInfo& cur_info, share::ObLogArchiveBackupInfo& new_info) + const share::ObLogArchiveBackupInfo &cur_info, share::ObLogArchiveBackupInfo &new_info) { int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; diff --git a/src/rootserver/ob_root_backup.cpp b/src/rootserver/ob_root_backup.cpp index a9f7c755f060ecd26d0c0a9df8e7584206f19175..74df0dc9e63e1b1689acb0620c0c17243dcfad4f 100644 --- a/src/rootserver/ob_root_backup.cpp +++ b/src/rootserver/ob_root_backup.cpp @@ -14,6 +14,8 @@ #include "ob_root_backup.h" #include "share/backup/ob_backup_operator.h" #include "share/backup/ob_extern_backup_info_mgr.h" +#include "share/schema/ob_schema_mgr.h" +#include "share/schema/ob_schema_struct.h" #include "ob_root_balancer.h" #include "ob_rs_event_history_table_operator.h" #include "share/backup/ob_tenant_backup_clean_info_updater.h" @@ -775,7 +777,7 @@ int ObRootBackup::do_tenant_backup(const share::ObBaseBackupInfoStruct &info, sh if (OB_FAIL(ret)) { if (ObBackupUtils::is_need_retry_error(ret)) { - //do nothing + // do nothing } else { dest_task_info = task_info; dest_task_info.result_ = ret; diff --git a/src/rootserver/restore/ob_restore_scheduler.cpp b/src/rootserver/restore/ob_restore_scheduler.cpp index 8466b3645ee75058f3b5de83fdbff97512be855f..784299429ce9983f7bf6b865e945a24c2f750a6b 100644 --- a/src/rootserver/restore/ob_restore_scheduler.cpp +++ b/src/rootserver/restore/ob_restore_scheduler.cpp @@ -20,6 +20,7 @@ #include "rootserver/ob_root_inspection.h" #include "share/ob_schema_status_proxy.h" #include "share/schema/ob_schema_utils.h" +#include "share/schema/ob_schema_mgr.h" #include "share/ob_upgrade_utils.h" #include "storage/transaction/ob_i_ts_source.h" #include "share/backup/ob_backup_struct.h" // ObPhysicalRestoreInfo @@ -75,11 +76,11 @@ ObRestoreScheduler::~ObRestoreScheduler() } } -int ObRestoreScheduler::init(ObMultiVersionSchemaService& schema_service, ObMySQLProxy& sql_proxy, - ObOracleSqlProxy& oracle_sql_proxy, ObCommonRpcProxy& rpc_proxy, obrpc::ObSrvRpcProxy& srv_rpc_proxy, - ObFreezeInfoManager& freeze_info_mgr, ObPartitionTableOperator& pt_operator, ObRebalanceTaskMgr& task_mgr, - ObServerManager& server_manager, ObZoneManager& zone_manager, ObUnitManager& unit_manager, - ObDDLService& ddl_service, const common::ObAddr& self_addr) +int ObRestoreScheduler::init(ObMultiVersionSchemaService &schema_service, ObMySQLProxy &sql_proxy, + ObOracleSqlProxy &oracle_sql_proxy, ObCommonRpcProxy &rpc_proxy, obrpc::ObSrvRpcProxy &srv_rpc_proxy, + ObFreezeInfoManager &freeze_info_mgr, ObPartitionTableOperator &pt_operator, ObRebalanceTaskMgr &task_mgr, + ObServerManager &server_manager, ObZoneManager &zone_manager, ObUnitManager &unit_manager, + ObDDLService &ddl_service, const common::ObAddr &self_addr) { int ret = OB_SUCCESS; const int restore_scheduler_thread_cnt = 1; @@ -190,7 +191,7 @@ void ObRestoreScheduler::run3() return; } -int ObRestoreScheduler::process_restore_job(const ObPhysicalRestoreJob& job) +int ObRestoreScheduler::process_restore_job(const ObPhysicalRestoreJob &job) { int ret = OB_SUCCESS; if (!inited_) { @@ -248,7 +249,7 @@ int ObRestoreScheduler::process_restore_job(const ObPhysicalRestoreJob& job) } // restore_tenant is not reentrant -int ObRestoreScheduler::restore_tenant(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::restore_tenant(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObCreateTenantArg arg; @@ -304,7 +305,7 @@ int ObRestoreScheduler::restore_tenant(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::fill_job_info(ObPhysicalRestoreJob& job, ObCreateTenantArg& arg) +int ObRestoreScheduler::fill_job_info(ObPhysicalRestoreJob &job, ObCreateTenantArg &arg) { int ret = OB_SUCCESS; if (!inited_) { @@ -319,7 +320,7 @@ int ObRestoreScheduler::fill_job_info(ObPhysicalRestoreJob& job, ObCreateTenantA } return ret; } -int ObRestoreScheduler::fill_create_tenant_arg(const ObPhysicalRestoreJob& job, ObCreateTenantArg& arg) +int ObRestoreScheduler::fill_create_tenant_arg(const ObPhysicalRestoreJob &job, ObCreateTenantArg &arg) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; @@ -351,7 +352,7 @@ int ObRestoreScheduler::fill_create_tenant_arg(const ObPhysicalRestoreJob& job, if (OB_FAIL(assign_pool_list(job.pool_list_, arg.pool_list_))) { LOG_WARN("fail to get pool list", K(ret), K(job)); } - ObTenantSchema& tenant_schema = arg.tenant_schema_; + ObTenantSchema &tenant_schema = arg.tenant_schema_; // check locality if (OB_SUCC(ret)) { bool specific_locality = 0 != strlen(job.locality_); @@ -402,13 +403,13 @@ int ObRestoreScheduler::fill_create_tenant_arg(const ObPhysicalRestoreJob& job, return ret; } -int ObRestoreScheduler::assign_pool_list(const char* str, common::ObIArray& pool_list) +int ObRestoreScheduler::assign_pool_list(const char *str, common::ObIArray &pool_list) { int ret = OB_SUCCESS; - char* item_str = NULL; - char* save_ptr = NULL; + char *item_str = NULL; + char *save_ptr = NULL; while (OB_SUCC(ret)) { - item_str = strtok_r((NULL == item_str ? const_cast(str) : NULL), ",", &save_ptr); + item_str = strtok_r((NULL == item_str ? const_cast(str) : NULL), ",", &save_ptr); if (NULL != item_str) { if (OB_FAIL(pool_list.push_back(ObString::make_string(item_str)))) { LOG_WARN("push_back failed", K(ret)); @@ -421,10 +422,10 @@ int ObRestoreScheduler::assign_pool_list(const char* str, common::ObIArray restore_pure_ids; @@ -524,7 +525,7 @@ int ObRestoreScheduler::fill_pkeys_for_physical_restore_log(const ObPhysicalRest return ret; } -int ObRestoreScheduler::fill_rs_info(ObPhysicalRestoreJob& job) +int ObRestoreScheduler::fill_rs_info(ObPhysicalRestoreJob &job) { int ret = OB_SUCCESS; ObRestoreBackupInfo backup_info; @@ -544,7 +545,7 @@ int ObRestoreScheduler::fill_rs_info(ObPhysicalRestoreJob& job) return ret; } -int ObRestoreScheduler::restore_sys_replica(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::restore_sys_replica(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; if (!inited_) { @@ -578,7 +579,7 @@ int ObRestoreScheduler::restore_sys_replica(const ObPhysicalRestoreJob& job_info return ret; } -int ObRestoreScheduler::update_restore_schema_version(const ObPhysicalRestoreJob& job) +int ObRestoreScheduler::update_restore_schema_version(const ObPhysicalRestoreJob &job) { int ret = OB_SUCCESS; ObRefreshSchemaStatus schema_status; @@ -601,7 +602,7 @@ int ObRestoreScheduler::update_restore_schema_version(const ObPhysicalRestoreJob } int ObRestoreScheduler::schedule_restore_task( - const ObPhysicalRestoreJob& job_info, ObPhysicalRestoreStat& stat, int64_t& task_cnt) + const ObPhysicalRestoreJob &job_info, ObPhysicalRestoreStat &stat, int64_t &task_cnt) { int ret = OB_SUCCESS; DEBUG_SYNC(BEFORE_PHYSICAL_RESTORE_REPLICA); @@ -641,8 +642,8 @@ int ObRestoreScheduler::schedule_restore_task( return ret; } -int ObRestoreScheduler::schedule_restore_task(const ObPhysicalRestoreJob& job_info, ObPhysicalRestoreStat& stat, - const PhysicalRestorePartition* partition, int64_t& task_cnt) +int ObRestoreScheduler::schedule_restore_task(const ObPhysicalRestoreJob &job_info, ObPhysicalRestoreStat &stat, + const PhysicalRestorePartition *partition, int64_t &task_cnt) { int ret = OB_SUCCESS; if (!inited_) { @@ -684,7 +685,7 @@ int ObRestoreScheduler::schedule_restore_task(const ObPhysicalRestoreJob& job_in stat.statistic_.finish_pg_cnt_ += 1; stat.statistic_.finish_partition_cnt_ += partition->table_cnt_; } else { - const ObPartitionReplica* restore_replica = NULL; + const ObPartitionReplica *restore_replica = NULL; FOR_BEGIN_END_E(r, *partition, stat.replicas_, OB_SUCC(ret)) { if (OB_ISNULL(r)) { @@ -727,9 +728,9 @@ int ObRestoreScheduler::schedule_restore_task(const ObPhysicalRestoreJob& job_in return ret; } -int ObRestoreScheduler::schedule_leader_restore_task(const PhysicalRestorePartition& partition, - const ObPartitionReplica& replica, const ObPhysicalRestoreJob& job_info, const ObPhysicalRestoreStat& stat, - int64_t& task_cnt) +int ObRestoreScheduler::schedule_leader_restore_task(const PhysicalRestorePartition &partition, + const ObPartitionReplica &replica, const ObPhysicalRestoreJob &job_info, const ObPhysicalRestoreStat &stat, + int64_t &task_cnt) { int ret = OB_SUCCESS; UNUSED(stat); @@ -744,7 +745,7 @@ int ObRestoreScheduler::schedule_leader_restore_task(const PhysicalRestorePartit ObPhysicalRestoreTask task; ObPhysicalRestoreTaskInfo task_info; common::ObArray task_info_array; - const char* comment = balancer::PHYSICAL_RESTORE_REPLICA; + const char *comment = balancer::PHYSICAL_RESTORE_REPLICA; int64_t tmp_cnt = 0; // fill dst OnlineReplica dst; @@ -769,9 +770,9 @@ int ObRestoreScheduler::schedule_leader_restore_task(const PhysicalRestorePartit return ret; } -int ObRestoreScheduler::schedule_follower_restore_task(const PhysicalRestorePartition& partition, - const ObPartitionReplica& replica, const ObPhysicalRestoreJob& job_info, const ObPhysicalRestoreStat& stat, - int64_t& task_cnt) +int ObRestoreScheduler::schedule_follower_restore_task(const PhysicalRestorePartition &partition, + const ObPartitionReplica &replica, const ObPhysicalRestoreJob &job_info, const ObPhysicalRestoreStat &stat, + int64_t &task_cnt) { int ret = OB_SUCCESS; UNUSED(job_info); @@ -786,7 +787,7 @@ int ObRestoreScheduler::schedule_follower_restore_task(const PhysicalRestorePart ObCopySSTableTaskInfo task_info; common::ObArray task_info_array; OnlineReplica dst; - const char* comment = balancer::RESTORE_FOLLOWER_REPLICA; + const char *comment = balancer::RESTORE_FOLLOWER_REPLICA; const ObCopySSTableType type = OB_COPY_SSTABLE_TYPE_RESTORE_FOLLOWER; ObReplicaMember data_src; int64_t tmp_cnt = 0; @@ -813,7 +814,7 @@ int ObRestoreScheduler::schedule_follower_restore_task(const PhysicalRestorePart } int ObRestoreScheduler::fill_restore_arg( - const common::ObPartitionKey& pg_key, const ObPhysicalRestoreJob& job, ObPhysicalRestoreArg& arg) + const common::ObPartitionKey &pg_key, const ObPhysicalRestoreJob &job, ObPhysicalRestoreArg &arg) { int ret = OB_SUCCESS; arg.pg_key_ = pg_key; @@ -826,7 +827,7 @@ int ObRestoreScheduler::fill_restore_arg( } int ObRestoreScheduler::choose_restore_data_source( - const PhysicalRestorePartition& partition, const ObPhysicalRestoreStat& stat, ObReplicaMember& data_src) + const PhysicalRestorePartition &partition, const ObPhysicalRestoreStat &stat, ObReplicaMember &data_src) { int ret = OB_SUCCESS; bool found = false; @@ -847,7 +848,7 @@ int ObRestoreScheduler::choose_restore_data_source( return ret; } -int ObRestoreScheduler::set_member_list(const ObPhysicalRestoreJob& job_info, const ObPhysicalRestoreStat& stat) +int ObRestoreScheduler::set_member_list(const ObPhysicalRestoreJob &job_info, const ObPhysicalRestoreStat &stat) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -866,7 +867,7 @@ int ObRestoreScheduler::set_member_list(const ObPhysicalRestoreJob& job_info, co LOG_WARN("fail to build member_list_map", K(ret), K(tenant_id)); } else { bool all_done = true; - ObArray persist_partitions; + ObArray persist_partitions; ObRecoveryHelper::ObMemberListPkeyList partition_infos; SetMemberListAction action = SetMemberListAction::BALANCE; FOREACH_CNT_X(partition, stat.partitions_, OB_SUCC(ret)) @@ -953,7 +954,7 @@ int ObRestoreScheduler::set_member_list(const ObPhysicalRestoreJob& job_info, co // 3. SET_MEMBER_LIST: replicas match locality, and all replicas' is_restore = // REPLICA_RESTORE_WAIT_ALL_DUMPED/REPLICA_RESTORE_MEMBER_LIST. int ObRestoreScheduler::get_set_member_list_action( - const PhysicalRestorePartition& partition, const ObPhysicalRestoreStat& stat, SetMemberListAction& action) + const PhysicalRestorePartition &partition, const ObPhysicalRestoreStat &stat, SetMemberListAction &action) { int ret = OB_SUCCESS; bool locality_match = false; @@ -1001,7 +1002,7 @@ int ObRestoreScheduler::get_set_member_list_action( return ret; } -int ObRestoreScheduler::check_locality_valid(const share::schema::ZoneLocalityIArray& locality) +int ObRestoreScheduler::check_locality_valid(const share::schema::ZoneLocalityIArray &locality) { int ret = OB_SUCCESS; int64_t cnt = locality.count(); @@ -1010,7 +1011,7 @@ int ObRestoreScheduler::check_locality_valid(const share::schema::ZoneLocalityIA LOG_WARN("invalid cnt", K(ret), K(cnt)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < cnt; i++) { - const share::ObZoneReplicaAttrSet& attr = locality.at(i); + const share::ObZoneReplicaAttrSet &attr = locality.at(i); if (attr.is_specific_readonly_replica() || attr.is_allserver_readonly_replica()) { ret = OB_NOT_SUPPORTED; LOG_WARN("locality with readonly replica is not supported", K(ret), K(locality)); @@ -1027,7 +1028,7 @@ int ObRestoreScheduler::check_locality_valid(const share::schema::ZoneLocalityIA } int ObRestoreScheduler::check_locality_match( - const PhysicalRestorePartition& partition, const ObPhysicalRestoreStat& stat, bool& locality_match) + const PhysicalRestorePartition &partition, const ObPhysicalRestoreStat &stat, bool &locality_match) { int ret = OB_SUCCESS; locality_match = false; @@ -1064,7 +1065,7 @@ int ObRestoreScheduler::check_locality_match( LOG_WARN("fail to get tenant schema guard", K(ret), K(tenant_id)); } else if (is_new_tablegroup_id(partition.schema_id_)) { // PG - const ObTablegroupSchema* tablegroup_schema = NULL; + const ObTablegroupSchema *tablegroup_schema = NULL; if (OB_FAIL(schema_guard.get_tablegroup_schema(partition.schema_id_, tablegroup_schema))) { LOG_WARN("fail to get tablegroup schema", K(ret), K(partition)); } else if (OB_ISNULL(tablegroup_schema)) { @@ -1077,7 +1078,7 @@ int ObRestoreScheduler::check_locality_match( } } else { // standalone partition - const ObSimpleTableSchemaV2* table_schema = NULL; + const ObSimpleTableSchemaV2 *table_schema = NULL; if (OB_FAIL(schema_guard.get_table_schema(partition.schema_id_, table_schema))) { LOG_WARN("fail to get table schema", K(ret), K(partition)); } else if (OB_ISNULL(table_schema)) { @@ -1105,8 +1106,8 @@ int ObRestoreScheduler::check_locality_match( return ret; } -int ObRestoreScheduler::add_member_list_pkey(const PhysicalRestorePartition& partition, - const ObPhysicalRestoreStat& stat, ObRecoveryHelper::ObMemberListPkeyList& partition_infos) +int ObRestoreScheduler::add_member_list_pkey(const PhysicalRestorePartition &partition, + const ObPhysicalRestoreStat &stat, ObRecoveryHelper::ObMemberListPkeyList &partition_infos) { int ret = OB_SUCCESS; if (!inited_) { @@ -1141,8 +1142,8 @@ int ObRestoreScheduler::add_member_list_pkey(const PhysicalRestorePartition& par return ret; } -int ObRestoreScheduler::add_member_list_pkey(const ObPartitionKey& pkey, - const ObPartitionReplica::MemberList& member_list, ObRecoveryHelper::ObMemberListPkeyList& partition_infos) +int ObRestoreScheduler::add_member_list_pkey(const ObPartitionKey &pkey, + const ObPartitionReplica::MemberList &member_list, ObRecoveryHelper::ObMemberListPkeyList &partition_infos) { int ret = OB_SUCCESS; int64_t member_cnt = member_list.count(); @@ -1181,7 +1182,7 @@ int ObRestoreScheduler::add_member_list_pkey(const ObPartitionKey& pkey, return ret; } -int ObRestoreScheduler::batch_set_member_list(const ObRecoveryHelper::ObMemberListPkeyList& partition_infos) +int ObRestoreScheduler::batch_set_member_list(const ObRecoveryHelper::ObMemberListPkeyList &partition_infos) { int ret = OB_SUCCESS; if (!inited_) { @@ -1198,10 +1199,10 @@ int ObRestoreScheduler::batch_set_member_list(const ObRecoveryHelper::ObMemberLi ObSetMemberListBatchProxy batch_rpc_proxy(*srv_rpc_proxy_, &obrpc::ObSrvRpcProxy::batch_set_member_list); int64_t rpc_count = 0; for (int64_t i = 0; i < partition_infos.ml_pk_array_.count() && OB_SUCC(ret); i++) { - const ObMemberList& member_list = partition_infos.ml_pk_array_.at(i).member_list_; + const ObMemberList &member_list = partition_infos.ml_pk_array_.at(i).member_list_; for (int64_t j = 0; j < partition_infos.ml_pk_array_.at(i).pkey_info_.count() && OB_SUCC(ret); j++) { int64_t index = partition_infos.ml_pk_array_.at(i).pkey_info_.at(j).pkey_index_; - const ObPartitionKey& key = partition_infos.pkey_array_.at(index); + const ObPartitionKey &key = partition_infos.pkey_array_.at(index); if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", K(ret)); } else if (OB_FAIL(arg.add_arg(key, member_list))) { @@ -1245,7 +1246,7 @@ int ObRestoreScheduler::batch_set_member_list(const ObRecoveryHelper::ObMemberLi } } for (int64_t i = 0; i < batch_rpc_proxy.get_results().count() && OB_SUCC(ret); i++) { - const ObCreatePartitionBatchRes* res = batch_rpc_proxy.get_results().at(i); + const ObCreatePartitionBatchRes *res = batch_rpc_proxy.get_results().at(i); if (OB_ISNULL(res)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get result is null", K(ret)); @@ -1267,7 +1268,7 @@ int ObRestoreScheduler::batch_set_member_list(const ObRecoveryHelper::ObMemberLi } int ObRestoreScheduler::send_batch_set_member_list_rpc( - ObSetMemberListBatchArg& arg, ObSetMemberListBatchProxy& batch_rpc_proxy) + ObSetMemberListBatchArg &arg, ObSetMemberListBatchProxy &batch_rpc_proxy) { int ret = OB_SUCCESS; ObAddr addr; @@ -1281,7 +1282,7 @@ int ObRestoreScheduler::send_batch_set_member_list_rpc( LOG_WARN("invalid arg", K(ret), K(arg)); } else { ObAddr server; - const ObMemberList& server_list = arg.args_.at(0).member_list_; + const ObMemberList &server_list = arg.args_.at(0).member_list_; const int64_t MAX_WAIT_TIMEOUT = 10 * 1000 * 1000; int64_t abs_timeout = ObTimeUtility::current_time() + MAX_WAIT_TIMEOUT; for (int64_t i = 0; i < server_list.get_member_number() && OB_SUCC(ret); i++) { @@ -1310,7 +1311,7 @@ int ObRestoreScheduler::send_batch_set_member_list_rpc( } int ObRestoreScheduler::build_member_list_map( - const uint64_t tenant_id, common::hash::ObHashMap& member_list_map) + const uint64_t tenant_id, common::hash::ObHashMap &member_list_map) { int ret = OB_SUCCESS; if (!inited_) { @@ -1325,7 +1326,7 @@ int ObRestoreScheduler::build_member_list_map( ObSqlString sql; HEAP_VAR(ObMySQLProxy::MySQLResult, res) { - common::sqlclient::ObMySQLResult* result = NULL; + common::sqlclient::ObMySQLResult *result = NULL; if (OB_FAIL(sql.assign_fmt( "select * from %s where tenant_id = %ld", OB_ALL_PARTITION_MEMBER_LIST_TNAME, tenant_id))) { LOG_WARN("failed to assign sql", KR(ret), K(sql)); @@ -1379,7 +1380,7 @@ int ObRestoreScheduler::build_member_list_map( } int ObRestoreScheduler::batch_persist_member_list( - ObArray& persist_partitions, const ObPhysicalRestoreStat& stat) + ObArray &persist_partitions, const ObPhysicalRestoreStat &stat) { int ret = OB_SUCCESS; int64_t total_cnt = persist_partitions.count(); @@ -1398,7 +1399,7 @@ int ObRestoreScheduler::batch_persist_member_list( end = min(start + STEP, total_cnt - 1); ObDMLSqlSplicer dml; for (int64_t i = start; OB_SUCC(ret) && i <= end; i++) { - const PhysicalRestorePartition* partition = persist_partitions.at(i); + const PhysicalRestorePartition *partition = persist_partitions.at(i); if (OB_ISNULL(partition)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("partition is null", K(ret)); @@ -1429,15 +1430,15 @@ int ObRestoreScheduler::batch_persist_member_list( } int ObRestoreScheduler::fill_dml_splicer( - const PhysicalRestorePartition& partition, const ObPhysicalRestoreStat& stat, ObDMLSqlSplicer& dml) + const PhysicalRestorePartition &partition, const ObPhysicalRestoreStat &stat, ObDMLSqlSplicer &dml) { int ret = OB_SUCCESS; // fill member_list ObPartitionReplica::MemberList member_list; ObArenaAllocator allocator(ObModIds::OB_RS_PARTITION_TABLE_TEMP); const int64_t length = MAX_MEMBER_LIST_LENGTH; - char* member_list_str = NULL; - if (NULL == (member_list_str = static_cast(allocator.alloc(length)))) { + char *member_list_str = NULL; + if (NULL == (member_list_str = static_cast(allocator.alloc(length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("allocate memory failed", K(ret), K(length)); } else { @@ -1504,7 +1505,7 @@ int ObRestoreScheduler::clear_member_list_table(const uint64_t tenant_id) return ret; } -int ObRestoreScheduler::refresh_schema(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::refresh_schema(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -1519,7 +1520,7 @@ int ObRestoreScheduler::refresh_schema(const ObPhysicalRestoreJob& job_info) } else { const int64_t DEFAULT_TIMEOUT = 10 * 1000 * 1000L; // TODO:() should refator in ver 3.3.0 - ObSchemaStatusProxy* schema_status_proxy = GCTX.schema_status_proxy_; + ObSchemaStatusProxy *schema_status_proxy = GCTX.schema_status_proxy_; ObRefreshSchemaStatus schema_status(tenant_id, OB_INVALID_TIMESTAMP, OB_INVALID_VERSION, OB_INVALID_VERSION); ObArray tenant_ids; if (OB_ISNULL(schema_status_proxy)) { @@ -1543,7 +1544,7 @@ int ObRestoreScheduler::refresh_schema(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::check_gts(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::check_gts(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -1574,7 +1575,7 @@ int ObRestoreScheduler::check_gts(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::modify_schema(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::modify_schema(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -1665,11 +1666,11 @@ int ObRestoreScheduler::force_drop_schema(const uint64_t tenant_id) // 4. foreign key : foreign key which related child_table or related parent table is not in white list // 5. tablegroup : tablegroups except table's tablegroup in white list and tenant/database's default tablegroup // 6. recyclebin objects in tenant -int ObRestoreScheduler::filter_schema(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::filter_schema(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; - const ObSArray& table_items = job_info.white_list_.get_table_white_list(); + const ObSArray &table_items = job_info.white_list_.get_table_white_list(); if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -1703,9 +1704,9 @@ int ObRestoreScheduler::filter_schema(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob& job_info, - const ObIArray& table_items, common::hash::ObHashSet& table_white_list, - common::hash::ObHashSet& tablegroup_white_list) +int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob &job_info, + const ObIArray &table_items, common::hash::ObHashSet &table_white_list, + common::hash::ObHashSet &tablegroup_white_list) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; @@ -1722,9 +1723,9 @@ int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob& job_info, LOG_WARN("fail to get tenant schema guard", K(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_items.count(); i++) { - const obrpc::ObTableItem& item = table_items.at(i); - const ObDatabaseSchema* db = NULL; - const ObSimpleTableSchemaV2* tb = NULL; + const obrpc::ObTableItem &item = table_items.at(i); + const ObDatabaseSchema *db = NULL; + const ObSimpleTableSchemaV2 *tb = NULL; if (OB_FAIL(schema_guard.get_database_schema(tenant_id, item.database_name_, db))) { LOG_WARN("fail to get database schema", KR(ret), K(tenant_id)); } else if (OB_ISNULL(db)) { @@ -1751,12 +1752,12 @@ int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob& job_info, } // TODO:(yanmu.ztl) We can reset database/tenant's default tablegroup so we won't restore such tablegroup. if (OB_SUCC(ret)) { - ObArray databases; + ObArray databases; if (OB_FAIL(schema_guard.get_database_schemas_in_tenant(tenant_id, databases))) { LOG_WARN("fail to get databases", KR(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < databases.count(); i++) { - const ObDatabaseSchema* database = databases.at(i); + const ObDatabaseSchema *database = databases.at(i); if (OB_ISNULL(database)) { ret = OB_NOT_SUPPORTED; LOG_WARN("database is null", KR(ret)); @@ -1768,7 +1769,7 @@ int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob& job_info, } } } - const ObTenantSchema* tenant = NULL; + const ObTenantSchema *tenant = NULL; if (FAILEDx(schema_guard.get_tenant_info(tenant_id, tenant))) { LOG_WARN("fail to get tenant info", KR(ret), K(tenant_id)); } else if (OB_ISNULL(tenant)) { @@ -1835,11 +1836,11 @@ int ObRestoreScheduler::filter_recyclebin_objects(const uint64_t tenant_id) } int ObRestoreScheduler::filter_view_and_foreign_key( - const uint64_t tenant_id, const common::hash::ObHashSet& table_white_list) + const uint64_t tenant_id, const common::hash::ObHashSet &table_white_list) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - ObArray tables; + ObArray tables; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -1854,7 +1855,7 @@ int ObRestoreScheduler::filter_view_and_foreign_key( LOG_WARN("fail to get table schemas", KR(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < tables.count(); i++) { - const ObSimpleTableSchemaV2* table = tables.at(i); + const ObSimpleTableSchemaV2 *table = tables.at(i); if (OB_ISNULL(table)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table is null", KR(ret)); @@ -1877,7 +1878,7 @@ int ObRestoreScheduler::filter_view_and_foreign_key( } int ObRestoreScheduler::try_drop_table( - ObSchemaGetterGuard& schema_guard, const share::schema::ObSimpleTableSchemaV2& table) + ObSchemaGetterGuard &schema_guard, const share::schema::ObSimpleTableSchemaV2 &table) { int ret = OB_SUCCESS; if (!inited_) { @@ -1896,7 +1897,7 @@ int ObRestoreScheduler::try_drop_table( arg.exec_tenant_id_ = tenant_id; arg.to_recyclebin_ = false; arg.table_type_ = table.get_table_type(); - const ObSimpleDatabaseSchema* database = NULL; + const ObSimpleDatabaseSchema *database = NULL; if (OB_FAIL(schema_guard.get_database_schema(table.get_database_id(), database))) { LOG_WARN("fail to get database schema", KR(ret), K(table)); } else if (OB_ISNULL(database)) { @@ -1918,8 +1919,8 @@ int ObRestoreScheduler::try_drop_table( return ret; } -int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard& schema_guard, - const share::schema::ObSimpleTableSchemaV2& table, const common::hash::ObHashSet& table_white_list) +int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard &schema_guard, + const share::schema::ObSimpleTableSchemaV2 &table, const common::hash::ObHashSet &table_white_list) { int ret = OB_SUCCESS; if (!inited_) { @@ -1932,8 +1933,8 @@ int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard& schema_guard, LOG_WARN("restore scheduler stopped", K(ret)); } else { const uint64_t tenant_id = table.get_tenant_id(); - const ObTableSchema* full_table = NULL; - const ObSimpleDatabaseSchema* database = NULL; + const ObTableSchema *full_table = NULL; + const ObSimpleDatabaseSchema *database = NULL; if (OB_FAIL(schema_guard.get_database_schema(table.get_database_id(), database))) { LOG_WARN("fail to get database schema", KR(ret), K(table)); } else if (OB_ISNULL(database)) { @@ -1945,9 +1946,9 @@ int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard& schema_guard, ret = OB_TABLE_NOT_EXIST; LOG_WARN("full table should exist", KR(ret), K(table)); } else { - const ObIArray& foreign_keys = full_table->get_foreign_key_infos(); + const ObIArray &foreign_keys = full_table->get_foreign_key_infos(); for (int i = 0; OB_SUCC(ret) && i < foreign_keys.count(); i++) { - const ObForeignKeyInfo& foreign_key = foreign_keys.at(i); + const ObForeignKeyInfo &foreign_key = foreign_keys.at(i); const uint64_t child_table_id = foreign_key.child_table_id_; const uint64_t parent_table_id = foreign_key.parent_table_id_; int hash_ret_1 = table_white_list.exist_refactored(child_table_id); @@ -1969,9 +1970,9 @@ int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard& schema_guard, is_oracle_mode = (ObWorker::CompatMode::ORACLE == compat_mode); } ObSqlString sql; - const ObString& database_name = database->get_database_name(); - const ObString& table_name = full_table->get_table_name(); - const ObString& foreign_key_name = foreign_key.foreign_key_name_; + const ObString &database_name = database->get_database_name(); + const ObString &table_name = full_table->get_table_name(); + const ObString &foreign_key_name = foreign_key.foreign_key_name_; int64_t affected_rows = 0; if (FAILEDx(sql.append_fmt(is_oracle_mode ? "ALTER TABLE \"%.*s\".\"%.*s\" DROP CONSTRAINT \"%.*s\"" : "ALTER TABLE `%.*s`.`%.*s` DROP FOREIGN KEY `%.*s`", @@ -2000,11 +2001,11 @@ int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard& schema_guard, } int ObRestoreScheduler::filter_table( - const uint64_t tenant_id, const common::hash::ObHashSet& table_white_list) + const uint64_t tenant_id, const common::hash::ObHashSet &table_white_list) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - ObArray tables; + ObArray tables; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -2019,7 +2020,7 @@ int ObRestoreScheduler::filter_table( LOG_WARN("fail to get table schemas", KR(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < tables.count(); i++) { - const ObSimpleTableSchemaV2* table = tables.at(i); + const ObSimpleTableSchemaV2 *table = tables.at(i); if (OB_ISNULL(table)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table is null", KR(ret)); @@ -2045,11 +2046,11 @@ int ObRestoreScheduler::filter_table( } int ObRestoreScheduler::filter_tablegroup( - const uint64_t tenant_id, const common::hash::ObHashSet& tablegroup_white_list) + const uint64_t tenant_id, const common::hash::ObHashSet &tablegroup_white_list) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - ObArray tablegroups; + ObArray tablegroups; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -2064,7 +2065,7 @@ int ObRestoreScheduler::filter_tablegroup( LOG_WARN("fail to get tablegroups", KR(ret), K(tenant_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < tablegroups.count(); i++) { - const ObSimpleTablegroupSchema* tablegroup = tablegroups.at(i); + const ObSimpleTablegroupSchema *tablegroup = tablegroups.at(i); if (OB_ISNULL(tablegroup)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablegroup is null", KR(ret), K(tenant_id)); @@ -2089,7 +2090,7 @@ int ObRestoreScheduler::filter_tablegroup( return ret; } -int ObRestoreScheduler::try_drop_tablegroup(const share::schema::ObSimpleTablegroupSchema& tablegroup) +int ObRestoreScheduler::try_drop_tablegroup(const share::schema::ObSimpleTablegroupSchema &tablegroup) { int ret = OB_SUCCESS; if (!inited_) { @@ -2141,7 +2142,7 @@ int ObRestoreScheduler::convert_database_options(const uint64_t tenant_id) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - ObArray databases; + ObArray databases; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -2160,7 +2161,7 @@ int ObRestoreScheduler::convert_database_options(const uint64_t tenant_id) arg.exec_tenant_id_ = tenant_id; arg.type_ = ObRestoreModifySchemaArg::RESET_DATABASE_PRIMARY_ZONE; for (int64_t i = 0; OB_SUCC(ret) && i < databases.count(); i++) { - const ObDatabaseSchema*& database = databases.at(i); + const ObDatabaseSchema *&database = databases.at(i); if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", K(ret)); } else if (OB_ISNULL(database)) { @@ -2196,8 +2197,8 @@ int ObRestoreScheduler::convert_tablegroup_options(const uint64_t tenant_id) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - const ObTenantSchema* tenant_schema = NULL; - ObArray tablegroups; + const ObTenantSchema *tenant_schema = NULL; + ObArray tablegroups; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -2218,7 +2219,7 @@ int ObRestoreScheduler::convert_tablegroup_options(const uint64_t tenant_id) } else { const int64_t DEFAULT_TIMEOUT = 10 * 1000 * 1000L; for (int64_t i = 0; OB_SUCC(ret) && i < tablegroups.count(); i++) { - const ObTablegroupSchema*& tablegroup = tablegroups.at(i); + const ObTablegroupSchema *&tablegroup = tablegroups.at(i); if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", K(ret)); } else if (OB_ISNULL(tablegroup)) { @@ -2256,7 +2257,7 @@ int ObRestoreScheduler::convert_tablegroup_options(const uint64_t tenant_id) } else if (!tablegroup->get_locality_str().empty()) { int tmp_ret = OB_SUCCESS; ObArray locality; - const ObString& locality_str = tablegroup->get_locality_str(); + const ObString &locality_str = tablegroup->get_locality_str(); if (OB_SUCCESS != (tmp_ret = ddl_service_->check_tablegroup_locality_with_tenant( schema_guard, *tenant_schema, *tablegroup))) { LOG_WARN("locality not match", K(tmp_ret), K(tablegroup_id), K(locality_str)); @@ -2296,8 +2297,8 @@ int ObRestoreScheduler::convert_table_options(const uint64_t tenant_id) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; - const ObTenantSchema* tenant_schema = NULL; - ObArray tables; + const ObTenantSchema *tenant_schema = NULL; + ObArray tables; if (!inited_) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); @@ -2318,7 +2319,7 @@ int ObRestoreScheduler::convert_table_options(const uint64_t tenant_id) } else { const int64_t DEFAULT_TIMEOUT = 10 * 1000 * 1000L; for (int64_t i = 0; OB_SUCC(ret) && i < tables.count(); i++) { - const ObSimpleTableSchemaV2*& table = tables.at(i); + const ObSimpleTableSchemaV2 *&table = tables.at(i); if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", K(ret)); } else if (OB_ISNULL(table)) { @@ -2335,7 +2336,7 @@ int ObRestoreScheduler::convert_table_options(const uint64_t tenant_id) } else if (!table->get_primary_zone().empty()) { int tmp_ret = OB_SUCCESS; ObArray locality; - const ObString& locality_str = table->get_locality_str(); + const ObString &locality_str = table->get_locality_str(); ObSimpleTableSchemaV2 new_table; if (OB_FAIL(new_table.assign(*table))) { LOG_WARN("fail to assign new table", K(ret), KPC(table)); @@ -2402,7 +2403,7 @@ int ObRestoreScheduler::convert_table_options(const uint64_t tenant_id) * index_status should be reset to unavaliable, and index should be rebuilded later. * Since we have dropped delay-deleted schemas before, we don't consider delay-deleted indexes here. */ -int ObRestoreScheduler::convert_index_status(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::convert_index_status(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObSchemaGetterGuard base_guard; // schema_guard with schema_version using by data backup @@ -2425,12 +2426,12 @@ int ObRestoreScheduler::convert_index_status(const ObPhysicalRestoreJob& job_inf } else if (OB_FAIL(schema_service_->get_tenant_schema_guard(tenant_id, schema_guard))) { LOG_WARN("fail to get tenant schema guard", KR(ret), K(tenant_id)); } else { - ObArray table_schemas; + ObArray table_schemas; if (OB_FAIL(schema_guard.get_table_schemas_in_tenant(tenant_id, table_schemas))) { LOG_WARN("fail to get table schemas in tenant", KR(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < table_schemas.count(); ++i) { - const ObSimpleTableSchemaV2* table_schema = table_schemas.at(i); + const ObSimpleTableSchemaV2 *table_schema = table_schemas.at(i); if (OB_ISNULL(table_schema)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("error unexpected, table schema is NULL", KR(ret)); @@ -2444,7 +2445,7 @@ int ObRestoreScheduler::convert_index_status(const ObPhysicalRestoreJob& job_inf } else if (INDEX_STATUS_INDEX_ERROR == index_status || INDEX_STATUS_UNUSABLE == index_status) { // case 2, just skip } else if (INDEX_STATUS_AVAILABLE == index_status) { - const ObSimpleTableSchemaV2* index_schema = NULL; + const ObSimpleTableSchemaV2 *index_schema = NULL; if (OB_FAIL(base_guard.get_table_schema(index_id, index_schema))) { LOG_WARN("fail to get index schema", KR(ret), K(index_id)); } else if (OB_ISNULL(index_schema)) { @@ -2473,7 +2474,7 @@ int ObRestoreScheduler::convert_index_status(const ObPhysicalRestoreJob& job_inf return ret; } -int ObRestoreScheduler::update_index_status(const common::ObIArray& index_ids, ObIndexStatus index_status) +int ObRestoreScheduler::update_index_status(const common::ObIArray &index_ids, ObIndexStatus index_status) { int ret = OB_SUCCESS; if (!inited_) { @@ -2505,7 +2506,7 @@ int ObRestoreScheduler::update_index_status(const common::ObIArray& in return ret; } -int ObRestoreScheduler::convert_parameters(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::convert_parameters(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -2540,7 +2541,7 @@ int ObRestoreScheduler::convert_parameters(const ObPhysicalRestoreJob& job_info) * is still limited by broadcasted schema version, it may cause deadlock when cluster is restoring. * To avoid this, we should broadcast new schema version before restore of user tables. */ -int ObRestoreScheduler::log_nop_operation(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::log_nop_operation(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -2572,7 +2573,7 @@ int ObRestoreScheduler::log_nop_operation(const ObPhysicalRestoreJob& job_info) } // not reentrant -int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -2580,8 +2581,8 @@ int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob& job_i ObSchemaGetterGuard base_guard; int64_t local_schema_version = OB_INVALID_VERSION; ObMultiVersionSchemaService::RefreshSchemaMode mode = ObMultiVersionSchemaService::FORCE_FALLBACK; - ObArray tables; - ObArray tablegroups; + ObArray tables; + ObArray tablegroups; DEBUG_SYNC(BEFORE_PHYSICAL_RESTORE_USER_PARTITIONS); if (!inited_) { ret = OB_NOT_INIT; @@ -2615,8 +2616,8 @@ int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob& job_i const int64_t TIMEOUT_PER_RPC = GCONF.rpc_timeout; // 2s const int64_t PARTITION_CNT_PER_RPC = 5; for (int64_t i = 0; i < tablegroups.count() && OB_SUCC(ret); ++i) { - const ObTablegroupSchema* tablegroup = tablegroups.at(i); - const ObTablegroupSchema* base_tablegroup = NULL; + const ObTablegroupSchema *tablegroup = tablegroups.at(i); + const ObTablegroupSchema *base_tablegroup = NULL; uint64_t tablegroup_id = OB_INVALID_ID; ObRestorePartitionsArg arg; if (OB_FAIL(check_stop())) { @@ -2642,8 +2643,8 @@ int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob& job_i } } for (int64_t i = 0; i < tables.count() && OB_SUCC(ret); ++i) { - const ObSimpleTableSchemaV2* table = tables.at(i); - const ObSimpleTableSchemaV2* base_table = NULL; + const ObSimpleTableSchemaV2 *table = tables.at(i); + const ObSimpleTableSchemaV2 *base_table = NULL; uint64_t table_id = OB_INVALID_ID; ObRestorePartitionsArg arg; if (OB_FAIL(check_stop())) { @@ -2681,7 +2682,7 @@ int ObRestoreScheduler::create_user_partitions(const ObPhysicalRestoreJob& job_i } int ObRestoreScheduler::fill_restore_partition_arg( - const uint64_t schema_id, const ObPartitionSchema* schema, obrpc::ObRestorePartitionsArg& arg) + const uint64_t schema_id, const ObPartitionSchema *schema, obrpc::ObRestorePartitionsArg &arg) { int ret = OB_SUCCESS; arg.schema_id_ = schema_id; @@ -2692,7 +2693,7 @@ int ObRestoreScheduler::fill_restore_partition_arg( skip = true; } else if (!is_new_tablegroup_id(arg.schema_id_)) { // unavaliable index for data restore - const ObTableSchema* table = static_cast(schema); + const ObTableSchema *table = static_cast(schema); if (table->has_self_partition() && table->is_global_index_table() && (table->is_dropped_schema() || INDEX_STATUS_AVAILABLE != table->get_index_status())) { skip = true; @@ -2718,7 +2719,7 @@ int ObRestoreScheduler::fill_restore_partition_arg( return ret; } -int ObRestoreScheduler::restore_user_replica(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::restore_user_replica(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; if (!inited_) { @@ -2750,13 +2751,13 @@ int ObRestoreScheduler::restore_user_replica(const ObPhysicalRestoreJob& job_inf return ret; } -int ObRestoreScheduler::rebuild_index(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::rebuild_index(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; uint64_t tenant_id = job_info.tenant_id_; bool exist = true; - const ObTenantSchema* tenant_schema = NULL; + const ObTenantSchema *tenant_schema = NULL; DEBUG_SYNC(BEFORE_PHYSICAL_RESTORE_REBUILD_INDEX); if (!inited_) { ret = OB_NOT_INIT; @@ -2808,13 +2809,13 @@ int ObRestoreScheduler::rebuild_index(const ObPhysicalRestoreJob& job_info) } // TODO:() restore job should fail when rebuild index failed -int ObRestoreScheduler::post_check(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::post_check(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; uint64_t tenant_id = job_info.tenant_id_; bool exist = true; - const ObTenantSchema* tenant_schema = NULL; + const ObTenantSchema *tenant_schema = NULL; DEBUG_SYNC(BEFORE_PHYSICAL_RESTORE_POST_CHECK); if (!inited_) { ret = OB_NOT_INIT; @@ -2863,7 +2864,7 @@ int ObRestoreScheduler::post_check(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::restore_success(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::restore_success(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObPhysicalRestoreTableOperator restore_op; @@ -2893,7 +2894,7 @@ int ObRestoreScheduler::restore_success(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::restore_fail(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::restore_fail(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; ObPhysicalRestoreTableOperator restore_op; @@ -2930,7 +2931,7 @@ int ObRestoreScheduler::check_stop() const * 2. Physical restore jobs will be recycled asynchronously when restore tenant has been dropped. * 3. Physical restore jobs will be used to avoid duplicate tenant_name when tenant is creating. */ -int ObRestoreScheduler::try_recycle_job(const ObPhysicalRestoreJob& job) +int ObRestoreScheduler::try_recycle_job(const ObPhysicalRestoreJob &job) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; @@ -2975,7 +2976,7 @@ int ObRestoreScheduler::try_recycle_job(const ObPhysicalRestoreJob& job) } int ObRestoreScheduler::mark_job_failed(int64_t job_id, int return_ret, PhysicalRestoreMod mod, - const common::ObCurTraceId::TraceId& trace_id, const common::ObAddr& addr) + const common::ObCurTraceId::TraceId &trace_id, const common::ObAddr &addr) { int ret = OB_SUCCESS; ObPhysicalRestoreTableOperator restore_op; @@ -3007,7 +3008,7 @@ int ObRestoreScheduler::mark_job_failed(int64_t job_id, int return_ret, Physical } int ObRestoreScheduler::try_update_job_status( - int return_ret, const ObPhysicalRestoreJob& job, share::PhysicalRestoreMod mod) + int return_ret, const ObPhysicalRestoreJob &job, share::PhysicalRestoreMod mod) { int ret = OB_SUCCESS; ObPhysicalRestoreTableOperator restore_op; @@ -3036,9 +3037,9 @@ int ObRestoreScheduler::try_update_job_status( return ret; } -void ObRestoreScheduler::record_rs_event(const ObPhysicalRestoreJob& job, const PhysicalRestoreStatus status) +void ObRestoreScheduler::record_rs_event(const ObPhysicalRestoreJob &job, const PhysicalRestoreStatus status) { - const char* status_str = + const char *status_str = ObPhysicalRestoreTableOperator::get_restore_status_str(static_cast(status)); ROOTSERVICE_EVENT_ADD("physical_restore", "change_restore_status", @@ -3118,7 +3119,7 @@ int ObRestoreScheduler::check_source_cluster_version(const uint64_t cluster_vers * 2. run upgrade_pre() by version. * 3. refresh tenant's schema. */ -int ObRestoreScheduler::upgrade_pre(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::upgrade_pre(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -3151,7 +3152,7 @@ int ObRestoreScheduler::upgrade_pre(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::upgrade_post(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::upgrade_post(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -3176,7 +3177,7 @@ int ObRestoreScheduler::upgrade_post(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::do_upgrade_pre(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::do_upgrade_pre(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -3207,7 +3208,7 @@ int ObRestoreScheduler::do_upgrade_pre(const ObPhysicalRestoreJob& job_info) LOG_WARN("fail to get processor idx by range", KR(ret), K(start_version), K(end_version)); } for (int64_t idx = start_idx + 1; OB_SUCC(ret) && idx <= end_idx; idx++) { - ObBaseUpgradeProcessor* processor = NULL; + ObBaseUpgradeProcessor *processor = NULL; if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", KR(ret)); } else if (OB_FAIL(upgrade_processors_.get_processor_by_idx(idx, processor))) { @@ -3245,7 +3246,7 @@ int ObRestoreScheduler::do_upgrade_pre(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::do_upgrade_post(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::do_upgrade_post(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; uint64_t tenant_id = job_info.tenant_id_; @@ -3276,7 +3277,7 @@ int ObRestoreScheduler::do_upgrade_post(const ObPhysicalRestoreJob& job_info) LOG_WARN("fail to get processor idx by range", KR(ret), K(start_version), K(end_version)); } for (int64_t idx = start_idx + 1; OB_SUCC(ret) && idx <= end_idx; idx++) { - ObBaseUpgradeProcessor* processor = NULL; + ObBaseUpgradeProcessor *processor = NULL; if (OB_FAIL(check_stop())) { LOG_WARN("restore scheduler stopped", KR(ret)); } else if (OB_FAIL(upgrade_processors_.get_processor_by_idx(idx, processor))) { @@ -3314,7 +3315,7 @@ int ObRestoreScheduler::do_upgrade_post(const ObPhysicalRestoreJob& job_info) return ret; } -int ObRestoreScheduler::drop_tenant_force_if_necessary(const ObPhysicalRestoreJob& job_info) +int ObRestoreScheduler::drop_tenant_force_if_necessary(const ObPhysicalRestoreJob &job_info) { int ret = OB_SUCCESS; const bool need_force_drop = GCONF._auto_drop_tenant_if_restore_failed; @@ -3326,7 +3327,7 @@ int ObRestoreScheduler::drop_tenant_force_if_necessary(const ObPhysicalRestoreJo } else if (need_force_drop) { ObSchemaGetterGuard schema_guard; ObString tenant_name(job_info.tenant_name_); - const ObTenantSchema* tenant_schema = NULL; + const ObTenantSchema *tenant_schema = NULL; if (OB_FAIL(schema_service_->get_tenant_schema_guard(OB_SYS_TENANT_ID, schema_guard))) { LOG_WARN("fail to get tenant schema guard", KR(ret)); } else if (OB_FAIL(schema_guard.get_tenant_info(tenant_name, tenant_schema))) { diff --git a/src/share/backup/ob_backup_backuppiece_operator.cpp b/src/share/backup/ob_backup_backuppiece_operator.cpp index acd169c272dc0fa3bf525cc8e60da551a79ba85e..992e6325d2cf2cf3ecae0433fd1ad219e4d248f5 100644 --- a/src/share/backup/ob_backup_backuppiece_operator.cpp +++ b/src/share/backup/ob_backup_backuppiece_operator.cpp @@ -12,13 +12,14 @@ #define USING_LOG_PREFIX SHARE #include "share/backup/ob_backup_backuppiece_operator.h" +#include "share/inner_table/ob_inner_table_schema_constants.h" using namespace oceanbase::share; namespace oceanbase { namespace share { -int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobInfo& item, ObDMLSqlSplicer& splicer) +int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobInfo &item, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = ""; @@ -43,7 +44,7 @@ int ObIBackupBackupPieceJobOperator::fill_one_item(const ObBackupBackupPieceJobI } int ObIBackupBackupPieceJobOperator::extract_one_item( - sqlclient::ObMySQLResult* result, ObBackupBackupPieceJobInfo& item) + sqlclient::ObMySQLResult *result, ObBackupBackupPieceJobInfo &item) { int ret = OB_SUCCESS; int64_t tmp_real_str_len = 0; @@ -77,13 +78,13 @@ int ObIBackupBackupPieceJobOperator::extract_one_item( return ret; } -int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString& sql, common::ObISQLClient& proxy, - common::ObIArray& item_list) +int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy, + common::ObIArray &item_list) { int ret = OB_SUCCESS; SMART_VAR(ObMySQLProxy::MySQLResult, res) { - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; if (OB_UNLIKELY(!sql.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", KR(ret), K(sql)); @@ -113,7 +114,7 @@ int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString& sq return ret; } -int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy) +int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -138,7 +139,7 @@ int ObBackupBackupPieceJobOperator::insert_job_item(const ObBackupBackupPieceJob } int ObBackupBackupPieceJobOperator::get_all_job_items( - common::ObISQLClient& proxy, common::ObIArray& items) + common::ObISQLClient &proxy, common::ObIArray &items) { int ret = OB_SUCCESS; items.reset(); @@ -152,7 +153,7 @@ int ObBackupBackupPieceJobOperator::get_all_job_items( } int ObBackupBackupPieceJobOperator::get_one_job( - common::ObISQLClient& proxy, common::ObIArray& items) + common::ObISQLClient &proxy, common::ObIArray &items) { int ret = OB_SUCCESS; items.reset(); @@ -166,7 +167,7 @@ int ObBackupBackupPieceJobOperator::get_one_job( } int ObBackupBackupPieceJobOperator::get_job_item( - const int64_t job_id, common::ObISQLClient& proxy, ObBackupBackupPieceJobInfo& item) + const int64_t job_id, common::ObISQLClient &proxy, ObBackupBackupPieceJobInfo &item) { int ret = OB_SUCCESS; item.reset(); @@ -193,7 +194,7 @@ int ObBackupBackupPieceJobOperator::get_job_item( return ret; } -int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy) +int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -224,7 +225,7 @@ int ObBackupBackupPieceJobOperator::report_job_item(const ObBackupBackupPieceJob return ret; } -int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy) +int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -242,7 +243,7 @@ int ObBackupBackupPieceJobOperator::remove_job_item(const int64_t job_id, common } int ObBackupBackupPieceJobHistoryOperator::insert_job_item( - const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -267,7 +268,7 @@ int ObBackupBackupPieceJobHistoryOperator::insert_job_item( } int ObBackupBackupPieceJobHistoryOperator::get_job_item( - const int64_t job_id, common::ObISQLClient& proxy, ObBackupBackupPieceJobInfo& item) + const int64_t job_id, common::ObISQLClient &proxy, ObBackupBackupPieceJobInfo &item) { int ret = OB_SUCCESS; item.reset(); @@ -295,7 +296,7 @@ int ObBackupBackupPieceJobHistoryOperator::get_job_item( } int ObBackupBackupPieceJobHistoryOperator::report_job_item( - const ObBackupBackupPieceJobInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceJobInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -323,7 +324,7 @@ int ObBackupBackupPieceJobHistoryOperator::report_job_item( return ret; } -int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy) +int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -340,7 +341,7 @@ int ObBackupBackupPieceJobHistoryOperator::remove_job_item(const int64_t job_id, return ret; } -int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTaskInfo& item, ObDMLSqlSplicer& splicer) +int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTaskInfo &item, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = ""; @@ -367,7 +368,7 @@ int ObIBackupBackupPieceTaskOperator::fill_one_item(const ObBackupBackupPieceTas } int ObIBackupBackupPieceTaskOperator::extract_one_item( - sqlclient::ObMySQLResult* result, ObBackupBackupPieceTaskInfo& item) + sqlclient::ObMySQLResult *result, ObBackupBackupPieceTaskInfo &item) { int ret = OB_SUCCESS; int64_t tmp_real_str_len = 0; @@ -405,13 +406,13 @@ int ObIBackupBackupPieceTaskOperator::extract_one_item( return ret; } -int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString& sql, common::ObISQLClient& proxy, - common::ObIArray& item_list) +int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy, + common::ObIArray &item_list) { int ret = OB_SUCCESS; SMART_VAR(ObMySQLProxy::MySQLResult, res) { - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; if (OB_UNLIKELY(!sql.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", KR(ret), K(sql)); @@ -442,13 +443,13 @@ int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString& s } int ObBackupBackupPieceTaskOperator::get_job_task_count( - const ObBackupBackupPieceJobInfo& job_info, common::ObISQLClient& sql_proxy, int64_t& task_count) + const ObBackupBackupPieceJobInfo &job_info, common::ObISQLClient &sql_proxy, int64_t &task_count) { int ret = OB_SUCCESS; const int64_t job_id = job_info.job_id_; task_count = 0; ObSqlString sql; - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; SMART_VAR(ObMySQLProxy::ReadResult, res) { if (OB_FAIL(sql.assign_fmt( @@ -472,7 +473,7 @@ int ObBackupBackupPieceTaskOperator::get_job_task_count( } int ObBackupBackupPieceTaskOperator::insert_task_item( - const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -497,7 +498,7 @@ int ObBackupBackupPieceTaskOperator::insert_task_item( } int ObBackupBackupPieceTaskOperator::get_all_task_items( - const int64_t job_id, common::ObISQLClient& proxy, ObIArray& items) + const int64_t job_id, common::ObISQLClient &proxy, ObIArray &items) { int ret = OB_SUCCESS; items.reset(); @@ -511,7 +512,7 @@ int ObBackupBackupPieceTaskOperator::get_all_task_items( } int ObBackupBackupPieceTaskOperator::get_doing_task_items(const int64_t job_id, const uint64_t tenant_id, - common::ObISQLClient& proxy, common::ObIArray& items) + common::ObISQLClient &proxy, common::ObIArray &items) { int ret = OB_SUCCESS; items.reset(); @@ -531,7 +532,7 @@ int ObBackupBackupPieceTaskOperator::get_doing_task_items(const int64_t job_id, } int ObBackupBackupPieceTaskOperator::get_task_item(const int64_t job_id, const int64_t tenant_id, - const int64_t piece_id, common::ObISQLClient& proxy, ObBackupBackupPieceTaskInfo& item) + const int64_t piece_id, common::ObISQLClient &proxy, ObBackupBackupPieceTaskInfo &item) { int ret = OB_SUCCESS; ObArray item_list; @@ -560,7 +561,7 @@ int ObBackupBackupPieceTaskOperator::get_task_item(const int64_t job_id, const i } int ObBackupBackupPieceTaskOperator::get_smallest_doing_task( - const int64_t job_id, const uint64_t tenant_id, common::ObISQLClient& proxy, ObBackupBackupPieceTaskInfo& item) + const int64_t job_id, const uint64_t tenant_id, common::ObISQLClient &proxy, ObBackupBackupPieceTaskInfo &item) { int ret = OB_SUCCESS; ObArray item_list; @@ -589,7 +590,7 @@ int ObBackupBackupPieceTaskOperator::get_smallest_doing_task( } int ObBackupBackupPieceTaskOperator::update_task_finish( - const uint64_t tenant_id, const int64_t job_id, const int64_t piece_id, common::ObISQLClient& proxy) + const uint64_t tenant_id, const int64_t job_id, const int64_t piece_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -615,7 +616,7 @@ int ObBackupBackupPieceTaskOperator::update_task_finish( } int ObBackupBackupPieceTaskOperator::report_task_item( - const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -646,7 +647,7 @@ int ObBackupBackupPieceTaskOperator::report_task_item( return ret; } -int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, common::ObISQLClient& proxy) +int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -664,7 +665,7 @@ int ObBackupBackupPieceTaskOperator::remove_task_items(const int64_t job_id, com } int ObBackupBackupPieceTaskHistoryOperator::insert_task_item( - const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -689,7 +690,7 @@ int ObBackupBackupPieceTaskHistoryOperator::insert_task_item( } int ObBackupBackupPieceTaskHistoryOperator::get_task_items( - const int64_t job_id, common::ObISQLClient& proxy, common::ObIArray& items) + const int64_t job_id, common::ObISQLClient &proxy, common::ObIArray &items) { int ret = OB_SUCCESS; items.reset(); @@ -707,7 +708,7 @@ int ObBackupBackupPieceTaskHistoryOperator::get_task_items( } int ObBackupBackupPieceTaskHistoryOperator::report_task_item( - const ObBackupBackupPieceTaskInfo& item, common::ObISQLClient& proxy) + const ObBackupBackupPieceTaskInfo &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -736,7 +737,7 @@ int ObBackupBackupPieceTaskHistoryOperator::report_task_item( } int ObBackupBackupPieceTaskHistoryOperator::report_task_items( - const common::ObIArray& items, common::ObISQLClient& proxy) + const common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -751,7 +752,7 @@ int ObBackupBackupPieceTaskHistoryOperator::report_task_items( const int64_t remain_cnt = items.count() - report_idx; int64_t cur_batch_cnt = remain_cnt < BATCH_CNT ? remain_cnt : BATCH_CNT; for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) { - const ObBackupBackupPieceTaskInfo& item = items.at(report_idx + i); + const ObBackupBackupPieceTaskInfo &item = items.at(report_idx + i); splicer.reuse(); if (OB_FAIL(ObIBackupBackupPieceTaskOperator::fill_one_item(item, splicer))) { LOG_WARN("failed to fill one item", KR(ret), K(item)); diff --git a/src/share/backup/ob_backup_backupset_operator.cpp b/src/share/backup/ob_backup_backupset_operator.cpp index 93409c6d3d85c32cdadada72344eb182fe1b0568..3f210b72c63db1b790da3014f778cf78393c6451 100644 --- a/src/share/backup/ob_backup_backupset_operator.cpp +++ b/src/share/backup/ob_backup_backupset_operator.cpp @@ -12,8 +12,9 @@ #define USING_LOG_PREFIX SHARE #include "share/backup/ob_backup_backupset_operator.h" -#include "lib/mysqlclient/ob_mysql_transaction.h" #include "share/backup/ob_backup_operator.h" +#include "share/inner_table/ob_inner_table_schema_constants.h" +#include "lib/mysqlclient/ob_mysql_transaction.h" using namespace oceanbase::share; @@ -22,7 +23,7 @@ namespace share { /* ObIBackupBackupsetOperator */ -int ObIBackupBackupsetOperator::fill_one_item(const ObBackupBackupsetJobItem& item, ObDMLSqlSplicer& splicer) +int ObIBackupBackupsetOperator::fill_one_item(const ObBackupBackupsetJobItem &item, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = ""; @@ -50,12 +51,12 @@ int ObIBackupBackupsetOperator::fill_one_item(const ObBackupBackupsetJobItem& it } int ObIBackupBackupsetOperator::get_task_items( - const common::ObSqlString& sql, common::ObIArray& item_list, common::ObISQLClient& proxy) + const common::ObSqlString &sql, common::ObIArray &item_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; SMART_VAR(ObMySQLProxy::MySQLResult, res) { - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; if (OB_UNLIKELY(!sql.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", KR(ret), K(sql)); @@ -85,7 +86,7 @@ int ObIBackupBackupsetOperator::get_task_items( return ret; } -int ObIBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult* result, ObBackupBackupsetJobItem& item) +int ObIBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult *result, ObBackupBackupsetJobItem &item) { int ret = OB_SUCCESS; int64_t tmp_real_str_len = 0; @@ -136,7 +137,7 @@ int ObIBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult* resu } /* ObBackupBackupsetOperator */ -int ObBackupBackupsetOperator::insert_job_item(const ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) +int ObBackupBackupsetOperator::insert_job_item(const ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -160,7 +161,7 @@ int ObBackupBackupsetOperator::insert_job_item(const ObBackupBackupsetJobItem& i return ret; } -int ObBackupBackupsetOperator::report_job_item(const ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) +int ObBackupBackupsetOperator::report_job_item(const ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -191,7 +192,7 @@ int ObBackupBackupsetOperator::report_job_item(const ObBackupBackupsetJobItem& i return ret; } -int ObBackupBackupsetOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy) +int ObBackupBackupsetOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -206,7 +207,7 @@ int ObBackupBackupsetOperator::remove_job_item(const int64_t job_id, common::ObI } int ObBackupBackupsetOperator::get_task_item( - const int64_t job_id, ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) + const int64_t job_id, ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -234,7 +235,7 @@ int ObBackupBackupsetOperator::get_task_item( } int ObBackupBackupsetOperator::get_all_task_items( - common::ObIArray& item_list, common::ObISQLClient& proxy) + common::ObIArray &item_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -252,7 +253,7 @@ int ObBackupBackupsetOperator::get_all_task_items( } int ObBackupBackupsetOperator::get_one_task( - common::ObIArray& item_list, common::ObISQLClient& proxy) + common::ObIArray &item_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -271,7 +272,7 @@ int ObBackupBackupsetOperator::get_one_task( /* ObBackupBackupsetHistoryOperator */ -int ObBackupBackupsetHistoryOperator::insert_job_item(const ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) +int ObBackupBackupsetHistoryOperator::insert_job_item(const ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -295,7 +296,7 @@ int ObBackupBackupsetHistoryOperator::insert_job_item(const ObBackupBackupsetJob return ret; } -int ObBackupBackupsetHistoryOperator::report_job_item(const ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) +int ObBackupBackupsetHistoryOperator::report_job_item(const ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -326,7 +327,7 @@ int ObBackupBackupsetHistoryOperator::report_job_item(const ObBackupBackupsetJob return ret; } -int ObBackupBackupsetHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient& proxy) +int ObBackupBackupsetHistoryOperator::remove_job_item(const int64_t job_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -341,7 +342,7 @@ int ObBackupBackupsetHistoryOperator::remove_job_item(const int64_t job_id, comm } int ObBackupBackupsetHistoryOperator::get_task_item( - const int64_t job_id, ObBackupBackupsetJobItem& item, common::ObISQLClient& proxy) + const int64_t job_id, ObBackupBackupsetJobItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -370,7 +371,7 @@ int ObBackupBackupsetHistoryOperator::get_task_item( } int ObBackupBackupsetHistoryOperator::get_all_task_items( - common::ObIArray& item_list, common::ObISQLClient& proxy) + common::ObIArray &item_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -390,7 +391,7 @@ int ObBackupBackupsetHistoryOperator::get_all_task_items( /* ObITenantBackupBackupsetOperator */ int ObITenantBackupBackupsetOperator::fill_one_item( - const ObTenantBackupBackupsetTaskItem& item, ObDMLSqlSplicer& splicer) + const ObTenantBackupBackupsetTaskItem &item, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char src_backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = ""; @@ -449,7 +450,7 @@ int ObITenantBackupBackupsetOperator::fill_one_item( } int ObITenantBackupBackupsetOperator::fill_one_item( - const ObTenantBackupBackupsetTaskItem& item, const bool need_fill_is_mark_deleted, ObDMLSqlSplicer& splicer) + const ObTenantBackupBackupsetTaskItem &item, const bool need_fill_is_mark_deleted, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; if (!item.is_valid()) { @@ -463,15 +464,15 @@ int ObITenantBackupBackupsetOperator::fill_one_item( return ret; } -int ObITenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant& tenant, - const common::ObSqlString& sql, const bool need_get_is_mark_deleted, - common::ObIArray& item_list, common::ObISQLClient& proxy) +int ObITenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant, + const common::ObSqlString &sql, const bool need_get_is_mark_deleted, + common::ObIArray &item_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; const uint64_t real_tenant_id = tenant.is_dropped_ ? OB_SYS_TENANT_ID : tenant.tenant_id_; SMART_VAR(ObMySQLProxy::MySQLResult, res) { - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; if (OB_UNLIKELY(!sql.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", KR(ret), K(sql)); @@ -502,7 +503,7 @@ int ObITenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBa } int ObITenantBackupBackupsetOperator::extract_task_item( - const bool need_extract_is_mark_deleted, sqlclient::ObMySQLResult* result, ObTenantBackupBackupsetTaskItem& item) + const bool need_extract_is_mark_deleted, sqlclient::ObMySQLResult *result, ObTenantBackupBackupsetTaskItem &item) { int ret = OB_SUCCESS; int64_t tmp_real_str_len = 0; @@ -584,7 +585,7 @@ int ObITenantBackupBackupsetOperator::extract_task_item( } int ObITenantBackupBackupsetOperator::fill_one_item( - const ObTenantBackupTaskInfo& task_info, const bool need_fill_is_mark_deleted, ObDMLSqlSplicer& splicer) + const ObTenantBackupTaskInfo &task_info, const bool need_fill_is_mark_deleted, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char dst_backup_dest_str[OB_MAX_BACKUP_DEST_LENGTH] = ""; @@ -642,14 +643,14 @@ int ObITenantBackupBackupsetOperator::fill_one_item( /* ObTenantBackupBackupsetOperator */ int ObTenantBackupBackupsetOperator::get_job_task_count( - const ObBackupBackupsetJobInfo& job_info, common::ObISQLClient& sql_proxy, int64_t& task_count) + const ObBackupBackupsetJobInfo &job_info, common::ObISQLClient &sql_proxy, int64_t &task_count) { int ret = OB_SUCCESS; const int64_t job_id = job_info.job_id_; const uint64_t tenant_id = job_info.tenant_id_; task_count = 0; ObSqlString sql; - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; SMART_VAR(ObMySQLProxy::ReadResult, res) { if (OB_FAIL(sql.assign_fmt("select count(*) as count from %s where job_id = %ld", @@ -673,8 +674,8 @@ int ObTenantBackupBackupsetOperator::get_job_task_count( return ret; } -int ObTenantBackupBackupsetOperator::insert_task_item(const share::SimpleBackupBackupsetTenant& tenant, - const ObTenantBackupBackupsetTaskItem& item, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::insert_task_item(const share::SimpleBackupBackupsetTenant &tenant, + const ObTenantBackupBackupsetTaskItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -706,8 +707,8 @@ int ObTenantBackupBackupsetOperator::insert_task_item(const share::SimpleBackupB return ret; } -int ObTenantBackupBackupsetOperator::report_task_item(const share::SimpleBackupBackupsetTenant& tenant, - const ObTenantBackupBackupsetTaskItem& item, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::report_task_item(const share::SimpleBackupBackupsetTenant &tenant, + const ObTenantBackupBackupsetTaskItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -739,8 +740,8 @@ int ObTenantBackupBackupsetOperator::report_task_item(const share::SimpleBackupB return ret; } -int ObTenantBackupBackupsetOperator::remove_task_item(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::remove_task_item(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; const uint64_t real_tenant_id = tenant.is_dropped_ ? OB_SYS_TENANT_ID : tenant.tenant_id_; @@ -757,9 +758,9 @@ int ObTenantBackupBackupsetOperator::remove_task_item(const share::SimpleBackupB return ret; } -int ObTenantBackupBackupsetOperator::get_task_item(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, ObTenantBackupBackupsetTaskItem& item, - common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::get_task_item(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, ObTenantBackupBackupsetTaskItem &item, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -791,8 +792,8 @@ int ObTenantBackupBackupsetOperator::get_task_item(const share::SimpleBackupBack return ret; } -int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, common::ObIArray& items, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -814,7 +815,7 @@ int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBac } int ObTenantBackupBackupsetOperator::get_sys_unfinished_task_items( - const int64_t job_id, common::ObIArray& items, common::ObISQLClient& proxy) + const int64_t job_id, common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -833,8 +834,8 @@ int ObTenantBackupBackupsetOperator::get_sys_unfinished_task_items( return ret; } -int ObTenantBackupBackupsetOperator::get_unfinished_task_items(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, common::ObIArray& items, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::get_unfinished_task_items(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -855,8 +856,8 @@ int ObTenantBackupBackupsetOperator::get_unfinished_task_items(const share::Simp return ret; } -int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant& tenant, - common::ObIArray& items, common::ObISQLClient& proxy) +int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant, + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -879,7 +880,7 @@ int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBac /* ObTenantBackupBackupsetHistoryOperator */ int ObTenantBackupBackupsetHistoryOperator::insert_task_item( - const ObTenantBackupBackupsetTaskItem& item, common::ObISQLClient& proxy) + const ObTenantBackupBackupsetTaskItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -909,7 +910,7 @@ int ObTenantBackupBackupsetHistoryOperator::insert_task_item( } int ObTenantBackupBackupsetHistoryOperator::report_task_item( - const ObTenantBackupBackupsetTaskItem& item, common::ObISQLClient& proxy) + const ObTenantBackupBackupsetTaskItem &item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -941,8 +942,8 @@ int ObTenantBackupBackupsetHistoryOperator::report_task_item( } int ObTenantBackupBackupsetHistoryOperator::get_task_item(const uint64_t tenant_id, const int64_t backup_set_id, - const int64_t copy_id, const bool for_update, common::ObIArray& items, - common::ObISQLClient& proxy) + const int64_t copy_id, const bool for_update, common::ObIArray &items, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -974,7 +975,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_task_item(const uint64_t tenant_ } int ObTenantBackupBackupsetHistoryOperator::get_task_items(const uint64_t tenant_id, const int64_t copy_id, - common::ObIArray& items, common::ObISQLClient& proxy) + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; items.reset(); @@ -999,8 +1000,8 @@ int ObTenantBackupBackupsetHistoryOperator::get_task_items(const uint64_t tenant } int ObTenantBackupBackupsetHistoryOperator::get_task_items_with_same_dest(const uint64_t tenant_id, - const share::ObBackupDest& dest, common::ObIArray& items, - common::ObISQLClient& proxy) + const share::ObBackupDest &dest, common::ObIArray &items, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; items.reset(); @@ -1027,7 +1028,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_task_items_with_same_dest(const } int ObTenantBackupBackupsetHistoryOperator::get_full_task_items(const uint64_t tenant_id, const int64_t copy_id, - common::ObIArray& items, common::ObISQLClient& proxy) + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1052,8 +1053,8 @@ int ObTenantBackupBackupsetHistoryOperator::get_full_task_items(const uint64_t t } int ObTenantBackupBackupsetHistoryOperator::get_need_mark_deleted_tasks_items(const uint64_t tenant_id, - const int64_t copy_id, const int64_t backup_set_id, const share::ObBackupDest& backup_dest, - common::ObIArray& items, common::ObISQLClient& proxy) + const int64_t copy_id, const int64_t backup_set_id, const share::ObBackupDest &backup_dest, + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1090,7 +1091,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_need_mark_deleted_tasks_items(co } int ObTenantBackupBackupsetHistoryOperator::get_marked_deleted_task_items( - const uint64_t tenant_id, common::ObIArray& items, common::ObISQLClient& proxy) + const uint64_t tenant_id, common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1112,7 +1113,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_marked_deleted_task_items( } int ObTenantBackupBackupsetHistoryOperator::mark_task_item_deleted(const uint64_t tenant_id, const int64_t incarnation, - const int64_t copy_id, const int64_t backup_set_id, common::ObISQLClient& proxy) + const int64_t copy_id, const int64_t backup_set_id, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1141,7 +1142,7 @@ int ObTenantBackupBackupsetHistoryOperator::mark_task_item_deleted(const uint64_ } int ObTenantBackupBackupsetHistoryOperator::delete_task_item( - const ObTenantBackupBackupsetTaskItem& task_item, common::ObISQLClient& proxy) + const ObTenantBackupBackupsetTaskItem &task_item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1160,7 +1161,7 @@ int ObTenantBackupBackupsetHistoryOperator::delete_task_item( } int ObTenantBackupBackupsetHistoryOperator::get_max_succeed_task(const uint64_t tenant_id, const int64_t copy_id, - ObTenantBackupBackupsetTaskItem& item, common::ObISQLClient& client) + ObTenantBackupBackupsetTaskItem &item, common::ObISQLClient &client) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1198,8 +1199,8 @@ int ObTenantBackupBackupsetHistoryOperator::get_max_succeed_task(const uint64_t } int ObTenantBackupBackupsetHistoryOperator::get_same_backup_set_id_tasks(const bool is_tenant_level, - const uint64_t tenant_id, const int64_t backup_set_id, common::ObIArray& items, - common::ObISQLClient& client) + const uint64_t tenant_id, const int64_t backup_set_id, common::ObIArray &items, + common::ObISQLClient &client) { int ret = OB_SUCCESS; items.reset(); @@ -1235,7 +1236,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_same_backup_set_id_tasks(const b } int ObTenantBackupBackupsetHistoryOperator::get_all_tasks_backup_set_id_smaller_then(const int64_t backup_set_id, - const uint64_t tenant_id, common::ObIArray& items, common::ObISQLClient& client) + const uint64_t tenant_id, common::ObIArray &items, common::ObISQLClient &client) { int ret = OB_SUCCESS; items.reset(); @@ -1260,7 +1261,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_all_tasks_backup_set_id_smaller_ } int ObTenantBackupBackupsetHistoryOperator::get_all_job_tasks(const int64_t job_id, const bool for_update, - common::ObIArray& items, common::ObISQLClient& client) + common::ObIArray &items, common::ObISQLClient &client) { int ret = OB_SUCCESS; items.reset(); @@ -1285,7 +1286,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_all_job_tasks(const int64_t job_ } int ObTenantBackupBackupsetHistoryOperator::get_all_sys_job_tasks(const int64_t job_id, const bool for_update, - common::ObIArray& items, common::ObISQLClient& client) + common::ObIArray &items, common::ObISQLClient &client) { int ret = OB_SUCCESS; items.reset(); @@ -1312,7 +1313,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_all_sys_job_tasks(const int64_t } int ObTenantBackupBackupsetHistoryOperator::get_full_task_items(const uint64_t tenant_id, const bool for_update, - common::ObIArray& items, common::ObISQLClient& proxy) + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1337,7 +1338,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_full_task_items(const uint64_t t } int ObTenantBackupBackupsetHistoryOperator::get_task_items( - const uint64_t tenant_id, common::ObIArray& items, common::ObISQLClient& proxy) + const uint64_t tenant_id, common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; items.reset(); @@ -1360,7 +1361,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_task_items( } int ObTenantBackupBackupsetHistoryOperator::get_tenant_ids_with_backup_set_id(const int64_t copy_id, - const int64_t backup_set_id, common::ObIArray& tenant_ids, common::ObISQLClient& proxy) + const int64_t backup_set_id, common::ObIArray &tenant_ids, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; tenant_ids.reset(); @@ -1382,7 +1383,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_tenant_ids_with_backup_set_id(co } int ObTenantBackupBackupsetHistoryOperator::get_tenant_ids_with_snapshot_version( - const int64_t snapshot_version, common::ObIArray& tenant_ids, common::ObISQLClient& proxy) + const int64_t snapshot_version, common::ObIArray &tenant_ids, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; tenant_ids.reset(); @@ -1403,7 +1404,7 @@ int ObTenantBackupBackupsetHistoryOperator::get_tenant_ids_with_snapshot_version } int ObTenantBackupBackupsetHistoryOperator::update_backup_task_info( - const ObTenantBackupTaskInfo& backup_task_info, const bool fill_mark_delete_item, common::ObISQLClient& proxy) + const ObTenantBackupTaskInfo &backup_task_info, const bool fill_mark_delete_item, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; const int64_t tenant_id = OB_SYS_TENANT_ID; @@ -1431,7 +1432,7 @@ int ObTenantBackupBackupsetHistoryOperator::update_backup_task_info( } int ObTenantBackupBackupsetHistoryOperator::delete_task_item(const uint64_t tenant_id, const int64_t incarnation, - const int64_t backup_set_id, const int64_t copy_id, common::ObISQLClient& client) + const int64_t backup_set_id, const int64_t copy_id, common::ObISQLClient &client) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1456,8 +1457,8 @@ int ObTenantBackupBackupsetHistoryOperator::delete_task_item(const uint64_t tena /* ObPGBackupBackupsetOperator */ -int ObPGBackupBackupsetOperator::batch_report_task(const share::SimpleBackupBackupsetTenant& tenant, - const common::ObIArray& items, common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::batch_report_task(const share::SimpleBackupBackupsetTenant &tenant, + const common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1477,7 +1478,7 @@ int ObPGBackupBackupsetOperator::batch_report_task(const share::SimpleBackupBack const int64_t remain_cnt = items.count() - report_idx; int64_t cur_batch_cnt = remain_cnt < BATCH_CNT ? remain_cnt : BATCH_CNT; for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) { - const ObPGBackupBackupsetTaskItem& item = items.at(report_idx + i); + const ObPGBackupBackupsetTaskItem &item = items.at(report_idx + i); splicer.reuse(); if (OB_FAIL(fill_one_item(item, splicer))) { LOG_WARN("failed to fill one item", KR(ret), K(item)); @@ -1537,9 +1538,9 @@ int ObPGBackupBackupsetOperator::batch_report_task(const share::SimpleBackupBack return ret; } -int ObPGBackupBackupsetOperator::get_pending_tasks(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, common::ObIArray& items, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_pending_tasks(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, common::ObIArray &items, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1559,9 +1560,9 @@ int ObPGBackupBackupsetOperator::get_pending_tasks(const share::SimpleBackupBack return ret; } -int ObPGBackupBackupsetOperator::get_pending_tasks_with_limit(const share::SimpleBackupBackupsetTenant& tenant, +int ObPGBackupBackupsetOperator::get_pending_tasks_with_limit(const share::SimpleBackupBackupsetTenant &tenant, const int64_t job_id, const int64_t backup_set_id, const int64_t limit, - common::ObIArray& items, common::ObISQLClient& proxy) + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1582,9 +1583,9 @@ int ObPGBackupBackupsetOperator::get_pending_tasks_with_limit(const share::Simpl return ret; } -int ObPGBackupBackupsetOperator::get_finished_tasks(const share::SimpleBackupBackupsetTenant& tenant, +int ObPGBackupBackupsetOperator::get_finished_tasks(const share::SimpleBackupBackupsetTenant &tenant, const int64_t job_id, const int64_t backup_set_id, const int64_t copy_id, - common::ObIArray& items, common::ObISQLClient& proxy) + common::ObIArray &items, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1605,9 +1606,9 @@ int ObPGBackupBackupsetOperator::get_finished_tasks(const share::SimpleBackupBac return ret; } -int ObPGBackupBackupsetOperator::get_finished_task_count(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, const int64_t copy_id, int64_t& finished_count, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_finished_task_count(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, const int64_t copy_id, int64_t &finished_count, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1632,9 +1633,9 @@ int ObPGBackupBackupsetOperator::get_finished_task_count(const share::SimpleBack } int ObPGBackupBackupsetOperator::update_result_and_status(const int64_t job_id, - const share::SimpleBackupBackupsetTenant& tenant, const int64_t backup_set_id, const int64_t copy_id, - const common::ObPartitionKey& pg_key, const int32_t result, const ObPGBackupBackupsetTaskItem::TaskStatus& status, - common::ObISQLClient& proxy) + const share::SimpleBackupBackupsetTenant &tenant, const int64_t backup_set_id, const int64_t copy_id, + const common::ObPartitionKey &pg_key, const int32_t result, const ObPGBackupBackupsetTaskItem::TaskStatus &status, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1667,8 +1668,8 @@ int ObPGBackupBackupsetOperator::update_result_and_status(const int64_t job_id, return ret; } -int ObPGBackupBackupsetOperator::update_task_stat(const share::SimpleBackupBackupsetTenant& tenant, - const ObPGBackupBackupsetTaskRowKey& row_key, const ObPGBackupBackupsetTaskStat& stat, common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::update_task_stat(const share::SimpleBackupBackupsetTenant &tenant, + const ObPGBackupBackupsetTaskRowKey &row_key, const ObPGBackupBackupsetTaskStat &stat, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1703,9 +1704,9 @@ int ObPGBackupBackupsetOperator::update_task_stat(const share::SimpleBackupBacku return ret; } -int ObPGBackupBackupsetOperator::batch_update_result_and_status(const share::SimpleBackupBackupsetTenant& tenant, - const common::ObIArray& args, const common::ObIArray& results, - const ObPGBackupBackupsetTaskItem::TaskStatus& status, common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::batch_update_result_and_status(const share::SimpleBackupBackupsetTenant &tenant, + const common::ObIArray &args, const common::ObIArray &results, + const ObPGBackupBackupsetTaskItem::TaskStatus &status, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t report_idx = 0; @@ -1722,11 +1723,11 @@ int ObPGBackupBackupsetOperator::batch_update_result_and_status(const share::Sim LOG_WARN("failed to start trans", KR(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < cur_batch_cnt; ++i) { - const share::ObBackupBackupsetArg& arg = args.at(i + report_idx); + const share::ObBackupBackupsetArg &arg = args.at(i + report_idx); const int64_t job_id = arg.job_id_; const int64_t backup_set_id = arg.backup_set_id_; const int64_t copy_id = arg.copy_id_; - const ObPartitionKey& pg_key = arg.pg_key_; + const ObPartitionKey &pg_key = arg.pg_key_; const int32_t result = results.at(i + report_idx); if (OB_FAIL(ObPGBackupBackupsetOperator::update_result_and_status( job_id, tenant, backup_set_id, copy_id, pg_key, result, status, trans))) { @@ -1752,9 +1753,9 @@ int ObPGBackupBackupsetOperator::batch_update_result_and_status(const share::Sim return ret; } -int ObPGBackupBackupsetOperator::get_doing_pg_tasks(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, common::ObIArray& pg_tasks, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_doing_pg_tasks(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, common::ObIArray &pg_tasks, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1776,9 +1777,9 @@ int ObPGBackupBackupsetOperator::get_doing_pg_tasks(const share::SimpleBackupBac return ret; } -int ObPGBackupBackupsetOperator::get_failed_pg_tasks(const share::SimpleBackupBackupsetTenant& tenant, - const int64_t job_id, const int64_t backup_set_id, common::ObIArray& pg_tasks, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_failed_pg_tasks(const share::SimpleBackupBackupsetTenant &tenant, + const int64_t job_id, const int64_t backup_set_id, common::ObIArray &pg_tasks, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1800,9 +1801,9 @@ int ObPGBackupBackupsetOperator::get_failed_pg_tasks(const share::SimpleBackupBa return ret; } -int ObPGBackupBackupsetOperator::get_pg_task(const share::SimpleBackupBackupsetTenant& tenant, const int64_t job_id, - const int64_t backup_set_id, const uint64_t table_id, const int64_t partition_id, ObPGBackupBackupsetTaskItem& task, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_pg_task(const share::SimpleBackupBackupsetTenant &tenant, const int64_t job_id, + const int64_t backup_set_id, const uint64_t table_id, const int64_t partition_id, ObPGBackupBackupsetTaskItem &task, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObSqlString sql; @@ -1833,7 +1834,7 @@ int ObPGBackupBackupsetOperator::get_pg_task(const share::SimpleBackupBackupsetT return ret; } -int ObPGBackupBackupsetOperator::fill_one_item(const ObPGBackupBackupsetTaskItem& item, ObDMLSqlSplicer& splicer) +int ObPGBackupBackupsetOperator::fill_one_item(const ObPGBackupBackupsetTaskItem &item, ObDMLSqlSplicer &splicer) { int ret = OB_SUCCESS; char svr_ip_str[OB_MAX_SERVER_ADDR_SIZE] = ""; @@ -1867,15 +1868,15 @@ int ObPGBackupBackupsetOperator::fill_one_item(const ObPGBackupBackupsetTaskItem return ret; } -int ObPGBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant& tenant, - const common::ObSqlString& sql, common::ObIArray& item_list, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant, + const common::ObSqlString &sql, common::ObIArray &item_list, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; const uint64_t real_tenant_id = tenant.is_dropped_ ? OB_SYS_TENANT_ID : tenant.tenant_id_; SMART_VAR(ObMySQLProxy::MySQLResult, res) { - sqlclient::ObMySQLResult* result = NULL; + sqlclient::ObMySQLResult *result = NULL; if (OB_UNLIKELY(!sql.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", KR(ret), K(sql)); @@ -1905,7 +1906,7 @@ int ObPGBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackups return ret; } -int ObPGBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult* result, ObPGBackupBackupsetTaskItem& item) +int ObPGBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult *result, ObPGBackupBackupsetTaskItem &item) { int ret = OB_SUCCESS; item.reset(); @@ -1952,9 +1953,9 @@ int ObPGBackupBackupsetOperator::extract_task_item(sqlclient::ObMySQLResult* res return ret; } -int ObPGBackupBackupsetOperator::get_same_trace_id_tasks(const share::SimpleBackupBackupsetTenant& tenant, - const ObPGBackupBackupsetTaskItem& task, common::ObIArray& tasks, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_same_trace_id_tasks(const share::SimpleBackupBackupsetTenant &tenant, + const ObPGBackupBackupsetTaskItem &task, common::ObIArray &tasks, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; tasks.reset(); @@ -1972,9 +1973,9 @@ int ObPGBackupBackupsetOperator::get_same_trace_id_tasks(const share::SimpleBack return ret; } -int ObPGBackupBackupsetOperator::get_next_end_key_for_remove(const share::SimpleBackupBackupsetTenant& tenant, - const share::ObPGBackupBackupsetTaskRowKey& prev_row_key, share::ObPGBackupBackupsetTaskRowKey& next_row_key, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_next_end_key_for_remove(const share::SimpleBackupBackupsetTenant &tenant, + const share::ObPGBackupBackupsetTaskRowKey &prev_row_key, share::ObPGBackupBackupsetTaskRowKey &next_row_key, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; next_row_key.reset(); @@ -2008,7 +2009,7 @@ int ObPGBackupBackupsetOperator::get_next_end_key_for_remove(const share::Simple ret = OB_ITER_END; LOG_WARN("no next end row key", KR(ret), K(sql), K(tenant)); } else { - const ObPGBackupBackupsetTaskItem& last_item = tasks.at(tasks.count() - 1); + const ObPGBackupBackupsetTaskItem &last_item = tasks.at(tasks.count() - 1); next_row_key.tenant_id_ = last_item.tenant_id_; next_row_key.job_id_ = last_item.job_id_; next_row_key.incarnation_ = last_item.incarnation_; @@ -2020,8 +2021,8 @@ int ObPGBackupBackupsetOperator::get_next_end_key_for_remove(const share::Simple return ret; } -int ObPGBackupBackupsetOperator::get_batch_end_key_for_remove(const share::SimpleBackupBackupsetTenant& tenant, - common::ObIArray& row_key_list, common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::get_batch_end_key_for_remove(const share::SimpleBackupBackupsetTenant &tenant, + common::ObIArray &row_key_list, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; row_key_list.reset(); @@ -2053,9 +2054,9 @@ int ObPGBackupBackupsetOperator::get_batch_end_key_for_remove(const share::Simpl return ret; } -int ObPGBackupBackupsetOperator::batch_remove_pg_tasks(const share::SimpleBackupBackupsetTenant& tenant, - const share::ObPGBackupBackupsetTaskRowKey& left_row_key, const share::ObPGBackupBackupsetTaskRowKey& right_row_key, - common::ObISQLClient& proxy) +int ObPGBackupBackupsetOperator::batch_remove_pg_tasks(const share::SimpleBackupBackupsetTenant &tenant, + const share::ObPGBackupBackupsetTaskRowKey &left_row_key, const share::ObPGBackupBackupsetTaskRowKey &right_row_key, + common::ObISQLClient &proxy) { int ret = OB_SUCCESS; int64_t affected_rows = 0; @@ -2095,7 +2096,7 @@ int ObPGBackupBackupsetOperator::batch_remove_pg_tasks(const share::SimpleBackup } int ObPGBackupBackupsetOperator::remove_all_pg_tasks( - const share::SimpleBackupBackupsetTenant& tenant, common::ObISQLClient& proxy) + const share::SimpleBackupBackupsetTenant &tenant, common::ObISQLClient &proxy) { int ret = OB_SUCCESS; ObArray row_key_list; @@ -2108,8 +2109,8 @@ int ObPGBackupBackupsetOperator::remove_all_pg_tasks( // do nothing } else { for (int64_t i = 0; OB_SUCC(ret) && i < row_key_list.count() - 1; ++i) { - const ObPGBackupBackupsetTaskRowKey& left_row_key = row_key_list.at(i); - const ObPGBackupBackupsetTaskRowKey& right_row_key = row_key_list.at(i + 1); + const ObPGBackupBackupsetTaskRowKey &left_row_key = row_key_list.at(i); + const ObPGBackupBackupsetTaskRowKey &right_row_key = row_key_list.at(i + 1); if (OB_FAIL(batch_remove_pg_tasks(tenant, left_row_key, right_row_key, proxy))) { LOG_WARN("failed to batch remove pg tasks", KR(ret), K(tenant), K(left_row_key), K(right_row_key)); } diff --git a/src/share/backup/ob_extern_backup_info_mgr.cpp b/src/share/backup/ob_extern_backup_info_mgr.cpp index 07ac98a9309caec1e489b694735aeaf2b1f71d2a..b56aefeb9f6fe67be209574e42e09513d8a374cf 100644 --- a/src/share/backup/ob_extern_backup_info_mgr.cpp +++ b/src/share/backup/ob_extern_backup_info_mgr.cpp @@ -14,6 +14,7 @@ #include "ob_extern_backup_info_mgr.h" #include "common/ob_record_header.h" #include "share/config/ob_server_config.h" +#include "share/backup/ob_backup_operator.h" using namespace oceanbase; using namespace common; @@ -48,11 +49,11 @@ int64_t ObExternBackupInfos::get_write_buf_size() const return size; } -int ObExternBackupInfos::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternBackupInfos::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -78,7 +79,7 @@ int ObExternBackupInfos::write_buf(char* buf, const int64_t buf_len, int64_t& po return ret; } -int ObExternBackupInfos::read_buf(const char* buf, const int64_t buf_len) +int ObExternBackupInfos::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -87,7 +88,7 @@ int ObExternBackupInfos::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -107,7 +108,7 @@ int ObExternBackupInfos::read_buf(const char* buf, const int64_t buf_len) } // in order to reuse, can not refer to last extern backup info' status is DOING -int ObExternBackupInfos::update(const ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfos::update(const ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; ObExternBackupInfo last_backup_info; @@ -127,7 +128,7 @@ int ObExternBackupInfos::update(const ObExternBackupInfo& extern_backup_info) return ret; } -int ObExternBackupInfos::get_last(ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfos::get_last(ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; extern_backup_info.reset(); @@ -141,7 +142,7 @@ int ObExternBackupInfos::get_last(ObExternBackupInfo& extern_backup_info) } // TODO() change error code -int ObExternBackupInfos::get_last_succeed_info(ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfos::get_last_succeed_info(ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; extern_backup_info.reset(); @@ -150,7 +151,7 @@ int ObExternBackupInfos::get_last_succeed_info(ObExternBackupInfo& extern_backup } else { bool found = false; for (int64_t i = extern_backup_info_array_.count() - 1; !found && i >= 0; --i) { - const ObExternBackupInfo& info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &info = extern_backup_info_array_.at(i); if (ObExternBackupInfo::SUCCESS == info.status_) { extern_backup_info = info; found = true; @@ -164,7 +165,7 @@ int ObExternBackupInfos::get_last_succeed_info(ObExternBackupInfo& extern_backup return ret; } -int ObExternBackupInfos::get_extern_backup_infos(ObIArray& extern_backup_infos) +int ObExternBackupInfos::get_extern_backup_infos(ObIArray &extern_backup_infos) { int ret = OB_SUCCESS; if (OB_FAIL(extern_backup_infos.assign(extern_backup_info_array_))) { @@ -173,12 +174,12 @@ int ObExternBackupInfos::get_extern_backup_infos(ObIArray& e return ret; } -int ObExternBackupInfos::get_extern_full_backup_infos(ObIArray& extern_backup_infos) +int ObExternBackupInfos::get_extern_full_backup_infos(ObIArray &extern_backup_infos) { int ret = OB_SUCCESS; for (int64_t i = 0; OB_SUCC(ret) && i < extern_backup_info_array_.count(); ++i) { - const ObExternBackupInfo& extern_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &extern_backup_info = extern_backup_info_array_.at(i); if (extern_backup_info.full_backup_set_id_ == extern_backup_info.inc_backup_set_id_) { if (OB_FAIL(extern_backup_infos.push_back(extern_backup_info))) { LOG_WARN("failed to push extern backup info into array", K(ret), K(extern_backup_info)); @@ -188,7 +189,7 @@ int ObExternBackupInfos::get_extern_full_backup_infos(ObIArray= 0; --i) { - const ObExternBackupInfo& tmp_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &tmp_backup_info = extern_backup_info_array_.at(i); if (ObExternBackupInfo::SUCCESS != tmp_backup_info.status_) { // do nothing } else if (tmp_backup_info.backup_snapshot_version_ <= restore_snapshot_version) { @@ -274,7 +275,7 @@ int ObExternBackupInfos::find_backup_info( } for (int64_t i = idx; OB_SUCC(ret) && i >= 0; --i) { - const ObExternBackupInfo& tmp_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &tmp_backup_info = extern_backup_info_array_.at(i); if (ObExternBackupInfo::SUCCESS != tmp_backup_info.status_) { // do nothing } else if (OB_FAIL(check_passwd(passwd_array, tmp_backup_info.passwd_.ptr()))) { @@ -286,7 +287,7 @@ int ObExternBackupInfos::find_backup_info( return ret; } -int ObExternBackupInfos::check_passwd(const char* passwd_array, const char* passwd) +int ObExternBackupInfos::check_passwd(const char *passwd_array, const char *passwd) { int ret = OB_SUCCESS; if (OB_FAIL(ObBackupUtils::check_passwd(passwd_array, passwd))) { @@ -299,7 +300,7 @@ int ObExternBackupInfos::mark_backup_info_deleted(const int64_t backup_set_id) { int ret = OB_SUCCESS; for (int64_t i = 0; OB_SUCC(ret) && i < extern_backup_info_array_.count(); ++i) { - ObExternBackupInfo& extern_backup_info = extern_backup_info_array_.at(i); + ObExternBackupInfo &extern_backup_info = extern_backup_info_array_.at(i); if (backup_set_id == extern_backup_info.inc_backup_set_id_) { extern_backup_info.is_mark_deleted_ = true; } @@ -311,7 +312,7 @@ int ObExternBackupInfos::delete_marked_backup_info(const int64_t backup_set_id) { int ret = OB_SUCCESS; for (int64_t i = extern_backup_info_array_.count() - 1; OB_SUCC(ret) && i >= 0; --i) { - const ObExternBackupInfo& extern_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &extern_backup_info = extern_backup_info_array_.at(i); if (backup_set_id == extern_backup_info.inc_backup_set_id_) { if (!extern_backup_info.is_mark_deleted_) { ret = OB_ERR_UNEXPECTED; @@ -330,12 +331,12 @@ int ObExternBackupInfos::delete_marked_backup_info(const int64_t backup_set_id) } int ObExternBackupInfos::get_extern_full_backup_info( - const int64_t full_backup_set_id, ObExternBackupInfo& extern_backup_info) + const int64_t full_backup_set_id, ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; bool found = false; for (int64_t i = 0; OB_SUCC(ret) && i < extern_backup_info_array_.count() && !found; ++i) { - const ObExternBackupInfo& tmp_extern_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &tmp_extern_backup_info = extern_backup_info_array_.at(i); if (full_backup_set_id == tmp_extern_backup_info.full_backup_set_id_ && full_backup_set_id == tmp_extern_backup_info.inc_backup_set_id_) { extern_backup_info = tmp_extern_backup_info; @@ -360,7 +361,7 @@ int ObExternBackupInfos::try_finish_extern_backup_info(const int64_t backup_set_ LOG_WARN("try finish extern backup info get invalid argument", K(ret), K(backup_set_id)); } else { for (int64_t i = extern_backup_info_array_.count() - 1; OB_SUCC(ret) && i >= 0; --i) { - ObExternBackupInfo& extern_info = extern_backup_info_array_.at(i); + ObExternBackupInfo &extern_info = extern_backup_info_array_.at(i); if (backup_set_id > extern_info.inc_backup_set_id_) { break; } else if (backup_set_id == extern_info.inc_backup_set_id_) { @@ -377,7 +378,7 @@ int ObExternBackupInfos::try_finish_extern_backup_info(const int64_t backup_set_ } int ObExternBackupInfos::get_extern_backup_info( - const int64_t full_backup_set_id, const int64_t inc_backup_set_id, ObExternBackupInfo& extern_backup_info) + const int64_t full_backup_set_id, const int64_t inc_backup_set_id, ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; bool found = false; @@ -387,7 +388,7 @@ int ObExternBackupInfos::get_extern_backup_info( LOG_WARN("get extern backup info get invalid argument", K(ret), K(full_backup_set_id), K(inc_backup_set_id)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < extern_backup_info_array_.count() && !found; ++i) { - const ObExternBackupInfo& tmp_extern_backup_info = extern_backup_info_array_.at(i); + const ObExternBackupInfo &tmp_extern_backup_info = extern_backup_info_array_.at(i); if (tmp_extern_backup_info.full_backup_set_id_ == full_backup_set_id && tmp_extern_backup_info.inc_backup_set_id_ == inc_backup_set_id) { extern_backup_info = tmp_extern_backup_info; @@ -419,8 +420,8 @@ ObExternBackupInfoMgr::ObExternBackupInfoMgr() ObExternBackupInfoMgr::~ObExternBackupInfoMgr() {} -int ObExternBackupInfoMgr::init(const uint64_t tenant_id, const ObClusterBackupDest& backup_dest, - share::ObIBackupLeaseService& backup_lease_service) +int ObExternBackupInfoMgr::init(const uint64_t tenant_id, const ObClusterBackupDest &backup_dest, + share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -449,12 +450,12 @@ int ObExternBackupInfoMgr::init(const uint64_t tenant_id, const ObClusterBackupD return ret; } -int ObExternBackupInfoMgr::get_extern_backup_infos(const uint64_t tenant_id, const ObClusterBackupDest& backup_dest) +int ObExternBackupInfoMgr::get_extern_backup_infos(const uint64_t tenant_id, const ObClusterBackupDest &backup_dest) { int ret = OB_SUCCESS; ObBackupPath path; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -470,7 +471,7 @@ int ObExternBackupInfoMgr::get_extern_backup_infos(const uint64_t tenant_id, con } } else if (0 == file_length) { FLOG_INFO("extern backup info is empty", K(ret), K(tenant_id), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -502,7 +503,7 @@ int ObExternBackupInfoMgr::get_last_succeed_info() return ret; } -int ObExternBackupInfoMgr::get_last_info(ObExternBackupInfo& last_backup_info) +int ObExternBackupInfoMgr::get_last_info(ObExternBackupInfo &last_backup_info) { int ret = OB_SUCCESS; last_backup_info.reset(); @@ -517,7 +518,7 @@ int ObExternBackupInfoMgr::get_last_info(ObExternBackupInfo& last_backup_info) return ret; } -int ObExternBackupInfoMgr::check_can_backup(const ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfoMgr::check_can_backup(const ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; ObExternBackupInfo last_backup_info; @@ -570,7 +571,7 @@ int ObExternBackupInfoMgr::check_can_backup(const ObExternBackupInfo& extern_bac return ret; } -int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; @@ -593,7 +594,7 @@ int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo& extern_b return ret; } -int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo& extern_backup_info, const bool search) +int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo &extern_backup_info, const bool search) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -613,7 +614,7 @@ int ObExternBackupInfoMgr::upload_backup_info(const ObExternBackupInfo& extern_b } int ObExternBackupInfoMgr::get_backup_path( - const uint64_t tenant_id, const ObClusterBackupDest& backup_dest, ObBackupPath& path) + const uint64_t tenant_id, const ObClusterBackupDest &backup_dest, ObBackupPath &path) { int ret = OB_SUCCESS; if (OB_SYS_TENANT_ID == tenant_id) { @@ -628,8 +629,8 @@ int ObExternBackupInfoMgr::get_backup_path( return ret; } -int ObExternBackupInfoMgr::get_extern_backup_info(const ObBaseBackupInfoStruct& info, - rootserver::ObFreezeInfoManager& freeze_info_mgr, ObExternBackupInfo& extern_backup_info) +int ObExternBackupInfoMgr::get_extern_backup_info(const ObBaseBackupInfoStruct &info, + rootserver::ObFreezeInfoManager &freeze_info_mgr, ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; extern_backup_info.reset(); @@ -731,7 +732,7 @@ int ObExternBackupInfoMgr::get_extern_backup_info(const ObBaseBackupInfoStruct& } int ObExternBackupInfoMgr::find_backup_info( - const int64_t restore_snapshot_version, const char* passwd_array, ObExternBackupInfo& extern_backup_info) + const int64_t restore_snapshot_version, const char *passwd_array, ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -747,7 +748,7 @@ int ObExternBackupInfoMgr::find_backup_info( return ret; } -int ObExternBackupInfoMgr::get_extern_backup_infos(ObIArray& extern_backup_infos) +int ObExternBackupInfoMgr::get_extern_backup_infos(ObIArray &extern_backup_infos) { int ret = OB_SUCCESS; extern_backup_infos.reset(); @@ -760,7 +761,7 @@ int ObExternBackupInfoMgr::get_extern_backup_infos(ObIArray& return ret; } -int ObExternBackupInfoMgr::get_extern_full_backup_infos(ObIArray& extern_backup_infos) +int ObExternBackupInfoMgr::get_extern_full_backup_infos(ObIArray &extern_backup_infos) { int ret = OB_SUCCESS; extern_backup_infos.reset(); @@ -778,7 +779,7 @@ int ObExternBackupInfoMgr::upload_backup_info() { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need_retry*/); @@ -790,7 +791,7 @@ int ObExternBackupInfoMgr::upload_backup_info() } else if (OB_FAIL(get_backup_path(tenant_id_, backup_dest_, path))) { LOG_WARN("failed to get backup path", K(ret), K(tenant_id_), K(backup_dest_)); } else if (FALSE_IT(buf_size = extern_backup_infos_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_backup_infos_.write_buf(buf, buf_size, pos))) { @@ -811,7 +812,7 @@ int ObExternBackupInfoMgr::upload_backup_info() return ret; } -int ObExternBackupInfoMgr::mark_backup_info_deleted(const common::ObIArray& backup_set_id_pairs) +int ObExternBackupInfoMgr::mark_backup_info_deleted(const common::ObIArray &backup_set_id_pairs) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -819,7 +820,7 @@ int ObExternBackupInfoMgr::mark_backup_info_deleted(const common::ObIArray& backup_set_ids, bool& is_empty) +int ObExternBackupInfoMgr::delete_marked_backup_info(const common::ObIArray &backup_set_ids, bool &is_empty) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -860,7 +861,7 @@ int ObExternBackupInfoMgr::delete_marked_backup_info(const common::ObIArray= 0; --i) { - const ObExternBackupInfo& extern_backup_info = extern_backup_infos.at(i); + const ObExternBackupInfo &extern_backup_info = extern_backup_infos.at(i); if (ObBackupType::is_full_backup(extern_backup_info.backup_type_)) { break; } else { @@ -914,7 +915,7 @@ int ObExternBackupInfoMgr::get_lastest_incremental_backup_count(int32_t& increme } int ObExternBackupInfoMgr::get_extern_backup_info( - const int64_t full_backup_set_id, const int64_t inc_backup_set_id, ObExternBackupInfo& extern_backup_info) + const int64_t full_backup_set_id, const int64_t inc_backup_set_id, ObExternBackupInfo &extern_backup_info) { int ret = OB_SUCCESS; @@ -929,7 +930,7 @@ int ObExternBackupInfoMgr::get_extern_backup_info( } int ObExternBackupInfoMgr::get_extern_backup_infos( - const int64_t backup_set_id, common::ObIArray& extern_backup_infos) + const int64_t backup_set_id, common::ObIArray &extern_backup_infos) { int ret = OB_SUCCESS; ObArray tmp_extern_backup_infos; @@ -941,7 +942,7 @@ int ObExternBackupInfoMgr::get_extern_backup_infos( LOG_WARN("failed to get extern backup infos", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < tmp_extern_backup_infos.count(); ++i) { - const ObExternBackupInfo& extern_backup_info = tmp_extern_backup_infos.at(i); + const ObExternBackupInfo &extern_backup_info = tmp_extern_backup_infos.at(i); if (extern_backup_info.inc_backup_set_id_ != backup_set_id) { // do nothing } else if (OB_FAIL(extern_backup_infos.push_back(extern_backup_info))) { @@ -952,7 +953,7 @@ int ObExternBackupInfoMgr::get_extern_backup_infos( return ret; } -int ObExternBackupInfoMgr::get_backup_path(const ObClusterBackupDest& cluster_backup_dest, ObBackupPath& path) +int ObExternBackupInfoMgr::get_backup_path(const ObClusterBackupDest &cluster_backup_dest, ObBackupPath &path) { int ret = OB_SUCCESS; path.reset(); @@ -1032,11 +1033,11 @@ int64_t ObExternBackupSetInfos::get_write_buf_size() const return size; } -int ObExternBackupSetInfos::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternBackupSetInfos::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -1062,7 +1063,7 @@ int ObExternBackupSetInfos::write_buf(char* buf, const int64_t buf_len, int64_t& return ret; } -int ObExternBackupSetInfos::read_buf(const char* buf, const int64_t buf_len) +int ObExternBackupSetInfos::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -1071,7 +1072,7 @@ int ObExternBackupSetInfos::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -1090,7 +1091,7 @@ int ObExternBackupSetInfos::read_buf(const char* buf, const int64_t buf_len) return ret; } -int ObExternBackupSetInfos::add(const ObExternBackupSetInfo& extern_backup_set_info) +int ObExternBackupSetInfos::add(const ObExternBackupSetInfo &extern_backup_set_info) { int ret = OB_SUCCESS; if (!extern_backup_set_info.is_valid()) { @@ -1102,7 +1103,7 @@ int ObExternBackupSetInfos::add(const ObExternBackupSetInfo& extern_backup_set_i return ret; } -int ObExternBackupSetInfos::get_extern_backup_set_infos(ObIArray& extern_backup_set_infos) +int ObExternBackupSetInfos::get_extern_backup_set_infos(ObIArray &extern_backup_set_infos) { int ret = OB_SUCCESS; if (OB_FAIL(extern_backup_set_infos.assign(extern_backup_set_info_array_))) { @@ -1127,8 +1128,8 @@ ObExternBackupSetInfoMgr::~ObExternBackupSetInfoMgr() {} int ObExternBackupSetInfoMgr::init(const uint64_t tenant_id, const int64_t full_backup_set_id, - const int64_t inc_backup_set_id, const ObClusterBackupDest& backup_dest, const int64_t backup_date, - const int64_t compatible, share::ObIBackupLeaseService& backup_lease_service) + const int64_t inc_backup_set_id, const ObClusterBackupDest &backup_dest, const int64_t backup_date, + const int64_t compatible, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -1173,11 +1174,11 @@ int ObExternBackupSetInfoMgr::init(const uint64_t tenant_id, const int64_t full_ } int ObExternBackupSetInfoMgr::get_extern_backup_set_infos( - const ObClusterBackupDest& backup_dest, const ObBackupPath& path) + const ObClusterBackupDest &backup_dest, const ObBackupPath &path) { int ret = OB_SUCCESS; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1191,7 +1192,7 @@ int ObExternBackupSetInfoMgr::get_extern_backup_set_infos( } } else if (0 == file_length) { FLOG_INFO("extern backup info is empty", K(ret), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -1209,11 +1210,11 @@ int ObExternBackupSetInfoMgr::get_extern_backup_set_infos( return ret; } -int ObExternBackupSetInfoMgr::upload_backup_set_info(const ObExternBackupSetInfo& extern_backup_set_info) +int ObExternBackupSetInfoMgr::upload_backup_set_info(const ObExternBackupSetInfo &extern_backup_set_info) { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1234,7 +1235,7 @@ int ObExternBackupSetInfoMgr::upload_backup_set_info(const ObExternBackupSetInfo } else if (OB_FAIL(extern_backup_set_infos_.add(extern_backup_set_info))) { LOG_WARN("failed to push extern backup set info into array", K(ret), K(extern_backup_set_info)); } else if (FALSE_IT(buf_size = extern_backup_set_infos_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_backup_set_infos_.write_buf(buf, buf_size, pos))) { @@ -1255,7 +1256,7 @@ int ObExternBackupSetInfoMgr::upload_backup_set_info(const ObExternBackupSetInfo return ret; } -int ObExternBackupSetInfoMgr::get_extern_backup_set_infos(ObIArray& extern_backup_set_infos) +int ObExternBackupSetInfoMgr::get_extern_backup_set_infos(ObIArray &extern_backup_set_infos) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -1344,11 +1345,11 @@ int64_t ObExternPGList::get_write_buf_size() const return size; } -int ObExternPGList::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternPGList::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -1373,7 +1374,7 @@ int ObExternPGList::write_buf(char* buf, const int64_t buf_len, int64_t& pos) co return ret; } -int ObExternPGList::read_buf(const char* buf, const int64_t buf_len) +int ObExternPGList::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -1382,7 +1383,7 @@ int ObExternPGList::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -1401,7 +1402,7 @@ int ObExternPGList::read_buf(const char* buf, const int64_t buf_len) return ret; } -int ObExternPGList::add(const ObPGKey& pg_key) +int ObExternPGList::add(const ObPGKey &pg_key) { int ret = OB_SUCCESS; if (!pg_key.is_valid()) { @@ -1413,7 +1414,7 @@ int ObExternPGList::add(const ObPGKey& pg_key) return ret; } -int ObExternPGList::get(ObIArray& pg_keys) +int ObExternPGList::get(ObIArray &pg_keys) { int ret = OB_SUCCESS; if (OB_FAIL(pg_keys.assign(pkeys_))) { @@ -1430,7 +1431,7 @@ ObExternPGListMgr::~ObExternPGListMgr() {} int ObExternPGListMgr::init( - const share::ObSimpleBackupSetPath& simple_path, share::ObIBackupLeaseService& backup_lease_service) + const share::ObSimpleBackupSetPath &simple_path, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; if (is_inited_) { @@ -1448,8 +1449,8 @@ int ObExternPGListMgr::init( } int ObExternPGListMgr::init(const uint64_t tenant_id, const int64_t full_backup_set_id, const int64_t inc_backup_set_id, - const ObClusterBackupDest& backup_dest, const int64_t backup_date, const int64_t compatible, - share::ObIBackupLeaseService& backup_lease_service) + const ObClusterBackupDest &backup_dest, const int64_t backup_date, const int64_t compatible, + share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupBaseDataPathInfo path_info; @@ -1480,7 +1481,7 @@ int ObExternPGListMgr::init(const uint64_t tenant_id, const int64_t full_backup_ return ret; } -int ObExternPGListMgr::add_pg_key(const ObPGKey& pg_key) +int ObExternPGListMgr::add_pg_key(const ObPGKey &pg_key) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -1521,7 +1522,7 @@ int ObExternPGListMgr::upload_sys_pg_list() { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1533,7 +1534,7 @@ int ObExternPGListMgr::upload_sys_pg_list() } else if (OB_FAIL(get_tenant_sys_pg_list_path_(path))) { LOG_WARN("failed to get tenant sys pg list path", KR(ret)); } else if (FALSE_IT(buf_size = extern_sys_pg_list_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_sys_pg_list_.write_buf(buf, buf_size, pos))) { @@ -1558,7 +1559,7 @@ int ObExternPGListMgr::upload_normal_pg_list() { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1570,7 +1571,7 @@ int ObExternPGListMgr::upload_normal_pg_list() } else if (OB_FAIL(get_tenant_normal_pg_list_path_(path))) { LOG_WARN("failed to get tenant normal pg list path", KR(ret)); } else if (FALSE_IT(buf_size = extern_normal_pg_list_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_normal_pg_list_.write_buf(buf, buf_size, pos))) { @@ -1591,7 +1592,7 @@ int ObExternPGListMgr::upload_normal_pg_list() return ret; } -int ObExternPGListMgr::get_sys_pg_list(common::ObIArray& pg_keys) +int ObExternPGListMgr::get_sys_pg_list(common::ObIArray &pg_keys) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -1605,7 +1606,7 @@ int ObExternPGListMgr::get_sys_pg_list(common::ObIArray& pg_key return ret; } -int ObExternPGListMgr::get_normal_pg_list(common::ObIArray& pg_keys) +int ObExternPGListMgr::get_normal_pg_list(common::ObIArray &pg_keys) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -1624,7 +1625,7 @@ int ObExternPGListMgr::get_extern_sys_pg_list() int ret = OB_SUCCESS; ObBackupPath path; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1641,7 +1642,7 @@ int ObExternPGListMgr::get_extern_sys_pg_list() } } else if (0 == file_length) { FLOG_INFO("extern sys pg list is empty", K(ret), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -1664,7 +1665,7 @@ int ObExternPGListMgr::get_extern_normal_pg_list() int ret = OB_SUCCESS; ObBackupPath path; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1680,7 +1681,7 @@ int ObExternPGListMgr::get_extern_normal_pg_list() } } else if (0 == file_length) { FLOG_INFO("extern sys pg list is empty", K(ret), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -1698,7 +1699,7 @@ int ObExternPGListMgr::get_extern_normal_pg_list() return ret; } -int ObExternPGListMgr::get_tenant_sys_pg_list_path_(share::ObBackupPath& path) +int ObExternPGListMgr::get_tenant_sys_pg_list_path_(share::ObBackupPath &path) { int ret = OB_SUCCESS; path.reset(); @@ -1708,7 +1709,7 @@ int ObExternPGListMgr::get_tenant_sys_pg_list_path_(share::ObBackupPath& path) return ret; } -int ObExternPGListMgr::get_tenant_normal_pg_list_path_(share::ObBackupPath& path) +int ObExternPGListMgr::get_tenant_normal_pg_list_path_(share::ObBackupPath &path) { int ret = OB_SUCCESS; path.reset(); @@ -1748,11 +1749,11 @@ int64_t ObExternTenantInfos::get_write_buf_size() const return size; } -int ObExternTenantInfos::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternTenantInfos::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -1778,7 +1779,7 @@ int ObExternTenantInfos::write_buf(char* buf, const int64_t buf_len, int64_t& po return ret; } -int ObExternTenantInfos::read_buf(const char* buf, const int64_t buf_len) +int ObExternTenantInfos::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -1787,7 +1788,7 @@ int ObExternTenantInfos::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -1806,7 +1807,7 @@ int ObExternTenantInfos::read_buf(const char* buf, const int64_t buf_len) return ret; } -int ObExternTenantInfos::get_extern_tenant_infos(ObIArray& extern_tenant_infos) +int ObExternTenantInfos::get_extern_tenant_infos(ObIArray &extern_tenant_infos) { int ret = OB_SUCCESS; if (OB_FAIL(extern_tenant_infos.assign(extern_tenant_info_array_))) { @@ -1815,7 +1816,7 @@ int ObExternTenantInfos::get_extern_tenant_infos(ObIArray& e return ret; } -int ObExternTenantInfos::add(const ObExternTenantInfo& extern_tenant_info) +int ObExternTenantInfos::add(const ObExternTenantInfo &extern_tenant_info) { int ret = OB_SUCCESS; if (!extern_tenant_info.is_valid()) { @@ -1824,7 +1825,7 @@ int ObExternTenantInfos::add(const ObExternTenantInfo& extern_tenant_info) } else { bool found = false; for (int64_t i = 0; !found && i < extern_tenant_info_array_.count(); ++i) { - ObExternTenantInfo& info = extern_tenant_info_array_.at(i); + ObExternTenantInfo &info = extern_tenant_info_array_.at(i); if (info.tenant_id_ == extern_tenant_info.tenant_id_) { found = true; if (info.tenant_name_ != extern_tenant_info.tenant_name_) { @@ -1843,7 +1844,7 @@ int ObExternTenantInfos::add(const ObExternTenantInfo& extern_tenant_info) return ret; } -int ObExternTenantInfos::find_tenant_info(const uint64_t tenant_id, ObExternTenantInfo& tenant_info) +int ObExternTenantInfos::find_tenant_info(const uint64_t tenant_id, ObExternTenantInfo &tenant_info) { int ret = OB_SUCCESS; bool found = false; @@ -1854,7 +1855,7 @@ int ObExternTenantInfos::find_tenant_info(const uint64_t tenant_id, ObExternTena } for (int64_t i = 0; !found && i < extern_tenant_info_array_.count(); ++i) { - const ObExternTenantInfo& tmp_tenant_info = extern_tenant_info_array_.at(i); + const ObExternTenantInfo &tmp_tenant_info = extern_tenant_info_array_.at(i); if (tmp_tenant_info.tenant_id_ == tenant_id) { tenant_info = tmp_tenant_info; found = true; @@ -1876,7 +1877,7 @@ int ObExternTenantInfos::delete_tenant_info(const uint64_t tenant_id) LOG_WARN("invalid args", K(ret), K(tenant_id)); } else { for (int64_t i = extern_tenant_info_array_.count() - 1; OB_SUCC(ret) && i >= 0; --i) { - const ObExternTenantInfo& tmp_tenant_info = extern_tenant_info_array_.at(i); + const ObExternTenantInfo &tmp_tenant_info = extern_tenant_info_array_.at(i); if (tmp_tenant_info.tenant_id_ == tenant_id) { if (OB_FAIL(extern_tenant_info_array_.remove(i))) { LOG_WARN("failed to remove exter tenant info", K(ret), K(tmp_tenant_info), K(tenant_id)); @@ -1898,7 +1899,7 @@ ObExternTenantInfoMgr::~ObExternTenantInfoMgr() {} int ObExternTenantInfoMgr::init( - const ObClusterBackupDest& backup_dest, share::ObIBackupLeaseService& backup_lease_service) + const ObClusterBackupDest &backup_dest, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -1925,12 +1926,12 @@ int ObExternTenantInfoMgr::init( return ret; } -int ObExternTenantInfoMgr::get_extern_tenant_infos(const ObClusterBackupDest& backup_dest) +int ObExternTenantInfoMgr::get_extern_tenant_infos(const ObClusterBackupDest &backup_dest) { int ret = OB_SUCCESS; ObBackupPath path; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1946,7 +1947,7 @@ int ObExternTenantInfoMgr::get_extern_tenant_infos(const ObClusterBackupDest& ba } } else if (0 == file_length) { FLOG_INFO("extern backup info is empty", K(ret), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -1964,7 +1965,7 @@ int ObExternTenantInfoMgr::get_extern_tenant_infos(const ObClusterBackupDest& ba return ret; } -int ObExternTenantInfoMgr::add_tenant_info(const ObExternTenantInfo& tenant_info) +int ObExternTenantInfoMgr::add_tenant_info(const ObExternTenantInfo &tenant_info) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -1984,7 +1985,7 @@ int ObExternTenantInfoMgr::upload_tenant_infos() int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -1996,7 +1997,7 @@ int ObExternTenantInfoMgr::upload_tenant_infos() } else if (OB_FAIL(ObBackupPathUtil::get_tenant_info_path(backup_dest_, path))) { LOG_WARN("failed to get tenant data backup info path", K(ret), K(backup_dest_)); } else if (FALSE_IT(buf_size = extern_tenant_infos_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_tenant_infos_.write_buf(buf, buf_size, pos))) { @@ -2018,7 +2019,7 @@ int ObExternTenantInfoMgr::upload_tenant_infos() return ret; } -int ObExternTenantInfoMgr::get_extern_tenant_infos(ObIArray& tenant_infos) +int ObExternTenantInfoMgr::get_extern_tenant_infos(ObIArray &tenant_infos) { int ret = OB_SUCCESS; tenant_infos.reset(); @@ -2031,7 +2032,7 @@ int ObExternTenantInfoMgr::get_extern_tenant_infos(ObIArray& return ret; } -int ObExternTenantInfoMgr::find_tenant_info(const uint64_t tenant_id, ObExternTenantInfo& tenant_info) +int ObExternTenantInfoMgr::find_tenant_info(const uint64_t tenant_id, ObExternTenantInfo &tenant_info) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -2090,11 +2091,11 @@ int64_t ObExternTenantLocality::get_write_buf_size() const return size; } -int ObExternTenantLocality::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternTenantLocality::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -2119,7 +2120,7 @@ int ObExternTenantLocality::write_buf(char* buf, const int64_t buf_len, int64_t& return ret; } -int ObExternTenantLocality::read_buf(const char* buf, const int64_t buf_len) +int ObExternTenantLocality::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -2128,7 +2129,7 @@ int ObExternTenantLocality::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -2147,7 +2148,7 @@ int ObExternTenantLocality::read_buf(const char* buf, const int64_t buf_len) return ret; } -int ObExternTenantLocality::set_tenant_locality_info(const ObExternTenantLocalityInfo& tenant_locality_info) +int ObExternTenantLocality::set_tenant_locality_info(const ObExternTenantLocalityInfo &tenant_locality_info) { int ret = OB_SUCCESS; if (!tenant_locality_info.is_valid()) { @@ -2167,7 +2168,7 @@ ObExternTenantLocalityInfoMgr::~ObExternTenantLocalityInfoMgr() {} int ObExternTenantLocalityInfoMgr::init( - const share::ObSimpleBackupSetPath& simple_path, share::ObIBackupLeaseService& backup_lease_service) + const share::ObSimpleBackupSetPath &simple_path, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; if (is_inited_) { @@ -2185,8 +2186,8 @@ int ObExternTenantLocalityInfoMgr::init( } int ObExternTenantLocalityInfoMgr::init(const uint64_t tenant_id, const int64_t full_backup_set_id, - const int64_t inc_backup_set_id, const ObClusterBackupDest& backup_dest, const int64_t backup_date, - const int64_t compatible, share::ObIBackupLeaseService& backup_lease_service) + const int64_t inc_backup_set_id, const ObClusterBackupDest &backup_dest, const int64_t backup_date, + const int64_t compatible, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupBaseDataPathInfo path_info; @@ -2216,12 +2217,12 @@ int ObExternTenantLocalityInfoMgr::init(const uint64_t tenant_id, const int64_t return ret; } -int ObExternTenantLocalityInfoMgr::upload_tenant_locality_info(const ObExternTenantLocalityInfo& tenant_locality_info) +int ObExternTenantLocalityInfoMgr::upload_tenant_locality_info(const ObExternTenantLocalityInfo &tenant_locality_info) { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -2238,7 +2239,7 @@ int ObExternTenantLocalityInfoMgr::upload_tenant_locality_info(const ObExternTen } else if (OB_FAIL(get_tenant_locality_info_path_(path))) { LOG_WARN("failed to get tenant locality info path", K(ret)); } else if (FALSE_IT(buf_size = extern_tenant_locality_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(extern_tenant_locality_.write_buf(buf, buf_size, pos))) { @@ -2260,14 +2261,14 @@ int ObExternTenantLocalityInfoMgr::upload_tenant_locality_info(const ObExternTen return ret; } -int ObExternTenantLocalityInfoMgr::get_extern_tenant_locality_info(ObExternTenantLocalityInfo& tenant_locality_info) +int ObExternTenantLocalityInfoMgr::get_extern_tenant_locality_info(ObExternTenantLocalityInfo &tenant_locality_info) { int ret = OB_SUCCESS; tenant_locality_info.reset(); ObBackupPath path; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -2286,7 +2287,7 @@ int ObExternTenantLocalityInfoMgr::get_extern_tenant_locality_info(ObExternTenan } } else if (0 == file_length) { FLOG_INFO("extern tenant locality info is empty", K(ret), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -2305,7 +2306,7 @@ int ObExternTenantLocalityInfoMgr::get_extern_tenant_locality_info(ObExternTenan return ret; } -int ObExternTenantLocalityInfoMgr::get_tenant_locality_info_path_(share::ObBackupPath& path) +int ObExternTenantLocalityInfoMgr::get_tenant_locality_info_path_(share::ObBackupPath &path) { int ret = OB_SUCCESS; path.reset(); @@ -2338,11 +2339,11 @@ int64_t ObExternTenantBackupDiagnoseMgr::get_write_buf_size() const } int ObExternTenantBackupDiagnoseMgr::write_buf( - const ObExternBackupDiagnoseInfo& diagnose_info, char* buf, const int64_t buf_len, int64_t& pos) const + const ObExternBackupDiagnoseInfo &diagnose_info, char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len), K(pos), K(need_size)); @@ -2374,8 +2375,8 @@ int ObExternTenantBackupDiagnoseMgr::write_buf( } int ObExternTenantBackupDiagnoseMgr::init(const uint64_t tenant_id, const int64_t full_backup_set_id, - const int64_t inc_backup_set_id, const ObClusterBackupDest& backup_dest, const int64_t backup_date, - share::ObIBackupLeaseService& backup_lease_service) + const int64_t inc_backup_set_id, const ObClusterBackupDest &backup_dest, const int64_t backup_date, + share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; if (is_inited_) { @@ -2402,11 +2403,11 @@ int ObExternTenantBackupDiagnoseMgr::init(const uint64_t tenant_id, const int64_ return ret; } -int ObExternTenantBackupDiagnoseMgr::upload_tenant_backup_diagnose_info(const ObExternBackupDiagnoseInfo& diagnose_info) +int ObExternTenantBackupDiagnoseMgr::upload_tenant_backup_diagnose_info(const ObExternBackupDiagnoseInfo &diagnose_info) { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -2426,7 +2427,7 @@ int ObExternTenantBackupDiagnoseMgr::upload_tenant_backup_diagnose_info(const Ob } else if (OB_FAIL(ObBackupPathUtil::get_tenant_backup_diagnose_path(path_info, path))) { LOG_WARN("failed to get tenant data backup info path", K(ret), K(backup_dest_)); } else if (FALSE_IT(buf_size = get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(write_buf(diagnose_info, buf, buf_size, pos))) { @@ -2477,11 +2478,11 @@ int64_t ObExternBackupSetFileInfos::get_write_buf_size() const return size; } -int ObExternBackupSetFileInfos::write_buf(char* buf, const int64_t buf_len, int64_t& pos) const +int ObExternBackupSetFileInfos::write_buf(char *buf, const int64_t buf_len, int64_t &pos) const { int ret = OB_SUCCESS; const int64_t need_size = get_write_buf_size(); - ObBackupCommonHeader* common_header = nullptr; + ObBackupCommonHeader *common_header = nullptr; if (OB_ISNULL(buf) || buf_len - pos < need_size) { ret = OB_INVALID_ARGUMENT; @@ -2506,7 +2507,7 @@ int ObExternBackupSetFileInfos::write_buf(char* buf, const int64_t buf_len, int6 return ret; } -int ObExternBackupSetFileInfos::read_buf(const char* buf, const int64_t buf_len) +int ObExternBackupSetFileInfos::read_buf(const char *buf, const int64_t buf_len) { int ret = OB_SUCCESS; @@ -2515,7 +2516,7 @@ int ObExternBackupSetFileInfos::read_buf(const char* buf, const int64_t buf_len) LOG_WARN("invalid args", K(ret), KP(buf), K(buf_len)); } else { int64_t pos = 0; - const ObBackupCommonHeader* common_header = reinterpret_cast(buf + pos); + const ObBackupCommonHeader *common_header = reinterpret_cast(buf + pos); pos += common_header->header_length_; if (OB_FAIL(common_header->check_header_checksum())) { LOG_WARN("failed to check common header", K(ret)); @@ -2535,14 +2536,14 @@ int ObExternBackupSetFileInfos::read_buf(const char* buf, const int64_t buf_len) } int ObExternBackupSetFileInfos::get_backup_set_file_info_(const uint64_t tenant_id, const int64_t incarnation, - const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo*& backup_set_file_info_ptr) + const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo *&backup_set_file_info_ptr) { int ret = OB_SUCCESS; bool found = false; backup_set_file_info_ptr = NULL; for (int64_t i = backup_set_file_info_array_.count() - 1; i >= 0 && !found; --i) { - ObBackupSetFileInfo& backup_set_file_info = backup_set_file_info_array_.at(i); + ObBackupSetFileInfo &backup_set_file_info = backup_set_file_info_array_.at(i); if (backup_set_file_info.tenant_id_ == tenant_id && backup_set_file_info.incarnation_ == incarnation && backup_set_file_info.backup_set_id_ == backup_set_id && backup_set_file_info.copy_id_ == copy_id) { backup_set_file_info_ptr = &backup_set_file_info; @@ -2557,10 +2558,10 @@ int ObExternBackupSetFileInfos::get_backup_set_file_info_(const uint64_t tenant_ return ret; } -int ObExternBackupSetFileInfos::add(const ObBackupSetFileInfo& backup_set_file_info) +int ObExternBackupSetFileInfos::add(const ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; - ObBackupSetFileInfo* backup_set_file_info_ptr = NULL; + ObBackupSetFileInfo *backup_set_file_info_ptr = NULL; if (!backup_set_file_info.is_valid()) { ret = OB_INVALID_ARGUMENT; @@ -2591,10 +2592,10 @@ int ObExternBackupSetFileInfos::add(const ObBackupSetFileInfo& backup_set_file_i return ret; } -int ObExternBackupSetFileInfos::update(const ObBackupSetFileInfo& backup_set_file_info) +int ObExternBackupSetFileInfos::update(const ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; - ObBackupSetFileInfo* backup_set_file_info_ptr = NULL; + ObBackupSetFileInfo *backup_set_file_info_ptr = NULL; ; if (!backup_set_file_info.is_valid()) { @@ -2622,10 +2623,10 @@ int ObExternBackupSetFileInfos::update(const ObBackupSetFileInfo& backup_set_fil } int ObExternBackupSetFileInfos::get_backup_set_file_info(const int64_t tenant_id, const int64_t incarnation, - const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo& backup_set_file_info) + const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; - ObBackupSetFileInfo* backup_set_file_info_ptr = NULL; + ObBackupSetFileInfo *backup_set_file_info_ptr = NULL; if (OB_INVALID_ID == tenant_id || incarnation <= 0 || backup_set_id <= 0 || copy_id < 0) { ret = OB_INVALID_ARGUMENT; LOG_WARN("get backup set file info get invalid argument", @@ -2646,7 +2647,7 @@ int ObExternBackupSetFileInfos::get_backup_set_file_info(const int64_t tenant_id return ret; } -int ObExternBackupSetFileInfos::get_backup_set_file_infos(ObIArray& backup_set_file_infos) +int ObExternBackupSetFileInfos::get_backup_set_file_infos(ObIArray &backup_set_file_infos) { int ret = OB_SUCCESS; if (OB_FAIL(backup_set_file_infos.assign(backup_set_file_info_array_))) { @@ -2656,7 +2657,7 @@ int ObExternBackupSetFileInfos::get_backup_set_file_infos(ObIArray= 0; --i) { - const ObBackupSetFileInfo& tmp_backup_set_file_info = backup_set_file_info_array_.at(i); + const ObBackupSetFileInfo &tmp_backup_set_file_info = backup_set_file_info_array_.at(i); if (ObBackupSetFileInfo::SUCCESS != tmp_backup_set_file_info.status_ || ObBackupFileStatus::BACKUP_FILE_AVAILABLE != tmp_backup_set_file_info.file_status_ || OB_SUCCESS != tmp_backup_set_file_info.result_) { @@ -2687,7 +2688,7 @@ int ObExternBackupSetFileInfos::find_backup_set_file_info( } for (int64_t i = idx; OB_SUCC(ret) && i >= 0; --i) { - const ObBackupSetFileInfo& tmp_backup_set_file_info = backup_set_file_info_array_.at(i); + const ObBackupSetFileInfo &tmp_backup_set_file_info = backup_set_file_info_array_.at(i); if (ObBackupSetFileInfo::SUCCESS != tmp_backup_set_file_info.status_ || ObBackupFileStatus::BACKUP_FILE_AVAILABLE != tmp_backup_set_file_info.file_status_ || OB_SUCCESS != tmp_backup_set_file_info.result_) { @@ -2701,7 +2702,7 @@ int ObExternBackupSetFileInfos::find_backup_set_file_info( return ret; } -int ObExternBackupSetFileInfos::check_passwd_(const char* passwd_array, const char* passwd) +int ObExternBackupSetFileInfos::check_passwd_(const char *passwd_array, const char *passwd) { int ret = OB_SUCCESS; if (OB_FAIL(ObBackupUtils::check_passwd(passwd_array, passwd))) { @@ -2710,7 +2711,7 @@ int ObExternBackupSetFileInfos::check_passwd_(const char* passwd_array, const ch return ret; } -int ObExternBackupSetFileInfos::mark_backup_set_file_deleting(const ObBackupSetIdPair& backup_set_id_pair) +int ObExternBackupSetFileInfos::mark_backup_set_file_deleting(const ObBackupSetIdPair &backup_set_id_pair) { int ret = OB_SUCCESS; const ObBackupFileStatus::STATUS file_status = ObBackupFileStatus::BACKUP_FILE_DELETING; @@ -2720,7 +2721,7 @@ int ObExternBackupSetFileInfos::mark_backup_set_file_deleting(const ObBackupSetI LOG_WARN("mark backup set file deleting get invalid argument", K(ret), K(backup_set_id_pair)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < backup_set_file_info_array_.count(); ++i) { - ObBackupSetFileInfo& backup_set_file_info = backup_set_file_info_array_.at(i); + ObBackupSetFileInfo &backup_set_file_info = backup_set_file_info_array_.at(i); if (backup_set_id_pair.backup_set_id_ == backup_set_file_info.backup_set_id_ && backup_set_id_pair.copy_id_ == backup_set_file_info.copy_id_) { if (ObBackupFileStatus::BACKUP_FILE_DELETING == backup_set_file_info.file_status_ || @@ -2735,7 +2736,7 @@ int ObExternBackupSetFileInfos::mark_backup_set_file_deleting(const ObBackupSetI return ret; } -int ObExternBackupSetFileInfos::mark_backup_set_file_deleted(const ObBackupSetIdPair& backup_set_id_pair) +int ObExternBackupSetFileInfos::mark_backup_set_file_deleted(const ObBackupSetIdPair &backup_set_id_pair) { int ret = OB_SUCCESS; const ObBackupFileStatus::STATUS file_status = ObBackupFileStatus::BACKUP_FILE_DELETED; @@ -2745,7 +2746,7 @@ int ObExternBackupSetFileInfos::mark_backup_set_file_deleted(const ObBackupSetId LOG_WARN("mark backup set file deleting get invalid argument", K(ret), K(backup_set_id_pair)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < backup_set_file_info_array_.count(); ++i) { - ObBackupSetFileInfo& backup_set_file_info = backup_set_file_info_array_.at(i); + ObBackupSetFileInfo &backup_set_file_info = backup_set_file_info_array_.at(i); if (backup_set_id_pair.backup_set_id_ == backup_set_file_info.backup_set_id_ && backup_set_id_pair.copy_id_ == backup_set_file_info.copy_id_) { if (ObBackupFileStatus::BACKUP_FILE_DELETED == backup_set_file_info.file_status_) { @@ -2763,7 +2764,7 @@ bool ObExternBackupSetFileInfos::is_all_extern_backup_set_file_infos_deleted() c { bool ret = true; for (int64_t i = 0; i < backup_set_file_info_array_.count(); ++i) { - const ObBackupSetFileInfo& backup_set_file_info = backup_set_file_info_array_.at(i); + const ObBackupSetFileInfo &backup_set_file_info = backup_set_file_info_array_.at(i); if (ObBackupFileStatus::BACKUP_FILE_DELETED != backup_set_file_info.file_status_) { ret = false; break; @@ -2789,8 +2790,8 @@ void ObExternBackupSetFileInfoMgr::clear() backup_set_file_infos_.reset(); } -int ObExternBackupSetFileInfoMgr::init(const uint64_t tenant_id, const ObClusterBackupDest& backup_dest, - const bool is_backup_backup, share::ObIBackupLeaseService& backup_lease_service) +int ObExternBackupSetFileInfoMgr::init(const uint64_t tenant_id, const ObClusterBackupDest &backup_dest, + const bool is_backup_backup, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -2819,7 +2820,7 @@ int ObExternBackupSetFileInfoMgr::init(const uint64_t tenant_id, const ObCluster } int ObExternBackupSetFileInfoMgr::get_backup_path( - const uint64_t tenant_id, const ObClusterBackupDest& backup_dest, const bool is_backup_backup, ObBackupPath& path) + const uint64_t tenant_id, const ObClusterBackupDest &backup_dest, const bool is_backup_backup, ObBackupPath &path) { int ret = OB_SUCCESS; if (OB_SYS_TENANT_ID == tenant_id) { @@ -2836,11 +2837,11 @@ int ObExternBackupSetFileInfoMgr::get_backup_path( } int ObExternBackupSetFileInfoMgr::get_extern_backup_set_file_infos( - const uint64_t tenant_id, const ObBackupPath& path, const ObClusterBackupDest& backup_dest) + const uint64_t tenant_id, const ObBackupPath &path, const ObClusterBackupDest &backup_dest) { int ret = OB_SUCCESS; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -2854,7 +2855,7 @@ int ObExternBackupSetFileInfoMgr::get_extern_backup_set_file_infos( } } else if (0 == file_length) { FLOG_INFO("extern backup info is empty", K(ret), K(tenant_id), K(path)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(path)); } else if (OB_FAIL( @@ -2871,7 +2872,7 @@ int ObExternBackupSetFileInfoMgr::get_extern_backup_set_file_infos( return ret; } -int ObExternBackupSetFileInfoMgr::add_backup_set_file_info(const ObBackupSetFileInfo& backup_set_file_info) +int ObExternBackupSetFileInfoMgr::add_backup_set_file_info(const ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -2886,7 +2887,7 @@ int ObExternBackupSetFileInfoMgr::add_backup_set_file_info(const ObBackupSetFile return ret; } -int ObExternBackupSetFileInfoMgr::update_backup_set_file_info(const ObBackupSetFileInfo& backup_set_file_info) +int ObExternBackupSetFileInfoMgr::update_backup_set_file_info(const ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; @@ -2903,7 +2904,7 @@ int ObExternBackupSetFileInfoMgr::update_backup_set_file_info(const ObBackupSetF } int ObExternBackupSetFileInfoMgr::get_backup_set_file_infos( - common::ObIArray& backup_set_file_infos) + common::ObIArray &backup_set_file_infos) { int ret = OB_SUCCESS; backup_set_file_infos.reset(); @@ -2917,7 +2918,7 @@ int ObExternBackupSetFileInfoMgr::get_backup_set_file_infos( } int ObExternBackupSetFileInfoMgr::get_backup_set_file_info(const uint64_t tenant_id, const int64_t incarnation, - const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo& backup_set_file_info) + const int64_t backup_set_id, const int64_t copy_id, ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; backup_set_file_info.reset(); @@ -2945,7 +2946,7 @@ int ObExternBackupSetFileInfoMgr::upload_backup_set_file_info() { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need_retry*/); @@ -2957,7 +2958,7 @@ int ObExternBackupSetFileInfoMgr::upload_backup_set_file_info() } else if (OB_FAIL(get_backup_path(tenant_id_, backup_dest_, is_backup_backup_, path))) { LOG_WARN("failed to get backup path", K(ret), K(tenant_id_), K(backup_dest_)); } else if (FALSE_IT(buf_size = backup_set_file_infos_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(backup_set_file_infos_.write_buf(buf, buf_size, pos))) { @@ -2978,7 +2979,7 @@ int ObExternBackupSetFileInfoMgr::upload_backup_set_file_info() } int ObExternBackupSetFileInfoMgr::find_backup_set_file_info( - const int64_t restore_snapshot_version, const char* passwd_array, ObBackupSetFileInfo& backup_set_file_info) + const int64_t restore_snapshot_version, const char *passwd_array, ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; backup_set_file_info.reset(); @@ -2996,7 +2997,7 @@ int ObExternBackupSetFileInfoMgr::find_backup_set_file_info( } int ObExternBackupSetFileInfoMgr::mark_backup_set_file_deleting( - const common::ObIArray& backup_set_id_pairs) + const common::ObIArray &backup_set_id_pairs) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -3004,7 +3005,7 @@ int ObExternBackupSetFileInfoMgr::mark_backup_set_file_deleting( LOG_WARN("extern backup set file info mgr do not init", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < backup_set_id_pairs.count(); ++i) { - const ObBackupSetIdPair& backup_set_id_pair = backup_set_id_pairs.at(i); + const ObBackupSetIdPair &backup_set_id_pair = backup_set_id_pairs.at(i); if (OB_FAIL(backup_set_file_infos_.mark_backup_set_file_deleting(backup_set_id_pair))) { LOG_WARN("failed to mark backup set file deleting", K(ret), K(backup_set_id_pair)); } @@ -3029,7 +3030,7 @@ int ObExternBackupSetFileInfoMgr::mark_backup_set_file_deleted( LOG_WARN("extern backup set file info mgr do not init", K(ret)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < backup_set_id_pairs.count(); ++i) { - const ObBackupSetIdPair& backup_set_id_pair = backup_set_id_pairs.at(i); + const ObBackupSetIdPair &backup_set_id_pair = backup_set_id_pairs.at(i); if (OB_FAIL(backup_set_file_infos_.mark_backup_set_file_deleted(backup_set_id_pair))) { LOG_WARN("failed to mark backup set file deleted", K(ret), K(backup_set_id_pair)); } @@ -3080,7 +3081,7 @@ int ObExternBackupSetFileInfoMgr::update_backup_set_file_timestamp() } int ObExternBackupSetFileInfoMgr::get_backup_path( - const ObClusterBackupDest& backup_dest, const bool is_backup_backup, ObBackupPath& path) + const ObClusterBackupDest &backup_dest, const bool is_backup_backup, ObBackupPath &path) { int ret = OB_SUCCESS; if (!is_inited_) { @@ -3112,7 +3113,7 @@ ObExternSingleBackupSetInfoMgr::~ObExternSingleBackupSetInfoMgr() {} int ObExternSingleBackupSetInfoMgr::init( - const share::ObSimpleBackupSetPath& simple_path, share::ObIBackupLeaseService& backup_lease_service) + const share::ObSimpleBackupSetPath &simple_path, share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -3137,8 +3138,8 @@ int ObExternSingleBackupSetInfoMgr::init( } int ObExternSingleBackupSetInfoMgr::init(const uint64_t tenant_id, const int64_t full_backup_set_id, - const int64_t inc_backup_set_id, const int64_t backup_date, const ObClusterBackupDest& backup_dest, - share::ObIBackupLeaseService& backup_lease_service) + const int64_t inc_backup_set_id, const int64_t backup_date, const ObClusterBackupDest &backup_dest, + share::ObIBackupLeaseService &backup_lease_service) { int ret = OB_SUCCESS; ObBackupPath path; @@ -3182,11 +3183,11 @@ int ObExternSingleBackupSetInfoMgr::init(const uint64_t tenant_id, const int64_t } int ObExternSingleBackupSetInfoMgr::get_extern_single_backup_set_info( - const common::ObString& uri, const common::ObString& storage_info) + const common::ObString &uri, const common::ObString &storage_info) { int ret = OB_SUCCESS; int64_t file_length = 0; - char* buf = nullptr; + char *buf = nullptr; int64_t read_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -3200,7 +3201,7 @@ int ObExternSingleBackupSetInfoMgr::get_extern_single_backup_set_info( } } else if (0 == file_length) { FLOG_INFO("extern single backup set info is empty", K(ret), K(uri)); - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(file_length)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(file_length), K(uri)); } else if (OB_FAIL(util.read_single_file(uri, storage_info, buf, file_length, read_size))) { @@ -3217,11 +3218,11 @@ int ObExternSingleBackupSetInfoMgr::get_extern_single_backup_set_info( return ret; } -int ObExternSingleBackupSetInfoMgr::upload_backup_set_file_info(const ObBackupSetFileInfo& backup_set_file_info) +int ObExternSingleBackupSetInfoMgr::upload_backup_set_file_info(const ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; ObBackupPath path; - char* buf = nullptr; + char *buf = nullptr; int64_t buf_size = 0; ObArenaAllocator allocator; ObStorageUtil util(false /*need retry*/); @@ -3249,7 +3250,7 @@ int ObExternSingleBackupSetInfoMgr::upload_backup_set_file_info(const ObBackupSe } else if (!is_empty && OB_FAIL(backup_set_file_infos_.update(backup_set_file_info))) { LOG_WARN("failed to push extern backup set info into array", K(ret), K(backup_set_file_info)); } else if (FALSE_IT(buf_size = backup_set_file_infos_.get_write_buf_size())) { - } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { + } else if (OB_ISNULL(buf = reinterpret_cast(allocator.alloc(buf_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc buf", K(ret), K(buf_size)); } else if (OB_FAIL(backup_set_file_infos_.write_buf(buf, buf_size, pos))) { @@ -3270,7 +3271,7 @@ int ObExternSingleBackupSetInfoMgr::upload_backup_set_file_info(const ObBackupSe return ret; } -int ObExternSingleBackupSetInfoMgr::get_extern_backup_set_file_info(ObBackupSetFileInfo& backup_set_file_info) +int ObExternSingleBackupSetInfoMgr::get_extern_backup_set_file_info(ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; ObArray backup_set_file_infos; @@ -3292,7 +3293,7 @@ int ObExternSingleBackupSetInfoMgr::get_extern_backup_set_file_info(ObBackupSetF } int ObExternSingleBackupSetInfoMgr::get_extern_backup_set_file_info( - const char* passwd_array, ObBackupSetFileInfo& backup_set_file_info) + const char *passwd_array, ObBackupSetFileInfo &backup_set_file_info) { int ret = OB_SUCCESS; ObArray backup_set_file_infos; diff --git a/src/share/schema/ob_schema_struct.h b/src/share/schema/ob_schema_struct.h index 5a095dc6e9058b82ed1be4e2389aeda1c36ae7c1..af576f26dee352243bb6f40991f29d6b5be3c4dc 100644 --- a/src/share/schema/ob_schema_struct.h +++ b/src/share/schema/ob_schema_struct.h @@ -63,8 +63,8 @@ class ObColumnSchemaV2; (dst)->field.assign(buffer + offset, (src)->field.length()); \ offset += (src)->field.length() + (skip); -#define ASSIGN_CONST_STRING(dst, src, field, buffer, skip) \ - (const_cast((dst)->field)).assign(buffer + offset, (src)->field.length()); \ +#define ASSIGN_CONST_STRING(dst, src, field, buffer, skip) \ + (const_cast((dst)->field)).assign(buffer + offset, (src)->field.length()); \ offset += (src)->field.length() + (skip); // match the default now func @@ -137,7 +137,7 @@ enum ObPartitionFuncType { PARTITION_FUNC_TYPE_MAX, }; -int get_part_type_str(ObPartitionFuncType type, common::ObString& str, bool can_change = true); +int get_part_type_str(ObPartitionFuncType type, common::ObString &str, bool can_change = true); inline bool is_hash_part(const ObPartitionFuncType part_type) { @@ -169,7 +169,7 @@ inline bool is_list_part(const ObPartitionFuncType part_type) return PARTITION_FUNC_TYPE_LIST == part_type || PARTITION_FUNC_TYPE_LIST_COLUMNS == part_type; } -int is_sys_table_name(uint64_t database_id, const common::ObString& table_name, bool& is_sys_table); +int is_sys_table_name(uint64_t database_id, const common::ObString &table_name, bool &is_sys_table); // adding new table type, take care ObRootUtils::is_balance_target_schema() interface // This structure indicates whether the tableSchema of this type is the object of load balancing, @@ -193,8 +193,8 @@ enum ObTableType { }; // ObTableType=>const char* ; used for show tables -const char* ob_table_type_str(ObTableType type); -const char* ob_mysql_table_type_str(ObTableType type); +const char *ob_table_type_str(ObTableType type); +const char *ob_mysql_table_type_str(ObTableType type); ObTableType get_inner_table_type_by_id(const uint64_t tid); @@ -232,7 +232,7 @@ enum ViewCheckOption { VIEW_CHECK_OPTION_MAX = 3, }; -const char* ob_view_check_option_str(const ViewCheckOption option); +const char *ob_view_check_option_str(const ViewCheckOption option); enum ObIndexStatus { // this is used in index virtual table:__index_process_info:means the table may be deleted when you get it INDEX_STATUS_NOT_FOUND = 0, @@ -291,7 +291,7 @@ public: return common::OB_INVALID_TENANT_ID != tenant_id_; } - bool operator==(const ObRefreshSchemaStatus& other) const + bool operator==(const ObRefreshSchemaStatus &other) const { return ((this == &other) || (this->tenant_id_ == other.tenant_id_ && this->snapshot_timestamp_ == other.snapshot_timestamp_ && @@ -320,10 +320,10 @@ public: sequence_id_(common::OB_INVALID_ID), split_schema_version_(common::OB_INVALID_VERSION) {} - ObRefreshSchemaInfo(const ObRefreshSchemaInfo& other); + ObRefreshSchemaInfo(const ObRefreshSchemaInfo &other); virtual ~ObRefreshSchemaInfo() {} - int assign(const ObRefreshSchemaInfo& other); + int assign(const ObRefreshSchemaInfo &other); void reset(); bool is_valid() const; void set_tenant_id(const uint64_t tenant_id) @@ -437,23 +437,23 @@ inline bool is_available_index_status(const ObIndexStatus index_status) return INDEX_STATUS_AVAILABLE == index_status; } -const char* ob_index_status_str(ObIndexStatus status); +const char *ob_index_status_str(ObIndexStatus status); struct ObTenantTableId { ObTenantTableId() : tenant_id_(common::OB_INVALID_ID), table_id_(common::OB_INVALID_ID) {} ObTenantTableId(const uint64_t tenant_id, const uint64_t table_id) : tenant_id_(tenant_id), table_id_(table_id) {} - bool operator==(const ObTenantTableId& rv) const + bool operator==(const ObTenantTableId &rv) const { return (tenant_id_ == rv.tenant_id_) && (table_id_ == rv.table_id_); } - ObTenantTableId& operator=(const ObTenantTableId& tenant_table_id); + ObTenantTableId &operator=(const ObTenantTableId &tenant_table_id); int64_t hash() const { return table_id_; } - bool operator<(const ObTenantTableId& rv) const + bool operator<(const ObTenantTableId &rv) const { bool res = tenant_id_ < rv.tenant_id_; if (tenant_id_ == rv.tenant_id_) { @@ -483,7 +483,7 @@ struct ObTenantDatabaseId { ObTenantDatabaseId(const uint64_t tenant_id, const uint64_t database_id) : tenant_id_(tenant_id), database_id_(database_id) {} - bool operator==(const ObTenantDatabaseId& rv) const + bool operator==(const ObTenantDatabaseId &rv) const { return ((tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_)); } @@ -491,7 +491,7 @@ struct ObTenantDatabaseId { { return database_id_; } - bool operator<(const ObTenantDatabaseId& rv) const + bool operator<(const ObTenantDatabaseId &rv) const { bool res = tenant_id_ < rv.tenant_id_; if (tenant_id_ == rv.tenant_id_) { @@ -521,7 +521,7 @@ struct ObTenantTablegroupId { ObTenantTablegroupId(const uint64_t tenant_id, const uint64_t tablegroup_id) : tenant_id_(tenant_id), tablegroup_id_(tablegroup_id) {} - bool operator==(const ObTenantTablegroupId& rv) const + bool operator==(const ObTenantTablegroupId &rv) const { return (tenant_id_ == rv.tenant_id_) && (tablegroup_id_ == rv.tablegroup_id_); } @@ -529,7 +529,7 @@ struct ObTenantTablegroupId { { return tablegroup_id_; } - bool operator<(const ObTenantTablegroupId& rv) const + bool operator<(const ObTenantTablegroupId &rv) const { bool res = tenant_id_ < rv.tenant_id_; if (tenant_id_ == rv.tenant_id_) { @@ -586,9 +586,9 @@ typedef enum { } ObSchemaType; // The user tenant system table schema is taken from the system tenant, and the schema_id needs to be changed -int need_change_schema_id(const ObSchemaType schema_type, const uint64_t schema_id, bool& need_change); +int need_change_schema_id(const ObSchemaType schema_type, const uint64_t schema_id, bool &need_change); -const char* schema_type_str(const ObSchemaType schema_type); +const char *schema_type_str(const ObSchemaType schema_type); bool is_normal_schema(const ObSchemaType schema_type); @@ -621,7 +621,7 @@ class PartIdPartitionArrayCmp { public: PartIdPartitionArrayCmp() : ret_(common::OB_SUCCESS) {} - bool operator()(const share::schema::ObPartition* left, const share::schema::ObPartition* right); + bool operator()(const share::schema::ObPartition *left, const share::schema::ObPartition *right); public: int get_ret() const @@ -638,7 +638,7 @@ class SubPartIdPartitionArrayCmp { public: SubPartIdPartitionArrayCmp() : ret_(common::OB_SUCCESS) {} - bool operator()(const share::schema::ObSubPartition* left, const share::schema::ObSubPartition* right); + bool operator()(const share::schema::ObSubPartition *left, const share::schema::ObSubPartition *right); public: int get_ret() const @@ -705,9 +705,9 @@ enum TenantStatus { TENANT_DELETED, }; -inline const char* print_table_status(const TableStatus status_no) +inline const char *print_table_status(const TableStatus status_no) { - const char* status_str = "UNKNOWN"; + const char *status_str = "UNKNOWN"; switch (status_no) { case TABLE_NOT_CREATE: status_str = "TABLE_NOT_CREATE"; @@ -733,9 +733,9 @@ enum PartitionStatus { PART_DELETED, // partition is deleted }; -inline const char* print_part_status(const PartitionStatus status) +inline const char *print_part_status(const PartitionStatus status) { - const char* str = "UNKNOWN"; + const char *str = "UNKNOWN"; switch (status) { case PART_STATUS_INVALID: str = "PART_STATUS_INVALID"; @@ -825,12 +825,12 @@ struct ObSchemaObjVersion { { return object_type_; } - inline bool operator==(const ObSchemaObjVersion& other) const + inline bool operator==(const ObSchemaObjVersion &other) const { return object_id_ == other.object_id_ && version_ == other.version_ && object_type_ == other.object_type_ && is_db_explicit_ == other.is_db_explicit_ && is_existed_ == other.is_existed_; } - inline bool operator!=(const ObSchemaObjVersion& other) const + inline bool operator!=(const ObSchemaObjVersion &other) const { return !operator==(other); } @@ -942,12 +942,12 @@ struct ObSysParam { ObSysParam(); ~ObSysParam(); - int init(const uint64_t tenant_id, const common::ObZone& zone, const common::ObString& name, const int64_t data_type, - const common::ObString& value, const common::ObString& min_val, const common::ObString& max_val, - const common::ObString& info, const int64_t flags); + int init(const uint64_t tenant_id, const common::ObZone &zone, const common::ObString &name, const int64_t data_type, + const common::ObString &value, const common::ObString &min_val, const common::ObString &max_val, + const common::ObString &info, const int64_t flags); void reset(); inline bool is_valid() const; - int64_t to_string(char* buf, const int64_t buf_len) const; + int64_t to_string(char *buf, const int64_t buf_len) const; uint64_t tenant_id_; common::ObZone zone_; @@ -970,13 +970,13 @@ typedef common::ObFixedBitSet ColumnR // Caution: zone_ here doesn't have buffer, users should manange // the buffer memory all by themselves. struct ObZoneScore { - ObZoneScore(common::ObString& zone, int64_t score) : zone_(zone), score_(score) + ObZoneScore(common::ObString &zone, int64_t score) : zone_(zone), score_(score) {} ObZoneScore() : zone_(), score_(INT64_MAX) {} virtual ~ObZoneScore() {} - bool operator<(const ObZoneScore& that) + bool operator<(const ObZoneScore &that) { return score_ < that.score_; } @@ -996,9 +996,9 @@ struct ObZoneScore { struct ObZoneRegion { ObZoneRegion() : zone_(), region_() {} - ObZoneRegion(const ObZoneRegion& that) : zone_(that.zone_), region_(that.region_) + ObZoneRegion(const ObZoneRegion &that) : zone_(that.zone_), region_(that.region_) {} - ObZoneRegion(const common::ObZone& zone, const common::ObRegion& region) : zone_(zone), region_(region) + ObZoneRegion(const common::ObZone &zone, const common::ObRegion ®ion) : zone_(zone), region_(region) {} virtual ~ObZoneRegion() {} @@ -1007,7 +1007,7 @@ struct ObZoneRegion { zone_.reset(); region_.reset(); } - int assign(const ObZoneRegion& that) + int assign(const ObZoneRegion &that) { int ret = common::OB_SUCCESS; if (OB_FAIL(zone_.assign(that.zone_.ptr()))) { @@ -1045,7 +1045,7 @@ public: {} ~ObCompareNameWithTenantID() {} - int compare(const common::ObString& str1, const common::ObString& str2); + int compare(const common::ObString &str1, const common::ObString &str2); private: uint64_t tenant_id_; @@ -1059,7 +1059,7 @@ public: friend class ObPrimaryZone; ObSchema(); // explicit ObSchema(common::ObDataBuffer &buffer); - explicit ObSchema(common::ObIAllocator* allocator); + explicit ObSchema(common::ObIAllocator *allocator); virtual ~ObSchema(); virtual void reset(); virtual bool is_valid() const @@ -1067,10 +1067,10 @@ public: return common::OB_SUCCESS == error_ret_; } virtual int zone_array2str( - const common::ObIArray& zone_list, char* str, const int64_t buf_size) const; + const common::ObIArray &zone_list, char *str, const int64_t buf_size) const; virtual int string_array2str( - const common::ObIArray& string_array, char* buf, const int64_t buf_size) const; - virtual int str2string_array(const char* str, common::ObIArray& string_array) const; + const common::ObIArray &string_array, char *buf, const int64_t buf_size) const; + virtual int str2string_array(const char *str, common::ObIArray &string_array) const; virtual int64_t get_convert_size() const { @@ -1078,18 +1078,18 @@ public: }; template static int set_charset_and_collation_options( - common::ObCharsetType src_charset_type, common::ObCollationType src_collation_type, DSTSCHEMA& dst); + common::ObCharsetType src_charset_type, common::ObCollationType src_collation_type, DSTSCHEMA &dst); static common::ObCollationType get_cs_type_with_cmp_mode(const common::ObNameCaseMode mode); - ObSchema* get_buffer() const + ObSchema *get_buffer() const { return buffer_; } - void set_buffer(ObSchema* buffer) + void set_buffer(ObSchema *buffer) { buffer_ = buffer; } - common::ObIAllocator* get_allocator(); + common::ObIAllocator *get_allocator(); void reset_allocator(); int get_assign_ret() { @@ -1102,35 +1102,35 @@ public: protected: static const int64_t STRING_ARRAY_EXTEND_CNT = 7; - void* alloc(const int64_t size); - void free(void* ptr); - int deep_copy_str(const char* src, common::ObString& dest); - int deep_copy_str(const common::ObString& src, common::ObString& dest); - int deep_copy_obj(const common::ObObj& src, common::ObObj& dest); + void *alloc(const int64_t size); + void free(void *ptr); + int deep_copy_str(const char *src, common::ObString &dest); + int deep_copy_str(const common::ObString &src, common::ObString &dest); + int deep_copy_obj(const common::ObObj &src, common::ObObj &dest); int deep_copy_string_array( - const common::ObIArray& src, common::ObArrayHelper& dst); - int add_string_to_array(const common::ObString& str, common::ObArrayHelper& str_array); + const common::ObIArray &src, common::ObArrayHelper &dst); + int add_string_to_array(const common::ObString &str, common::ObArrayHelper &str_array); int serialize_string_array( - char* buf, const int64_t buf_len, int64_t& pos, const common::ObArrayHelper& str_array) const; + char *buf, const int64_t buf_len, int64_t &pos, const common::ObArrayHelper &str_array) const; int deserialize_string_array( - const char* buf, const int64_t data_len, int64_t& pos, common::ObArrayHelper& str_array); - int64_t get_string_array_serialize_size(const common::ObArrayHelper& str_array) const; - void reset_string(common::ObString& str); - void reset_string_array(common::ObArrayHelper& str_array); - const char* extract_str(const common::ObString& str) const; + const char *buf, const int64_t data_len, int64_t &pos, common::ObArrayHelper &str_array); + int64_t get_string_array_serialize_size(const common::ObArrayHelper &str_array) const; + void reset_string(common::ObString &str); + void reset_string_array(common::ObArrayHelper &str_array); + const char *extract_str(const common::ObString &str) const; // buffer is the memory used to store schema item, if not same with this pointer, // it means that this schema item has already been rewrote to buffer when rewriting // other schema manager, and when we want to rewrite this schema item in current schema // manager, we just set pointer of schema item in schema manager to buffer - ObSchema* buffer_; + ObSchema *buffer_; int error_ret_; bool is_inner_allocator_; - common::ObIAllocator* allocator_; + common::ObIAllocator *allocator_; }; template int ObSchema::set_charset_and_collation_options( - common::ObCharsetType src_charset_type, common::ObCollationType src_collation_type, DSTSCHEMA& dst) + common::ObCharsetType src_charset_type, common::ObCollationType src_collation_type, DSTSCHEMA &dst) { int ret = common::OB_SUCCESS; if (dst.get_charset_type() == common::CHARSET_INVALID && dst.get_collation_type() == common::CS_TYPE_INVALID) { @@ -1164,17 +1164,17 @@ class ObLocality { OB_UNIS_VERSION(1); public: - explicit ObLocality(ObSchema* schema) : schema_(schema) + explicit ObLocality(ObSchema *schema) : schema_(schema) {} - int assign(const ObLocality& other); - int set_locality_str(const common::ObString& locality); - int set_zone_replica_attr_array(const common::ObIArray& src); - int set_zone_replica_attr_array(const common::ObIArray& src); + int assign(const ObLocality &other); + int set_locality_str(const common::ObString &locality); + int set_zone_replica_attr_array(const common::ObIArray &src); + int set_zone_replica_attr_array(const common::ObIArray &src); int set_specific_replica_attr_array( - share::SchemaReplicaAttrArray& schema_replica_set, const common::ObIArray& src); + share::SchemaReplicaAttrArray &schema_replica_set, const common::ObIArray &src); void reset_zone_replica_attr_array(); int64_t get_convert_size() const; - inline const common::ObString& get_locality_str() const + inline const common::ObString &get_locality_str() const { return locality_str_; } @@ -1184,26 +1184,26 @@ public: public: common::ObString locality_str_; ZoneLocalityArray zone_replica_attr_array_; - ObSchema* schema_; + ObSchema *schema_; }; class ObPrimaryZone { OB_UNIS_VERSION(1); public: - explicit ObPrimaryZone(ObSchema* schema) : schema_(schema) + explicit ObPrimaryZone(ObSchema *schema) : schema_(schema) {} - int assign(const ObPrimaryZone& other); - inline const common::ObString& get_primary_zone() const + int assign(const ObPrimaryZone &other); + inline const common::ObString &get_primary_zone() const { return primary_zone_str_; } - inline const common::ObIArray& get_primary_zone_array() const + inline const common::ObIArray &get_primary_zone_array() const { return primary_zone_array_; } - int set_primary_zone_array(const common::ObIArray& primary_zone_array); - int set_primary_zone(const common::ObString& zone); + int set_primary_zone_array(const common::ObIArray &primary_zone_array); + int set_primary_zone(const common::ObString &zone); int64_t get_convert_size() const; void reset(); TO_STRING_KV(K_(primary_zone_str), K_(primary_zone_array)); @@ -1211,7 +1211,7 @@ public: public: common::ObString primary_zone_str_; common::ObSEArray primary_zone_array_; - ObSchema* schema_; + ObSchema *schema_; }; class ObSysVarSchema : public ObSchema { @@ -1224,10 +1224,10 @@ public: } ~ObSysVarSchema() {} - explicit ObSysVarSchema(common::ObIAllocator* allocator); - explicit ObSysVarSchema(const ObSysVarSchema& src_schema); - ObSysVarSchema& operator=(const ObSysVarSchema& src_schema); - int assign(const ObSysVarSchema& src_schema); + explicit ObSysVarSchema(common::ObIAllocator *allocator); + explicit ObSysVarSchema(const ObSysVarSchema &src_schema); + ObSysVarSchema &operator=(const ObSysVarSchema &src_schema); + int assign(const ObSysVarSchema &src_schema); virtual bool is_valid() const { return ObSchema::is_valid() && tenant_id_ != common::OB_INVALID_ID && !name_.empty(); @@ -1242,11 +1242,11 @@ public: { tenant_id_ = tenant_id; } - const common::ObString& get_name() const + const common::ObString &get_name() const { return name_; } - int set_name(const common::ObString& name) + int set_name(const common::ObString &name) { return deep_copy_str(name, name_); } @@ -1258,35 +1258,35 @@ public: { data_type_ = data_type; } - const common::ObString& get_value() const + const common::ObString &get_value() const { return value_; } int get_value( - common::ObIAllocator* allocator, const common::ObDataTypeCastParams& dtc_params, common::ObObj& value) const; + common::ObIAllocator *allocator, const common::ObDataTypeCastParams &dtc_params, common::ObObj &value) const; inline int get_value( - common::ObIAllocator* allocator, const common::ObTimeZoneInfo* tz_info, common::ObObj& value) const + common::ObIAllocator *allocator, const common::ObTimeZoneInfo *tz_info, common::ObObj &value) const { const common::ObDataTypeCastParams dtc_params(tz_info); return get_value(allocator, dtc_params, value); } - int set_value(const common::ObString& value) + int set_value(const common::ObString &value) { return deep_copy_str(value, value_); } - const common::ObString& get_min_val() const + const common::ObString &get_min_val() const { return min_val_; } - int set_min_val(const common::ObString& min_val) + int set_min_val(const common::ObString &min_val) { return deep_copy_str(min_val, min_val_); } - const common::ObString& get_max_val() const + const common::ObString &get_max_val() const { return max_val_; } - int set_max_val(const common::ObString& max_val) + int set_max_val(const common::ObString &max_val) { return deep_copy_str(max_val, max_val_); } @@ -1306,23 +1306,23 @@ public: { flags_ = flags; } - int set_info(const common::ObString& info) + int set_info(const common::ObString &info) { return deep_copy_str(info, info_); } - const common::ObString& get_info() const + const common::ObString &get_info() const { return info_; } - int set_zone(const common::ObZone& zone) + int set_zone(const common::ObZone &zone) { return zone_.assign(zone); } - int set_zone(const common::ObString& zone) + int set_zone(const common::ObString &zone) { return zone_.assign(zone); } - const common::ObZone& get_zone() const + const common::ObZone &get_zone() const { return zone_; } @@ -1372,10 +1372,10 @@ class ObSysVariableSchema : public ObSchema { public: // base methods ObSysVariableSchema(); - explicit ObSysVariableSchema(common::ObIAllocator* allocator); + explicit ObSysVariableSchema(common::ObIAllocator *allocator); virtual ~ObSysVariableSchema(); - ObSysVariableSchema(const ObSysVariableSchema& src_schema); - ObSysVariableSchema& operator=(const ObSysVariableSchema& src_schema); + ObSysVariableSchema(const ObSysVariableSchema &src_schema); + ObSysVariableSchema &operator=(const ObSysVariableSchema &src_schema); // set methods inline void set_tenant_id(const uint64_t tenant_id) { @@ -1402,17 +1402,17 @@ public: memset(sysvar_array_, 0, sizeof(sysvar_array_)); } int64_t get_convert_size() const; - int add_sysvar_schema(const share::schema::ObSysVarSchema& sysvar_schema); + int add_sysvar_schema(const share::schema::ObSysVarSchema &sysvar_schema); int load_default_system_variable(bool is_sys_tenant); int64_t get_sysvar_count() const { return ObSysVarFactory::ALL_SYS_VARS_COUNT; } int64_t get_real_sysvar_count() const; - int get_sysvar_schema(const common::ObString& sysvar_name, const ObSysVarSchema*& sysvar_schema) const; - int get_sysvar_schema(ObSysVarClassType var_type, const ObSysVarSchema*& sysvar_schema) const; - const ObSysVarSchema* get_sysvar_schema(int64_t idx) const; - ObSysVarSchema* get_sysvar_schema(int64_t idx); + int get_sysvar_schema(const common::ObString &sysvar_name, const ObSysVarSchema *&sysvar_schema) const; + int get_sysvar_schema(ObSysVarClassType var_type, const ObSysVarSchema *&sysvar_schema) const; + const ObSysVarSchema *get_sysvar_schema(int64_t idx) const; + ObSysVarSchema *get_sysvar_schema(int64_t idx); bool is_read_only() const { return read_only_; @@ -1425,15 +1425,15 @@ public: { name_case_mode_ = mode; } - int get_oracle_mode(bool& is_oracle_mode) const; + int get_oracle_mode(bool &is_oracle_mode) const; TO_STRING_KV(K_(tenant_id), K_(schema_version), "sysvars", - common::ObArrayWrap(sysvar_array_, ObSysVarFactory::ALL_SYS_VARS_COUNT), K_(read_only), + common::ObArrayWrap(sysvar_array_, ObSysVarFactory::ALL_SYS_VARS_COUNT), K_(read_only), K_(name_case_mode)); private: uint64_t tenant_id_; int64_t schema_version_; - ObSysVarSchema* sysvar_array_[ObSysVarFactory::ALL_SYS_VARS_COUNT]; + ObSysVarSchema *sysvar_array_[ObSysVarFactory::ALL_SYS_VARS_COUNT]; bool read_only_; common::ObNameCaseMode name_case_mode_; }; @@ -1446,9 +1446,9 @@ enum ObTenantStatus { TENANT_STATUS_MAX }; -const char* ob_tenant_status_str(const ObTenantStatus); +const char *ob_tenant_status_str(const ObTenantStatus); -int get_tenant_status(const common::ObString& str, ObTenantStatus& status); +int get_tenant_status(const common::ObString &str, ObTenantStatus &status); class ObTenantSchema : public ObSchema { OB_UNIS_VERSION(1); @@ -1456,25 +1456,25 @@ class ObTenantSchema : public ObSchema { public: // base methods ObTenantSchema(); - explicit ObTenantSchema(common::ObIAllocator* allocator); + explicit ObTenantSchema(common::ObIAllocator *allocator); virtual ~ObTenantSchema(); - ObTenantSchema(const ObTenantSchema& src_schema); - ObTenantSchema& operator=(const ObTenantSchema& src_schema); - int assign(const ObTenantSchema& src_schema); + ObTenantSchema(const ObTenantSchema &src_schema); + ObTenantSchema &operator=(const ObTenantSchema &src_schema); + int assign(const ObTenantSchema &src_schema); // for sorted vector - static bool cmp(const ObTenantSchema* lhs, const ObTenantSchema* rhs) + static bool cmp(const ObTenantSchema *lhs, const ObTenantSchema *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_tenant_id() < rhs->get_tenant_id() : false; } - static bool equal(const ObTenantSchema* lhs, const ObTenantSchema* rhs) + static bool equal(const ObTenantSchema *lhs, const ObTenantSchema *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_tenant_id() == rhs->get_tenant_id() : false; } - static bool cmp_tenant_id(const ObTenantSchema* lhs, const uint64_t tenant_id) + static bool cmp_tenant_id(const ObTenantSchema *lhs, const uint64_t tenant_id) { return NULL != lhs ? lhs->get_tenant_id() < tenant_id : false; } - static bool equal_tenant_id(const ObTenantSchema* lhs, const uint64_t tenant_id) + static bool equal_tenant_id(const ObTenantSchema *lhs, const uint64_t tenant_id) { return NULL != lhs ? lhs->get_tenant_id() == tenant_id : false; } @@ -1487,31 +1487,31 @@ public: { schema_version_ = schema_version; } - inline int set_tenant_name(const char* tenant_name) + inline int set_tenant_name(const char *tenant_name) { return deep_copy_str(tenant_name, tenant_name_); } - inline int set_comment(const char* comment) + inline int set_comment(const char *comment) { return deep_copy_str(comment, comment_); } - inline int set_locality(const char* locality) + inline int set_locality(const char *locality) { return deep_copy_str(locality, locality_str_); } - inline int set_previous_locality(const char* previous_locality) + inline int set_previous_locality(const char *previous_locality) { return deep_copy_str(previous_locality, previous_locality_str_); } - inline int set_tenant_name(const common::ObString& tenant_name) + inline int set_tenant_name(const common::ObString &tenant_name) { return deep_copy_str(tenant_name, tenant_name_); } - inline int set_zone_list(const common::ObIArray& zone_list); - int set_zone_list(const common::ObIArray& zone_list); - inline int set_primary_zone(const common::ObString& zone); - int set_primary_zone_array(const common::ObIArray& primary_zone_array); - inline int add_zone(const common::ObString& zone); + inline int set_zone_list(const common::ObIArray &zone_list); + int set_zone_list(const common::ObIArray &zone_list); + inline int set_primary_zone(const common::ObString &zone); + int set_primary_zone_array(const common::ObIArray &primary_zone_array); + inline int add_zone(const common::ObString &zone); inline void set_locked(const bool locked) { locked_ = locked; @@ -1524,15 +1524,15 @@ public: { rewrite_merge_version_ = version; } - inline int set_comment(const common::ObString& comment) + inline int set_comment(const common::ObString &comment) { return deep_copy_str(comment, comment_); } - inline int set_locality(const common::ObString& locality) + inline int set_locality(const common::ObString &locality) { return deep_copy_str(locality, locality_str_); } - inline int set_previous_locality(const common::ObString& previous_locality) + inline int set_previous_locality(const common::ObString &previous_locality) { return deep_copy_str(previous_locality, previous_locality_str_); } @@ -1548,10 +1548,10 @@ public: { name_case_mode_ = mode; } - int set_zone_replica_attr_array(const common::ObIArray& src); - int set_zone_replica_attr_array(const common::ObIArray& src); + int set_zone_replica_attr_array(const common::ObIArray &src); + int set_zone_replica_attr_array(const common::ObIArray &src); int set_specific_replica_attr_array( - share::SchemaReplicaAttrArray& schema_replica_set, const common::ObIArray& src); + share::SchemaReplicaAttrArray &schema_replica_set, const common::ObIArray &src); void reset_zone_replica_attr_array(); inline void set_storage_format_version(const int64_t storage_format_version); inline void set_storage_format_work_version(const int64_t storage_format_work_version); @@ -1559,7 +1559,7 @@ public: { default_tablegroup_id_ = tablegroup_id; } - int set_default_tablegroup_name(const common::ObString& tablegroup_name) + int set_default_tablegroup_name(const common::ObString &tablegroup_name) { return deep_copy_str(tablegroup_name, default_tablegroup_name_); } @@ -1577,23 +1577,23 @@ public: { return schema_version_; } - inline const char* get_tenant_name() const + inline const char *get_tenant_name() const { return extract_str(tenant_name_); } - inline const char* get_comment() const + inline const char *get_comment() const { return extract_str(comment_); } - inline const char* get_locality() const + inline const char *get_locality() const { return extract_str(locality_str_); } - inline const char* get_previous_locality() const + inline const char *get_previous_locality() const { return extract_str(previous_locality_str_); } - inline const common::ObString& get_tenant_name_str() const + inline const common::ObString &get_tenant_name_str() const { return tenant_name_; } @@ -1601,7 +1601,7 @@ public: { return logonly_replica_num_; } - inline const common::ObString& get_primary_zone() const + inline const common::ObString &get_primary_zone() const { return primary_zone_; } @@ -1617,15 +1617,15 @@ public: { return rewrite_merge_version_; } - inline const common::ObString& get_comment_str() const + inline const common::ObString &get_comment_str() const { return comment_; } - inline const common::ObString& get_locality_str() const + inline const common::ObString &get_locality_str() const { return locality_str_; } - inline const common::ObString& get_previous_locality_str() const + inline const common::ObString &get_previous_locality_str() const { return previous_locality_str_; } @@ -1638,23 +1638,23 @@ public: return collation_type_; } int get_raw_first_primary_zone( - const rootserver::ObRandomZoneSelector& random_selector, common::ObZone& first_primary_zone) const; - int get_first_primary_zone(const rootserver::ObRandomZoneSelector& random_selector, - const common::ObIArray& replica_addrs, common::ObZone& first_primary_zone) const; - int get_primary_zone_score(const common::ObZone& zone, int64_t& zone_score) const; - inline const common::ObIArray& get_primary_zone_array() const + const rootserver::ObRandomZoneSelector &random_selector, common::ObZone &first_primary_zone) const; + int get_first_primary_zone(const rootserver::ObRandomZoneSelector &random_selector, + const common::ObIArray &replica_addrs, common::ObZone &first_primary_zone) const; + int get_primary_zone_score(const common::ObZone &zone, int64_t &zone_score) const; + inline const common::ObIArray &get_primary_zone_array() const { return primary_zone_array_; } int get_primary_zone_inherit( - share::schema::ObSchemaGetterGuard& schema_guard, share::schema::ObPrimaryZone& primary_zone) const; - int get_zone_replica_attr_array(ZoneLocalityIArray& locality) const; - int get_zone_replica_attr_array_inherit(ObSchemaGetterGuard& schema_guard, ZoneLocalityIArray& locality) const; + share::schema::ObSchemaGetterGuard &schema_guard, share::schema::ObPrimaryZone &primary_zone) const; + int get_zone_replica_attr_array(ZoneLocalityIArray &locality) const; + int get_zone_replica_attr_array_inherit(ObSchemaGetterGuard &schema_guard, ZoneLocalityIArray &locality) const; int64_t get_full_replica_num() const; - int get_paxos_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const; - int get_zone_list(common::ObIArray& zone_list) const; + int get_paxos_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const; + int get_zone_list(common::ObIArray &zone_list) const; int get_zone_list( - share::schema::ObSchemaGetterGuard& schema_guard, common::ObIArray& zone_list) const; + share::schema::ObSchemaGetterGuard &schema_guard, common::ObIArray &zone_list) const; inline int64_t get_storage_format_version() const { return storage_format_version_; @@ -1667,7 +1667,7 @@ public: { return default_tablegroup_id_; } - inline const common::ObString& get_default_tablegroup_name() const + inline const common::ObString &get_default_tablegroup_name() const { return default_tablegroup_name_; } @@ -1727,17 +1727,17 @@ public: K_(charset_type), K_(locked), K_(comment), K_(name_case_mode), K_(read_only), K_(rewrite_merge_version), K_(locality_str), K_(logonly_replica_num), K_(zone_replica_attr_array), K_(primary_zone_array), K_(storage_format_version), K_(storage_format_work_version), K_(previous_locality_str), "sysvars", - common::ObArrayWrap(sysvar_array_, ObSysVarFactory::ALL_SYS_VARS_COUNT), + common::ObArrayWrap(sysvar_array_, ObSysVarFactory::ALL_SYS_VARS_COUNT), K_(default_tablegroup_id), K_(default_tablegroup_name), K_(compatibility_mode), K_(drop_tenant_time), K_(status), K_(in_recyclebin)); private: - int add_sysvar_schema(const share::schema::ObSysVarSchema& sysvar_schema); + int add_sysvar_schema(const share::schema::ObSysVarSchema &sysvar_schema); int64_t get_sysvar_count() const { return ObSysVarFactory::ALL_SYS_VARS_COUNT; } - const ObSysVarSchema* get_sysvar_schema(int64_t idx) const; + const ObSysVarSchema *get_sysvar_schema(int64_t idx) const; private: uint64_t tenant_id_; @@ -1762,7 +1762,7 @@ private: common::ObString previous_locality_str_; int64_t storage_format_version_; int64_t storage_format_work_version_; - ObSysVarSchema* sysvar_array_[ObSysVarFactory::ALL_SYS_VARS_COUNT]; // deprecated + ObSysVarSchema *sysvar_array_[ObSysVarFactory::ALL_SYS_VARS_COUNT]; // deprecated uint64_t default_tablegroup_id_; common::ObString default_tablegroup_name_; common::ObCompatibilityMode compatibility_mode_; @@ -1771,17 +1771,17 @@ private: bool in_recyclebin_; }; -inline int ObTenantSchema::set_zone_list(const common::ObIArray& zone_list) +inline int ObTenantSchema::set_zone_list(const common::ObIArray &zone_list) { return deep_copy_string_array(zone_list, zone_list_); } -inline int ObTenantSchema::set_primary_zone(const common::ObString& zone) +inline int ObTenantSchema::set_primary_zone(const common::ObString &zone) { return deep_copy_str(zone, primary_zone_); } -inline int ObTenantSchema::add_zone(const common::ObString& zone) +inline int ObTenantSchema::add_zone(const common::ObString &zone) { return add_string_to_array(zone, zone_list_); } @@ -1802,11 +1802,11 @@ class ObDatabaseSchema : public ObSchema { public: // base methods ObDatabaseSchema(); - explicit ObDatabaseSchema(common::ObIAllocator* allocator); + explicit ObDatabaseSchema(common::ObIAllocator *allocator); virtual ~ObDatabaseSchema(); - ObDatabaseSchema(const ObDatabaseSchema& src_schema); - ObDatabaseSchema& operator=(const ObDatabaseSchema& src_schema); - int assign(const ObDatabaseSchema& src_schema); + ObDatabaseSchema(const ObDatabaseSchema &src_schema); + ObDatabaseSchema &operator=(const ObDatabaseSchema &src_schema); + int assign(const ObDatabaseSchema &src_schema); // set methods inline void set_tenant_id(const uint64_t tenant_id) { @@ -1820,24 +1820,24 @@ public: { schema_version_ = schema_version; } - int set_database_name(const char* database_name) + int set_database_name(const char *database_name) { return deep_copy_str(database_name, database_name_); } - int set_database_name(const common::ObString& database_name) + int set_database_name(const common::ObString &database_name) { return deep_copy_str(database_name, database_name_); } - inline int set_zone_list(const common::ObIArray& zone_list); - int set_zone_list(const common::ObIArray& zone_list); - inline int set_primary_zone(const common::ObString& zone); - int set_primary_zone_array(const common::ObIArray& primary_zone_array); - inline int add_zone(const common::ObString& zone); - int set_comment(const char* comment) + inline int set_zone_list(const common::ObIArray &zone_list); + int set_zone_list(const common::ObIArray &zone_list); + inline int set_primary_zone(const common::ObString &zone); + int set_primary_zone_array(const common::ObIArray &primary_zone_array); + inline int add_zone(const common::ObString &zone); + int set_comment(const char *comment) { return deep_copy_str(comment, comment_); } - int set_comment(const common::ObString& comment) + int set_comment(const common::ObString &comment) { return deep_copy_str(comment, comment_); } @@ -1861,7 +1861,7 @@ public: { default_tablegroup_id_ = tablegroup_id; } - int set_default_tablegroup_name(const common::ObString& tablegroup_name) + int set_default_tablegroup_name(const common::ObString &tablegroup_name) { return deep_copy_str(tablegroup_name, default_tablegroup_name_); } @@ -1888,23 +1888,23 @@ public: { return schema_version_; } - inline const char* get_database_name() const + inline const char *get_database_name() const { return extract_str(database_name_); } - inline const common::ObString& get_database_name_str() const + inline const common::ObString &get_database_name_str() const { return database_name_; } - inline const common::ObString& get_primary_zone() const + inline const common::ObString &get_primary_zone() const { return primary_zone_; } - inline const char* get_comment() const + inline const char *get_comment() const { return extract_str(comment_); } - inline const common::ObString& get_comment_str() const + inline const common::ObString &get_comment_str() const { return comment_; } @@ -1928,7 +1928,7 @@ public: { return default_tablegroup_id_; } - inline const common::ObString& get_default_tablegroup_name() const + inline const common::ObString &get_default_tablegroup_name() const { return default_tablegroup_name_; } @@ -1940,29 +1940,29 @@ public: { return in_recyclebin_ || database_id_ == common::combine_id(tenant_id_, common::OB_RECYCLEBIN_SCHEMA_ID); } - inline const common::ObString& get_locality_str() const + inline const common::ObString &get_locality_str() const { static const common::ObString dummy; return dummy; } int get_raw_first_primary_zone( - const rootserver::ObRandomZoneSelector& random_selector, common::ObZone& first_primary_zone) const; - int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard& schema_guard, - const rootserver::ObRandomZoneSelector& random_selector, - const common::ObIArray& replica_addrs, common::ObZone& first_primary_zone) const; - int get_primary_zone_score(const common::ObZone& zone, int64_t& zone_score) const; - inline const common::ObIArray& get_primary_zone_array() const + const rootserver::ObRandomZoneSelector &random_selector, common::ObZone &first_primary_zone) const; + int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard &schema_guard, + const rootserver::ObRandomZoneSelector &random_selector, + const common::ObIArray &replica_addrs, common::ObZone &first_primary_zone) const; + int get_primary_zone_score(const common::ObZone &zone, int64_t &zone_score) const; + inline const common::ObIArray &get_primary_zone_array() const { return primary_zone_array_; } int get_primary_zone_inherit( - share::schema::ObSchemaGetterGuard& schema_guard, share::schema::ObPrimaryZone& primary_zone) const; - int get_paxos_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const; + share::schema::ObSchemaGetterGuard &schema_guard, share::schema::ObPrimaryZone &primary_zone) const; + int get_paxos_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const; int get_zone_replica_attr_array_inherit( - share::schema::ObSchemaGetterGuard& schema_guard, ZoneLocalityIArray& locality) const; + share::schema::ObSchemaGetterGuard &schema_guard, ZoneLocalityIArray &locality) const; // In the current implementation, the zone_list of the Database is directly read from the corresponding tenant. int get_zone_list( - share::schema::ObSchemaGetterGuard& schema_guard, common::ObIArray& zone_list) const; + share::schema::ObSchemaGetterGuard &schema_guard, common::ObIArray &zone_list) const; // other methods int64_t get_convert_size() const; virtual bool is_valid() const; @@ -2006,17 +2006,17 @@ private: int64_t drop_schema_version_; }; -inline int ObDatabaseSchema::set_zone_list(const common::ObIArray& zone_list) +inline int ObDatabaseSchema::set_zone_list(const common::ObIArray &zone_list) { return deep_copy_string_array(zone_list, zone_list_); } -inline int ObDatabaseSchema::set_primary_zone(const common::ObString& zone) +inline int ObDatabaseSchema::set_primary_zone(const common::ObString &zone) { return deep_copy_str(zone, primary_zone_); } -inline int ObDatabaseSchema::add_zone(const common::ObString& zone) +inline int ObDatabaseSchema::add_zone(const common::ObString &zone) { return add_string_to_array(zone, zone_list_); } @@ -2026,12 +2026,12 @@ class ObPartitionOption : public ObSchema { public: ObPartitionOption(); - explicit ObPartitionOption(common::ObIAllocator* allocator); + explicit ObPartitionOption(common::ObIAllocator *allocator); virtual ~ObPartitionOption(); - ObPartitionOption(const ObPartitionOption& expr); - ObPartitionOption& operator=(const ObPartitionOption& expr); - bool operator==(const ObPartitionOption& expr) const; - bool operator!=(const ObPartitionOption& expr) const; + ObPartitionOption(const ObPartitionOption &expr); + ObPartitionOption &operator=(const ObPartitionOption &expr); + bool operator==(const ObPartitionOption &expr) const; + bool operator!=(const ObPartitionOption &expr) const; inline bool is_range_part() const { @@ -2059,7 +2059,7 @@ public: } // set methods - int set_part_expr(const common::ObString& expr) + int set_part_expr(const common::ObString &expr) { return deep_copy_str(expr, part_func_expr_); } @@ -2093,11 +2093,11 @@ public: } // get methods - inline const common::ObString& get_part_func_expr_str() const + inline const common::ObString &get_part_func_expr_str() const { return part_func_expr_; } - inline const char* get_part_func_expr() const + inline const char *get_part_func_expr() const { return extract_str(part_func_expr_); } @@ -2129,11 +2129,11 @@ public: { return is_columns_; } - const common::ObString& get_intervel_start_str() const + const common::ObString &get_intervel_start_str() const { return interval_start_; } - const common::ObString& get_part_intervel_str() const + const common::ObString &get_part_intervel_str() const { return part_interval_; } @@ -2144,7 +2144,7 @@ public: // other methods virtual void reset(); - int64_t assign(const ObPartitionOption& src_part); + int64_t assign(const ObPartitionOption &src_part); int64_t get_convert_size() const; virtual bool is_valid() const; TO_STRING_KV(K_(part_func_type), K_(part_func_expr), K_(part_num), K_(partition_cnt_within_partition_table), @@ -2170,17 +2170,17 @@ class ObSchemaAllocator : public common::ObIAllocator { public: ObSchemaAllocator() : allocator_(NULL) {} - ObSchemaAllocator(common::ObIAllocator& allocator) : allocator_(&allocator) + ObSchemaAllocator(common::ObIAllocator &allocator) : allocator_(&allocator) {} - virtual void* alloc(const int64_t sz) + virtual void *alloc(const int64_t sz) { return alloc(sz, common::default_memattr); } - virtual void* alloc(const int64_t sz, const common::ObMemAttr& attr) + virtual void *alloc(const int64_t sz, const common::ObMemAttr &attr) { - void* ret = NULL; + void *ret = NULL; if (allocator_) { ret = allocator_->alloc(sz, attr); } @@ -2190,7 +2190,7 @@ public: virtual ~ObSchemaAllocator(){}; private: - common::ObIAllocator* allocator_; + common::ObIAllocator *allocator_; }; // May need to add a schema_version field, this mark when the table was created @@ -2203,7 +2203,7 @@ public: {} public: - bool operator()(const common::ObNewRow& left, const common::ObNewRow& right) + bool operator()(const common::ObNewRow &left, const common::ObNewRow &right) { bool bool_ret = false; int cmp = 0; @@ -2233,7 +2233,7 @@ public: friend class ObPartitionUtils; friend class sql::ObPartitionExecutorUtils; ObBasePartition(); - explicit ObBasePartition(common::ObIAllocator* allocator); + explicit ObBasePartition(common::ObIAllocator *allocator); virtual void reset(); void set_tenant_id(const uint64_t tenant_id) { @@ -2280,11 +2280,11 @@ public: return schema_version_; } - int set_part_name(common::ObString& part_name) + int set_part_name(common::ObString &part_name) { return deep_copy_str(part_name, name_); } - const common::ObString& get_part_name() const + const common::ObString &get_part_name() const { return name_; } @@ -2298,32 +2298,32 @@ public: return tablespace_id_; } - int assign(const ObBasePartition& src_part); + int assign(const ObBasePartition &src_part); // This interface is not strictly semantically less than, please note - static bool less_than(const ObBasePartition* lhs, const ObBasePartition* rhs); - static bool list_part_func_layout(const ObBasePartition* lhs, const ObBasePartition* rhs); - static bool range_like_func_less_than(const ObBasePartition* lhs, const ObBasePartition* rhs); - static bool hash_like_func_less_than(const ObBasePartition* lhs, const ObBasePartition* rhs); - int add_list_row(const common::ObNewRow& row) + static bool less_than(const ObBasePartition *lhs, const ObBasePartition *rhs); + static bool list_part_func_layout(const ObBasePartition *lhs, const ObBasePartition *rhs); + static bool range_like_func_less_than(const ObBasePartition *lhs, const ObBasePartition *rhs); + static bool hash_like_func_less_than(const ObBasePartition *lhs, const ObBasePartition *rhs); + int add_list_row(const common::ObNewRow &row) { return list_row_values_.push_back(row); } - int set_high_bound_val(const common::ObRowkey& high_bound_val); - int set_high_bound_val_with_hex_str(const common::ObString& high_bound_val_hex); - int set_list_vector_values_with_hex_str(const common::ObString& list_vector_vals_hex); - const common::ObRowkey& get_high_bound_val() const + int set_high_bound_val(const common::ObRowkey &high_bound_val); + int set_high_bound_val_with_hex_str(const common::ObString &high_bound_val_hex); + int set_list_vector_values_with_hex_str(const common::ObString &list_vector_vals_hex); + const common::ObRowkey &get_high_bound_val() const { return high_bound_val_; } virtual int64_t get_deep_copy_size() const; - const common::ObIArray& get_list_row_values() const + const common::ObIArray &get_list_row_values() const { return list_row_values_; } - bool same_base_partition(const ObBasePartition& other) const + bool same_base_partition(const ObBasePartition &other) const { return part_id_ == other.part_id_ && high_bound_val_ == other.high_bound_val_ && status_ == other.status_; } @@ -2339,18 +2339,18 @@ public: { return status_; } - const common::ObIArray& get_source_part_ids() const + const common::ObIArray &get_source_part_ids() const { return source_part_ids_; } - common::ObIArray& get_source_part_ids() + common::ObIArray &get_source_part_ids() { return source_part_ids_; } - int set_source_part_id(common::ObString& partition_str); + int set_source_part_id(common::ObString &partition_str); VIRTUAL_TO_STRING_KV(K_(tenant_id), K_(table_id), K_(part_id), K_(name), K_(high_bound_val), K_(list_row_values), K_(part_idx), K_(is_empty_partition_name)); - int get_source_part_ids_str(char* str, const int64_t buf_len) const; + int get_source_part_ids_str(char *str, const int64_t buf_len) const; void set_is_empty_partition_name(bool is_empty) { is_empty_partition_name_ = is_empty; @@ -2377,7 +2377,7 @@ protected: * @warning: The projector can only be used by the less than interface for partition comparison calculations, * and it is not allowed to be used in other places */ - int32_t* projector_; + int32_t *projector_; int64_t projector_size_; common::ObSEArray source_part_ids_; int64_t part_idx_; // Valid for hash partition @@ -2395,12 +2395,12 @@ struct ObPartition : public ObBasePartition { public: ObPartition(); - explicit ObPartition(common::ObIAllocator* allocator); - int assign(const ObPartition& src_part); + explicit ObPartition(common::ObIAllocator *allocator); + int assign(const ObPartition &src_part); void reset(); virtual int64_t get_convert_size() const; - virtual int clone(common::ObIAllocator& allocator, ObPartition*& dst) const; + virtual int clone(common::ObIAllocator &allocator, ObPartition *&dst) const; void set_sub_part_num(const int64_t sub_part_num) { @@ -2450,7 +2450,7 @@ public: { return max_used_sub_part_id_; } - ObSubPartition** get_subpart_array() const + ObSubPartition **get_subpart_array() const { return subpartition_array_; } @@ -2458,19 +2458,19 @@ public: { return subpartition_num_; } - ObSubPartition** get_sorted_part_id_subpartition_array() const + ObSubPartition **get_sorted_part_id_subpartition_array() const { return sorted_part_id_subpartition_array_; } - bool same_partition(const ObPartition& other) const + bool same_partition(const ObPartition &other) const { return same_base_partition(other) && sub_part_num_ == other.sub_part_num_ && sub_part_space_ == other.sub_part_space_ && sub_interval_start_ == other.sub_interval_start_ && sub_part_interval_ == other.sub_part_interval_; } - int add_partition(const ObSubPartition& subpartition); + int add_partition(const ObSubPartition &subpartition); int generate_mapping_pg_subpartition_array(); - ObSubPartition** get_dropped_subpart_array() const + ObSubPartition **get_dropped_subpart_array() const { return dropped_subpartition_array_; } @@ -2485,14 +2485,14 @@ public: } INHERIT_TO_STRING_KV("BasePartition", ObBasePartition, K_(mapping_pg_part_id), K_(source_part_ids), K_(drop_schema_version), K_(max_used_sub_part_id), "subpartition_array", - common::ObArrayWrap(subpartition_array_, subpartition_num_), K_(subpartition_array_capacity), + common::ObArrayWrap(subpartition_array_, subpartition_num_), K_(subpartition_array_capacity), "dropped_subpartition_array", - common::ObArrayWrap(dropped_subpartition_array_, dropped_subpartition_num_), + common::ObArrayWrap(dropped_subpartition_array_, dropped_subpartition_num_), K_(dropped_subpartition_array_capacity)); private: int inner_add_partition( - const ObSubPartition& part, ObSubPartition**& part_array, int64_t& part_array_capacity, int64_t& part_num); + const ObSubPartition &part, ObSubPartition **&part_array, int64_t &part_array_capacity, int64_t &part_num); protected: static const int64_t DEFAULT_ARRAY_CAPACITY = 128; @@ -2515,13 +2515,13 @@ private: int64_t subpartition_num_; // The array size of subpartition_array is not necessarily equal to subpartition_num_ int64_t subpartition_array_capacity_; - ObSubPartition** subpartition_array_; + ObSubPartition **subpartition_array_; // Generated when the schema is refreshed, only used by the table, used to quickly index pg_key, not serialized - ObSubPartition** sorted_part_id_subpartition_array_; + ObSubPartition **sorted_part_id_subpartition_array_; /* delay delete subpartition */ int64_t dropped_subpartition_num_; int64_t dropped_subpartition_array_capacity_; - ObSubPartition** dropped_subpartition_array_; + ObSubPartition **dropped_subpartition_array_; }; struct ObSubPartition : public ObBasePartition { @@ -2533,10 +2533,10 @@ public: public: ObSubPartition(); - explicit ObSubPartition(common::ObIAllocator* allocator); - int assign(const ObSubPartition& src_part); + explicit ObSubPartition(common::ObIAllocator *allocator); + int assign(const ObSubPartition &src_part); virtual void reset(); - virtual int clone(common::ObIAllocator& allocator, ObSubPartition*& dst) const; + virtual int clone(common::ObIAllocator &allocator, ObSubPartition *&dst) const; void set_sub_part_id(const int64_t subpart_id) { @@ -2576,14 +2576,14 @@ public: } // first compare part_idx,then compare high_bound_val - static bool less_than(const ObSubPartition* lhs, const ObSubPartition* rhs); - bool same_sub_partition(const ObSubPartition& other) const + static bool less_than(const ObSubPartition *lhs, const ObSubPartition *rhs); + bool same_sub_partition(const ObSubPartition &other) const { return same_base_partition(other) && subpart_id_ == other.subpart_id_; } virtual int64_t get_convert_size() const; - bool key_match(const ObSubPartition& other) const; - static bool hash_like_func_less_than(const ObSubPartition* lhs, const ObSubPartition* rhs); + bool key_match(const ObSubPartition &other) const; + static bool hash_like_func_less_than(const ObSubPartition *lhs, const ObSubPartition *rhs); INHERIT_TO_STRING_KV("BasePartition", ObBasePartition, K_(subpart_id), K_(subpart_idx), K_(mapping_pg_sub_part_id), K_(drop_schema_version)); @@ -2601,13 +2601,13 @@ class ObPartitionSchema : public ObSchema { public: // base methods ObPartitionSchema(); - explicit ObPartitionSchema(common::ObIAllocator* allocator); + explicit ObPartitionSchema(common::ObIAllocator *allocator); virtual ~ObPartitionSchema(); - ObPartitionSchema(const ObPartitionSchema& src_schema); - ObPartitionSchema& operator=(const ObPartitionSchema& src_schema); + ObPartitionSchema(const ObPartitionSchema &src_schema); + ObPartitionSchema &operator=(const ObPartitionSchema &src_schema); // partition related - virtual const char* get_entity_name() const = 0; + virtual const char *get_entity_name() const = 0; virtual uint64_t get_tenant_id() const = 0; virtual void set_tenant_id(const uint64_t tenant_id) = 0; virtual uint64_t get_table_id() const = 0; @@ -2622,23 +2622,23 @@ public: } virtual int64_t get_partition_cnt() const = 0; virtual bool has_self_partition() const = 0; - virtual int get_primary_zone_inherit(ObSchemaGetterGuard& schema_guard, ObPrimaryZone& primary_zone) const = 0; + virtual int get_primary_zone_inherit(ObSchemaGetterGuard &schema_guard, ObPrimaryZone &primary_zone) const = 0; virtual int get_zone_replica_attr_array_inherit( - ObSchemaGetterGuard& schema_guard, ZoneLocalityIArray& locality) const = 0; + ObSchemaGetterGuard &schema_guard, ZoneLocalityIArray &locality) const = 0; virtual int get_zone_list( - share::schema::ObSchemaGetterGuard& schema_guard, common::ObIArray& zone_list) const = 0; + share::schema::ObSchemaGetterGuard &schema_guard, common::ObIArray &zone_list) const = 0; virtual int get_locality_str_inherit( - share::schema::ObSchemaGetterGuard& guard, const common::ObString*& locality_str) const = 0; - virtual int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard& schema_guard, - const rootserver::ObRandomZoneSelector& random_selector, - const common::ObIArray& replica_addrs, common::ObZone& first_primary_zone) const = 0; - virtual int check_is_duplicated(share::schema::ObSchemaGetterGuard& guard, bool& is_duplicated) const = 0; + share::schema::ObSchemaGetterGuard &guard, const common::ObString *&locality_str) const = 0; + virtual int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard &schema_guard, + const rootserver::ObRandomZoneSelector &random_selector, + const common::ObIArray &replica_addrs, common::ObZone &first_primary_zone) const = 0; + virtual int check_is_duplicated(share::schema::ObSchemaGetterGuard &guard, bool &is_duplicated) const = 0; virtual uint64_t get_tablegroup_id() const = 0; virtual void set_tablegroup_id(const uint64_t tg_id) = 0; - virtual const common::ObString& get_locality_str() const = 0; - virtual common::ObString& get_locality_str() = 0; - virtual const common::ObString& get_previous_locality_str() const = 0; - virtual int get_paxos_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const = 0; + virtual const common::ObString &get_locality_str() const = 0; + virtual common::ObString &get_locality_str() = 0; + virtual const common::ObString &get_previous_locality_str() const = 0; + virtual int get_paxos_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const = 0; virtual share::ObDuplicateScope get_duplicate_scope() const = 0; virtual void set_duplicate_scope(const share::ObDuplicateScope duplicate_scope) = 0; virtual void set_duplicate_scope(const int64_t duplicate_scope) = 0; @@ -2693,15 +2693,15 @@ public: } // Only the templated secondary partition is valid, pay attention!! int64_t get_def_sub_part_num() const; - int get_first_individual_sub_part_num(int64_t& sub_part_num) const; + int get_first_individual_sub_part_num(int64_t &sub_part_num) const; // SQL view, unable to see the delayed deleted partition int64_t get_all_part_num() const; - int get_all_partition_num(bool check_dropped_partition, int64_t& part_num) const; + int get_all_partition_num(bool check_dropped_partition, int64_t &part_num) const; - int check_part_name(const ObPartition& partition); - int check_part_id(const ObPartition& partition); - int add_partition(const ObPartition& partition); - int add_def_subpartition(const ObSubPartition& subpartition); + int check_part_name(const ObPartition &partition); + int check_part_id(const ObPartition &partition); + int add_partition(const ObPartition &partition); + int add_def_subpartition(const ObSubPartition &subpartition); inline bool is_hash_part() const { @@ -2749,19 +2749,19 @@ public: return part_option_.is_auto_range_part(); } - inline const ObPartitionOption& get_part_option() const + inline const ObPartitionOption &get_part_option() const { return part_option_; } - inline ObPartitionOption& get_part_option() + inline ObPartitionOption &get_part_option() { return part_option_; } - inline const ObPartitionOption& get_sub_part_option() const + inline const ObPartitionOption &get_sub_part_option() const { return sub_part_option_; } - inline ObPartitionOption& get_sub_part_option() + inline ObPartitionOption &get_sub_part_option() { return sub_part_option_; } @@ -2770,16 +2770,16 @@ public: return part_option_.get_auto_part_size(); } - int serialize_partitions(char* buf, const int64_t data_len, int64_t& pos) const; - int serialize_dropped_partitions(char* buf, const int64_t data_len, int64_t& pos) const; - int serialize_def_subpartitions(char* buf, const int64_t data_len, int64_t& pos) const; - int deserialize_partitions(const char* buf, const int64_t data_len, int64_t& pos); - int deserialize_def_subpartitions(const char* buf, const int64_t data_len, int64_t& pos); + int serialize_partitions(char *buf, const int64_t data_len, int64_t &pos) const; + int serialize_dropped_partitions(char *buf, const int64_t data_len, int64_t &pos) const; + int serialize_def_subpartitions(char *buf, const int64_t data_len, int64_t &pos) const; + int deserialize_partitions(const char *buf, const int64_t data_len, int64_t &pos); + int deserialize_def_subpartitions(const char *buf, const int64_t data_len, int64_t &pos); int get_partition_by_part_id( - const int64_t part_id, const bool check_dropped_partition, const ObPartition*& partition) const; + const int64_t part_id, const bool check_dropped_partition, const ObPartition *&partition) const; // both part_id and subpart_id is not OB_TWO_PART_MASK - int get_subpartition(const int64_t part_id, const int64_t subpart_id, const ObSubPartition*& subpartition) const; + int get_subpartition(const int64_t part_id, const int64_t subpart_id, const ObSubPartition *&subpartition) const; /** generate part name of hash partition, for resolver only * @name_type: Type of generated hash partition name: @@ -2790,17 +2790,17 @@ public: * @partition: nantemplate table, the partition name needs to be spelled with the partition name, * and partition indicates the partition where the current subpartition is located */ - int gen_hash_part_name(const int64_t part_id, const ObHashNameType name_type, const bool need_upper_case, char* buf, - const int64_t buf_size, int64_t* pos, const ObPartition* partition = NULL) const; + int gen_hash_part_name(const int64_t part_id, const ObHashNameType name_type, const bool need_upper_case, char *buf, + const int64_t buf_size, int64_t *pos, const ObPartition *partition = NULL) const; // Get the partition name corresponding to partition_id (non-partition/partition/subpartition) - int get_partition_name(const int64_t partition_id, char* buf, const int64_t buf_size, int64_t* pos /* = NULL*/) const; + int get_partition_name(const int64_t partition_id, char *buf, const int64_t buf_size, int64_t *pos /* = NULL*/) const; // get partition name - int get_part_name(const int64_t part_id, char* buf, const int64_t buf_size, int64_t* pos /* = NULL*/) const; + int get_part_name(const int64_t part_id, char *buf, const int64_t buf_size, int64_t *pos /* = NULL*/) const; // is_def_subpart refers to the generation of __all_def_sub_part or the part_name in the __all_sub_part table - int get_subpart_name(const int64_t part_id, const int64_t subpart_id, const bool is_def_subpart, char* buf, - const int64_t buf_size, int64_t* pos /* = NULL*/) const; + int get_subpart_name(const int64_t part_id, const int64_t subpart_id, const bool is_def_subpart, char *buf, + const int64_t buf_size, int64_t *pos /* = NULL*/) const; - inline ObPartition** get_part_array() const + inline ObPartition **get_part_array() const { return partition_array_; } @@ -2813,7 +2813,7 @@ public: return partition_num_; } // The following interfaces can only be used for templated subpartition tables - inline ObSubPartition** get_def_subpart_array() const + inline ObSubPartition **get_def_subpart_array() const { return def_subpartition_array_; } @@ -2867,37 +2867,37 @@ public: } // This interface is only for iterators, and the corresponding iterator should be used to access the deleted // partition, or the schema_guard/schema_service corresponding interface should be used - ObPartition** get_dropped_part_array() const + ObPartition **get_dropped_part_array() const { return dropped_partition_array_; } // ------------------------------------- - int get_part_id_by_name(const common::ObString partition_name, int64_t& part_id) const; + int get_part_id_by_name(const common::ObString partition_name, int64_t &part_id) const; // FIXME:() Refresh the schema, do not assume that the partition_array is in order, and can be optimized later int find_partition_by_part_id( - const int64_t part_id, const bool check_dropped_partition, const ObPartition*& partition) const; + const int64_t part_id, const bool check_dropped_partition, const ObPartition *&partition) const; int get_subpart_info( - const int64_t part_id, ObSubPartition**& subpart_array, int64_t& subpart_num, int64_t& subpartition_num) const; + const int64_t part_id, ObSubPartition **&subpart_array, int64_t &subpart_num, int64_t &subpartition_num) const; //-------index partition------- - int get_part_id_by_idx(const int64_t part_idx, int64_t& part_id) const; - int get_hash_subpart_id_by_idx(const int64_t part_id, const int64_t subpart_idx, int64_t& subpart_id) const; + int get_part_id_by_idx(const int64_t part_idx, int64_t &part_id) const; + int get_hash_subpart_id_by_idx(const int64_t part_id, const int64_t subpart_idx, int64_t &subpart_id) const; - int get_hash_part_idx_by_id(const int64_t part_id, int64_t& part_idx) const; - int get_hash_subpart_idx_by_id(const int64_t part_id, const int64_t subpart_id, int64_t& subpart_idx) const; + int get_hash_part_idx_by_id(const int64_t part_id, int64_t &part_idx) const; + int get_hash_subpart_idx_by_id(const int64_t part_id, const int64_t subpart_id, int64_t &subpart_idx) const; - int convert_partition_idx_to_id(const int64_t partition_idx, int64_t& partition_id) const; - int convert_partition_id_to_idx(const int64_t partition_id, int64_t& partition_idx) const; + int convert_partition_idx_to_id(const int64_t partition_idx, int64_t &partition_id) const; + int convert_partition_id_to_idx(const int64_t partition_id, int64_t &partition_idx) const; //---------------------- // Get the offset of the partition in partition_array, just take the offset of the partition, // not including the subpartition int get_partition_index_by_id( - const int64_t part_id, const bool check_dropped_partition, int64_t& partition_index) const; + const int64_t part_id, const bool check_dropped_partition, int64_t &partition_index) const; // Binary search range partition, only applicable to the partition that has not been split int get_partition_index_binary_search( - const int64_t part_id, const bool check_dropped_partition, int64_t& partition_index) const; + const int64_t part_id, const bool check_dropped_partition, int64_t &partition_index) const; // Iterate all the partitions to get the offset int get_partition_index_loop( - const int64_t part_id, const bool check_dropped_partition, int64_t& partition_index) const; + const int64_t part_id, const bool check_dropped_partition, int64_t &partition_index) const; inline void set_partition_status(const ObPartitionStatus partition_status) { @@ -2932,19 +2932,19 @@ public: return 0; } virtual int get_split_source_partition_key( - const common::ObPartitionKey& dst_part_key, common::ObPartitionKey& source_part_key) const; + const common::ObPartitionKey &dst_part_key, common::ObPartitionKey &source_part_key) const; DECLARE_VIRTUAL_TO_STRING; - int try_assign_part_array(const share::schema::ObPartitionSchema& that); - int try_assign_def_subpart_array(const share::schema::ObPartitionSchema& that); + int try_assign_part_array(const share::schema::ObPartitionSchema &that); + int try_assign_def_subpart_array(const share::schema::ObPartitionSchema &that); protected: - int inner_add_partition(const ObPartition& part); - int inner_add_partition(const ObSubPartition& part); + int inner_add_partition(const ObPartition &part); + int inner_add_partition(const ObSubPartition &part); template - int inner_add_partition(const T& part, T**& part_array, int64_t& part_array_capacity, int64_t& part_num); - int get_subpart_name(const int64_t part_id, const int64_t subpart_id, char* buf, const int64_t buf_size, - int64_t* pos /* = NULL*/) const; - int get_def_subpart_name(const int64_t subpart_id, char* buf, const int64_t buf_size, int64_t* pos /* = NULL*/) const; + int inner_add_partition(const T &part, T **&part_array, int64_t &part_array_capacity, int64_t &part_num); + int get_subpart_name(const int64_t part_id, const int64_t subpart_id, char *buf, const int64_t buf_size, + int64_t *pos /* = NULL*/) const; + int get_def_subpart_name(const int64_t subpart_id, char *buf, const int64_t buf_size, int64_t *pos /* = NULL*/) const; protected: static const int64_t DEFAULT_ARRAY_CAPACITY = 128; @@ -2957,13 +2957,13 @@ protected: ObPartitionOption part_option_; // The part_num_ is only valid when is_sub_part_template = true ObPartitionOption sub_part_option_; - ObPartition** partition_array_; + ObPartition **partition_array_; int64_t partition_array_capacity_; // The array size of partition_array is not necessarily equal to partition_num; // Equal to part_num; historical reasons cause the two values to have the same meaning; // need to be modified together with part_num_ int64_t partition_num_; /* template table, when is_sub_part_template = true, valid */ - ObSubPartition** def_subpartition_array_; + ObSubPartition **def_subpartition_array_; // The array size of subpartition_array, not necessarily equal to subpartition_num int64_t def_subpartition_array_capacity_; int64_t def_subpartition_num_; // equal subpart_num @@ -2974,7 +2974,7 @@ protected: /* delay delete table/tablegroup/partition start*/ int64_t drop_schema_version_; // delay delete partition, Not visible to SQL - ObPartition** dropped_partition_array_; + ObPartition **dropped_partition_array_; int64_t dropped_partition_array_capacity_; int64_t dropped_partition_num_; /* delay delete table/tablegroup/partition end*/ @@ -2989,11 +2989,11 @@ class ObTablegroupSchema : public ObPartitionSchema { public: // base methods ObTablegroupSchema(); - explicit ObTablegroupSchema(common::ObIAllocator* allocator); + explicit ObTablegroupSchema(common::ObIAllocator *allocator); virtual ~ObTablegroupSchema(); - ObTablegroupSchema(const ObTablegroupSchema& src_schema); - ObTablegroupSchema& operator=(const ObTablegroupSchema& src_schema); - int assign(const ObTablegroupSchema& src_schema); + ObTablegroupSchema(const ObTablegroupSchema &src_schema); + ObTablegroupSchema &operator=(const ObTablegroupSchema &src_schema); + int assign(const ObTablegroupSchema &src_schema); // set methods inline void set_binding(const bool binding) { @@ -3011,51 +3011,51 @@ public: { tablegroup_id_ = tablegroup_id; } - inline int set_tablegroup_name(const char* name) + inline int set_tablegroup_name(const char *name) { return deep_copy_str(name, tablegroup_name_); } - inline int set_comment(const char* comment) + inline int set_comment(const char *comment) { return deep_copy_str(comment, comment_); } - inline int set_tablegroup_name(const common::ObString& name) + inline int set_tablegroup_name(const common::ObString &name) { return deep_copy_str(name, tablegroup_name_); } - inline int set_table_name(const common::ObString& name) + inline int set_table_name(const common::ObString &name) { return deep_copy_str(name, tablegroup_name_); } - inline int set_comment(const common::ObString& comment) + inline int set_comment(const common::ObString &comment) { return deep_copy_str(comment, comment_); } - inline int set_locality(const common::ObString& locality) + inline int set_locality(const common::ObString &locality) { return deep_copy_str(locality, locality_info_.locality_str_); } - inline int set_primary_zone(const common::ObString& primary_zone) + inline int set_primary_zone(const common::ObString &primary_zone) { return deep_copy_str(primary_zone, primary_zone_info_.primary_zone_str_); } - inline int set_previous_locality(const common::ObString& previous_locality) + inline int set_previous_locality(const common::ObString &previous_locality) { return deep_copy_str(previous_locality, previous_locality_); } - int set_primary_zone_array(const common::ObIArray& primary_zone_array); + int set_primary_zone_array(const common::ObIArray &primary_zone_array); - int set_zone_replica_attr_array(const common::ObIArray& src); - int set_zone_replica_attr_array(const common::ObIArray& src); - inline int set_split_partition(const common::ObString& split_partition) + int set_zone_replica_attr_array(const common::ObIArray &src); + int set_zone_replica_attr_array(const common::ObIArray &src); + inline int set_split_partition(const common::ObString &split_partition) { return deep_copy_str(split_partition, split_partition_name_); } - inline int set_split_rowkey(const common::ObRowkey& rowkey) + inline int set_split_rowkey(const common::ObRowkey &rowkey) { return rowkey.deep_copy(split_high_bound_val_, *get_allocator()); } - inline int set_split_list_value(common::ObRowkey& list_values) + inline int set_split_list_value(common::ObRowkey &list_values) { return list_values.deep_copy(split_list_row_values_, *get_allocator()); } @@ -3076,76 +3076,76 @@ public: { return tablegroup_id_; } - inline const char* get_tablegroup_name_str() const + inline const char *get_tablegroup_name_str() const { return extract_str(tablegroup_name_); } - inline const char* get_comment() const + inline const char *get_comment() const { return extract_str(comment_); } - inline const common::ObString& get_tablegroup_name() const + inline const common::ObString &get_tablegroup_name() const { return tablegroup_name_; } - inline const common::ObString& get_table_name() const + inline const common::ObString &get_table_name() const { return tablegroup_name_; } - virtual const char* get_entity_name() const override + virtual const char *get_entity_name() const override { return extract_str(tablegroup_name_); } - inline const common::ObString& get_comment_str() const + inline const common::ObString &get_comment_str() const { return comment_; } - inline const ObLocality& get_locality_info() const + inline const ObLocality &get_locality_info() const { return locality_info_; } - virtual common::ObString& get_locality_str() override + virtual common::ObString &get_locality_str() override { return locality_info_.locality_str_; } - virtual const common::ObString& get_locality_str() const override + virtual const common::ObString &get_locality_str() const override { return locality_info_.locality_str_; } - inline const char* get_locality() const + inline const char *get_locality() const { return extract_str(locality_info_.locality_str_); } - inline const char* get_previous_locality() const + inline const char *get_previous_locality() const { return extract_str(previous_locality_); } - virtual const common::ObString& get_previous_locality_str() const override + virtual const common::ObString &get_previous_locality_str() const override { return previous_locality_; } - inline const ObPrimaryZone& get_primary_zone_info() const + inline const ObPrimaryZone &get_primary_zone_info() const { return primary_zone_info_; } - inline const common::ObString& get_primary_zone() const + inline const common::ObString &get_primary_zone() const { return primary_zone_info_.primary_zone_str_; } - int set_zone_list(const common::ObIArray& zone_list) + int set_zone_list(const common::ObIArray &zone_list) { UNUSED(zone_list); return common::OB_SUCCESS; } - inline const common::ObString& get_split_partition_name() const + inline const common::ObString &get_split_partition_name() const { return split_partition_name_; } - inline const common::ObRowkey& get_split_rowkey() const + inline const common::ObRowkey &get_split_rowkey() const { return split_high_bound_val_; } - inline const common::ObRowkey& get_split_list_row_values() const + inline const common::ObRowkey &get_split_list_row_values() const { return split_list_row_values_; } @@ -3153,32 +3153,32 @@ public: // In the current implementation, if the locality of the zone_list of the tablegroup is empty, // it will be read from the tenant, otherwise it will be parsed from the locality virtual int get_zone_list( - share::schema::ObSchemaGetterGuard& schema_guard, common::ObIArray& zone_list) const override; - virtual int get_zone_replica_attr_array(ZoneLocalityIArray& locality) const; + share::schema::ObSchemaGetterGuard &schema_guard, common::ObIArray &zone_list) const override; + virtual int get_zone_replica_attr_array(ZoneLocalityIArray &locality) const; virtual int get_zone_replica_attr_array_inherit( - ObSchemaGetterGuard& schema_guard, ZoneLocalityIArray& locality) const override; + ObSchemaGetterGuard &schema_guard, ZoneLocalityIArray &locality) const override; virtual int get_locality_str_inherit( - ObSchemaGetterGuard& schema_guard, const common::ObString*& locality_str) const override; - virtual int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard& schema_guard, - const rootserver::ObRandomZoneSelector& random_selector, - const common::ObIArray& replica_addrs, - common::ObZone& first_primary_zone) const override; - virtual int check_is_duplicated(share::schema::ObSchemaGetterGuard& guard, bool& is_duplicated) const override; - int get_primary_zone_score(const common::ObZone& zone, int64_t& zone_score) const; - inline const common::ObIArray& get_primary_zone_array() const + ObSchemaGetterGuard &schema_guard, const common::ObString *&locality_str) const override; + virtual int get_first_primary_zone_inherit(share::schema::ObSchemaGetterGuard &schema_guard, + const rootserver::ObRandomZoneSelector &random_selector, + const common::ObIArray &replica_addrs, + common::ObZone &first_primary_zone) const override; + virtual int check_is_duplicated(share::schema::ObSchemaGetterGuard &guard, bool &is_duplicated) const override; + int get_primary_zone_score(const common::ObZone &zone, int64_t &zone_score) const; + inline const common::ObIArray &get_primary_zone_array() const { return primary_zone_info_.primary_zone_array_; } virtual int get_primary_zone_inherit( - share::schema::ObSchemaGetterGuard& schema_guard, share::schema::ObPrimaryZone& primary_zone) const override; + share::schema::ObSchemaGetterGuard &schema_guard, share::schema::ObPrimaryZone &primary_zone) const override; int fill_additional_options(); int check_in_locality_modification( - share::schema::ObSchemaGetterGuard& schema_guard, bool& in_locality_modification) const; - int check_is_readonly_at_all(share::schema::ObSchemaGetterGuard& guard, const common::ObZone& zone, - const common::ObRegion& region, bool& readonly_at_all) const; - int get_full_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const; - virtual int get_paxos_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const override; - int get_all_replica_num(share::schema::ObSchemaGetterGuard& schema_guard, int64_t& num) const; + share::schema::ObSchemaGetterGuard &schema_guard, bool &in_locality_modification) const; + int check_is_readonly_at_all(share::schema::ObSchemaGetterGuard &guard, const common::ObZone &zone, + const common::ObRegion ®ion, bool &readonly_at_all) const; + int get_full_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const; + virtual int get_paxos_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const override; + int get_all_replica_num(share::schema::ObSchemaGetterGuard &schema_guard, int64_t &num) const; // partition related virtual share::ObDuplicateScope get_duplicate_scope() const override { @@ -3236,8 +3236,8 @@ public: { return 0; } - virtual int calc_part_func_expr_num(int64_t& part_func_expr_num) const; - virtual int calc_subpart_func_expr_num(int64_t& subpart_func_expr_num) const; + virtual int calc_part_func_expr_num(int64_t &part_func_expr_num) const; + virtual int calc_subpart_func_expr_num(int64_t &subpart_func_expr_num) const; // other methods virtual void reset() override; int64_t get_convert_size() const override; @@ -3292,120 +3292,120 @@ public: /// Get part ids through range of partition_column // Get hash(FUNC_HASH/FUNC_KEY) part type ids - static int get_hash_part_ids(const ObTableSchema& table_schema, const common::ObNewRange& range, - const int64_t part_num, common::ObIArray& part_ids); + static int get_hash_part_ids(const ObTableSchema &table_schema, const common::ObNewRange &range, + const int64_t part_num, common::ObIArray &part_ids); // @param: get_part_index Indicates whether this function is called to get whether it is part_index or part_id // - true Indicates that part_index is to be obtained, and part_index indicates the position of partition // in the partition array. // - false Indicates that the part to be obtained is part_id, and part_id indicates the logical id of the primary // partition - static int get_hash_part_ids(const ObTableSchema& table_schema, const common::ObNewRow& row, int64_t part_num, - common::ObIArray& part_ids, bool get_part_index = false); - static int get_hash_subpart_ids(const ObTableSchema& table_schema, const int64_t part_id, - const common::ObNewRange& range, const int64_t subpart_num, common::ObIArray& subpart_ids); + static int get_hash_part_ids(const ObTableSchema &table_schema, const common::ObNewRow &row, int64_t part_num, + common::ObIArray &part_ids, bool get_part_index = false); + static int get_hash_subpart_ids(const ObTableSchema &table_schema, const int64_t part_id, + const common::ObNewRange &range, const int64_t subpart_num, common::ObIArray &subpart_ids); // @param: get_subpart_index Indicates whether this function is called to get whether it is subpart_index or // subpart_id // - true Indicates that subpart_index is to be obtained, and subpart_index indicates the position of subpartition // in the subpartition array. // - false Indicates that the subpart to be obtained is subpart_id, and subpart_id indicates the logical id of // the primary subpartition - static int get_hash_subpart_ids(const ObTableSchema& table_schema, const int64_t part_id, const common::ObNewRow& row, - int64_t subpart_num, common::ObIArray& subpart_ids, bool get_subpart_index = false); + static int get_hash_subpart_ids(const ObTableSchema &table_schema, const int64_t part_id, const common::ObNewRow &row, + int64_t subpart_num, common::ObIArray &subpart_ids, bool get_subpart_index = false); // Get level-one range part_ids - static int get_range_part_ids(const common::ObNewRange& range, const bool reverse, - ObPartition* const* partition_array, const int64_t partition_num, common::ObIArray& part_ids); + static int get_range_part_ids(const common::ObNewRange &range, const bool reverse, + ObPartition *const *partition_array, const int64_t partition_num, common::ObIArray &part_ids); // The meaning of get_part_index can refer to get_hash_part_ids() - static int get_range_part_ids(const common::ObNewRow& row, ObPartition* const* partition_array, - const int64_t partition_num, common::ObIArray& part_ids, bool get_part_index = false); + static int get_range_part_ids(const common::ObNewRow &row, ObPartition *const *partition_array, + const int64_t partition_num, common::ObIArray &part_ids, bool get_part_index = false); // Get level-one range part_ids - static int get_list_part_ids(const common::ObNewRange& range, const bool reverse, ObPartition* const* partition_array, - const int64_t partition_num, common::ObIArray& part_ids); + static int get_list_part_ids(const common::ObNewRange &range, const bool reverse, ObPartition *const *partition_array, + const int64_t partition_num, common::ObIArray &part_ids); // The meaning of get_part_index can refer to get_hash_part_ids() - static int get_list_part_ids(const common::ObNewRow& row, ObPartition* const* partition_array, - const int64_t partition_num, common::ObIArray& part_ids, bool get_part_index = false); + static int get_list_part_ids(const common::ObNewRow &row, ObPartition *const *partition_array, + const int64_t partition_num, common::ObIArray &part_ids, bool get_part_index = false); // Get level-two range part_ids - static int get_range_part_ids(const int64_t part_id, const common::ObNewRange& range, const bool reverse, - ObSubPartition* const* partition_array, const int64_t partition_num, common::ObIArray& part_ids); + static int get_range_part_ids(const int64_t part_id, const common::ObNewRange &range, const bool reverse, + ObSubPartition *const *partition_array, const int64_t partition_num, common::ObIArray &part_ids); // The meaning of get_subpart_index can refer to get_hash_subpart_ids() - static int get_range_part_ids(const int64_t part_id, const common::ObNewRow& row, - ObSubPartition* const* partition_array, const int64_t partition_num, common::ObIArray& part_ids, + static int get_range_part_ids(const int64_t part_id, const common::ObNewRow &row, + ObSubPartition *const *partition_array, const int64_t partition_num, common::ObIArray &part_ids, bool get_subpart_index = false); // Get level-two range part_ids - static int get_list_part_ids(const int64_t part_id, const common::ObNewRange& range, const bool reverse, - ObSubPartition* const* partition_array, const int64_t partition_num, common::ObIArray& part_ids); + static int get_list_part_ids(const int64_t part_id, const common::ObNewRange &range, const bool reverse, + ObSubPartition *const *partition_array, const int64_t partition_num, common::ObIArray &part_ids); // The meaning of get_subpart_index can refer to get_hash_subpart_ids() - static int get_list_part_ids(const int64_t part_id, const common::ObNewRow& row, - ObSubPartition* const* partition_array, const int64_t partition_num, common::ObIArray& part_ids, + static int get_list_part_ids(const int64_t part_id, const common::ObNewRow &row, + ObSubPartition *const *partition_array, const int64_t partition_num, common::ObIArray &part_ids, bool get_subpart_index = false); // According to the given hash value val and partition number part_num, // distinguish between oracle and mysql modes to calculate which partition this fold falls on // This interface is called at get_hash_part_idxs, get_hash_subpart_ids, etc. - static int calc_hash_part_idx(const uint64_t val, const int64_t part_num, int64_t& partition_idx); + static int calc_hash_part_idx(const uint64_t val, const int64_t part_num, int64_t &partition_idx); template static int get_range_part_idx( - const common::ObObj& obj, T* const* part_array, const int64_t part_num, int64_t& part_idx); + const common::ObObj &obj, T *const *part_array, const int64_t part_num, int64_t &part_idx); template - static int get_range_part_bounds(T* const* part_array, const int64_t part_num, const int64_t part_idx, - common::ObObj& lower_bound, common::ObObj& upper_bound); + static int get_range_part_bounds(T *const *part_array, const int64_t part_num, const int64_t part_idx, + common::ObObj &lower_bound, common::ObObj &upper_bound); // Get all part idxs of part num - static int get_all_part(const ObTableSchema& table_schema, int64_t part_num, common::ObIArray& part_ids); + static int get_all_part(const ObTableSchema &table_schema, int64_t part_num, common::ObIArray &part_ids); // Convert rowkey to sql literal for show - static int convert_rowkey_to_sql_literal(const common::ObRowkey& rowkey, char* buf, const int64_t buf_len, - int64_t& pos, bool print_collation, const common::ObTimeZoneInfo* tz_info); + static int convert_rowkey_to_sql_literal(const common::ObRowkey &rowkey, char *buf, const int64_t buf_len, + int64_t &pos, bool print_collation, const common::ObTimeZoneInfo *tz_info); // Used to display the defined value of the LIST partition - static int convert_rows_to_sql_literal(const common::ObIArray& rows, char* buf, - const int64_t buf_len, int64_t& pos, bool print_collation, const common::ObTimeZoneInfo* tz_info); - static int print_oracle_datetime_literal(const common::ObObj& tmp_obj, char* buf, const int64_t buf_len, int64_t& pos, - const common::ObTimeZoneInfo* tz_info); + static int convert_rows_to_sql_literal(const common::ObIArray &rows, char *buf, + const int64_t buf_len, int64_t &pos, bool print_collation, const common::ObTimeZoneInfo *tz_info); + static int print_oracle_datetime_literal(const common::ObObj &tmp_obj, char *buf, const int64_t buf_len, int64_t &pos, + const common::ObTimeZoneInfo *tz_info); // Convert rowkey's serialize buff to hex.For record all rowkey info. - static int convert_rowkey_to_hex(const common::ObRowkey& rowkey, char* buf, const int64_t buf_len, int64_t& pos); + static int convert_rowkey_to_hex(const common::ObRowkey &rowkey, char *buf, const int64_t buf_len, int64_t &pos); static int convert_rows_to_hex( - const common::ObIArray& rows, char* buf, const int64_t buf_len, int64_t& pos); + const common::ObIArray &rows, char *buf, const int64_t buf_len, int64_t &pos); // Get partition start with start_part rowkey, return start_pos template static int get_start( - const T* const* partition_array, const int64_t partition_num, const T& start_part, int64_t& start_pos); + const T *const *partition_array, const int64_t partition_num, const T &start_part, int64_t &start_pos); // Get partition end with end_part rowkey, return end_pos template - static int get_end(const T* const* partition_array, const int64_t partition_num, - const common::ObBorderFlag& border_flag, const T& end_part, int64_t& end_pos); + static int get_end(const T *const *partition_array, const int64_t partition_num, + const common::ObBorderFlag &border_flag, const T &end_part, int64_t &end_pos); // check if partition value equal template static int check_partition_value( - const PARTITION& l_part, const PARTITION& r_part, const ObPartitionFuncType part_type, bool& is_equal); + const PARTITION &l_part, const PARTITION &r_part, const ObPartitionFuncType part_type, bool &is_equal); - static bool is_types_equal_for_partition_check(const common::ObObjType& typ1, const common::ObObjType& type2); + static bool is_types_equal_for_partition_check(const common::ObObjType &typ1, const common::ObObjType &type2); private: // Get level-one range part_ids // The meaning of get_part_index can refer to get_hash_part_ids() - static int get_range_part_ids(ObPartition& start, ObPartition& end, const common::ObBorderFlag& border_flag, - const bool reverse, ObPartition* const* partition_array, const int64_t partition_num, - common::ObIArray& part_ids, bool get_part_index = false); + static int get_range_part_ids(ObPartition &start, ObPartition &end, const common::ObBorderFlag &border_flag, + const bool reverse, ObPartition *const *partition_array, const int64_t partition_num, + common::ObIArray &part_ids, bool get_part_index = false); // Get level-two range part_ids // The meaning of get_subpart_index can refer to get_hash_subpart_ids() - static int get_range_part_ids(ObSubPartition& start_bound, ObSubPartition& end_bound, - const common::ObBorderFlag& border_flag, const bool reverse, ObSubPartition* const* partition_array, - const int64_t partition_num, common::ObIArray& part_ids, bool get_subpart_index = false); + static int get_range_part_ids(ObSubPartition &start_bound, ObSubPartition &end_bound, + const common::ObBorderFlag &border_flag, const bool reverse, ObSubPartition *const *partition_array, + const int64_t partition_num, common::ObIArray &part_ids, bool get_subpart_index = false); }; template int ObPartitionUtils::get_range_part_idx( - const common::ObObj& obj, T* const* part_array, const int64_t part_num, int64_t& part_idx) + const common::ObObj &obj, T *const *part_array, const int64_t part_num, int64_t &part_idx) { int ret = common::OB_SUCCESS; if (obj.is_null()) { @@ -3429,8 +3429,8 @@ int ObPartitionUtils::get_range_part_idx( } template -int ObPartitionUtils::get_range_part_bounds(T* const* part_array, const int64_t part_num, const int64_t part_idx, - common::ObObj& lower_bound, common::ObObj& upper_bound) +int ObPartitionUtils::get_range_part_bounds(T *const *part_array, const int64_t part_num, const int64_t part_idx, + common::ObObj &lower_bound, common::ObObj &upper_bound) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY(!(0 <= part_idx && part_idx < part_num))) { @@ -3464,14 +3464,14 @@ int ObPartitionUtils::get_range_part_bounds(T* const* part_array, const int64_t template int ObPartitionUtils::get_start( - const T* const* partition_array, const int64_t partition_num, const T& start_part, int64_t& start_pos) + const T *const *partition_array, const int64_t partition_num, const T &start_part, int64_t &start_pos) { int ret = common::OB_SUCCESS; if (OB_ISNULL(partition_array)) { ret = common::OB_ERR_UNEXPECTED; SHARE_SCHEMA_LOG(WARN, "Partition array should not be NULL", K(ret)); } else { - const T* const* result = + const T *const *result = std::upper_bound(partition_array, partition_array + partition_num, &start_part, T::less_than); start_pos = result - partition_array; if (start_pos < 0) { @@ -3483,15 +3483,15 @@ int ObPartitionUtils::get_start( } template -int ObPartitionUtils::get_end(const T* const* partition_array, const int64_t partition_num, - const common::ObBorderFlag& border_flag, const T& end_part, int64_t& end_pos) +int ObPartitionUtils::get_end(const T *const *partition_array, const int64_t partition_num, + const common::ObBorderFlag &border_flag, const T &end_part, int64_t &end_pos) { int ret = common::OB_SUCCESS; if (OB_ISNULL(partition_array)) { ret = common::OB_ERR_UNEXPECTED; SHARE_SCHEMA_LOG(WARN, "Input partition array should not be NULL", K(ret)); } else { - const T* const* result = + const T *const *result = std::lower_bound(partition_array, partition_array + partition_num, &end_part, T::less_than); int64_t pos = result - partition_array; if (pos >= partition_num) { @@ -3501,12 +3501,12 @@ int ObPartitionUtils::get_end(const T* const* partition_array, const int64_t par SHARE_SCHEMA_LOG(WARN, "result should not be NULL", K(ret), K(result)); } else { common::ObNewRow lrow; - lrow.cells_ = const_cast((*result)->high_bound_val_.get_obj_ptr()); + lrow.cells_ = const_cast((*result)->high_bound_val_.get_obj_ptr()); lrow.count_ = (*result)->high_bound_val_.get_obj_cnt(); lrow.projector_ = (*result)->projector_; lrow.projector_size_ = (*result)->projector_size_; common::ObNewRow rrow; - rrow.cells_ = const_cast(end_part.high_bound_val_.get_obj_ptr()); + rrow.cells_ = const_cast(end_part.high_bound_val_.get_obj_ptr()); rrow.count_ = end_part.high_bound_val_.get_obj_cnt(); rrow.projector_ = end_part.projector_; rrow.projector_size_ = end_part.projector_size_; @@ -3560,18 +3560,18 @@ class ObViewSchema : public ObSchema { public: ObViewSchema(); - explicit ObViewSchema(common::ObIAllocator* allocator); + explicit ObViewSchema(common::ObIAllocator *allocator); virtual ~ObViewSchema(); - ObViewSchema(const ObViewSchema& src_schema); - ObViewSchema& operator=(const ObViewSchema& src_schema); - bool operator==(const ObViewSchema& other) const; - bool operator!=(const ObViewSchema& other) const; + ObViewSchema(const ObViewSchema &src_schema); + ObViewSchema &operator=(const ObViewSchema &src_schema); + bool operator==(const ObViewSchema &other) const; + bool operator!=(const ObViewSchema &other) const; - inline int set_view_definition(const char* view_definition) + inline int set_view_definition(const char *view_definition) { return deep_copy_str(view_definition, view_definition_); } - inline int set_view_definition(const common::ObString& view_definition) + inline int set_view_definition(const common::ObString &view_definition) { return deep_copy_str(view_definition, view_definition_); } @@ -3598,11 +3598,11 @@ public: // view_definition_ is defined using utf8, for sql resolve please use // ObSQLUtils::generate_view_definition_for_resolve - inline const common::ObString& get_view_definition_str() const + inline const common::ObString &get_view_definition_str() const { return view_definition_; } - inline const char* get_view_definition() const + inline const char *get_view_definition() const { return extract_str(view_definition_); } @@ -3648,15 +3648,15 @@ class ObColumnSchemaHashWrapper { public: ObColumnSchemaHashWrapper() {} - explicit ObColumnSchemaHashWrapper(const common::ObString& str) : column_name_(str) + explicit ObColumnSchemaHashWrapper(const common::ObString &str) : column_name_(str) {} ~ObColumnSchemaHashWrapper() {} - void set_name(const common::ObString& str) + void set_name(const common::ObString &str) { column_name_ = str; } - inline bool operator==(const ObColumnSchemaHashWrapper& other) const + inline bool operator==(const ObColumnSchemaHashWrapper &other) const { ObCompareNameWithTenantID name_cmp; return (0 == name_cmp.compare(column_name_, other.column_name_)); @@ -3668,21 +3668,21 @@ class ObColumnSchemaWrapper { public: ObColumnSchemaWrapper() : column_name_(), prefix_len_(0) {} - explicit ObColumnSchemaWrapper(const common::ObString& str, int32_t prefix_len) + explicit ObColumnSchemaWrapper(const common::ObString &str, int32_t prefix_len) : column_name_(str), prefix_len_(prefix_len) {} ~ObColumnSchemaWrapper() {} - void set_name(const common::ObString& str) + void set_name(const common::ObString &str) { column_name_ = str; } - inline bool name_equal(const ObColumnSchemaWrapper& other) const + inline bool name_equal(const ObColumnSchemaWrapper &other) const { ObCompareNameWithTenantID name_cmp; return (0 == name_cmp.compare(column_name_, other.column_name_)); } - inline bool all_equal(const ObColumnSchemaWrapper& other) const + inline bool all_equal(const ObColumnSchemaWrapper &other) const { ObCompareNameWithTenantID name_cmp; return (0 == name_cmp.compare(column_name_, other.column_name_)) && prefix_len_ == other.prefix_len_; @@ -3711,13 +3711,13 @@ public: : tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID), data_table_id_(common::OB_INVALID_ID) {} ObIndexSchemaHashWrapper( - uint64_t tenant_id, const uint64_t database_id, const uint64_t data_table_id, const common::ObString& index_name) + uint64_t tenant_id, const uint64_t database_id, const uint64_t data_table_id, const common::ObString &index_name) : tenant_id_(tenant_id), database_id_(database_id), data_table_id_(data_table_id), index_name_(index_name) {} ~ObIndexSchemaHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObIndexSchemaHashWrapper& rv) const; + inline bool operator==(const ObIndexSchemaHashWrapper &rv) const; inline uint64_t get_tenant_id() const { @@ -3731,7 +3731,7 @@ public: { return data_table_id_; } - inline const common::ObString& get_index_name() const + inline const common::ObString &get_index_name() const { return index_name_; } @@ -3754,7 +3754,7 @@ inline uint64_t ObIndexSchemaHashWrapper::hash() const return hash_ret; } -inline bool ObIndexSchemaHashWrapper::operator==(const ObIndexSchemaHashWrapper& rv) const +inline bool ObIndexSchemaHashWrapper::operator==(const ObIndexSchemaHashWrapper &rv) const { // mysql case insensitive // oracle case sensitive @@ -3772,7 +3772,7 @@ public: name_case_mode_(common::OB_NAME_CASE_INVALID) {} ObTableSchemaHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const uint64_t session_id, - const common::ObNameCaseMode mode, const common::ObString& table_name) + const common::ObNameCaseMode mode, const common::ObString &table_name) : tenant_id_(tenant_id), database_id_(database_id), session_id_(session_id), @@ -3782,7 +3782,7 @@ public: ~ObTableSchemaHashWrapper() {} inline uint64_t hash() const; - bool operator==(const ObTableSchemaHashWrapper& rv) const; + bool operator==(const ObTableSchemaHashWrapper &rv) const; inline uint64_t get_tenant_id() const { @@ -3796,7 +3796,7 @@ public: { return session_id_; } - inline const common::ObString& get_table_name() const + inline const common::ObString &get_table_name() const { return table_name_; } @@ -3820,7 +3820,7 @@ inline uint64_t ObTableSchemaHashWrapper::hash() const } // See ObSchemaMgr::get_table_schema comment for session visibility judgment -inline bool ObTableSchemaHashWrapper::operator==(const ObTableSchemaHashWrapper& rv) const +inline bool ObTableSchemaHashWrapper::operator==(const ObTableSchemaHashWrapper &rv) const { ObCompareNameWithTenantID name_cmp(tenant_id_, name_case_mode_, database_id_); return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) && @@ -3834,13 +3834,13 @@ public: ObDatabaseSchemaHashWrapper() : tenant_id_(common::OB_INVALID_ID), name_case_mode_(common::OB_NAME_CASE_INVALID) {} ObDatabaseSchemaHashWrapper( - const uint64_t tenant_id, const common::ObNameCaseMode mode, const common::ObString& database_name) + const uint64_t tenant_id, const common::ObNameCaseMode mode, const common::ObString &database_name) : tenant_id_(tenant_id), name_case_mode_(mode), database_name_(database_name) {} ~ObDatabaseSchemaHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObDatabaseSchemaHashWrapper& rv) const; + inline bool operator==(const ObDatabaseSchemaHashWrapper &rv) const; inline uint64_t get_tenant_id() const { @@ -3850,7 +3850,7 @@ public: { return name_case_mode_; } - inline const common::ObString& get_database_name() const + inline const common::ObString &get_database_name() const { return database_name_; } @@ -3870,7 +3870,7 @@ inline uint64_t ObDatabaseSchemaHashWrapper::hash() const return hash_ret; } -inline bool ObDatabaseSchemaHashWrapper::operator==(const ObDatabaseSchemaHashWrapper& rv) const +inline bool ObDatabaseSchemaHashWrapper::operator==(const ObDatabaseSchemaHashWrapper &rv) const { ObCompareNameWithTenantID name_cmp(tenant_id_, name_case_mode_); return (tenant_id_ == rv.tenant_id_) && (name_case_mode_ == rv.name_case_mode_) && @@ -3881,19 +3881,19 @@ class ObTablegroupSchemaHashWrapper { public: ObTablegroupSchemaHashWrapper() : tenant_id_(common::OB_INVALID_ID) {} - ObTablegroupSchemaHashWrapper(uint64_t tenant_id, const common::ObString& tablegroup_name) + ObTablegroupSchemaHashWrapper(uint64_t tenant_id, const common::ObString &tablegroup_name) : tenant_id_(tenant_id), tablegroup_name_(tablegroup_name) {} ~ObTablegroupSchemaHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObTablegroupSchemaHashWrapper& rv) const; + inline bool operator==(const ObTablegroupSchemaHashWrapper &rv) const; inline uint64_t get_tenant_id() const { return tenant_id_; } - inline const common::ObString& get_tablegroup_name() const + inline const common::ObString &get_tablegroup_name() const { return tablegroup_name_; } @@ -3911,13 +3911,13 @@ public: database_id_ = common::OB_INVALID_ID; foreign_key_name_.assign_ptr("", 0); } - ObForeignKeyInfoHashWrapper(uint64_t tenant_id, const uint64_t database_id, const common::ObString& foreign_key_name) + ObForeignKeyInfoHashWrapper(uint64_t tenant_id, const uint64_t database_id, const common::ObString &foreign_key_name) : tenant_id_(tenant_id), database_id_(database_id), foreign_key_name_(foreign_key_name) {} ~ObForeignKeyInfoHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObForeignKeyInfoHashWrapper& rv) const; + inline bool operator==(const ObForeignKeyInfoHashWrapper &rv) const; inline uint64_t get_tenant_id() const { return tenant_id_; @@ -3926,7 +3926,7 @@ public: { return database_id_; } - inline const common::ObString& get_foreign_key_name() const + inline const common::ObString &get_foreign_key_name() const { return foreign_key_name_; } @@ -3947,7 +3947,7 @@ inline uint64_t ObForeignKeyInfoHashWrapper::hash() const return hash_ret; } -inline bool ObForeignKeyInfoHashWrapper::operator==(const ObForeignKeyInfoHashWrapper& rv) const +inline bool ObForeignKeyInfoHashWrapper::operator==(const ObForeignKeyInfoHashWrapper &rv) const { // mysql case insensitive // oracle case sensitive @@ -3964,13 +3964,13 @@ public: database_id_ = common::OB_INVALID_ID; constraint_name_.assign_ptr("", 0); } - ObConstraintInfoHashWrapper(uint64_t tenant_id, const uint64_t database_id, const common::ObString& constraint_name) + ObConstraintInfoHashWrapper(uint64_t tenant_id, const uint64_t database_id, const common::ObString &constraint_name) : tenant_id_(tenant_id), database_id_(database_id), constraint_name_(constraint_name) {} ~ObConstraintInfoHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObConstraintInfoHashWrapper& rv) const; + inline bool operator==(const ObConstraintInfoHashWrapper &rv) const; inline uint64_t get_tenant_id() const { return tenant_id_; @@ -3979,7 +3979,7 @@ public: { return database_id_; } - inline const common::ObString& get_constraint_name() const + inline const common::ObString &get_constraint_name() const { return constraint_name_; } @@ -4000,7 +4000,7 @@ inline uint64_t ObConstraintInfoHashWrapper::hash() const return hash_ret; } -inline bool ObConstraintInfoHashWrapper::operator==(const ObConstraintInfoHashWrapper& rv) const +inline bool ObConstraintInfoHashWrapper::operator==(const ObConstraintInfoHashWrapper &rv) const { // mysql case insensitive // oracle case sensitive @@ -4017,7 +4017,7 @@ inline uint64_t ObTablegroupSchemaHashWrapper::hash() const return hash_ret; } -inline bool ObTablegroupSchemaHashWrapper::operator==(const ObTablegroupSchemaHashWrapper& rv) const +inline bool ObTablegroupSchemaHashWrapper::operator==(const ObTablegroupSchemaHashWrapper &rv) const { return (tenant_id_ == rv.tenant_id_) && (tablegroup_name_ == rv.tablegroup_name_); } @@ -4031,15 +4031,15 @@ public: ObTenantPlanBaselineId(const uint64_t tenant_id, const uint64_t plan_baseline_id) : tenant_id_(tenant_id), plan_baseline_id_(plan_baseline_id) {} - bool operator==(const ObTenantPlanBaselineId& rhs) const + bool operator==(const ObTenantPlanBaselineId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (plan_baseline_id_ == rhs.plan_baseline_id_); } - bool operator!=(const ObTenantPlanBaselineId& rhs) const + bool operator!=(const ObTenantPlanBaselineId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantPlanBaselineId& rhs) const + bool operator<(const ObTenantPlanBaselineId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -4072,15 +4072,15 @@ public: ObTenantOutlineId(const uint64_t tenant_id, const uint64_t outline_id) : tenant_id_(tenant_id), outline_id_(outline_id) {} - bool operator==(const ObTenantOutlineId& rhs) const + bool operator==(const ObTenantOutlineId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (outline_id_ == rhs.outline_id_); } - bool operator!=(const ObTenantOutlineId& rhs) const + bool operator!=(const ObTenantOutlineId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantOutlineId& rhs) const + bool operator<(const ObTenantOutlineId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -4113,15 +4113,15 @@ public: {} ObTenantUserId(const uint64_t tenant_id, const uint64_t user_id) : tenant_id_(tenant_id), user_id_(user_id) {} - bool operator==(const ObTenantUserId& rhs) const + bool operator==(const ObTenantUserId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (user_id_ == rhs.user_id_); } - bool operator!=(const ObTenantUserId& rhs) const + bool operator!=(const ObTenantUserId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantUserId& rhs) const + bool operator<(const ObTenantUserId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -4161,16 +4161,16 @@ public: const uint64_t col_id) : tenant_id_(tenant_id), grantee_id_(grantee_id), obj_id_(obj_id), obj_type_(obj_type), col_id_(col_id) {} - bool operator==(const ObTenantUrObjId& rhs) const + bool operator==(const ObTenantUrObjId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (grantee_id_ == rhs.grantee_id_) && (obj_id_ == rhs.obj_id_) && (obj_type_ == rhs.obj_type_) && (col_id_ == rhs.col_id_); } - bool operator!=(const ObTenantUrObjId& rhs) const + bool operator!=(const ObTenantUrObjId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantUrObjId& rhs) const + bool operator<(const ObTenantUrObjId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -4224,13 +4224,13 @@ private: class ObPrintPackedPrivArray { public: - explicit ObPrintPackedPrivArray(const ObPackedPrivArray& packed_priv_array) : packed_priv_array_(packed_priv_array) + explicit ObPrintPackedPrivArray(const ObPackedPrivArray &packed_priv_array) : packed_priv_array_(packed_priv_array) {} DECLARE_TO_STRING; private: - const ObPackedPrivArray& packed_priv_array_; + const ObPackedPrivArray &packed_priv_array_; }; class ObPriv { @@ -4244,7 +4244,7 @@ public: priv_set_(0), priv_array_() {} - ObPriv(common::ObIAllocator* allocator) + ObPriv(common::ObIAllocator *allocator) : tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID), schema_version_(1), @@ -4257,16 +4257,16 @@ public: virtual ~ObPriv() {} - ObPriv& operator=(const ObPriv& other); - static bool cmp_tenant_user_id(const ObPriv* lhs, const ObTenantUserId& tenant_user_id) + ObPriv &operator=(const ObPriv &other); + static bool cmp_tenant_user_id(const ObPriv *lhs, const ObTenantUserId &tenant_user_id) { return (lhs->get_tenant_user_id() < tenant_user_id); } - static bool equal_tenant_user_id(const ObPriv* lhs, const ObTenantUserId& tenant_user_id) + static bool equal_tenant_user_id(const ObPriv *lhs, const ObTenantUserId &tenant_user_id) { return (lhs->get_tenant_user_id() == tenant_user_id); } - static bool cmp_tenant_id(const ObPriv* lhs, const uint64_t tenant_id) + static bool cmp_tenant_id(const ObPriv *lhs, const uint64_t tenant_id) { return (lhs->get_tenant_id() < tenant_id); } @@ -4303,7 +4303,7 @@ public: { priv_set_ = obj_privs; } - int set_priv_array(const ObPackedPrivArray& other) + int set_priv_array(const ObPackedPrivArray &other) { return priv_array_.assign(other); } @@ -4328,7 +4328,7 @@ public: { return priv_set_ & priv; } - inline const ObPackedPrivArray& get_priv_array() const + inline const ObPackedPrivArray &get_priv_array() const { return priv_array_; } @@ -4359,19 +4359,19 @@ class ObUserInfoHashWrapper { public: ObUserInfoHashWrapper() : tenant_id_(common::OB_INVALID_ID) {} - ObUserInfoHashWrapper(uint64_t tenant_id, const common::ObString& user_name) + ObUserInfoHashWrapper(uint64_t tenant_id, const common::ObString &user_name) : tenant_id_(tenant_id), user_name_(user_name) {} ~ObUserInfoHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObUserInfoHashWrapper& rv) const; + inline bool operator==(const ObUserInfoHashWrapper &rv) const; inline uint64_t get_tenant_id() const { return tenant_id_; } - inline const common::ObString& get_user_name() const + inline const common::ObString &get_user_name() const { return user_name_; } @@ -4389,7 +4389,7 @@ inline uint64_t ObUserInfoHashWrapper::hash() const return hash_ret; } -inline bool ObUserInfoHashWrapper::operator==(const ObUserInfoHashWrapper& other) const +inline bool ObUserInfoHashWrapper::operator==(const ObUserInfoHashWrapper &other) const { return (tenant_id_ == other.tenant_id_) && (user_name_ == other.user_name_); } @@ -4404,7 +4404,7 @@ enum class ObSSLType : int { }; common::ObString get_ssl_type_string(const ObSSLType ssl_type); -ObSSLType get_ssl_type_from_string(const common::ObString& ssl_type_str); +ObSSLType get_ssl_type_from_string(const common::ObString &ssl_type_str); enum class ObSSLSpecifiedType : int { SSL_SPEC_TYPE_CIPHER = 0, @@ -4413,7 +4413,7 @@ enum class ObSSLSpecifiedType : int { SSL_SPEC_TYPE_MAX }; -const char* get_ssl_spec_type_str(const ObSSLSpecifiedType ssl_spec_type); +const char *get_ssl_spec_type_str(const ObSSLSpecifiedType ssl_spec_type); enum ObUserType { OB_USER = 0, @@ -4449,49 +4449,49 @@ public: max_connections_(0), max_user_connections_(0) {} - explicit ObUserInfo(common::ObIAllocator* allocator); + explicit ObUserInfo(common::ObIAllocator *allocator); virtual ~ObUserInfo(); - ObUserInfo(const ObUserInfo& other); - ObUserInfo& operator=(const ObUserInfo& other); - static bool cmp(const ObUserInfo* lhs, const ObUserInfo* rhs) + ObUserInfo(const ObUserInfo &other); + ObUserInfo &operator=(const ObUserInfo &other); + static bool cmp(const ObUserInfo *lhs, const ObUserInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_tenant_user_id() < rhs->get_tenant_user_id() : false; } - static bool equal(const ObUserInfo* lhs, const ObUserInfo* rhs) + static bool equal(const ObUserInfo *lhs, const ObUserInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_tenant_user_id() == rhs->get_tenant_user_id() : false; } // set methods - inline int set_user_name(const char* user_name) + inline int set_user_name(const char *user_name) { return deep_copy_str(user_name, user_name_); } - inline int set_user_name(const common::ObString& user_name) + inline int set_user_name(const common::ObString &user_name) { return deep_copy_str(user_name, user_name_); } - inline int set_host(const char* host_name) + inline int set_host(const char *host_name) { return deep_copy_str(host_name, host_name_); } - inline int set_host(const common::ObString& host_name) + inline int set_host(const common::ObString &host_name) { return deep_copy_str(host_name, host_name_); } - inline int set_passwd(const char* passwd) + inline int set_passwd(const char *passwd) { return deep_copy_str(passwd, passwd_); } - inline int set_passwd(const common::ObString& passwd) + inline int set_passwd(const common::ObString &passwd) { return deep_copy_str(passwd, passwd_); } - inline int set_info(const char* info) + inline int set_info(const char *info) { return deep_copy_str(info, info_); } - inline int set_info(const common::ObString& info) + inline int set_info(const common::ObString &info) { return deep_copy_str(info, info_); } @@ -4503,27 +4503,27 @@ public: { ssl_type_ = ssl_type; } - inline int set_ssl_cipher(const char* ssl_cipher) + inline int set_ssl_cipher(const char *ssl_cipher) { return deep_copy_str(ssl_cipher, ssl_cipher_); } - inline int set_ssl_cipher(const common::ObString& ssl_cipher) + inline int set_ssl_cipher(const common::ObString &ssl_cipher) { return deep_copy_str(ssl_cipher, ssl_cipher_); } - inline int set_x509_issuer(const char* x509_issuer) + inline int set_x509_issuer(const char *x509_issuer) { return deep_copy_str(x509_issuer, x509_issuer_); } - inline int set_x509_issuer(const common::ObString& x509_issuer) + inline int set_x509_issuer(const common::ObString &x509_issuer) { return deep_copy_str(x509_issuer, x509_issuer_); } - inline int set_x509_subject(const char* x509_subject) + inline int set_x509_subject(const char *x509_subject) { return deep_copy_str(x509_subject, x509_subject_); } - inline int set_x509_subject(const common::ObString& x509_subject) + inline int set_x509_subject(const common::ObString &x509_subject) { return deep_copy_str(x509_subject, x509_subject_); } @@ -4548,35 +4548,35 @@ public: max_user_connections_ = max_user_connections; } // get methods - inline const char* get_user_name() const + inline const char *get_user_name() const { return extract_str(user_name_); } - inline const common::ObString& get_user_name_str() const + inline const common::ObString &get_user_name_str() const { return user_name_; } - inline const char* get_host_name() const + inline const char *get_host_name() const { return extract_str(host_name_); } - inline const common::ObString& get_host_name_str() const + inline const common::ObString &get_host_name_str() const { return host_name_; } - inline const char* get_passwd() const + inline const char *get_passwd() const { return extract_str(passwd_); } - inline const common::ObString& get_passwd_str() const + inline const common::ObString &get_passwd_str() const { return passwd_; } - inline const char* get_info() const + inline const char *get_info() const { return extract_str(info_); } - inline const common::ObString& get_info_str() const + inline const common::ObString &get_info_str() const { return info_; } @@ -4592,27 +4592,27 @@ public: { return get_ssl_type_string(ssl_type_); } - inline const char* get_ssl_cipher() const + inline const char *get_ssl_cipher() const { return extract_str(ssl_cipher_); } - inline const common::ObString& get_ssl_cipher_str() const + inline const common::ObString &get_ssl_cipher_str() const { return ssl_cipher_; } - inline const char* get_x509_issuer() const + inline const char *get_x509_issuer() const { return extract_str(x509_issuer_); } - inline const common::ObString& get_x509_issuer_str() const + inline const common::ObString &get_x509_issuer_str() const { return x509_issuer_; } - inline const char* get_x509_subject() const + inline const char *get_x509_subject() const { return extract_str(x509_subject_); } - inline const common::ObString& get_x509_subject_str() const + inline const common::ObString &get_x509_subject_str() const { return x509_subject_; } @@ -4645,15 +4645,15 @@ public: { return role_id_array_.count(); } - const common::ObSEArray& get_grantee_id_array() const + const common::ObSEArray &get_grantee_id_array() const { return grantee_id_array_; } - const common::ObSEArray& get_role_id_array() const + const common::ObSEArray &get_role_id_array() const { return role_id_array_; } - const common::ObSEArray& get_role_id_option_array() const + const common::ObSEArray &get_role_id_option_array() const { return role_id_option_array_; } @@ -4662,15 +4662,15 @@ public: return grantee_id_array_.push_back(id); } int add_role_id(const uint64_t id, const uint64_t admin_option = NO_OPTION, const uint64_t disable_flag = 0); - void set_admin_option(uint64_t& option, const uint64_t admin_option) + void set_admin_option(uint64_t &option, const uint64_t admin_option) { option |= (admin_option << ADMIN_OPTION_SHIFT); } - void set_disable_flag(uint64_t& option, const uint64_t disable_flag) + void set_disable_flag(uint64_t &option, const uint64_t disable_flag) { option |= (disable_flag << DISABLE_FLAG_SHIFT); } - int get_nth_role_option(uint64_t nth, uint64_t& option) const; + int get_nth_role_option(uint64_t nth, uint64_t &option) const; uint64_t get_admin_option(uint64_t option) const { return 1 & (option >> ADMIN_OPTION_SHIFT); @@ -4688,7 +4688,7 @@ public: K_(info), K_(locked), K_(ssl_type), K_(ssl_cipher), K_(x509_issuer), K_(x509_subject), K_(type), K_(grantee_id_array), K_(role_id_array), K_(profile_id)); bool role_exists(const uint64_t role_id, const uint64_t option) const; - int get_seq_by_role_id(uint64_t role_id, uint64_t& seq) const; + int get_seq_by_role_id(uint64_t role_id, uint64_t &seq) const; private: common::ObString user_name_; @@ -4717,15 +4717,15 @@ struct ObDBPrivSortKey { ObDBPrivSortKey(const uint64_t tenant_id, const uint64_t user_id, const uint64_t sort_value) : tenant_id_(tenant_id), user_id_(user_id), sort_(sort_value) {} - bool operator==(const ObDBPrivSortKey& rhs) const + bool operator==(const ObDBPrivSortKey &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (user_id_ == rhs.user_id_) && (sort_ == rhs.sort_); } - bool operator!=(const ObDBPrivSortKey& rhs) const + bool operator!=(const ObDBPrivSortKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObDBPrivSortKey& rhs) const + bool operator<(const ObDBPrivSortKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -4747,18 +4747,18 @@ struct ObDBPrivSortKey { struct ObOriginalDBKey { ObOriginalDBKey() : tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID) {} - ObOriginalDBKey(const uint64_t tenant_id, const uint64_t user_id, const common::ObString& db) + ObOriginalDBKey(const uint64_t tenant_id, const uint64_t user_id, const common::ObString &db) : tenant_id_(tenant_id), user_id_(user_id), db_(db) {} - bool operator==(const ObOriginalDBKey& rhs) const + bool operator==(const ObOriginalDBKey &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (user_id_ == rhs.user_id_) && (db_ == rhs.db_); } - bool operator!=(const ObOriginalDBKey& rhs) const + bool operator!=(const ObOriginalDBKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObOriginalDBKey& rhs) const + bool operator<(const ObOriginalDBKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -4790,15 +4790,15 @@ struct ObSysPrivKey { {} ObSysPrivKey(const uint64_t tenant_id, const uint64_t user_id) : tenant_id_(tenant_id), grantee_id_(user_id) {} - bool operator==(const ObSysPrivKey& rhs) const + bool operator==(const ObSysPrivKey &rhs) const { return ((tenant_id_ == rhs.tenant_id_) && (grantee_id_ == rhs.grantee_id_)); } - bool operator!=(const ObSysPrivKey& rhs) const + bool operator!=(const ObSysPrivKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObSysPrivKey& rhs) const + bool operator<(const ObSysPrivKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -4829,21 +4829,21 @@ class ObDBPriv : public ObSchema, public ObPriv { public: ObDBPriv() : ObPriv(), db_(), sort_(0) {} - explicit ObDBPriv(common::ObIAllocator* allocator) : ObSchema(allocator), ObPriv(allocator), db_(), sort_(0) + explicit ObDBPriv(common::ObIAllocator *allocator) : ObSchema(allocator), ObPriv(allocator), db_(), sort_(0) {} virtual ~ObDBPriv() {} - ObDBPriv(const ObDBPriv& other) : ObSchema(), ObPriv() + ObDBPriv(const ObDBPriv &other) : ObSchema(), ObPriv() { *this = other; } - ObDBPriv& operator=(const ObDBPriv& other); + ObDBPriv &operator=(const ObDBPriv &other); - static bool cmp(const ObDBPriv* lhs, const ObDBPriv* rhs) + static bool cmp(const ObDBPriv *lhs, const ObDBPriv *rhs) { return (NULL != lhs && NULL != rhs) ? (lhs->get_sort_key() < rhs->get_sort_key()) : false; } - static bool cmp_sort_key(const ObDBPriv* lhs, const ObDBPrivSortKey& sort_key) + static bool cmp_sort_key(const ObDBPriv *lhs, const ObDBPrivSortKey &sort_key) { return NULL != lhs ? lhs->get_sort_key() < sort_key : false; } @@ -4851,7 +4851,7 @@ public: { return ObDBPrivSortKey(tenant_id_, user_id_, sort_); } - static bool equal(const ObDBPriv* lhs, const ObDBPriv* rhs) + static bool equal(const ObDBPriv *lhs, const ObDBPriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_sort_key() == rhs->get_sort_key() : false; } // point check @@ -4861,11 +4861,11 @@ public: } // set methods - inline int set_database_name(const char* db) + inline int set_database_name(const char *db) { return deep_copy_str(db, db_); } - inline int set_database_name(const common::ObString& db) + inline int set_database_name(const common::ObString &db) { return deep_copy_str(db, db_); } @@ -4875,11 +4875,11 @@ public: } // get methods - inline const char* get_database_name() const + inline const char *get_database_name() const { return extract_str(db_); } - inline const common::ObString& get_database_name_str() const + inline const common::ObString &get_database_name_str() const { return db_; } @@ -4902,18 +4902,18 @@ private: struct ObTablePrivDBKey { ObTablePrivDBKey() : tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID) {} - ObTablePrivDBKey(const uint64_t tenant_id, const uint64_t user_id, const common::ObString& db) + ObTablePrivDBKey(const uint64_t tenant_id, const uint64_t user_id, const common::ObString &db) : tenant_id_(tenant_id), user_id_(user_id), db_(db) {} - bool operator==(const ObTablePrivDBKey& rhs) const + bool operator==(const ObTablePrivDBKey &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (user_id_ == rhs.user_id_) && (db_ == rhs.db_); } - bool operator!=(const ObTablePrivDBKey& rhs) const + bool operator!=(const ObTablePrivDBKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObTablePrivDBKey& rhs) const + bool operator<(const ObTablePrivDBKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -4933,18 +4933,18 @@ struct ObTablePrivSortKey { ObTablePrivSortKey() : tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID) {} ObTablePrivSortKey( - const uint64_t tenant_id, const uint64_t user_id, const common::ObString& db, const common::ObString& table) + const uint64_t tenant_id, const uint64_t user_id, const common::ObString &db, const common::ObString &table) : tenant_id_(tenant_id), user_id_(user_id), db_(db), table_(table) {} - bool operator==(const ObTablePrivSortKey& rhs) const + bool operator==(const ObTablePrivSortKey &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (user_id_ == rhs.user_id_) && (db_ == rhs.db_) && (table_ == rhs.table_); } - bool operator!=(const ObTablePrivSortKey& rhs) const + bool operator!=(const ObTablePrivSortKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObTablePrivSortKey& rhs) const + bool operator<(const ObTablePrivSortKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -4997,16 +4997,16 @@ struct ObObjPrivSortKey { grantor_id_(grantor_id), grantee_id_(grantee_id) {} - bool operator==(const ObObjPrivSortKey& rhs) const + bool operator==(const ObObjPrivSortKey &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (obj_id_ == rhs.obj_id_) && (obj_type_ == rhs.obj_type_) && (col_id_ == rhs.col_id_) && (grantor_id_ == rhs.grantor_id_) && (grantee_id_ == rhs.grantee_id_); } - bool operator!=(const ObObjPrivSortKey& rhs) const + bool operator!=(const ObObjPrivSortKey &rhs) const { return !(*this == rhs); } - bool operator<(const ObObjPrivSortKey& rhs) const + bool operator<(const ObObjPrivSortKey &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (false == bret && tenant_id_ == rhs.tenant_id_) { @@ -5061,9 +5061,9 @@ public: // constructor and destructor ObTablePriv() : ObSchema(), ObPriv() {} - explicit ObTablePriv(common::ObIAllocator* allocator) : ObSchema(allocator), ObPriv(allocator) + explicit ObTablePriv(common::ObIAllocator *allocator) : ObSchema(allocator), ObPriv(allocator) {} - ObTablePriv(const ObTablePriv& other) : ObSchema(), ObPriv() + ObTablePriv(const ObTablePriv &other) : ObSchema(), ObPriv() { *this = other; } @@ -5071,26 +5071,26 @@ public: {} // operator= - ObTablePriv& operator=(const ObTablePriv& other); + ObTablePriv &operator=(const ObTablePriv &other); // for sort ObTablePrivSortKey get_sort_key() const { return ObTablePrivSortKey(tenant_id_, user_id_, db_, table_); } - static bool cmp(const ObTablePriv* lhs, const ObTablePriv* rhs) + static bool cmp(const ObTablePriv *lhs, const ObTablePriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_sort_key() < rhs->get_sort_key() : false; } - static bool cmp_sort_key(const ObTablePriv* lhs, const ObTablePrivSortKey& sort_key) + static bool cmp_sort_key(const ObTablePriv *lhs, const ObTablePrivSortKey &sort_key) { return NULL != lhs ? lhs->get_sort_key() < sort_key : false; } - static bool equal(const ObTablePriv* lhs, const ObTablePriv* rhs) + static bool equal(const ObTablePriv *lhs, const ObTablePriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_sort_key() == rhs->get_sort_key() : false; } - static bool equal_sort_key(const ObTablePriv* lhs, const ObTablePrivSortKey& sort_key) + static bool equal_sort_key(const ObTablePriv *lhs, const ObTablePrivSortKey &sort_key) { return NULL != lhs ? lhs->get_sort_key() == sort_key : false; } @@ -5099,43 +5099,43 @@ public: { return ObTablePrivDBKey(tenant_id_, user_id_, db_); } - static bool cmp_db_key(const ObTablePriv* lhs, const ObTablePrivDBKey& db_key) + static bool cmp_db_key(const ObTablePriv *lhs, const ObTablePrivDBKey &db_key) { return lhs->get_db_key() < db_key; } // set methods - inline int set_database_name(const char* db) + inline int set_database_name(const char *db) { return deep_copy_str(db, db_); } - inline int set_database_name(const common::ObString& db) + inline int set_database_name(const common::ObString &db) { return deep_copy_str(db, db_); } - inline int set_table_name(const char* table) + inline int set_table_name(const char *table) { return deep_copy_str(table, table_); } - inline int set_table_name(const common::ObString& table) + inline int set_table_name(const common::ObString &table) { return deep_copy_str(table, table_); } // get methods - inline const char* get_database_name() const + inline const char *get_database_name() const { return extract_str(db_); } - inline const common::ObString& get_database_name_str() const + inline const common::ObString &get_database_name_str() const { return db_; } - inline const char* get_table_name() const + inline const char *get_table_name() const { return extract_str(table_); } - inline const common::ObString& get_table_name_str() const + inline const common::ObString &get_table_name_str() const { return table_; } @@ -5158,9 +5158,9 @@ public: // constructor and destructor ObObjPriv() : ObSchema(), ObPriv() {} - explicit ObObjPriv(common::ObIAllocator* allocator) : ObSchema(allocator), ObPriv() + explicit ObObjPriv(common::ObIAllocator *allocator) : ObSchema(allocator), ObPriv() {} - ObObjPriv(const ObObjPriv& other) : ObSchema(), ObPriv() + ObObjPriv(const ObObjPriv &other) : ObSchema(), ObPriv() { *this = other; } @@ -5168,7 +5168,7 @@ public: {} // operator= - ObObjPriv& operator=(const ObObjPriv& other); + ObObjPriv &operator=(const ObObjPriv &other); // for sort ObObjPrivSortKey get_sort_key() const @@ -5181,23 +5181,23 @@ public: return ObTenantUrObjId(tenant_id_, grantee_id_, obj_id_, obj_type_, col_id_); } - static bool cmp_tenant_ur_obj_id(const ObObjPriv* lhs, const ObTenantUrObjId& rhs) + static bool cmp_tenant_ur_obj_id(const ObObjPriv *lhs, const ObTenantUrObjId &rhs) { return (lhs->get_tenant_ur_obj_id() < rhs); } - static bool cmp(const ObObjPriv* lhs, const ObObjPriv* rhs) + static bool cmp(const ObObjPriv *lhs, const ObObjPriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_sort_key() < rhs->get_sort_key() : false; } - static bool cmp_sort_key(const ObObjPriv* lhs, const ObObjPrivSortKey& sort_key) + static bool cmp_sort_key(const ObObjPriv *lhs, const ObObjPrivSortKey &sort_key) { return NULL != lhs ? lhs->get_sort_key() < sort_key : false; } - static bool equal(const ObObjPriv* lhs, const ObObjPriv* rhs) + static bool equal(const ObObjPriv *lhs, const ObObjPriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_sort_key() == rhs->get_sort_key() : false; } - static bool equal_sort_key(const ObObjPriv* lhs, const ObObjPrivSortKey& sort_key) + static bool equal_sort_key(const ObObjPriv *lhs, const ObObjPrivSortKey &sort_key) { return NULL != lhs ? lhs->get_sort_key() == sort_key : false; } @@ -5276,16 +5276,16 @@ enum ObPrivLevel { OB_PRIV_MAX_LEVEL, }; -const char* ob_priv_level_str(const ObPrivLevel grant_level); +const char *ob_priv_level_str(const ObPrivLevel grant_level); struct ObNeedPriv { - ObNeedPriv(const common::ObString& db, const common::ObString& table, ObPrivLevel priv_level, ObPrivSet priv_set, + ObNeedPriv(const common::ObString &db, const common::ObString &table, ObPrivLevel priv_level, ObPrivSet priv_set, const bool is_sys_table) : db_(db), table_(table), priv_level_(priv_level), priv_set_(priv_set), is_sys_table_(is_sys_table) {} ObNeedPriv() : db_(), table_(), priv_level_(OB_PRIV_INVALID_LEVEL), priv_set_(0), is_sys_table_(false) {} - int deep_copy(const ObNeedPriv& other, common::ObIAllocator& allocator); + int deep_copy(const ObNeedPriv &other, common::ObIAllocator &allocator); common::ObString db_; common::ObString table_; ObPrivLevel priv_level_; @@ -5296,7 +5296,7 @@ struct ObNeedPriv { struct ObStmtNeedPrivs { typedef common::ObFixedArray NeedPrivs; - explicit ObStmtNeedPrivs(common::ObIAllocator& alloc) : need_privs_(alloc) + explicit ObStmtNeedPrivs(common::ObIAllocator &alloc) : need_privs_(alloc) {} ObStmtNeedPrivs() : need_privs_() {} @@ -5308,7 +5308,7 @@ struct ObStmtNeedPrivs { { need_privs_.reset(); } - int deep_copy(const ObStmtNeedPrivs& other, common::ObIAllocator& allocator); + int deep_copy(const ObStmtNeedPrivs &other, common::ObIAllocator &allocator); NeedPrivs need_privs_; TO_STRING_KV(K_(need_privs)); }; @@ -5331,7 +5331,7 @@ struct ObOraNeedPriv { obj_privs_(0), owner_id_(common::OB_INVALID_ID) {} - ObOraNeedPriv(const common::ObString& db_name, uint64_t grantee_id, uint64_t obj_id, uint64_t col_id, + ObOraNeedPriv(const common::ObString &db_name, uint64_t grantee_id, uint64_t obj_id, uint64_t col_id, uint64_t obj_type, uint32_t check_flag, ObPackedObjPriv obj_privs, uint64_t owner_id) : db_name_(db_name), grantee_id_(grantee_id), @@ -5344,8 +5344,8 @@ struct ObOraNeedPriv { {} ~ObOraNeedPriv() {} - int deep_copy(const ObOraNeedPriv& other, common::ObIAllocator& allocator); - bool same_obj(const ObOraNeedPriv& other); + int deep_copy(const ObOraNeedPriv &other, common::ObIAllocator &allocator); + bool same_obj(const ObOraNeedPriv &other); // ObOraNeedPriv& operator=(const ObOraNeedPriv &other); common::ObString db_name_; uint64_t grantee_id_; @@ -5363,7 +5363,7 @@ struct ObOraNeedPriv { // the system permissions and multiple object permissions are recorded in the array struct ObStmtOraNeedPrivs { typedef common::ObFixedArray OraNeedPrivs; - explicit ObStmtOraNeedPrivs(common::ObIAllocator& alloc) : need_privs_(alloc) + explicit ObStmtOraNeedPrivs(common::ObIAllocator &alloc) : need_privs_(alloc) {} ObStmtOraNeedPrivs() : need_privs_() {} @@ -5375,7 +5375,7 @@ struct ObStmtOraNeedPrivs { { need_privs_.reset(); } - int deep_copy(const ObStmtOraNeedPrivs& other, common::ObIAllocator& allocator); + int deep_copy(const ObStmtOraNeedPrivs &other, common::ObIAllocator &allocator); OraNeedPrivs need_privs_; TO_STRING_KV(K_(need_privs)); }; @@ -5393,7 +5393,7 @@ struct ObSessionPrivInfo { enable_role_id_array_() {} ObSessionPrivInfo(const uint64_t tenant_id, const uint64_t effective_tenant_id, const uint64_t user_id, - const common::ObString& db, const ObPrivSet user_priv_set, const ObPrivSet db_priv_set) + const common::ObString &db, const ObPrivSet user_priv_set, const ObPrivSet db_priv_set) : tenant_id_(tenant_id), user_id_(user_id), user_name_(), @@ -5455,8 +5455,8 @@ struct ObSessionPrivInfo { struct ObUserLoginInfo { ObUserLoginInfo() {} - ObUserLoginInfo(const common::ObString& tenant_name, const common::ObString& user_name, - const common::ObString& client_ip, const common::ObString& passwd, const common::ObString& db) + ObUserLoginInfo(const common::ObString &tenant_name, const common::ObString &user_name, + const common::ObString &client_ip, const common::ObString &passwd, const common::ObString &db) : tenant_name_(tenant_name), user_name_(user_name), client_ip_(client_ip), @@ -5465,9 +5465,9 @@ struct ObUserLoginInfo { scramble_str_() {} - ObUserLoginInfo(const common::ObString& tenant_name, const common::ObString& user_name, - const common::ObString& client_ip, const common::ObString& passwd, const common::ObString& db, - const common::ObString& scramble_str) + ObUserLoginInfo(const common::ObString &tenant_name, const common::ObString &user_name, + const common::ObString &client_ip, const common::ObString &passwd, const common::ObString &db, + const common::ObString &scramble_str) : tenant_name_(tenant_name), user_name_(user_name), client_ip_(client_ip), @@ -5492,25 +5492,25 @@ class ObSysPriv : public ObSchema, public ObPriv { public: ObSysPriv() : ObPriv(), grantee_id_(common::OB_INVALID_ID) {} - explicit ObSysPriv(common::ObIAllocator* allocator) : ObSchema(allocator), ObPriv(allocator) + explicit ObSysPriv(common::ObIAllocator *allocator) : ObSchema(allocator), ObPriv(allocator) {} virtual ~ObSysPriv() {} - ObSysPriv(const ObSysPriv& other) : ObSchema(), ObPriv(), grantee_id_(common::OB_INVALID_ID) + ObSysPriv(const ObSysPriv &other) : ObSchema(), ObPriv(), grantee_id_(common::OB_INVALID_ID) { *this = other; } - ObSysPriv& operator=(const ObSysPriv& other); + ObSysPriv &operator=(const ObSysPriv &other); - static bool cmp_tenant_grantee_id(const ObSysPriv* lhs, const ObTenantUserId& tenant_grantee_id) + static bool cmp_tenant_grantee_id(const ObSysPriv *lhs, const ObTenantUserId &tenant_grantee_id) { return (lhs->get_tenant_grantee_id() < tenant_grantee_id); } - static bool equal_tenant_grantee_id(const ObSysPriv* lhs, const ObTenantUserId& tenant_grantee_id) + static bool equal_tenant_grantee_id(const ObSysPriv *lhs, const ObTenantUserId &tenant_grantee_id) { return (lhs->get_tenant_grantee_id() == tenant_grantee_id); } - static bool cmp_tenant_id(const ObPriv* lhs, const uint64_t tenant_id) + static bool cmp_tenant_id(const ObPriv *lhs, const uint64_t tenant_id) { return (lhs->get_tenant_id() < tenant_id); } @@ -5535,11 +5535,11 @@ public: return user_id_ == 234; } - static bool cmp(const ObSysPriv* lhs, const ObSysPriv* rhs) + static bool cmp(const ObSysPriv *lhs, const ObSysPriv *rhs) { return (NULL != lhs && NULL != rhs) ? (lhs->get_key() < rhs->get_key()) : false; } - static bool cmp_key(const ObSysPriv* lhs, const ObSysPrivKey& key) + static bool cmp_key(const ObSysPriv *lhs, const ObSysPrivKey &key) { return NULL != lhs ? lhs->get_key() < key : false; } @@ -5547,7 +5547,7 @@ public: { return ObSysPrivKey(tenant_id_, grantee_id_); } - static bool equal(const ObSysPriv* lhs, const ObSysPriv* rhs) + static bool equal(const ObSysPriv *lhs, const ObSysPriv *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_key() == rhs->get_key() : false; } // point check @@ -5565,7 +5565,7 @@ private: uint64_t grantee_id_; }; -int get_int_value(const common::ObString& str, int64_t& value); +int get_int_value(const common::ObString &str, int64_t &value); class ObHostnameStuct { public: @@ -5575,12 +5575,12 @@ public: {} static const uint32_t FAKE_PORT = 0; static const int MAX_IP_BITS = 128; - static int get_int_value(const common::ObString& str, int64_t& value); - static bool calc_ip(const common::ObString& host_ip, common::ObAddr& addr); - static bool calc_ip_mask(const common::ObString& host_ip_mask, common::ObAddr& mask); - static bool is_ip_match(const common::ObString& client_ip, common::ObString host_name); - static bool is_wild_match(const common::ObString& client_ip, const common::ObString& host_name); - static bool is_in_white_list(const common::ObString& client_ip, common::ObString& ip_white_list); + static int get_int_value(const common::ObString &str, int64_t &value); + static bool calc_ip(const common::ObString &host_ip, common::ObAddr &addr); + static bool calc_ip_mask(const common::ObString &host_ip_mask, common::ObAddr &mask); + static bool is_ip_match(const common::ObString &client_ip, common::ObString host_name); + static bool is_wild_match(const common::ObString &client_ip, const common::ObString &host_name); + static bool is_in_white_list(const common::ObString &client_ip, common::ObString &ip_white_list); }; enum ObHintFormat { @@ -5594,8 +5594,8 @@ public: {} virtual ~ObFixedParam() {} - bool has_equal_value(const common::ObObj& other_value) const; - bool is_equal(const ObFixedParam& other_param) const; + bool has_equal_value(const common::ObObj &other_value) const; + bool is_equal(const ObFixedParam &other_param) const; VIRTUAL_TO_STRING_KV(K(offset_), K(value_)); int64_t offset_; common::ObObj value_; @@ -5607,16 +5607,16 @@ class ObMaxConcurrentParam { public: static const int64_t UNLIMITED = -1; typedef common::ObArray FixParamStore; - explicit ObMaxConcurrentParam(common::ObIAllocator* allocator, const common::ObMemAttr& attr = common::ObMemAttr()); + explicit ObMaxConcurrentParam(common::ObIAllocator *allocator, const common::ObMemAttr &attr = common::ObMemAttr()); virtual ~ObMaxConcurrentParam(); int destroy(); int64_t get_convert_size() const; - int assign(const ObMaxConcurrentParam& max_concurrent_param); + int assign(const ObMaxConcurrentParam &max_concurrent_param); int64_t get_concurrent_num() const { return concurrent_num_; } - int match_fixed_param(const ParamStore& const_param_store, bool& is_match) const; + int match_fixed_param(const ParamStore &const_param_store, bool &is_match) const; bool is_concurrent_limit_param() const { return concurrent_num_ != UNLIMITED; @@ -5625,20 +5625,20 @@ public: { return !outline_content_.empty(); } - int get_fixed_param_with_offset(int64_t offset, ObFixedParam& fixed_param, bool& is_found) const; - int same_param_as(const ObMaxConcurrentParam& other, bool& is_same) const; - void set_mem_attr(const common::ObMemAttr& attr) + int get_fixed_param_with_offset(int64_t offset, ObFixedParam &fixed_param, bool &is_found) const; + int same_param_as(const ObMaxConcurrentParam &other, bool &is_same) const; + void set_mem_attr(const common::ObMemAttr &attr) { mem_attr_ = attr; } VIRTUAL_TO_STRING_KV(K_(concurrent_num), K_(outline_content), K_(fixed_param_store)); private: - int deep_copy_outline_content(const common::ObString& src); - int deep_copy_param_value(const common::ObObj& src, common::ObObj& dest); + int deep_copy_outline_content(const common::ObString &src); + int deep_copy_param_value(const common::ObObj &src, common::ObObj &dest); public: - common::ObIAllocator* allocator_; + common::ObIAllocator *allocator_; int64_t concurrent_num_; common::ObString outline_content_; common::ObMemAttr mem_attr_; @@ -5655,28 +5655,28 @@ class ObOutlineParamsWrapper { public: ObOutlineParamsWrapper(); - explicit ObOutlineParamsWrapper(common::ObIAllocator* allocator); + explicit ObOutlineParamsWrapper(common::ObIAllocator *allocator); ~ObOutlineParamsWrapper(); int destroy(); - int assign(const ObOutlineParamsWrapper& src); - int set_allocator(common::ObIAllocator* allocator, const common::ObMemAttr& attr = common::ObMemAttr()); - OutlineParamsArray& get_outline_params() + int assign(const ObOutlineParamsWrapper &src); + int set_allocator(common::ObIAllocator *allocator, const common::ObMemAttr &attr = common::ObMemAttr()); + OutlineParamsArray &get_outline_params() { return outline_params_; } - const OutlineParamsArray& get_outline_params() const + const OutlineParamsArray &get_outline_params() const { return outline_params_; } - ObMaxConcurrentParam* get_outline_param(int64_t index) const; + ObMaxConcurrentParam *get_outline_param(int64_t index) const; int64_t get_convert_size() const; bool is_empty() const { return 0 == outline_params_.count(); } - int add_param(const ObMaxConcurrentParam& param); - int has_param(const ObMaxConcurrentParam& param, bool& has_param) const; - int has_concurrent_limit_param(bool& has) const; + int add_param(const ObMaxConcurrentParam ¶m); + int has_param(const ObMaxConcurrentParam ¶m, bool &has_param) const; + int has_concurrent_limit_param(bool &has) const; int64_t get_param_count() const { return outline_params_.count(); @@ -5686,14 +5686,14 @@ public: allocator_ = NULL; mem_attr_ = common::ObMemAttr(); } - void set_mem_attr(const common::ObMemAttr& attr) + void set_mem_attr(const common::ObMemAttr &attr) { mem_attr_ = attr; }; TO_STRING_KV(K_(outline_params)); private: - common::ObIAllocator* allocator_; + common::ObIAllocator *allocator_; OutlineParamsArray outline_params_; common::ObMemAttr mem_attr_; @@ -5720,7 +5720,7 @@ public: return hash_val; } - inline bool operator==(const BaselineKey& other_key) const + inline bool operator==(const BaselineKey &other_key) const { return tenant_id_ == other_key.tenant_id_ && db_id_ == other_key.db_id_ && constructed_sql_ == other_key.constructed_sql_ && params_info_str_ == other_key.params_info_str_; @@ -5745,18 +5745,18 @@ class ObPlanBaselineInfo : public ObSchema { public: ObPlanBaselineInfo(); - explicit ObPlanBaselineInfo(common::ObIAllocator* allocator); + explicit ObPlanBaselineInfo(common::ObIAllocator *allocator); virtual ~ObPlanBaselineInfo(); - ObPlanBaselineInfo(const ObPlanBaselineInfo& src_schema); - ObPlanBaselineInfo& operator=(const ObPlanBaselineInfo& src_schema); + ObPlanBaselineInfo(const ObPlanBaselineInfo &src_schema); + ObPlanBaselineInfo &operator=(const ObPlanBaselineInfo &src_schema); void reset(); int64_t get_convert_size() const; - static bool cmp(const ObPlanBaselineInfo* lhs, const ObPlanBaselineInfo* rhs) + static bool cmp(const ObPlanBaselineInfo *lhs, const ObPlanBaselineInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_plan_baseline_id() < rhs->get_plan_baseline_id() : false; } - static bool equal(const ObPlanBaselineInfo* lhs, const ObPlanBaselineInfo* rhs) + static bool equal(const ObPlanBaselineInfo *lhs, const ObPlanBaselineInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_plan_baseline_id() == rhs->get_plan_baseline_id() : false; } @@ -5845,92 +5845,92 @@ public: // int set_plan_hash_value(const common::number::ObNumber &num); - int set_sql_id(const char* sql_id) + int set_sql_id(const char *sql_id) { return deep_copy_str(sql_id, sql_id_); } - int set_sql_id(const common::ObString& sql_id) + int set_sql_id(const common::ObString &sql_id) { return deep_copy_str(sql_id, sql_id_); } - inline const char* get_sql_id() const + inline const char *get_sql_id() const { return extract_str(sql_id_); } - inline const common::ObString& get_sql_id_str() const + inline const common::ObString &get_sql_id_str() const { return sql_id_; } - int set_hints_info(const char* hints_info) + int set_hints_info(const char *hints_info) { return deep_copy_str(hints_info, hints_info_); } - int set_hints_info(const common::ObString& hints_info) + int set_hints_info(const common::ObString &hints_info) { return deep_copy_str(hints_info, hints_info_); } - inline const char* get_hints_info() const + inline const char *get_hints_info() const { return extract_str(hints_info_); } - inline const common::ObString& get_hints_info_str() const + inline const common::ObString &get_hints_info_str() const { return hints_info_; } - int set_outline_data(const char* outline_data) + int set_outline_data(const char *outline_data) { return deep_copy_str(outline_data, outline_data_); } - int set_outline_data(const common::ObString& outline_data) + int set_outline_data(const common::ObString &outline_data) { return deep_copy_str(outline_data, outline_data_); } - inline const char* get_outline_data() const + inline const char *get_outline_data() const { return extract_str(outline_data_); } - inline const common::ObString& get_outline_data_str() const + inline const common::ObString &get_outline_data_str() const { return outline_data_; } - int set_sql_text(const char* constructed_sql) + int set_sql_text(const char *constructed_sql) { return deep_copy_str(constructed_sql, key_.constructed_sql_); } - int set_sql_text(const common::ObString& constructed_sql) + int set_sql_text(const common::ObString &constructed_sql) { return deep_copy_str(constructed_sql, key_.constructed_sql_); } - inline const char* get_sql_text() const + inline const char *get_sql_text() const { return extract_str(key_.constructed_sql_); } - inline const common::ObString& get_sql_text_str() const + inline const common::ObString &get_sql_text_str() const { return key_.constructed_sql_; } - int set_params_info(const char* params_info) + int set_params_info(const char *params_info) { return deep_copy_str(params_info, key_.params_info_str_); } - int set_params_info(const common::ObString& params_info) + int set_params_info(const common::ObString ¶ms_info) { return deep_copy_str(params_info, key_.params_info_str_); } - inline const char* get_params_info() const + inline const char *get_params_info() const { return extract_str(key_.params_info_str_); } - inline const common::ObString& get_params_info_str() const + inline const common::ObString &get_params_info_str() const { return key_.params_info_str_; } @@ -5958,19 +5958,19 @@ class ObOutlineInfo : public ObSchema { public: ObOutlineInfo(); - explicit ObOutlineInfo(common::ObIAllocator* allocator); + explicit ObOutlineInfo(common::ObIAllocator *allocator); virtual ~ObOutlineInfo(); - ObOutlineInfo(const ObOutlineInfo& src_schema); - ObOutlineInfo& operator=(const ObOutlineInfo& src_schema); + ObOutlineInfo(const ObOutlineInfo &src_schema); + ObOutlineInfo &operator=(const ObOutlineInfo &src_schema); void reset(); bool is_valid() const; bool is_valid_for_replace() const; int64_t get_convert_size() const; - static bool cmp(const ObOutlineInfo* lhs, const ObOutlineInfo* rhs) + static bool cmp(const ObOutlineInfo *lhs, const ObOutlineInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_outline_id() < rhs->get_outline_id() : false; } - static bool equal(const ObOutlineInfo* lhs, const ObOutlineInfo* rhs) + static bool equal(const ObOutlineInfo *lhs, const ObOutlineInfo *rhs) { return (NULL != lhs && NULL != rhs) ? lhs->get_outline_id() == rhs->get_outline_id() : false; } @@ -5991,60 +5991,60 @@ public: { schema_version_ = version; } - int set_name(const char* name) + int set_name(const char *name) { return deep_copy_str(name, name_); } - int set_name(const common::ObString& name) + int set_name(const common::ObString &name) { return deep_copy_str(name, name_); } - int set_signature(const char* sig) + int set_signature(const char *sig) { return deep_copy_str(sig, signature_); } - int set_signature(const common::ObString& sig) + int set_signature(const common::ObString &sig) { return deep_copy_str(sig, signature_); } - int set_sql_id(const char* sql_id) + int set_sql_id(const char *sql_id) { return deep_copy_str(sql_id, sql_id_); } - int set_sql_id(const common::ObString& sql_id) + int set_sql_id(const common::ObString &sql_id) { return deep_copy_str(sql_id, sql_id_); } - int set_outline_params(const common::ObString& outline_params_str); - int set_outline_content(const char* content) + int set_outline_params(const common::ObString &outline_params_str); + int set_outline_content(const char *content) { return deep_copy_str(content, outline_content_); } - int set_outline_content(const common::ObString& content) + int set_outline_content(const common::ObString &content) { return deep_copy_str(content, outline_content_); } - int set_sql_text(const char* sql) + int set_sql_text(const char *sql) { return deep_copy_str(sql, sql_text_); } - int set_sql_text(const common::ObString& sql) + int set_sql_text(const common::ObString &sql) { return deep_copy_str(sql, sql_text_); } - int set_outline_target(const char* target) + int set_outline_target(const char *target) { return deep_copy_str(target, outline_target_); } - int set_outline_target(const common::ObString& target) + int set_outline_target(const common::ObString &target) { return deep_copy_str(target, outline_target_); } - int set_owner(const char* owner) + int set_owner(const char *owner) { return deep_copy_str(owner, owner_); } - int set_owner(const common::ObString& owner) + int set_owner(const common::ObString &owner) { return deep_copy_str(owner, owner_); } @@ -6056,11 +6056,11 @@ public: { used_ = used; } - int set_version(const char* version) + int set_version(const char *version) { return deep_copy_str(version, version_); } - int set_version(const common::ObString& version) + int set_version(const common::ObString &version) { return deep_copy_str(version, version_); } @@ -6113,87 +6113,87 @@ public: { return format_; } - inline const char* get_name() const + inline const char *get_name() const { return extract_str(name_); } - inline const common::ObString& get_name_str() const + inline const common::ObString &get_name_str() const { return name_; } - inline const char* get_signature() const + inline const char *get_signature() const { return extract_str(signature_); } - inline const char* get_sql_id() const + inline const char *get_sql_id() const { return extract_str(sql_id_); } - inline const common::ObString& get_sql_id_str() const + inline const common::ObString &get_sql_id_str() const { return sql_id_; } - inline const common::ObString& get_signature_str() const + inline const common::ObString &get_signature_str() const { return signature_; } - inline const char* get_outline_content() const + inline const char *get_outline_content() const { return extract_str(outline_content_); } - inline const common::ObString& get_outline_content_str() const + inline const common::ObString &get_outline_content_str() const { return outline_content_; } - inline const char* get_sql_text() const + inline const char *get_sql_text() const { return extract_str(sql_text_); } - inline const common::ObString& get_sql_text_str() const + inline const common::ObString &get_sql_text_str() const { return sql_text_; } - inline common::ObString& get_sql_text_str() + inline common::ObString &get_sql_text_str() { return sql_text_; } - inline const char* get_outline_target() const + inline const char *get_outline_target() const { return extract_str(outline_target_); } - inline const common::ObString& get_outline_target_str() const + inline const common::ObString &get_outline_target_str() const { return outline_target_; } - inline common::ObString& get_outline_target_str() + inline common::ObString &get_outline_target_str() { return outline_target_; } - inline const char* get_owner() const + inline const char *get_owner() const { return extract_str(owner_); } - inline const common::ObString& get_owner_str() const + inline const common::ObString &get_owner_str() const { return owner_; } - inline const char* get_version() const + inline const char *get_version() const { return extract_str(version_); } - inline const common::ObString& get_version_str() const + inline const common::ObString &get_version_str() const { return version_; } - int get_visible_signature(common::ObString& visiable_signature) const; + int get_visible_signature(common::ObString &visiable_signature) const; int get_outline_sql( - common::ObIAllocator& allocator, const sql::ObSQLSessionInfo& session, common::ObString& outline_sql) const; - int get_hex_str_from_outline_params(common::ObString& hex_str, common::ObIAllocator& allocator) const; - const ObOutlineParamsWrapper& get_outline_params_wrapper() const + common::ObIAllocator &allocator, const sql::ObSQLSessionInfo &session, common::ObString &outline_sql) const; + int get_hex_str_from_outline_params(common::ObString &hex_str, common::ObIAllocator &allocator) const; + const ObOutlineParamsWrapper &get_outline_params_wrapper() const { return outline_params_wrapper_; } - ObOutlineParamsWrapper& get_outline_params_wrapper() + ObOutlineParamsWrapper &get_outline_params_wrapper() { return outline_params_wrapper_; } @@ -6201,21 +6201,21 @@ public: { return outline_params_wrapper_.get_outline_params().count() > 0; } - int has_concurrent_limit_param(bool& has) const; + int has_concurrent_limit_param(bool &has) const; int gen_valid_allocator(); - int add_param(const ObMaxConcurrentParam& src_param); - static int gen_limit_sql(const common::ObString& visible_signature, const ObMaxConcurrentParam* param, - const sql::ObSQLSessionInfo& session, common::ObIAllocator& allocator, common::ObString& limit_sql); + int add_param(const ObMaxConcurrentParam &src_param); + static int gen_limit_sql(const common::ObString &visible_signature, const ObMaxConcurrentParam *param, + const sql::ObSQLSessionInfo &session, common::ObIAllocator &allocator, common::ObString &limit_sql); VIRTUAL_TO_STRING_KV(K_(tenant_id), K_(database_id), K_(outline_id), K_(schema_version), K_(name), K_(signature), K_(sql_id), K_(outline_content), K_(sql_text), K_(owner_id), K_(owner), K_(used), K_(compatible), K_(enabled), K_(format), K_(outline_params_wrapper), K_(outline_target)); - static bool is_sql_id_valid(const common::ObString& sql_id); + static bool is_sql_id_valid(const common::ObString &sql_id); private: - static int replace_question_mark(const common::ObString& not_param_sql, const ObMaxConcurrentParam& concurrent_param, - int64_t start_pos, int64_t cur_pos, int64_t& question_mark_offset, common::ObSqlString& string_helper); - static int replace_not_param(const common::ObString& not_param_sql, const ParseNode& node, int64_t start_pos, - int64_t cur_pos, common::ObSqlString& string_helper); + static int replace_question_mark(const common::ObString ¬_param_sql, const ObMaxConcurrentParam &concurrent_param, + int64_t start_pos, int64_t cur_pos, int64_t &question_mark_offset, common::ObSqlString &string_helper); + static int replace_not_param(const common::ObString ¬_param_sql, const ParseNode &node, int64_t start_pos, + int64_t cur_pos, common::ObSqlString &string_helper); protected: uint64_t tenant_id_; @@ -6244,7 +6244,7 @@ public: { reset(); } - explicit ObDbLinkBaseInfo(common::ObIAllocator* allocator) : ObSchema(allocator) + explicit ObDbLinkBaseInfo(common::ObIAllocator *allocator) : ObSchema(allocator) { reset(); } @@ -6267,31 +6267,31 @@ public: { schema_version_ = version; } - inline int set_dblink_name(const common::ObString& name) + inline int set_dblink_name(const common::ObString &name) { return deep_copy_str(name, dblink_name_); } - inline int set_cluster_name(const common::ObString& name) + inline int set_cluster_name(const common::ObString &name) { return deep_copy_str(name, cluster_name_); } - inline int set_tenant_name(const common::ObString& name) + inline int set_tenant_name(const common::ObString &name) { return deep_copy_str(name, tenant_name_); } - inline int set_user_name(const common::ObString& name) + inline int set_user_name(const common::ObString &name) { return deep_copy_str(name, user_name_); } - inline int set_password(const common::ObString& password) + inline int set_password(const common::ObString &password) { return deep_copy_str(password, password_); } - inline void set_host_addr(const common::ObAddr& addr) + inline void set_host_addr(const common::ObAddr &addr) { host_addr_ = addr; } - inline int set_host_ip(const common::ObString& host_ip) + inline int set_host_ip(const common::ObString &host_ip) { host_addr_.set_ip_addr(host_ip, 0); return common::OB_SUCCESS; @@ -6317,27 +6317,27 @@ public: { return schema_version_; } - inline const common::ObString& get_dblink_name() const + inline const common::ObString &get_dblink_name() const { return dblink_name_; } - inline const common::ObString& get_cluster_name() const + inline const common::ObString &get_cluster_name() const { return cluster_name_; } - inline const common::ObString& get_tenant_name() const + inline const common::ObString &get_tenant_name() const { return tenant_name_; } - inline const common::ObString& get_user_name() const + inline const common::ObString &get_user_name() const { return user_name_; } - inline const common::ObString& get_password() const + inline const common::ObString &get_password() const { return password_; } - inline const common::ObAddr& get_host_addr() const + inline const common::ObAddr &get_host_addr() const { return host_addr_; } @@ -6374,23 +6374,23 @@ public: {} ObTenantDbLinkId(uint64_t tenant_id, uint64_t dblink_id) : tenant_id_(tenant_id), dblink_id_(dblink_id) {} - ObTenantDbLinkId(const ObTenantDbLinkId& other) : tenant_id_(other.tenant_id_), dblink_id_(other.dblink_id_) + ObTenantDbLinkId(const ObTenantDbLinkId &other) : tenant_id_(other.tenant_id_), dblink_id_(other.dblink_id_) {} - ObTenantDbLinkId& operator=(const ObTenantDbLinkId& other) + ObTenantDbLinkId &operator=(const ObTenantDbLinkId &other) { tenant_id_ = other.tenant_id_; dblink_id_ = other.dblink_id_; return *this; } - bool operator==(const ObTenantDbLinkId& rhs) const + bool operator==(const ObTenantDbLinkId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (dblink_id_ == rhs.dblink_id_); } - bool operator!=(const ObTenantDbLinkId& rhs) const + bool operator!=(const ObTenantDbLinkId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantDbLinkId& rhs) const + bool operator<(const ObTenantDbLinkId &rhs) const { return (tenant_id_ < rhs.tenant_id_) || (tenant_id_ == rhs.tenant_id_ && dblink_id_ < rhs.dblink_id_); } @@ -6426,7 +6426,7 @@ class ObDbLinkInfo : public ObDbLinkBaseInfo { public: ObDbLinkInfo() : ObDbLinkBaseInfo() {} - explicit ObDbLinkInfo(common::ObIAllocator* allocator) : ObDbLinkBaseInfo(allocator) + explicit ObDbLinkInfo(common::ObIAllocator *allocator) : ObDbLinkBaseInfo(allocator) {} virtual ~ObDbLinkInfo() {} @@ -6436,13 +6436,13 @@ class ObDbLinkSchema : public ObDbLinkBaseInfo { public: ObDbLinkSchema() : ObDbLinkBaseInfo() {} - explicit ObDbLinkSchema(common::ObIAllocator* allocator) : ObDbLinkBaseInfo(allocator) + explicit ObDbLinkSchema(common::ObIAllocator *allocator) : ObDbLinkBaseInfo(allocator) {} - ObDbLinkSchema(const ObDbLinkSchema& src_schema); + ObDbLinkSchema(const ObDbLinkSchema &src_schema); virtual ~ObDbLinkSchema() {} - ObDbLinkSchema& operator=(const ObDbLinkSchema& other); - bool operator==(const ObDbLinkSchema& other) const; + ObDbLinkSchema &operator=(const ObDbLinkSchema &other); + bool operator==(const ObDbLinkSchema &other) const; inline ObTenantDbLinkId get_tenant_dblink_id() const { @@ -6460,11 +6460,11 @@ class ObSynonymInfo : public ObSchema { public: ObSynonymInfo(); - explicit ObSynonymInfo(common::ObIAllocator* allocator); + explicit ObSynonymInfo(common::ObIAllocator *allocator); VIRTUAL_TO_STRING_KV(K_(tenant_id), K_(database_id), K_(synonym_id), K_(schema_version)); virtual ~ObSynonymInfo(); - ObSynonymInfo& operator=(const ObSynonymInfo& src_schema); - ObSynonymInfo(const ObSynonymInfo& src_schema); + ObSynonymInfo &operator=(const ObSynonymInfo &src_schema); + ObSynonymInfo(const ObSynonymInfo &src_schema); inline void set_tenant_id(const uint64_t id) { tenant_id_ = id; @@ -6486,27 +6486,27 @@ public: schema_version_ = version; } int64_t get_convert_size() const; - int set_synonym_name(const char* name) + int set_synonym_name(const char *name) { return deep_copy_str(name, name_); } - int set_synonym_name(const common::ObString& name) + int set_synonym_name(const common::ObString &name) { return deep_copy_str(name, name_); } - int set_object_name(const char* name) + int set_object_name(const char *name) { return deep_copy_str(name, object_name_); } - int set_object_name(const common::ObString& name) + int set_object_name(const common::ObString &name) { return deep_copy_str(name, object_name_); } - int set_version(const char* version) + int set_version(const char *version) { return deep_copy_str(version, version_); } - int set_version(const common::ObString& version) + int set_version(const common::ObString &version) { return deep_copy_str(version, version_); } @@ -6526,27 +6526,27 @@ public: { return schema_version_; } - inline const char* get_synonym_name() const + inline const char *get_synonym_name() const { return extract_str(name_); } - inline const common::ObString& get_synonym_name_str() const + inline const common::ObString &get_synonym_name_str() const { return name_; } - inline const char* get_object_name() const + inline const char *get_object_name() const { return extract_str(object_name_); } - inline const common::ObString& get_object_name_str() const + inline const common::ObString &get_object_name_str() const { return object_name_; } - inline const char* get_version() const + inline const char *get_version() const { return extract_str(version_); } - inline const common::ObString& get_version_str() const + inline const common::ObString &get_version_str() const { return version_; } @@ -6576,17 +6576,17 @@ struct ObTenantUDFId { public: ObTenantUDFId() : tenant_id_(common::OB_INVALID_ID), udf_name_() {} - ObTenantUDFId(const uint64_t tenant_id, const common::ObString& name) : tenant_id_(tenant_id), udf_name_(name) + ObTenantUDFId(const uint64_t tenant_id, const common::ObString &name) : tenant_id_(tenant_id), udf_name_(name) {} - bool operator==(const ObTenantUDFId& rhs) const + bool operator==(const ObTenantUDFId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (udf_name_ == rhs.udf_name_); } - bool operator!=(const ObTenantUDFId& rhs) const + bool operator!=(const ObTenantUDFId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantUDFId& rhs) const + bool operator<(const ObTenantUDFId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -6619,15 +6619,15 @@ public: ObTenantSynonymId(const uint64_t tenant_id, const uint64_t synonym_id) : tenant_id_(tenant_id), synonym_id_(synonym_id) {} - bool operator==(const ObTenantSynonymId& rhs) const + bool operator==(const ObTenantSynonymId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (synonym_id_ == rhs.synonym_id_); } - bool operator!=(const ObTenantSynonymId& rhs) const + bool operator!=(const ObTenantSynonymId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantSynonymId& rhs) const + bool operator<(const ObTenantSynonymId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -6660,15 +6660,15 @@ public: ObTenantSequenceId(const uint64_t tenant_id, const uint64_t sequence_id) : tenant_id_(tenant_id), sequence_id_(sequence_id) {} - bool operator==(const ObTenantSequenceId& rhs) const + bool operator==(const ObTenantSequenceId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (sequence_id_ == rhs.sequence_id_); } - bool operator!=(const ObTenantSequenceId& rhs) const + bool operator!=(const ObTenantSequenceId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantSequenceId& rhs) const + bool operator<(const ObTenantSequenceId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -6705,11 +6705,11 @@ public: ObOutlineInfo::reset(); alter_option_bitset_.reset(); } - const common::ObBitSet<>& get_alter_option_bitset() const + const common::ObBitSet<> &get_alter_option_bitset() const { return alter_option_bitset_; } - common::ObBitSet<>& get_alter_option_bitset() + common::ObBitSet<> &get_alter_option_bitset() { return alter_option_bitset_; } @@ -6723,13 +6723,13 @@ class ObOutlineNameHashWrapper { public: ObOutlineNameHashWrapper() : tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID), name_() {} - ObOutlineNameHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString& name_) + ObOutlineNameHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString &name_) : tenant_id_(tenant_id), database_id_(database_id), name_(name_) {} ~ObOutlineNameHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObOutlineNameHashWrapper& rv) const; + inline bool operator==(const ObOutlineNameHashWrapper &rv) const; inline void set_tenant_id(uint64_t tenant_id) { tenant_id_ = tenant_id; @@ -6738,7 +6738,7 @@ public: { database_id_ = database_id; } - inline void set_name(const common::ObString& name) + inline void set_name(const common::ObString &name) { name_ = name; } @@ -6751,7 +6751,7 @@ public: { return database_id_; } - inline const common::ObString& get_name() const + inline const common::ObString &get_name() const { return name_; } @@ -6771,7 +6771,7 @@ inline uint64_t ObOutlineNameHashWrapper::hash() const return hash_ret; } -inline bool ObOutlineNameHashWrapper::operator==(const ObOutlineNameHashWrapper& rv) const +inline bool ObOutlineNameHashWrapper::operator==(const ObOutlineNameHashWrapper &rv) const { return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) && (name_ == rv.name_); } @@ -6780,13 +6780,13 @@ class ObOutlineSignatureHashWrapper { public: ObOutlineSignatureHashWrapper() : tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID), signature_() {} - ObOutlineSignatureHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString& signature) + ObOutlineSignatureHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString &signature) : tenant_id_(tenant_id), database_id_(database_id), signature_(signature) {} ~ObOutlineSignatureHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObOutlineSignatureHashWrapper& rv) const; + inline bool operator==(const ObOutlineSignatureHashWrapper &rv) const; inline void set_tenant_id(uint64_t tenant_id) { tenant_id_ = tenant_id; @@ -6795,7 +6795,7 @@ public: { database_id_ = database_id; } - inline void set_signature(const common::ObString& signature) + inline void set_signature(const common::ObString &signature) { signature_ = signature; } @@ -6808,7 +6808,7 @@ public: { return database_id_; } - inline const common::ObString& get_signature() const + inline const common::ObString &get_signature() const { return signature_; } @@ -6823,13 +6823,13 @@ class ObOutlineSqlIdHashWrapper { public: ObOutlineSqlIdHashWrapper() : tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID), sql_id_() {} - ObOutlineSqlIdHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString& sql_id) + ObOutlineSqlIdHashWrapper(const uint64_t tenant_id, const uint64_t database_id, const common::ObString &sql_id) : tenant_id_(tenant_id), database_id_(database_id), sql_id_(sql_id) {} ~ObOutlineSqlIdHashWrapper() {} inline uint64_t hash() const; - inline bool operator==(const ObOutlineSqlIdHashWrapper& rv) const; + inline bool operator==(const ObOutlineSqlIdHashWrapper &rv) const; inline void set_tenant_id(uint64_t tenant_id) { tenant_id_ = tenant_id; @@ -6838,7 +6838,7 @@ public: { database_id_ = database_id; } - inline void set_sql_id(const common::ObString& sql_id) + inline void set_sql_id(const common::ObString &sql_id) { sql_id_ = sql_id; } @@ -6851,7 +6851,7 @@ public: { return database_id_; } - inline const common::ObString& get_sql_id() const + inline const common::ObString &get_sql_id() const { return sql_id_; } @@ -6871,7 +6871,7 @@ inline uint64_t ObOutlineSqlIdHashWrapper::hash() const return hash_ret; } -inline bool ObOutlineSqlIdHashWrapper::operator==(const ObOutlineSqlIdHashWrapper& rv) const +inline bool ObOutlineSqlIdHashWrapper::operator==(const ObOutlineSqlIdHashWrapper &rv) const { return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) && (sql_id_ == rv.sql_id_); } @@ -6885,7 +6885,7 @@ inline uint64_t ObOutlineSignatureHashWrapper::hash() const return hash_ret; } -inline bool ObOutlineSignatureHashWrapper::operator==(const ObOutlineSignatureHashWrapper& rv) const +inline bool ObOutlineSignatureHashWrapper::operator==(const ObOutlineSignatureHashWrapper &rv) const { return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) && (signature_ == rv.signature_); } @@ -6897,12 +6897,12 @@ private: int init_tenant_space_table_id_map(); int init_sys_table_name_map(); - int check_tenant_space_table_id(const uint64_t table_id, bool& is_tenant_space_table); - int check_sys_table_name(const uint64_t database_id, const common::ObString& table_name, bool& is_tenant_space_table); - int ob_write_string(const common::ObString& src, common::ObString& dst); + int check_tenant_space_table_id(const uint64_t table_id, bool &is_tenant_space_table); + int check_sys_table_name(const uint64_t database_id, const common::ObString &table_name, bool &is_tenant_space_table); + int ob_write_string(const common::ObString &src, common::ObString &dst); public: - static ObSysTableChecker& instance(); + static ObSysTableChecker &instance(); int init(); int destroy(); @@ -6911,13 +6911,13 @@ public: return tenant_space_sys_table_num_; } - static int is_tenant_space_table_id(const uint64_t table_id, bool& is_tenant_space_table); + static int is_tenant_space_table_id(const uint64_t table_id, bool &is_tenant_space_table); static int is_sys_table_name( - const uint64_t database_id, const common::ObString& table_name, bool& is_tenant_space_table); + const uint64_t database_id, const common::ObString &table_name, bool &is_tenant_space_table); static bool is_tenant_table_in_version_2200(const uint64_t table_id); static bool is_cluster_private_tenant_table(const uint64_t table_id); static bool is_backup_private_tenant_table(const uint64_t table_id); - static int is_tenant_table_need_weak_read(const uint64_t table_id, bool& need_weak_read); + static int is_tenant_table_need_weak_read(const uint64_t table_id, bool &need_weak_read); static bool is_rs_restart_related_table_id(const uint64_t table_id); static bool is_rs_restart_related_partition(const uint64_t table_id, const int64_t partition_id); @@ -6927,13 +6927,13 @@ public: TableNameWrapper() : database_id_(common::OB_INVALID_ID), name_case_mode_(common::OB_NAME_CASE_INVALID), table_name_() {} - TableNameWrapper(const uint64_t database_id, const common::ObNameCaseMode mode, const common::ObString& table_name) + TableNameWrapper(const uint64_t database_id, const common::ObNameCaseMode mode, const common::ObString &table_name) : database_id_(database_id), name_case_mode_(mode), table_name_(table_name) {} ~TableNameWrapper() {} inline uint64_t hash() const; - bool operator==(const TableNameWrapper& rv) const; + bool operator==(const TableNameWrapper &rv) const; TO_STRING_KV(K_(database_id), K_(name_case_mode), K_(table_name)); private: @@ -6948,7 +6948,7 @@ private: private: common::hash::ObHashSet tenant_space_table_id_map_; - common::hash::ObHashMap sys_table_name_map_; + common::hash::ObHashMap sys_table_name_map_; int64_t tenant_space_sys_table_num_; // Number of tenant-level system tables (including system table indexes) common::ObArenaAllocator allocator_; bool is_inited_; @@ -6970,7 +6970,7 @@ public: TRIGGER, TENANT, }; - ObRecycleObject(common::ObIAllocator* allocator); + ObRecycleObject(common::ObIAllocator *allocator); ObRecycleObject() : ObSchema(), tenant_id_(common::OB_INVALID_ID), @@ -6983,8 +6983,8 @@ public: tablegroup_name_(), database_name_() {} - ObRecycleObject(const ObRecycleObject& recycle_obj); - ObRecycleObject& operator=(const ObRecycleObject& recycle_obj); + ObRecycleObject(const ObRecycleObject &recycle_obj); + ObRecycleObject &operator=(const ObRecycleObject &recycle_obj); virtual ~ObRecycleObject() {} inline bool is_valid() const; @@ -7006,11 +7006,11 @@ public: { return tablegroup_id_; } - const common::ObString& get_object_name() const + const common::ObString &get_object_name() const { return object_name_; } - const common::ObString& get_original_name() const + const common::ObString &get_original_name() const { return original_name_; } @@ -7034,11 +7034,11 @@ public: { tablegroup_id_ = tablegroup_id; } - int set_object_name(const common::ObString& object_name) + int set_object_name(const common::ObString &object_name) { return deep_copy_str(object_name, object_name_); } - int set_original_name(const common::ObString& original_name) + int set_original_name(const common::ObString &original_name) { return deep_copy_str(original_name, original_name_); } @@ -7046,22 +7046,22 @@ public: { type_ = type; } - int set_type_by_table_schema(const ObSimpleTableSchemaV2& table_schema); - static RecycleObjType get_type_by_table_schema(const ObSimpleTableSchemaV2& table_schema); + int set_type_by_table_schema(const ObSimpleTableSchemaV2 &table_schema); + static RecycleObjType get_type_by_table_schema(const ObSimpleTableSchemaV2 &table_schema); // for backup - int set_tablegroup_name(const common::ObString& tablegroup_name) + int set_tablegroup_name(const common::ObString &tablegroup_name) { return deep_copy_str(tablegroup_name, tablegroup_name_); } - const common::ObString& get_tablegroup_name() const + const common::ObString &get_tablegroup_name() const { return tablegroup_name_; } - int set_database_name(const common::ObString& database_name) + int set_database_name(const common::ObString &database_name) { return deep_copy_str(database_name, database_name_); } - const common::ObString& get_database_name() const + const common::ObString &get_database_name() const { return database_name_; } @@ -7101,7 +7101,7 @@ public: ObBasedSchemaObjectInfo(const uint64_t schema_id, const ObSchemaType schema_type, const int64_t schema_version) : schema_id_(schema_id), schema_type_(schema_type), schema_version_(schema_version) {} - bool operator==(const ObBasedSchemaObjectInfo& other) const + bool operator==(const ObBasedSchemaObjectInfo &other) const { return (schema_id_ == other.schema_id_ && schema_type_ == other.schema_type_ && schema_version_ == other.schema_version_); @@ -7127,7 +7127,7 @@ public: ObAuxTableMetaInfo(const uint64_t table_id, const ObTableType table_type, const int64_t drop_schema_version) : table_id_(table_id), table_type_(table_type), drop_schema_version_(drop_schema_version) {} - bool operator==(const ObAuxTableMetaInfo& other) const + bool operator==(const ObAuxTableMetaInfo &other) const { return (table_id_ == other.table_id_ && table_type_ == other.table_type_ && drop_schema_version_ == other.drop_schema_version_); @@ -7190,7 +7190,7 @@ public: ref_cst_type_(CONSTRAINT_TYPE_INVALID), ref_cst_id_(common::OB_INVALID_ID) {} - ObForeignKeyInfo(common::ObIAllocator* allocator); + ObForeignKeyInfo(common::ObIAllocator *allocator); virtual ~ObForeignKeyInfo() {} @@ -7219,7 +7219,7 @@ public: { delete_action_ = static_cast(delete_action); } - inline int set_foreign_key_name(const common::ObString& foreign_key_name) + inline int set_foreign_key_name(const common::ObString &foreign_key_name) { foreign_key_name_ = foreign_key_name; return common::OB_SUCCESS; @@ -7260,17 +7260,17 @@ public: { ref_cst_id_ = ref_cst_id; } - inline const char* get_update_action_str() const + inline const char *get_update_action_str() const { return get_action_str(update_action_); } - inline const char* get_delete_action_str() const + inline const char *get_delete_action_str() const { return get_action_str(delete_action_); } - inline const char* get_action_str(ObReferenceAction action) const + inline const char *get_action_str(ObReferenceAction action) const { - const char* ret = NULL; + const char *ret = NULL; if (ACTION_RESTRICT <= action && action <= ACTION_SET_DEFAULT) { ret = reference_action_str_[action]; } @@ -7297,7 +7297,7 @@ public: ref_cst_type_ = CONSTRAINT_TYPE_INVALID; ref_cst_id_ = common::OB_INVALID_ID; } - int assign(const ObForeignKeyInfo& other); + int assign(const ObForeignKeyInfo &other); inline int64_t get_convert_size() const { int64_t convert_size = sizeof(*this); @@ -7332,7 +7332,7 @@ public: uint64_t ref_cst_id_; private: - static const char* reference_action_str_[ACTION_MAX + 1]; + static const char *reference_action_str_[ACTION_MAX + 1]; }; struct ObSimpleForeignKeyInfo { @@ -7348,14 +7348,14 @@ public: foreign_key_id_ = common::OB_INVALID_ID; } ObSimpleForeignKeyInfo(const uint64_t tenant_id, const uint64_t database_id, const uint64_t table_id, - const common::ObString& foreign_key_name, const uint64_t foreign_key_id) + const common::ObString &foreign_key_name, const uint64_t foreign_key_id) : tenant_id_(tenant_id), database_id_(database_id), table_id_(table_id), foreign_key_name_(foreign_key_name), foreign_key_id_(foreign_key_id) {} - bool operator==(const ObSimpleForeignKeyInfo& other) const + bool operator==(const ObSimpleForeignKeyInfo &other) const { return (tenant_id_ == other.tenant_id_ && database_id_ == other.database_id_ && table_id_ == other.table_id_ && foreign_key_name_ == other.foreign_key_name_ && foreign_key_id_ == other.foreign_key_id_); @@ -7396,14 +7396,14 @@ public: constraint_id_ = common::OB_INVALID_ID; } ObSimpleConstraintInfo(const uint64_t tenant_id, const uint64_t database_id, const uint64_t table_id, - const common::ObString& constraint_name, const uint64_t constraint_id) + const common::ObString &constraint_name, const uint64_t constraint_id) : tenant_id_(tenant_id), database_id_(database_id), table_id_(table_id), constraint_name_(constraint_name), constraint_id_(constraint_id) {} - bool operator==(const ObSimpleConstraintInfo& other) const + bool operator==(const ObSimpleConstraintInfo &other) const { return (tenant_id_ == other.tenant_id_ && database_id_ == other.database_id_ && table_id_ == other.table_id_ && constraint_name_ == other.constraint_name_ && constraint_id_ == other.constraint_id_); @@ -7433,7 +7433,7 @@ public: template int ObPartitionUtils::check_partition_value( - const PARTITION& l_part, const PARTITION& r_part, const ObPartitionFuncType part_type, bool& is_equal) + const PARTITION &l_part, const PARTITION &r_part, const ObPartitionFuncType part_type, bool &is_equal) { int ret = common::OB_SUCCESS; is_equal = true; @@ -7480,16 +7480,16 @@ int ObPartitionUtils::check_partition_value( } } } else if (is_list_part(part_type)) { - const common::ObIArray& l_list_values = l_part.get_list_row_values(); - const common::ObIArray& r_list_values = r_part.get_list_row_values(); + const common::ObIArray &l_list_values = l_part.get_list_row_values(); + const common::ObIArray &r_list_values = r_part.get_list_row_values(); if (l_list_values.count() != r_list_values.count()) { is_equal = false; } else { for (int64_t i = 0; i < l_list_values.count() && is_equal; i++) { - const common::ObNewRow& l_rowkey = l_list_values.at(i); + const common::ObNewRow &l_rowkey = l_list_values.at(i); bool find_equal_item = false; for (int64_t j = 0; j < r_list_values.count() && !find_equal_item && is_equal; j++) { - const common::ObNewRow& r_rowkey = r_list_values.at(j); + const common::ObNewRow &r_rowkey = r_list_values.at(j); // First check that the count and meta information are consistent; if (l_rowkey.get_count() != r_rowkey.get_count()) { is_equal = false; @@ -7537,11 +7537,11 @@ class ObSequenceSchema : public ObSchema { public: ObSequenceSchema(); - explicit ObSequenceSchema(common::ObIAllocator* allocator); + explicit ObSequenceSchema(common::ObIAllocator *allocator); virtual ~ObSequenceSchema(); - ObSequenceSchema& operator=(const ObSequenceSchema& src_schema); - int assign(const ObSequenceSchema& src_schema); - ObSequenceSchema(const ObSequenceSchema& src_schema); + ObSequenceSchema &operator=(const ObSequenceSchema &src_schema); + int assign(const ObSequenceSchema &src_schema); + ObSequenceSchema(const ObSequenceSchema &src_schema); int64_t get_convert_size() const; inline void set_tenant_id(const uint64_t id) @@ -7560,15 +7560,15 @@ public: { schema_version_ = version; } - inline int set_sequence_name(const char* name) + inline int set_sequence_name(const char *name) { return deep_copy_str(name, name_); } - inline int set_sequence_name(const common::ObString& name) + inline int set_sequence_name(const common::ObString &name) { return deep_copy_str(name, name_); } - inline int set_name(const common::ObString& name) + inline int set_name(const common::ObString &name) { return set_sequence_name(name); } @@ -7593,44 +7593,44 @@ public: // int set_start_with(const common::ObString &str); // int set_cache_size(const common::ObString &str); - int set_max_value(const common::number::ObNumber& num) + int set_max_value(const common::number::ObNumber &num) { return option_.set_max_value(num); } - int set_min_value(const common::number::ObNumber& num) + int set_min_value(const common::number::ObNumber &num) { return option_.set_min_value(num); } - int set_increment_by(const common::number::ObNumber& num) + int set_increment_by(const common::number::ObNumber &num) { return option_.set_increment_by(num); } - int set_start_with(const common::number::ObNumber& num) + int set_start_with(const common::number::ObNumber &num) { return option_.set_start_with(num); } - int set_cache_size(const common::number::ObNumber& num) + int set_cache_size(const common::number::ObNumber &num) { return option_.set_cache_size(num); } - inline const common::number::ObNumber& get_min_value() const + inline const common::number::ObNumber &get_min_value() const { return option_.get_min_value(); } - inline const common::number::ObNumber& get_max_value() const + inline const common::number::ObNumber &get_max_value() const { return option_.get_max_value(); } - inline const common::number::ObNumber& get_increment_by() const + inline const common::number::ObNumber &get_increment_by() const { return option_.get_increment_by(); } - inline const common::number::ObNumber& get_start_with() const + inline const common::number::ObNumber &get_start_with() const { return option_.get_start_with(); } - inline const common::number::ObNumber& get_cache_size() const + inline const common::number::ObNumber &get_cache_size() const { return option_.get_cache_size(); } @@ -7664,19 +7664,19 @@ public: { return schema_version_; } - inline const common::ObString& get_sequence_name() const + inline const common::ObString &get_sequence_name() const { return name_; } - inline const char* get_sequence_name_str() const + inline const char *get_sequence_name_str() const { return extract_str(name_); } - inline share::ObSequenceOption& get_sequence_option() + inline share::ObSequenceOption &get_sequence_option() { return option_; } - inline const share::ObSequenceOption& get_sequence_option() const + inline const share::ObSequenceOption &get_sequence_option() const { return option_; } @@ -7714,15 +7714,15 @@ public: ObTenantCommonSchemaId(const uint64_t tenant_id, const uint64_t schema_id) : tenant_id_(tenant_id), schema_id_(schema_id) {} - bool operator==(const ObTenantCommonSchemaId& rhs) const + bool operator==(const ObTenantCommonSchemaId &rhs) const { return (tenant_id_ == rhs.tenant_id_) && (schema_id_ == rhs.schema_id_); } - bool operator!=(const ObTenantCommonSchemaId& rhs) const + bool operator!=(const ObTenantCommonSchemaId &rhs) const { return !(*this == rhs); } - bool operator<(const ObTenantCommonSchemaId& rhs) const + bool operator<(const ObTenantCommonSchemaId &rhs) const { bool bret = tenant_id_ < rhs.tenant_id_; if (tenant_id_ == rhs.tenant_id_) { @@ -7785,10 +7785,10 @@ public: static const int64_t DEFAULT_PARAM_VALUES[MAX_PARAMS]; static const int64_t INVALID_PARAM_VALUES[MAX_PARAMS]; - static const char* PARAM_VALUE_NAMES[MAX_PARAMS]; + static const char *PARAM_VALUE_NAMES[MAX_PARAMS]; ObProfileSchema(); - explicit ObProfileSchema(common::ObIAllocator* allocator); + explicit ObProfileSchema(common::ObIAllocator *allocator); virtual ~ObProfileSchema(); TO_STRING_KV(K_(tenant_id), K_(profile_id), K_(schema_version), K_(profile_name), K_(failed_login_attempts), @@ -7798,8 +7798,8 @@ public: void reset(); int64_t get_convert_size() const; - ObProfileSchema& operator=(const ObProfileSchema& src_schema); - ObProfileSchema(const ObProfileSchema& src_schema); + ObProfileSchema &operator=(const ObProfileSchema &src_schema); + ObProfileSchema(const ObProfileSchema &src_schema); inline void set_tenant_id(const uint64_t id) { @@ -7813,11 +7813,11 @@ public: { schema_version_ = version; } - inline int set_profile_name(const char* name) + inline int set_profile_name(const char *name) { return deep_copy_str(name, profile_name_); } - inline int set_profile_name(const common::ObString& name) + inline int set_profile_name(const common::ObString &name) { return deep_copy_str(name, profile_name_); } @@ -7850,11 +7850,11 @@ public: { return schema_version_; } - inline const char* get_profile_name() const + inline const char *get_profile_name() const { return extract_str(profile_name_); } - inline const common::ObString& get_profile_name_str() const + inline const common::ObString &get_profile_name_str() const { return profile_name_; } @@ -7884,21 +7884,21 @@ public: int set_default_value(const int64_t type); int set_default_values(); int set_invalid_values(); - static int get_default_value(const int64_t type, int64_t& value); + static int get_default_value(const int64_t type, int64_t &value); - inline const char* get_password_verify_function() const + inline const char *get_password_verify_function() const { return extract_str(password_verify_function_); } - inline const common::ObString& get_password_verify_function_str() const + inline const common::ObString &get_password_verify_function_str() const { return password_verify_function_; } - inline int set_password_verify_function(const char* name) + inline int set_password_verify_function(const char *name) { return deep_copy_str(name, password_verify_function_); } - inline int set_password_verify_function(const common::ObString& name) + inline int set_password_verify_function(const common::ObString &name) { return deep_copy_str(name, password_verify_function_); } @@ -7915,7 +7915,7 @@ private: int64_t password_grace_time_; }; -common::ObIAllocator*& schema_stack_allocator(); +common::ObIAllocator *&schema_stack_allocator(); struct ObObjectStruct { ObObjectStruct() : type_(ObObjectType::INVALID), id_(common::OB_INVALID_ID){}; @@ -7941,7 +7941,7 @@ public: virtual ObObjectType get_object_type() const = 0; static constexpr uint64_t TYPE_MASK = (0x7) << (sizeof(uint64_t) - 3); static constexpr uint64_t VAL_MASK = (-1) >> 3; - void inline gen_mask(uint64_t type, uint64_t& id) + void inline gen_mask(uint64_t type, uint64_t &id) { id = (TYPE_MASK & type) | (VAL_MASK & id); } diff --git a/src/sql/resolver/cmd/ob_variable_set_resolver.cpp b/src/sql/resolver/cmd/ob_variable_set_resolver.cpp index ff32d3cd0bc94485625671a37241339470d46d37..02851e1767da7ac87103df1e703aa58c36213f66 100644 --- a/src/sql/resolver/cmd/ob_variable_set_resolver.cpp +++ b/src/sql/resolver/cmd/ob_variable_set_resolver.cpp @@ -17,21 +17,22 @@ #include "sql/resolver/cmd/ob_variable_set_resolver.h" #include "sql/resolver/cmd/ob_variable_set_stmt.h" #include "sql/session/ob_sql_session_info.h" +#include "sql/resolver/cmd/ob_variable_set_resolver.h" namespace oceanbase { using namespace common; using namespace share; namespace sql { -ObVariableSetResolver::ObVariableSetResolver(ObResolverParams& params) : ObStmtResolver(params) +ObVariableSetResolver::ObVariableSetResolver(ObResolverParams ¶ms) : ObStmtResolver(params) {} ObVariableSetResolver::~ObVariableSetResolver() {} -int ObVariableSetResolver::resolve(const ParseNode& parse_tree) +int ObVariableSetResolver::resolve(const ParseNode &parse_tree) { int ret = OB_SUCCESS; - ObVariableSetStmt* variable_set_stmt = NULL; + ObVariableSetStmt *variable_set_stmt = NULL; if (OB_UNLIKELY(T_VARIABLE_SET != parse_tree.type_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("parse_tree.type_ must be T_VARIABLE_SET", K(ret), K(parse_tree.type_)); @@ -44,7 +45,7 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree) } else { stmt_ = variable_set_stmt; variable_set_stmt->set_actual_tenant_id(session_info_->get_effective_tenant_id()); - ParseNode* set_node = NULL; + ParseNode *set_node = NULL; ObVariableSetStmt::VariableSetNode var_node; ObVariableSetStmt::NamesSetNode names_node; for (int64_t i = 0; OB_SUCC(ret) && i < parse_tree.num_child_; ++i) { @@ -57,7 +58,7 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree) } } else if (T_SET_NAMES == set_node->type_ || T_SET_CHARSET == set_node->type_) { if (OB_FAIL(resolve_set_names(*set_node, names_node))) - LOG_WARN("resolve set names failed", K(ret)); + LOG_WARN("resolve set names failed", K(ret)); } else { ret = OB_ERR_UNEXPECTED; LOG_ERROR("unexpected set_node->type_ ", K(ret), K(set_node->type_)); @@ -74,12 +75,11 @@ int ObVariableSetResolver::resolve(const ParseNode& parse_tree) return ret; } -int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node, - ObVariableSetStmt::VariableSetNode &var_node, - ObVariableSetStmt* variable_set_stmt) +int ObVariableSetResolver::resolve_set_variable( + const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node, ObVariableSetStmt *variable_set_stmt) { int ret = OB_SUCCESS; - ParseNode* var = NULL; + ParseNode *var = NULL; switch (set_node.value_) { case 0: var_node.set_scope_ = ObSetVar::SET_SCOPE_SESSION; @@ -105,7 +105,7 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node, var_node.is_system_variable_ = true; var_name.assign_ptr(var->str_value_, static_cast(var->str_len_)); } else if (T_OBJ_ACCESS_REF == var->type_) { // Oracle mode - const ParseNode* name_node = NULL; + const ParseNode *name_node = NULL; if (OB_ISNULL(name_node = var->children_[0]) || OB_UNLIKELY(var->children_[1] != NULL)) { ret = OB_NOT_SUPPORTED; LOG_USER_ERROR(OB_NOT_SUPPORTED, "Variable name not an identifier type"); @@ -171,18 +171,15 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node, } if (OB_SUCC(ret)) { if (0 == var_node.variable_name_.case_compare("ob_compatibility_mode") && - 0 == strncasecmp( - value_node.str_value_, "oracle", std::min(static_cast(value_node.str_len_), 6))) { + 0 == strncasecmp(value_node.str_value_, "oracle", std::min(static_cast(value_node.str_len_), 6))) { ret = OB_NOT_SUPPORTED; LOG_USER_ERROR(OB_NOT_SUPPORTED, "Not support oracle mode"); - } else if (OB_FAIL( - ObResolverUtils::resolve_const_expr(params_, value_node, var_node.value_expr_, NULL))) { + } else if (OB_FAIL(ObResolverUtils::resolve_const_expr(params_, value_node, var_node.value_expr_, NULL))) { LOG_WARN("resolve variable value failed", K(ret)); } } } else { - if (OB_FAIL(ObResolverUtils::resolve_const_expr( - params_, *set_node.children_[1], var_node.value_expr_, NULL))) { + if (OB_FAIL(ObResolverUtils::resolve_const_expr(params_, *set_node.children_[1], var_node.value_expr_, NULL))) { LOG_WARN("resolve variable value failed", K(ret)); } } @@ -190,8 +187,7 @@ int ObVariableSetResolver::resolve_set_variable(const ParseNode &set_node, return ret; } -int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, - ObVariableSetStmt::NamesSetNode &names_node) +int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, ObVariableSetStmt::NamesSetNode &names_node) { int ret = OB_SUCCESS; if (OB_ISNULL(set_node.children_)) { @@ -209,8 +205,7 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, } else { names_node.is_default_charset_ = false; ObString charset; - charset.assign_ptr( - set_node.children_[0]->str_value_, static_cast(set_node.children_[0]->str_len_)); + charset.assign_ptr(set_node.children_[0]->str_value_, static_cast(set_node.children_[0]->str_len_)); if (0 == charset.case_compare("utf16")) { ret = OB_ERR_WRONG_VALUE_FOR_VAR; LOG_USER_ERROR(OB_ERR_WRONG_VALUE_FOR_VAR, @@ -240,8 +235,8 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, names_node.is_default_charset_ = true; } else { names_node.is_default_charset_ = false; - names_node.charset_.assign_ptr(set_node.children_[0]->str_value_, - static_cast(set_node.children_[0]->str_len_)); + names_node.charset_.assign_ptr( + set_node.children_[0]->str_value_, static_cast(set_node.children_[0]->str_len_)); } } } @@ -249,19 +244,17 @@ int ObVariableSetResolver::resolve_set_names(const ParseNode &set_node, return ret; } - - -ObAlterSessionSetResolver::ObAlterSessionSetResolver(ObResolverParams& params) : ObStmtResolver(params) +ObAlterSessionSetResolver::ObAlterSessionSetResolver(ObResolverParams ¶ms) : ObStmtResolver(params) {} ObAlterSessionSetResolver::~ObAlterSessionSetResolver() {} // for oracle mode grammer: alter session set sys_var = val -int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree) +int ObAlterSessionSetResolver::resolve(const ParseNode &parse_tree) { int ret = OB_SUCCESS; - ObVariableSetStmt* variable_set_stmt = NULL; + ObVariableSetStmt *variable_set_stmt = NULL; if (OB_UNLIKELY(T_ALTER_SESSION_SET != parse_tree.type_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("parse_tree.type_ must be T_ALTER_SESSION_SET", K(ret), K(parse_tree.type_)); @@ -275,8 +268,8 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree) // start resolve stmt_ = variable_set_stmt; variable_set_stmt->set_actual_tenant_id(session_info_->get_effective_tenant_id()); - ParseNode* set_clause_node = NULL; - ParseNode* set_param_node = NULL; + ParseNode *set_clause_node = NULL; + ParseNode *set_param_node = NULL; ObVariableSetStmt::VariableSetNode var_node; // resolve alter_session_set_clause if (OB_ISNULL(set_clause_node = parse_tree.children_[0])) { @@ -296,7 +289,7 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree) LOG_WARN("set_node->type_ must be T_VAR_VAL", K(ret), K(set_param_node->type_)); } else { // resolve set_system_parameter_clause - ParseNode* var = NULL; + ParseNode *var = NULL; var_node.set_scope_ = ObSetVar::SET_SCOPE_SESSION; if (OB_ISNULL(var = set_param_node->children_[0])) { ret = OB_ERR_UNEXPECTED; @@ -332,8 +325,8 @@ int ObAlterSessionSetResolver::resolve(const ParseNode& parse_tree) } } } - if (OB_SUCC(ret) && OB_FAIL(variable_set_stmt->add_variable_node( - ObVariableSetStmt::make_variable_name_node(var_node)))) { + if (OB_SUCC(ret) && + OB_FAIL(variable_set_stmt->add_variable_node(ObVariableSetStmt::make_variable_name_node(var_node)))) { LOG_WARN("Add set entry failed", K(ret)); } } diff --git a/src/sql/resolver/cmd/ob_variable_set_resolver.h b/src/sql/resolver/cmd/ob_variable_set_resolver.h index 0631caf207205fe72e41ace76cf18e58142d52e3..b0c8e439ad43e451286b4f5755a65520d35b3f0d 100644 --- a/src/sql/resolver/cmd/ob_variable_set_resolver.h +++ b/src/sql/resolver/cmd/ob_variable_set_resolver.h @@ -14,17 +14,19 @@ #define OCEANBASE_SQL_RESOLVER_CMD_OB_VARIALBLE_SET_RESOLVER_ #include "sql/resolver/ob_stmt_resolver.h" +#include "sql/resolver/cmd/ob_variable_set_resolver.h" +#include "sql/resolver/cmd/ob_variable_set_stmt.h" namespace oceanbase { namespace sql { class ObVariableSetResolver : public ObStmtResolver { public: - explicit ObVariableSetResolver(ObResolverParams& params); + explicit ObVariableSetResolver(ObResolverParams ¶ms); virtual ~ObVariableSetResolver(); - virtual int resolve(const ParseNode& parse_tree); - int resolve_set_variable(const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node, - ObVariableSetStmt* variable_set_stmt); + virtual int resolve(const ParseNode &parse_tree); + int resolve_set_variable( + const ParseNode &set_node, ObVariableSetStmt::VariableSetNode &var_node, ObVariableSetStmt *variable_set_stmt); int resolve_set_names(const ParseNode &set_node, ObVariableSetStmt::NamesSetNode &names_node); private: @@ -33,10 +35,10 @@ private: class ObAlterSessionSetResolver : public ObStmtResolver { public: - explicit ObAlterSessionSetResolver(ObResolverParams& params); + explicit ObAlterSessionSetResolver(ObResolverParams ¶ms); virtual ~ObAlterSessionSetResolver(); - virtual int resolve(const ParseNode& parse_tree); + virtual int resolve(const ParseNode &parse_tree); private: DISALLOW_COPY_AND_ASSIGN(ObAlterSessionSetResolver); diff --git a/src/sql/resolver/expr/ob_raw_expr.h b/src/sql/resolver/expr/ob_raw_expr.h index d1b0765cb99fe9c0dc7f599f18c5d6d7aa3eafc5..b546a03a44ae8a4b279b4252d5b49a0ef4ff04eb 100644 --- a/src/sql/resolver/expr/ob_raw_expr.h +++ b/src/sql/resolver/expr/ob_raw_expr.h @@ -29,6 +29,7 @@ #include "sql/resolver/expr/ob_case_op_expr.h" #include "sql/engine/expr/ob_expr_res_type.h" #include "share/schema/ob_schema_utils.h" +#include "share/schema/ob_schema_struct.h" #include "sql/ob_sql_define.h" #include "sql/resolver/expr/ob_expr_info_flag.h" #include "share/system_variable/ob_system_variable.h" @@ -50,7 +51,7 @@ class ObSQLSessionInfo; class ObExprOperator; class ObRawExprFactory; class ObSelectStmt; -extern ObRawExpr* USELESS_POINTER; +extern ObRawExpr *USELESS_POINTER; // ObSqlBitSet is a simple bitset, in order to avoid memory explosure // ObBitSet is too large just for a simple bitset @@ -70,7 +71,7 @@ public: SQL_RESV_LOG(WARN, "invalid argument", K(ret)); } else { int64_t words_size = sizeof(BitSetWord) * MAX_BITSETWORD; - if (OB_ISNULL(bit_set_word_array_ = (BitSetWord*)block_allocator_->alloc(words_size))) { + if (OB_ISNULL(bit_set_word_array_ = (BitSetWord *)block_allocator_->alloc(words_size))) { ret = OB_ALLOCATE_MEMORY_FAILED; SQL_RESV_LOG(WARN, "failed to alloc memory", K(ret)); } else { @@ -82,7 +83,7 @@ public: } } - ObSqlBitSet(const ObSqlBitSet& other) + ObSqlBitSet(const ObSqlBitSet &other) : block_allocator_(NULL), bit_set_word_array_(NULL), desc_() { int ret = OB_SUCCESS; @@ -100,7 +101,7 @@ public: cap = MAX_BITSETWORD; } int64_t words_size = sizeof(BitSetWord) * cap; - if (OB_ISNULL(bit_set_word_array_ = (BitSetWord*)block_allocator_->alloc(words_size))) { + if (OB_ISNULL(bit_set_word_array_ = (BitSetWord *)block_allocator_->alloc(words_size))) { ret = OB_ALLOCATE_MEMORY_FAILED; SQL_RESV_LOG(WARN, "failed to alloc memory", K(ret)); } else { @@ -125,7 +126,7 @@ public: } else { int64_t bitset_word_cnt = (bit_size <= N ? MAX_BITSETWORD : ((bit_size - 1) / PER_BITSETWORD_BITS + 1)); int64_t words_size = sizeof(BitSetWord) * bitset_word_cnt; - if (OB_ISNULL(bit_set_word_array_ = (BitSetWord*)block_allocator_->alloc(words_size))) { + if (OB_ISNULL(bit_set_word_array_ = (BitSetWord *)block_allocator_->alloc(words_size))) { ret = OB_ALLOCATE_MEMORY_FAILED; SQL_RESV_LOG(WARN, "failed to alloc memory", K(ret)); } else { @@ -338,7 +339,7 @@ public: } template - int add_members(const ObSqlBitSet& other) + int add_members(const ObSqlBitSet &other) { int ret = common::OB_SUCCESS; if (!is_valid()) { @@ -377,13 +378,13 @@ public: } template - int add_members2(const ObSqlBitSet& other) + int add_members2(const ObSqlBitSet &other) { return add_members(other); } template - int del_members(const ObSqlBitSet& other) + int del_members(const ObSqlBitSet &other) { int ret = common::OB_SUCCESS; if (!is_valid()) { @@ -398,13 +399,13 @@ public: } template - int del_members2(const ObSqlBitSet& other) + int del_members2(const ObSqlBitSet &other) { return del_members(other); } template - bool is_subset(const ObSqlBitSet& other) const + bool is_subset(const ObSqlBitSet &other) const { bool bool_ret = true; if (!is_valid()) { @@ -426,13 +427,13 @@ public: } template - bool is_subset2(const ObSqlBitSet& other) const + bool is_subset2(const ObSqlBitSet &other) const { return is_subset(other); } template - bool is_superset(const ObSqlBitSet& other) const + bool is_superset(const ObSqlBitSet &other) const { bool bool_ret = false; if (!is_valid()) { @@ -455,13 +456,13 @@ public: } template - bool is_superset2(const ObSqlBitSet& other) const + bool is_superset2(const ObSqlBitSet &other) const { return is_superset(other); } template - bool overlap(const ObSqlBitSet& other) const + bool overlap(const ObSqlBitSet &other) const { bool bool_ret = false; if (!is_valid()) { @@ -478,12 +479,12 @@ public: } template - bool overlap2(const ObSqlBitSet& other) const + bool overlap2(const ObSqlBitSet &other) const { return overlap(other); } - int to_array(ObIArray& arr) const + int to_array(ObIArray &arr) const { int ret = common::OB_SUCCESS; if (!is_valid()) { @@ -508,7 +509,7 @@ public: } template - bool equal(const ObSqlBitSet& other) const + bool equal(const ObSqlBitSet &other) const { bool bool_ret = true; if (!is_valid() || !other.is_valid()) { @@ -525,18 +526,18 @@ public: return bool_ret; } - bool operator==(const ObSqlBitSet& other) const + bool operator==(const ObSqlBitSet &other) const { return this->equal(other); } - bool operator!=(const ObSqlBitSet& other) const + bool operator!=(const ObSqlBitSet &other) const { return !(*this == other); } template - int intersect(const ObSqlBitSet& left, const ObSqlBitSet& right) + int intersect(const ObSqlBitSet &left, const ObSqlBitSet &right) { int ret = common::OB_SUCCESS; if (!is_valid() || !left.is_valid() || !right.is_valid()) { @@ -568,7 +569,7 @@ public: } template - int except(const ObSqlBitSet& left, const ObSqlBitSet& right) + int except(const ObSqlBitSet &left, const ObSqlBitSet &right) { int ret = common::OB_SUCCESS; if (!is_valid() || !left.is_valid() || !right.is_valid()) { @@ -602,17 +603,17 @@ public: return ret; } - static int databuff_print_obj(char* buf, const int64_t buf_len, int64_t& pos, const int64_t& obj) + static int databuff_print_obj(char *buf, const int64_t buf_len, int64_t &pos, const int64_t &obj) { return common::databuff_print_obj(buf, buf_len, pos, obj); } - static int databuff_print_obj(char* buf, const int64_t buf_len, int64_t& pos, const ObExprInfoFlag& flag) + static int databuff_print_obj(char *buf, const int64_t buf_len, int64_t &pos, const ObExprInfoFlag &flag) { return common::databuff_printf(buf, buf_len, pos, "\"%s\"", get_expr_info_flag_str(flag)); } - int64_t to_string(char* buf, const int64_t buf_len) const + int64_t to_string(char *buf, const int64_t buf_len) const { int ret = common::OB_SUCCESS; int64_t pos = 0; @@ -635,7 +636,7 @@ public: return pos; } - ObSqlBitSet& operator=(const ObSqlBitSet& other) + ObSqlBitSet &operator=(const ObSqlBitSet &other) { int ret = OB_SUCCESS; if (!other.is_valid() || !is_valid()) { @@ -668,14 +669,14 @@ private: { int ret = OB_SUCCESS; int64_t words_size = sizeof(BitSetWord) * word_cnt; - BitSetWord* new_buf = NULL; - ObIAllocator* allocator = get_block_allocator(); + BitSetWord *new_buf = NULL; + ObIAllocator *allocator = get_block_allocator(); if (!is_valid()) { ret = OB_NOT_INIT; SQL_RESV_LOG(WARN, "not inited", K(ret)); } else if (OB_ISNULL(allocator)) { SQL_RESV_LOG(WARN, "invalid allocator", K(ret)); - } else if (OB_ISNULL(new_buf = (BitSetWord*)allocator->alloc(words_size))) { + } else if (OB_ISNULL(new_buf = (BitSetWord *)allocator->alloc(words_size))) { ret = OB_ALLOCATE_MEMORY_FAILED; SQL_RESV_LOG(WARN, "failed to alloc memory", K(ret)); } else { @@ -689,9 +690,9 @@ private: return ret; } - ObIAllocator* get_block_allocator() + ObIAllocator *get_block_allocator() { - ObIAllocator* ret_alloc = NULL; + ObIAllocator *ret_alloc = NULL; if (!is_valid()) { // do nothing } else { @@ -709,7 +710,7 @@ private: } else if (auto_free) { block_allocator_ = &CURRENT_CONTEXT->get_arena_allocator(); } else { - void* alloc_buf = NULL; + void *alloc_buf = NULL; if (OB_ISNULL(alloc_buf = ob_malloc(sizeof(ObArenaAllocator), ObModIds::OB_BIT_SET))) { ret = OB_ALLOCATE_MEMORY_FAILED; SQL_RESV_LOG(WARN, "failed to allocate memory", K(ret)); @@ -736,8 +737,8 @@ private: }; private: - ObIAllocator* block_allocator_; - BitSetWord* bit_set_word_array_; + ObIAllocator *block_allocator_; + BitSetWord *bit_set_word_array_; SqlBitSetDesc desc_; }; @@ -766,13 +767,13 @@ public: ObObjAccessIdent() : type_(UNKNOWN), access_name_(), access_index_(common::OB_INVALID_INDEX), sys_func_expr_(NULL), params_() {} - ObObjAccessIdent(const common::ObString& name, int64_t index = common::OB_INVALID_INDEX) + ObObjAccessIdent(const common::ObString &name, int64_t index = common::OB_INVALID_INDEX) : type_(UNKNOWN), access_name_(name), access_index_(index), sys_func_expr_(NULL), params_() {} virtual ~ObObjAccessIdent() {} - int assign(const ObObjAccessIdent& other) + int assign(const ObObjAccessIdent &other) { type_ = other.type_; access_name_ = other.access_name_; @@ -780,7 +781,7 @@ public: sys_func_expr_ = other.sys_func_expr_; return params_.assign(other.params_); } - ObObjAccessIdent& operator=(const ObObjAccessIdent& other) + ObObjAccessIdent &operator=(const ObObjAccessIdent &other) { assign(other); return *this; @@ -848,17 +849,17 @@ public: return is_local_type(); } - int extract_params(int64_t level, common::ObIArray& params) const; - int replace_params(ObRawExpr* from, ObRawExpr* to); + int extract_params(int64_t level, common::ObIArray ¶ms) const; + int replace_params(ObRawExpr *from, ObRawExpr *to); TO_STRING_KV(K_(access_name), K_(access_index), K_(type), K_(params)); AccessNameType type_; common::ObString access_name_; int64_t access_index_; - ObSysFunRawExpr* sys_func_expr_; + ObSysFunRawExpr *sys_func_expr_; // x/y/m/n are parameters of a.f, but the param_level of x/y is 0, and m/n is 1. - common::ObSEArray, 4, common::ModulePageAllocator, true> params_; + common::ObSEArray, 4, common::ModulePageAllocator, true> params_; }; class ObColumnRefRawExpr; @@ -878,7 +879,7 @@ public: virtual ~ObQualifiedName() {} - int assign(const ObQualifiedName& other) + int assign(const ObQualifiedName &other) { database_name_ = other.database_name_; tbl_name_ = other.tbl_name_; @@ -890,7 +891,7 @@ public: is_access_root_ = other.is_access_root_; return access_idents_.assign(other.access_idents_); } - ObQualifiedName& operator=(const ObQualifiedName& other) + ObQualifiedName &operator=(const ObQualifiedName &other) { assign(other); return *this; @@ -910,7 +911,7 @@ public: return is_access_root_; } - int replace_access_ident_params(ObRawExpr* from, ObRawExpr* to); + int replace_access_ident_params(ObRawExpr *from, ObRawExpr *to); TO_STRING_KV(N_DATABASE_NAME, database_name_, N_TABLE_NAME, tbl_name_, N_COLUMN, col_name_, K_(is_star), K_(ref_expr), K_(parents_expr_info), K_(parent_aggr_level), K_(access_idents), K_(is_access_root)); @@ -920,7 +921,7 @@ public: common::ObString tbl_name_; // used for package name for UDF common::ObString col_name_; // used for function name for UDF bool is_star_; - ObColumnRefRawExpr* ref_expr_; + ObColumnRefRawExpr *ref_expr_; ObExprInfo parents_expr_info_; int64_t parent_aggr_level_; // all identifiers will be stored here, like a/f/c in a.f(x,y).c @@ -954,9 +955,9 @@ struct OrderItem { { reset(); } - explicit OrderItem(ObRawExpr* expr) : expr_(expr), order_type_(default_asc_direction()) + explicit OrderItem(ObRawExpr *expr) : expr_(expr), order_type_(default_asc_direction()) {} - OrderItem(ObRawExpr* expr, ObOrderDirection order_type) : expr_(expr), order_type_(order_type) + OrderItem(ObRawExpr *expr, ObOrderDirection order_type) : expr_(expr), order_type_(order_type) {} public: @@ -967,11 +968,11 @@ public: expr_ = NULL; order_type_ = default_asc_direction(); } - inline bool operator==(const OrderItem& other) const + inline bool operator==(const OrderItem &other) const { return (expr_ == other.expr_ && order_type_ == other.order_type_); } - inline bool operator!=(const OrderItem& other) const + inline bool operator!=(const OrderItem &other) const { return !(*this == other); } @@ -1000,12 +1001,12 @@ public: return NULLS_FIRST_DESC == order_type_ || NULLS_LAST_DESC == order_type_; } - int deep_copy(ObRawExprFactory& expr_factory, const OrderItem& other, const uint64_t copy_types, + int deep_copy(ObRawExprFactory &expr_factory, const OrderItem &other, const uint64_t copy_types, bool use_new_allocator = false); - static const char* order_type2name(const ObOrderDirection direction) + static const char *order_type2name(const ObOrderDirection direction) { - const char* name = NULL; + const char *name = NULL; switch (direction) { case NULLS_FIRST_ASC: name = N_NULLS_FIRST_ASC; @@ -1027,7 +1028,7 @@ public: TO_STRING_KV(N_EXPR, expr_, N_ASCENDING, order_type2name(order_type_)); - ObRawExpr* expr_; + ObRawExpr *expr_; ObOrderDirection order_type_; }; @@ -1043,25 +1044,25 @@ struct ObExprEqualCheckContext { virtual ~ObExprEqualCheckContext() {} struct ParamExprPair { - ParamExprPair(int64_t param_idx, const ObRawExpr* expr) : param_idx_(param_idx), expr_(expr) + ParamExprPair(int64_t param_idx, const ObRawExpr *expr) : param_idx_(param_idx), expr_(expr) {} ParamExprPair() : param_idx_(-1), expr_(NULL) {} TO_STRING_KV(K_(param_idx), K_(expr)); int64_t param_idx_; - const ObRawExpr* expr_; + const ObRawExpr *expr_; }; - inline int add_param_pair(int64_t param_idx, const ObRawExpr* expr) + inline int add_param_pair(int64_t param_idx, const ObRawExpr *expr) { return param_expr_.push_back(ParamExprPair(param_idx, expr)); } // only compare the result type of two columns - virtual bool compare_column(const ObColumnRefRawExpr& left, const ObColumnRefRawExpr& right); + virtual bool compare_column(const ObColumnRefRawExpr &left, const ObColumnRefRawExpr &right); - virtual bool compare_const(const ObConstRawExpr& left, const ObConstRawExpr& right); + virtual bool compare_const(const ObConstRawExpr &left, const ObConstRawExpr &right); - virtual bool compare_query(const ObQueryRefRawExpr& left, const ObQueryRefRawExpr& right); + virtual bool compare_query(const ObQueryRefRawExpr &left, const ObQueryRefRawExpr &right); void reset() { @@ -1088,14 +1089,14 @@ struct ObExprParamCheckContext : ObExprEqualCheckContext { } virtual ~ObExprParamCheckContext() {} - int init(const ObQueryCtx* context); - bool compare_const(const ObConstRawExpr& left, const ObConstRawExpr& right) override; + int init(const ObQueryCtx *context); + bool compare_const(const ObConstRawExpr &left, const ObConstRawExpr &right) override; - int get_calc_expr(const int64_t param_idx, const ObRawExpr*& expr); + int get_calc_expr(const int64_t param_idx, const ObRawExpr *&expr); - int is_pre_calc_item(const ObConstRawExpr& const_expr, bool& is_calc); + int is_pre_calc_item(const ObConstRawExpr &const_expr, bool &is_calc); - const ObQueryCtx* context_; + const ObQueryCtx *context_; }; enum ObVarType { @@ -1110,8 +1111,8 @@ struct ObVarInfo final { public: ObVarInfo() : type_(INVALID_VAR), name_() {} - int deep_copy(common::ObIAllocator& allocator, ObVarInfo& var_info) const; - bool operator==(const ObVarInfo& other) const + int deep_copy(common::ObIAllocator &allocator, ObVarInfo &var_info) const; + bool operator==(const ObVarInfo &other) const { return (type_ == other.type_ && name_ == other.name_); } @@ -1129,8 +1130,8 @@ struct ObSubQueryInfo { } TO_STRING_KV(K_(ref_expr)); - const ParseNode* sub_query_; - ObQueryRefRawExpr* ref_expr_; + const ParseNode *sub_query_; + ObQueryRefRawExpr *ref_expr_; ObExprInfo parents_expr_info_; }; class ObAggFunRawExpr; @@ -1145,7 +1146,7 @@ struct ObResolveContext { {} bool is_win_agg_; }; - ObResolveContext(ExprFactoryT& expr_factory, const common::ObTimeZoneInfo* tz_info, const common::ObNameCaseMode mode) + ObResolveContext(ExprFactoryT &expr_factory, const common::ObTimeZoneInfo *tz_info, const common::ObNameCaseMode mode) : expr_factory_(expr_factory), stmt_(NULL), connection_charset_(common::CHARSET_INVALID), @@ -1172,33 +1173,33 @@ struct ObResolveContext { is_for_dbms_sql_(false) {} - ExprFactoryT& expr_factory_; - ObStmt* stmt_; + ExprFactoryT &expr_factory_; + ObStmt *stmt_; common::ObCharsetType connection_charset_; common::ObCollationType dest_collation_; - const common::ObTimeZoneInfo* tz_info_; + const common::ObTimeZoneInfo *tz_info_; common::ObNameCaseMode case_mode_; ObExprInfo parents_expr_info_; - common::ObIArray* columns_; - common::ObIArray* sys_vars_; - common::ObIArray* sub_query_info_; - common::ObIArray* aggr_exprs_; - common::ObIArray* win_exprs_; - common::ObIArray* op_exprs_; - common::ObIArray* user_var_exprs_; + common::ObIArray *columns_; + common::ObIArray *sys_vars_; + common::ObIArray *sub_query_info_; + common::ObIArray *aggr_exprs_; + common::ObIArray *win_exprs_; + common::ObIArray *op_exprs_; + common::ObIArray *user_var_exprs_; bool is_extract_param_type_; - const ParamStore* param_list_; + const ParamStore *param_list_; int64_t prepare_param_count_; - common::ObIArray>* external_param_info_; // for anonymous + ps + common::ObIArray> *external_param_info_; // for anonymous + ps ObStmtScope current_scope_; common::ObArenaAllocator local_allocator_; typedef common::ObDList ObAggResolveLink; ObAggResolveLink agg_resolve_link_; bool is_win_agg_; - ObSchemaChecker* schema_checker_; // we use checker to get udf function name. - const ObSQLSessionInfo* session_info_; // we use to get tenant id - share::schema::ObSchemaGetterGuard* schema_guard_; - ObQueryCtx* query_ctx_; + ObSchemaChecker *schema_checker_; // we use checker to get udf function name. + const ObSQLSessionInfo *session_info_; // we use to get tenant id + share::schema::ObSchemaGetterGuard *schema_guard_; + ObQueryCtx *query_ctx_; bool is_for_pivot_; bool is_for_dynamic_sql_; bool is_for_dbms_sql_; @@ -1210,8 +1211,8 @@ struct ObHiddenColumnItem; class ObRawExpr : virtual public jit::expr::ObExpr { public: - friend sql::ObExpr* ObStaticEngineExprCG::get_rt_expr(const ObRawExpr& raw_expr); - friend sql::ObExpr* ObExprOperator::get_rt_expr(const ObRawExpr& raw_expr) const; + friend sql::ObExpr *ObStaticEngineExprCG::get_rt_expr(const ObRawExpr &raw_expr); + friend sql::ObExpr *ObExprOperator::get_rt_expr(const ObRawExpr &raw_expr) const; explicit ObRawExpr(ObItemType expr_type = T_INVALID) : ObExpr(expr_type), @@ -1232,7 +1233,7 @@ public: is_deterministic_(true) {} - explicit ObRawExpr(common::ObIAllocator& alloc, ObItemType expr_type = T_INVALID) + explicit ObRawExpr(common::ObIAllocator &alloc, ObItemType expr_type = T_INVALID) : ObExpr(alloc, expr_type), magic_num_(0x13572468), info_(), @@ -1251,11 +1252,11 @@ public: is_deterministic_(true) {} virtual ~ObRawExpr(); - int assign(const ObRawExpr& other); + int assign(const ObRawExpr &other); int deep_copy( - ObRawExprFactory& expr_factory, const ObRawExpr& other, const uint64_t types, bool use_new_allocator = false); + ObRawExprFactory &expr_factory, const ObRawExpr &other, const uint64_t types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) = 0; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) = 0; virtual void clear_child() = 0; virtual void reset(); @@ -1264,58 +1265,58 @@ public: bool has_generalized_column() const; bool has_enum_set_column() const; bool has_specified_pseudocolumn() const; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const = 0; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const = 0; bool is_generalized_column() const; void unset_result_flag(uint32_t result_flag); // void set_op_factory(ObExprOperatorFactory &factory) { op_factory_ = &factory; } - void set_allocator(common::ObIAllocator& alloc); - void set_expr_factory(ObRawExprFactory& factory) + void set_allocator(common::ObIAllocator &alloc); + void set_expr_factory(ObRawExprFactory &factory) { expr_factory_ = &factory; } - ObRawExprFactory* get_expr_factory() + ObRawExprFactory *get_expr_factory() { return expr_factory_; } - void set_expr_info(const ObExprInfo& info); + void set_expr_info(const ObExprInfo &info); int add_flag(int32_t flag); - int add_flags(const ObExprInfo& flags); - int add_child_flags(const ObExprInfo& flags); + int add_flags(const ObExprInfo &flags); + int add_child_flags(const ObExprInfo &flags); bool has_flag(ObExprInfoFlag flag) const; int clear_flag(int32_t flag); bool has_const_or_const_expr_flag() const; bool has_hierarchical_query_flag() const; - const ObExprInfo& get_expr_info() const; - ObExprInfo& get_expr_info(); + const ObExprInfo &get_expr_info() const; + ObExprInfo &get_expr_info(); - void set_relation_ids(const ObRelIds& rel_ids); + void set_relation_ids(const ObRelIds &rel_ids); int add_relation_id(int64_t rel_idx); - int add_relation_ids(const ObRelIds& rel_ids); - ObRelIds& get_relation_ids(); - const ObRelIds& get_relation_ids() const; + int add_relation_ids(const ObRelIds &rel_ids); + ObRelIds &get_relation_ids(); + const ObRelIds &get_relation_ids() const; - int add_expr_levels(const ObExprLevels& expr_levels) + int add_expr_levels(const ObExprLevels &expr_levels) { return expr_levels_.add_members(expr_levels); } - ObExprLevels& get_expr_levels() + ObExprLevels &get_expr_levels() { return expr_levels_; } - const ObExprLevels& get_expr_levels() const + const ObExprLevels &get_expr_levels() const { return expr_levels_; } // implemented base on get_param_count() and get_param_expr() interface, // children are visited in get_param_expr() return order. - int preorder_accept(ObRawExprVisitor& visitor); - int postorder_accept(ObRawExprVisitor& visitor); - int postorder_replace(ObRawExprVisitor& visitor); + int preorder_accept(ObRawExprVisitor &visitor); + int postorder_accept(ObRawExprVisitor &visitor); + int postorder_replace(ObRawExprVisitor &visitor); - virtual int do_visit(ObRawExprVisitor& visitor) = 0; + virtual int do_visit(ObRawExprVisitor &visitor) = 0; // skip visit child for expr visitor. (ObSetIterRawExpr) virtual bool skip_visit_child() const @@ -1324,8 +1325,8 @@ public: } virtual int64_t get_param_count() const = 0; - virtual const ObRawExpr* get_param_expr(int64_t index) const = 0; - virtual ObRawExpr*& get_param_expr(int64_t index) = 0; + virtual const ObRawExpr *get_param_expr(int64_t index) const = 0; + virtual ObRawExpr *&get_param_expr(int64_t index) = 0; virtual int64_t get_output_column() const { return -1; @@ -1353,28 +1354,28 @@ public: } bool is_non_pure_sys_func_expr() const; bool is_specified_pseudocolumn_expr() const; - void set_alias_column_name(const common::ObString& alias_name) + void set_alias_column_name(const common::ObString &alias_name) { alias_column_name_ = alias_name; } - const common::ObString& get_alias_column_name() const + const common::ObString &get_alias_column_name() const { return alias_column_name_; } - inline const common::ObString& get_root_alias_column_name() const + inline const common::ObString &get_root_alias_column_name() const { return OB_NOT_NULL(orig_expr_) ? orig_expr_->get_root_alias_column_name() : alias_column_name_; } - inline ObRawExpr* get_orig_expr() const + inline ObRawExpr *get_orig_expr() const { return orig_expr_; } - inline const ObRawExpr* get_root_orig_expr() const + inline const ObRawExpr *get_root_orig_expr() const { return OB_NOT_NULL(orig_expr_) ? orig_expr_->get_root_orig_expr() : this; } - int set_expr_name(const common::ObString& expr_name); - const common::ObString& get_expr_name() const + int set_expr_name(const common::ObString &expr_name); + const common::ObString &get_expr_name() const { return expr_name_; } @@ -1401,21 +1402,21 @@ public: } virtual uint64_t hash_internal(uint64_t seed) const = 0; - int get_name(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type = EXPLAIN_UNINITIALIZED) const; - int get_type_and_length(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const; - virtual int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const = 0; + int get_name(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type = EXPLAIN_UNINITIALIZED) const; + int get_type_and_length(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const; + virtual int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const = 0; // post-processing for expressions - int formalize(const ObSQLSessionInfo* my_session); + int formalize(const ObSQLSessionInfo *my_session); int pull_relation_id_and_levels(int32_t cur_stmt_level); int extract_info(); - int deduce_type(const ObSQLSessionInfo* my_session = NULL); - inline ObExprInfo& get_flags() + int deduce_type(const ObSQLSessionInfo *my_session = NULL); + inline ObExprInfo &get_flags() { return info_; } - int set_enum_set_values(const common::ObIArray& values); - const common::ObIArray& get_enum_set_values() const + int set_enum_set_values(const common::ObIArray &values); + const common::ObIArray &get_enum_set_values() const { return enum_set_values_; } @@ -1449,7 +1450,7 @@ public: { is_for_generated_column_ = false; } - void set_rt_expr(sql::ObExpr* expr) + void set_rt_expr(sql::ObExpr *expr) { rt_expr_ = expr; } @@ -1473,7 +1474,7 @@ public: { return is_calculated_; } - void set_orig_expr(ObRawExpr* expr) + void set_orig_expr(ObRawExpr *expr) { orig_expr_ = expr; } @@ -1501,8 +1502,8 @@ protected: ObRelIds rel_ids_; // related table idx // means the raw expr contain which level variables(column, aggregate expr, set expr or subquery expr) ObExprLevels expr_levels_; - common::ObIAllocator* inner_alloc_; - ObRawExprFactory* expr_factory_; + common::ObIAllocator *inner_alloc_; + ObRawExprFactory *expr_factory_; common::ObString alias_column_name_; int32_t expr_level_; common::ObArray enum_set_values_; // string_map @@ -1511,17 +1512,17 @@ protected: bool is_explicited_reference_; int64_t ref_count_; bool is_for_generated_column_; - sql::ObExpr* rt_expr_; + sql::ObExpr *rt_expr_; uint64_t extra_; - ObRawExpr* orig_expr_; // orig raw expr before pre cast of pre calc. + ObRawExpr *orig_expr_; // orig raw expr before pre cast of pre calc. bool is_calculated_; // for code gerenation in static engine. bool is_deterministic_; // expr is deterministic, given the same inputs, returns the same result private: DISALLOW_COPY_AND_ASSIGN(ObRawExpr); }; -inline void ObRawExpr::set_allocator(ObIAllocator& alloc) +inline void ObRawExpr::set_allocator(ObIAllocator &alloc) { inner_alloc_ = &alloc; result_type_.set_allocator(&alloc); @@ -1531,7 +1532,7 @@ inline void ObRawExpr::unset_result_flag(uint32_t result_flag) { result_type_.unset_result_flag(result_flag); } -inline void ObRawExpr::set_relation_ids(const ObRelIds& rel_ids) +inline void ObRawExpr::set_relation_ids(const ObRelIds &rel_ids) { rel_ids_ = rel_ids; } @@ -1547,7 +1548,7 @@ inline int ObRawExpr::add_relation_id(int64_t rel_idx) return ret; } -inline int ObRawExpr::add_relation_ids(const ObRelIds& rel_ids) +inline int ObRawExpr::add_relation_ids(const ObRelIds &rel_ids) { return rel_ids_.add_members(rel_ids); } @@ -1583,7 +1584,7 @@ inline bool ObRawExpr::has_hierarchical_query_flag() const ; } -inline int ObRawExpr::add_flags(const ObExprInfo& flags) +inline int ObRawExpr::add_flags(const ObExprInfo &flags) { return info_.add_members(flags); } @@ -1592,29 +1593,29 @@ inline bool ObRawExpr::has_flag(ObExprInfoFlag flag) const { return info_.has_member(flag); } -inline bool ObRawExpr::same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context) const +inline bool ObRawExpr::same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context) const { UNUSED(check_context); return (get_expr_type() == expr.get_expr_type() && get_result_type() == expr.get_result_type()); } -inline void ObRawExpr::set_expr_info(const ObExprInfo& info) +inline void ObRawExpr::set_expr_info(const ObExprInfo &info) { info_ = info; } -inline ObExprInfo& ObRawExpr::get_expr_info() +inline ObExprInfo &ObRawExpr::get_expr_info() { return info_; } -inline const ObExprInfo& ObRawExpr::get_expr_info() const +inline const ObExprInfo &ObRawExpr::get_expr_info() const { return info_; } -inline ObRelIds& ObRawExpr::get_relation_ids() +inline ObRelIds &ObRawExpr::get_relation_ids() { return rel_ids_; } -inline const ObRelIds& ObRawExpr::get_relation_ids() const +inline const ObRelIds &ObRawExpr::get_relation_ids() const { return rel_ids_; } @@ -1624,7 +1625,7 @@ class ObTerminalRawExpr : public ObRawExpr { public: explicit ObTerminalRawExpr(ObItemType expr_type = T_INVALID) : ObRawExpr(expr_type) {} - explicit ObTerminalRawExpr(common::ObIAllocator& alloc, ObItemType expr_type = T_INVALID) + explicit ObTerminalRawExpr(common::ObIAllocator &alloc, ObItemType expr_type = T_INVALID) : ObRawExpr(alloc, expr_type) {} virtual ~ObTerminalRawExpr() @@ -1636,12 +1637,12 @@ public: { return 0; } - virtual const ObRawExpr* get_param_expr(int64_t index) const + virtual const ObRawExpr *get_param_expr(int64_t index) const { UNUSED(index); return NULL; } - virtual ObRawExpr*& get_param_expr(int64_t index); + virtual ObRawExpr *&get_param_expr(int64_t index); virtual uint64_t hash_internal(uint64_t seed) const { return seed; @@ -1659,12 +1660,12 @@ public: { ObExpr::set_expr_class(ObExpr::EXPR_CONST); } - ObConstRawExpr(common::ObIAllocator& alloc) + ObConstRawExpr(common::ObIAllocator &alloc) : ObExpr(alloc), ObTerminalRawExpr(alloc), ObConstExpr(), is_date_unit_(false) { ObExpr::set_expr_class(ObExpr::EXPR_CONST); } - ObConstRawExpr(const oceanbase::common::ObObj& val, ObItemType expr_type = T_INVALID) + ObConstRawExpr(const oceanbase::common::ObObj &val, ObItemType expr_type = T_INVALID) : ObExpr(expr_type), ObTerminalRawExpr(expr_type), ObConstExpr(), is_date_unit_(false) { set_value(val); @@ -1672,23 +1673,23 @@ public: } virtual ~ObConstRawExpr() {} - int assign(const ObConstRawExpr& other); + int assign(const ObConstRawExpr &other); - int deep_copy(ObRawExprFactory& expr_factory, const ObConstRawExpr& other, const uint64_t copy_types, + int deep_copy(ObRawExprFactory &expr_factory, const ObConstRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - void set_value(const oceanbase::common::ObObj& val); - void set_literal_prefix(const common::ObString& name); - void set_expr_obj_meta(const common::ObObjMeta& meta) + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + void set_value(const oceanbase::common::ObObj &val); + void set_literal_prefix(const common::ObString &name); + void set_expr_obj_meta(const common::ObObjMeta &meta) { obj_meta_ = meta; } - const common::ObObjMeta& get_expr_obj_meta() const + const common::ObObjMeta &get_expr_obj_meta() const { return obj_meta_; } - const common::ObString& get_literal_prefix() const + const common::ObString &get_literal_prefix() const { return literal_prefix_; } @@ -1699,12 +1700,12 @@ public: return true == is_date_unit_; } virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; DECLARE_VIRTUAL_TO_STRING; private: @@ -1723,7 +1724,7 @@ public: { ObExpr::set_expr_class(ObExpr::EXPR_VAR); } - ObVarRawExpr(common::ObIAllocator& alloc) + ObVarRawExpr(common::ObIAllocator &alloc) : ObExpr(alloc), ObTerminalRawExpr(alloc), ObVarExpr(), result_type_assigned_(false) { ObExpr::set_expr_class(ObExpr::EXPR_VAR); @@ -1736,17 +1737,17 @@ public: virtual ~ObVarRawExpr() {} - int assign(const ObVarRawExpr& other); + int assign(const ObVarRawExpr &other); - int deep_copy(ObRawExprFactory& expr_factory, const ObVarRawExpr& other, const uint64_t copy_types, + int deep_copy(ObRawExprFactory &expr_factory, const ObVarRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; void set_result_type_assigned(bool v) { result_type_assigned_ = v; @@ -1766,24 +1767,24 @@ class ObUserVarIdentRawExpr : public ObConstRawExpr { public: ObUserVarIdentRawExpr() : is_contain_assign_(false), query_has_udf_(false) {} - ObUserVarIdentRawExpr(common::ObIAllocator& alloc) + ObUserVarIdentRawExpr(common::ObIAllocator &alloc) : ObConstRawExpr(alloc), is_contain_assign_(false), query_has_udf_(false) {} - ObUserVarIdentRawExpr(const oceanbase::common::ObObj& val, ObItemType expr_type = T_INVALID) + ObUserVarIdentRawExpr(const oceanbase::common::ObObj &val, ObItemType expr_type = T_INVALID) : ObConstRawExpr(val, expr_type), is_contain_assign_(false), query_has_udf_(false) {} virtual ~ObUserVarIdentRawExpr() {} - int assign(const ObUserVarIdentRawExpr& other); + int assign(const ObUserVarIdentRawExpr &other); - int deep_copy(ObRawExprFactory& expr_factory, const ObUserVarIdentRawExpr& other, const uint64_t copy_types, + int deep_copy(ObRawExprFactory &expr_factory, const ObUserVarIdentRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; @@ -1803,7 +1804,7 @@ public: { query_has_udf_ = query_has_udf; } - bool is_same_variable(const ObObj& obj) const; + bool is_same_variable(const ObObj &obj) const; DECLARE_VIRTUAL_TO_STRING; private: @@ -1831,7 +1832,7 @@ public: set_expr_class(ObExpr::EXPR_QUERY_REF); } - ObQueryRefRawExpr(common::ObIAllocator& alloc) + ObQueryRefRawExpr(common::ObIAllocator &alloc) : ObTerminalRawExpr(alloc), ref_id_(common::OB_INVALID_ID), output_column_(0), @@ -1857,28 +1858,28 @@ public: } virtual ~ObQueryRefRawExpr() {} - int assign(const ObQueryRefRawExpr& other); - int deep_copy(ObStmtFactory& stmt_factory, ObRawExprFactory& expr_factory, const ObQueryRefRawExpr& other); + int assign(const ObQueryRefRawExpr &other); + int deep_copy(ObStmtFactory &stmt_factory, ObRawExprFactory &expr_factory, const ObQueryRefRawExpr &other); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; int64_t get_ref_id() const; void set_ref_id(int64_t id); - ObSelectStmt* get_ref_stmt(); - const ObSelectStmt* get_ref_stmt() const; - void set_ref_stmt(ObSelectStmt* ref_stmt) + ObSelectStmt *get_ref_stmt(); + const ObSelectStmt *get_ref_stmt() const; + void set_ref_stmt(ObSelectStmt *ref_stmt) { ref_stmt_ = ref_stmt; ref_type_ = OB_STMT; } - ObLogicalOperator* get_ref_operator() + ObLogicalOperator *get_ref_operator() { return (OB_LOGICAL_OPERATOR == ref_type_ ? ref_operator_ : NULL); } - const ObLogicalOperator* get_ref_operator() const + const ObLogicalOperator *get_ref_operator() const { return (OB_LOGICAL_OPERATOR == ref_type_ ? ref_operator_ : NULL); } - void set_ref_operator(ObLogicalOperator* ref_opeator) + void set_ref_operator(ObLogicalOperator *ref_opeator) { ref_operator_ = ref_opeator; ref_type_ = OB_LOGICAL_OPERATOR; @@ -1893,15 +1894,15 @@ public: } void set_output_column(int64_t output_column); int64_t get_output_column() const override; - int add_column_type(const ObExprResType& type) + int add_column_type(const ObExprResType &type) { return column_types_.push_back(type); } - const common::ObIArray& get_column_types() const + const common::ObIArray &get_column_types() const { return column_types_; } - common::ObIArray& get_column_types() + common::ObIArray &get_column_types() { return column_types_; } @@ -1922,16 +1923,16 @@ public: return is_cursor_; } virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override { return common::do_hash(ref_id_, seed); } - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, N_ID, ref_id_, K_(expr_level), K_(expr_levels), K_(output_column), K_(is_set), K_(is_cursor), K_(column_types), K_(enum_set_values)); @@ -1940,8 +1941,8 @@ private: DISALLOW_COPY_AND_ASSIGN(ObQueryRefRawExpr); int64_t ref_id_; union { - ObSelectStmt* ref_stmt_; - ObLogicalOperator* ref_operator_; + ObSelectStmt *ref_stmt_; + ObLogicalOperator *ref_operator_; }; enum RefType { OB_STMT = 0, OB_LOGICAL_OPERATOR = 1 }; int64_t output_column_; @@ -1995,7 +1996,7 @@ public: set_expr_class(ObExpr::EXPR_COLUMN_REF); } - ObColumnRefRawExpr(common::ObIAllocator& alloc) + ObColumnRefRawExpr(common::ObIAllocator &alloc) : ObExpr(alloc), ObTerminalRawExpr(alloc), ObColumnRefExpr(alloc), @@ -2041,74 +2042,74 @@ public: virtual ~ObColumnRefRawExpr() {} - int assign(const ObColumnRefRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObColumnRefRawExpr& other, bool use_new_allocator = false); + int assign(const ObColumnRefRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObColumnRefRawExpr &other, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; uint64_t get_table_id() const; uint64_t get_column_id() const; - uint64_t& get_table_id(); - uint64_t& get_column_id(); + uint64_t &get_table_id(); + uint64_t &get_column_id(); void set_ref_id(uint64_t table_id, uint64_t column_id); void set_table_id(uint64_t table_id); - void set_column_attr(const common::ObString& table_name, const common::ObString& column_name); - inline void set_table_name(const common::ObString& table_name) + void set_column_attr(const common::ObString &table_name, const common::ObString &column_name); + inline void set_table_name(const common::ObString &table_name) { table_name_ = table_name; } - inline common::ObString& get_table_name() + inline common::ObString &get_table_name() { return table_name_; } - inline const common::ObString& get_table_name() const + inline const common::ObString &get_table_name() const { return table_name_; } - inline void set_synonym_name(const common::ObString& synonym_name) + inline void set_synonym_name(const common::ObString &synonym_name) { synonym_name_ = synonym_name; } - inline common::ObString& get_synonym_name() + inline common::ObString &get_synonym_name() { return synonym_name_; } - inline const common::ObString& get_synonym_name() const + inline const common::ObString &get_synonym_name() const { return synonym_name_; } - inline void set_synonym_db_name(const common::ObString& synonym_db_name) + inline void set_synonym_db_name(const common::ObString &synonym_db_name) { synonym_db_name_ = synonym_db_name; } - inline common::ObString& get_synonym_db_name() + inline common::ObString &get_synonym_db_name() { return synonym_db_name_; } - inline const common::ObString& get_synonym_db_name() const + inline const common::ObString &get_synonym_db_name() const { return synonym_db_name_; } - inline void set_column_name(const common::ObString& column_name) + inline void set_column_name(const common::ObString &column_name) { column_name_ = column_name; } - inline common::ObString& get_column_name() + inline common::ObString &get_column_name() { return column_name_; } - inline const common::ObString& get_column_name() const + inline const common::ObString &get_column_name() const { return column_name_; } - inline void set_database_name(const common::ObString& db_name) + inline void set_database_name(const common::ObString &db_name) { database_name_ = db_name; } - inline const common::ObString& get_database_name() const + inline const common::ObString &get_database_name() const { return database_name_; } - inline common::ObString& get_database_name() + inline common::ObString &get_database_name() { return database_name_; } @@ -2117,14 +2118,20 @@ public: return get_column_id(); } virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - bool is_from_alias_table() const { return from_alias_table_; } - void set_from_alias_table(bool value) { from_alias_table_ = value; } + bool is_from_alias_table() const + { + return from_alias_table_; + } + void set_from_alias_table(bool value) + { + from_alias_table_ = value; + } inline bool is_generated_column() const { return share::schema::ObSchemaUtils::is_generated_column(column_flags_); @@ -2165,15 +2172,15 @@ public: { return column_flags_; } - inline const ObRawExpr* get_dependant_expr() const + inline const ObRawExpr *get_dependant_expr() const { return dependant_expr_; } - inline ObRawExpr* get_dependant_expr() + inline ObRawExpr *get_dependant_expr() { return dependant_expr_; } - inline void set_dependant_expr(ObRawExpr* expr) + inline void set_dependant_expr(ObRawExpr *expr) { dependant_expr_ = expr; } @@ -2202,16 +2209,16 @@ public: is_hidden_ = value; } - inline ObRawExpr* get_real_expr() + inline ObRawExpr *get_real_expr() { return real_expr_; } - inline void set_real_expr(ObRawExpr* expr) + inline void set_real_expr(ObRawExpr *expr) { real_expr_ = expr; } - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, N_TID, table_id_, N_CID, column_id_, K_(database_name), K_(table_name), K_(synonym_name), K_(synonym_db_name), @@ -2228,12 +2235,12 @@ private: common::ObString synonym_db_name_; common::ObString column_name_; uint64_t column_flags_; // same as flags in ObColumnSchemaV2 - ObRawExpr* dependant_expr_; // TODO + ObRawExpr *dependant_expr_; // TODO bool is_lob_column_; // TODO add lob column bool is_unpivot_mocked_column_; // used for unpivot bool is_hidden_; // used for print hidden column bool from_alias_table_; - ObRawExpr* real_expr_; // for oracle virtual table that is mapping a real table + ObRawExpr *real_expr_; // for oracle virtual table that is mapping a real table }; inline void ObColumnRefRawExpr::set_ref_id(uint64_t table_id, uint64_t column_id) @@ -2257,12 +2264,12 @@ inline uint64_t ObColumnRefRawExpr::get_column_id() const return column_id_; } -inline uint64_t& ObColumnRefRawExpr::get_table_id() +inline uint64_t &ObColumnRefRawExpr::get_table_id() { return table_id_; } -inline uint64_t& ObColumnRefRawExpr::get_column_id() +inline uint64_t &ObColumnRefRawExpr::get_column_id() { return column_id_; } @@ -2274,22 +2281,22 @@ public: { set_expr_class(ObExpr::EXPR_SET_OP); } - ObSetOpRawExpr(common::ObIAllocator& alloc) : ObTerminalRawExpr(alloc), idx_(-1) + ObSetOpRawExpr(common::ObIAllocator &alloc) : ObTerminalRawExpr(alloc), idx_(-1) { set_expr_class(ObExpr::EXPR_SET_OP); } virtual ~ObSetOpRawExpr() {} - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; int deep_copy( - ObRawExprFactory& expr_factory, const ObSetOpRawExpr& other, const uint64_t copy_types, bool use_new_allocator); + ObRawExprFactory &expr_factory, const ObSetOpRawExpr &other, const uint64_t copy_types, bool use_new_allocator); - int assign(const ObSetOpRawExpr& other); + int assign(const ObSetOpRawExpr &other); void set_idx(int64_t idx) { @@ -2314,21 +2321,21 @@ public: { set_expr_class(ObExpr::EXPR_ALIAS_REF); } - ObAliasRefRawExpr(common::ObIAllocator& alloc) : ObRawExpr(alloc), ref_expr_(NULL), project_index_(OB_INVALID_INDEX) + ObAliasRefRawExpr(common::ObIAllocator &alloc) : ObRawExpr(alloc), ref_expr_(NULL), project_index_(OB_INVALID_INDEX) { set_expr_class(ObExpr::EXPR_ALIAS_REF); } virtual ~ObAliasRefRawExpr() {} - int assign(const ObAliasRefRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObAliasRefRawExpr& other, const uint64_t copy_types, + int assign(const ObAliasRefRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObAliasRefRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - const ObRawExpr* get_ref_expr() const; - ObRawExpr* get_ref_expr(); - void set_ref_expr(ObRawExpr* ref_expr) + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + const ObRawExpr *get_ref_expr() const; + ObRawExpr *get_ref_expr(); + void set_ref_expr(ObRawExpr *ref_expr) { ref_expr_ = ref_expr; } @@ -2340,7 +2347,7 @@ public: { return project_index_; } - void set_query_output(ObQueryRefRawExpr* query_ref, int64_t project_index) + void set_query_output(ObQueryRefRawExpr *query_ref, int64_t project_index) { ref_expr_ = query_ref; project_index_ = project_index; @@ -2354,18 +2361,18 @@ public: { return 1; } - virtual const ObRawExpr* get_param_expr(int64_t index) const override; - virtual ObRawExpr*& get_param_expr(int64_t index) override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual const ObRawExpr *get_param_expr(int64_t index) const override; + virtual ObRawExpr *&get_param_expr(int64_t index) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, N_VALUE, ref_expr_, K_(enum_set_values)); private: DISALLOW_COPY_AND_ASSIGN(ObAliasRefRawExpr); - ObRawExpr* ref_expr_; + ObRawExpr *ref_expr_; int64_t project_index_; // project index of the subquery }; @@ -2374,32 +2381,32 @@ class ObNonTerminalRawExpr : public ObRawExpr { public: ObNonTerminalRawExpr() : ObRawExpr(), op_(NULL), input_types_() {} - ObNonTerminalRawExpr(common::ObIAllocator& alloc) : ObRawExpr(alloc), op_(NULL), input_types_() + ObNonTerminalRawExpr(common::ObIAllocator &alloc) : ObRawExpr(alloc), op_(NULL), input_types_() {} virtual ~ObNonTerminalRawExpr() { free_op(); } - int assign(const ObNonTerminalRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObNonTerminalRawExpr& other, const uint64_t copy_types, + int assign(const ObNonTerminalRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObNonTerminalRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; virtual void reset() override { free_op(); input_types_.reset(); } - virtual ObExprOperator* get_op(); + virtual ObExprOperator *get_op(); void free_op(); /* * store the target type of paramters. */ - int set_input_types(const ObIExprResTypes& input_types); + int set_input_types(const ObIExprResTypes &input_types); - inline const ObExprResTypes& get_input_types() + inline const ObExprResTypes &get_input_types() { return input_types_; } @@ -2415,7 +2422,7 @@ public: protected: // data members - ObExprOperator* op_; + ObExprOperator *op_; ObExprResTypes input_types_; DISALLOW_COPY_AND_ASSIGN(ObNonTerminalRawExpr); }; @@ -2434,7 +2441,7 @@ public: set_expr_class(ObExpr::EXPR_OPERATOR); } - ObOpRawExpr(common::ObIAllocator& alloc) + ObOpRawExpr(common::ObIAllocator &alloc) : ObExpr(alloc), ObNonTerminalRawExpr(alloc), ObOpExpr(alloc), @@ -2445,20 +2452,20 @@ public: set_expr_class(ObExpr::EXPR_OPERATOR); } - ObOpRawExpr(ObRawExpr* first_expr, ObRawExpr* second_expr, ObItemType type); // binary op + ObOpRawExpr(ObRawExpr *first_expr, ObRawExpr *second_expr, ObItemType type); // binary op virtual ~ObOpRawExpr() {} - int assign(const ObOpRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObOpRawExpr& other, const uint64_t copy_types, + int assign(const ObOpRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObOpRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - int set_param_expr(ObRawExpr* expr); // unary op - int set_param_exprs(ObRawExpr* first_expr, ObRawExpr* second_expr); // binary op - int set_param_exprs(ObRawExpr* first_expr, ObRawExpr* second_expr, ObRawExpr* third_expr); // triple op - int add_param_expr(ObRawExpr* expr); + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + int set_param_expr(ObRawExpr *expr); // unary op + int set_param_exprs(ObRawExpr *first_expr, ObRawExpr *second_expr); // binary op + int set_param_exprs(ObRawExpr *first_expr, ObRawExpr *second_expr, ObRawExpr *third_expr); // triple op + int add_param_expr(ObRawExpr *expr); int remove_param_expr(int64_t index); - int replace_param_expr(int64_t index, ObRawExpr* expr); + int replace_param_expr(int64_t index, ObRawExpr *expr); bool deduce_type_adding_implicit_cast() const { @@ -2471,18 +2478,18 @@ public: void set_expr_type(ObItemType type); - common::ObIArray& get_param_exprs() + common::ObIArray &get_param_exprs() { return exprs_; } - const common::ObIArray& get_param_exprs() const + const common::ObIArray &get_param_exprs() const { return exprs_; } int64_t get_param_count() const override; - const ObRawExpr* get_param_expr(int64_t index) const override; - ObRawExpr*& get_param_expr(int64_t index) override; + const ObRawExpr *get_param_expr(int64_t index) const override; + ObRawExpr *&get_param_expr(int64_t index) override; virtual int64_t get_output_column() const override { return T_OP_ROW == get_expr_type() ? get_param_count() : -1; @@ -2490,7 +2497,7 @@ public: virtual void clear_child() override; virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; // used for jit expr virtual int64_t get_children_count() const override @@ -2498,9 +2505,9 @@ public: return exprs_.count(); } // used for jit expr - virtual int get_children(jit::expr::ExprArray& jit_exprs) const override; + virtual int get_children(jit::expr::ExprArray &jit_exprs) const override; - void set_subquery_key(ObSubQueryKey& key) + void set_subquery_key(ObSubQueryKey &key) { subquery_key_ = key; } @@ -2509,18 +2516,18 @@ public: return subquery_key_; } - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; int get_subquery_comparison_name( - const common::ObString& symbol, char* buf, int64_t buf_len, int64_t& pos, ExplainType type) const; + const common::ObString &symbol, char *buf, int64_t buf_len, int64_t &pos, ExplainType type) const; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, K_(expr_levels), N_CHILDREN, exprs_); protected: - common::ObSEArray exprs_; + common::ObSEArray exprs_; ObSubQueryKey subquery_key_; bool deduce_type_adding_implicit_cast_; @@ -2529,9 +2536,9 @@ private: DISALLOW_COPY_AND_ASSIGN(ObOpRawExpr); }; -inline const ObRawExpr* ObOpRawExpr::get_param_expr(int64_t index) const +inline const ObRawExpr *ObOpRawExpr::get_param_expr(int64_t index) const { - const ObRawExpr* expr = NULL; + const ObRawExpr *expr = NULL; if (index >= 0 && index < exprs_.count()) { expr = exprs_.at(index); } @@ -2539,7 +2546,7 @@ inline const ObRawExpr* ObOpRawExpr::get_param_expr(int64_t index) const } // here must return in two branch, because ret value is a *& -inline ObRawExpr*& ObOpRawExpr::get_param_expr(int64_t index) +inline ObRawExpr *&ObOpRawExpr::get_param_expr(int64_t index) { if (index >= 0 && index < exprs_.count()) { return exprs_.at(index); @@ -2548,7 +2555,7 @@ inline ObRawExpr*& ObOpRawExpr::get_param_expr(int64_t index) } } -inline int ObOpRawExpr::add_param_expr(ObRawExpr* expr) +inline int ObOpRawExpr::add_param_expr(ObRawExpr *expr) { return exprs_.push_back(expr); } @@ -2564,13 +2571,13 @@ inline int ObOpRawExpr::remove_param_expr(int64_t index) return ret; } -inline int ObOpRawExpr::replace_param_expr(int64_t index, ObRawExpr* expr) +inline int ObOpRawExpr::replace_param_expr(int64_t index, ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (index < 0 || index >= exprs_.count()) { ret = common::OB_INVALID_ARGUMENT; } else { - ObRawExpr*& target_expr = exprs_.at(index); + ObRawExpr *&target_expr = exprs_.at(index); if (OB_NOT_NULL(expr) && expr != target_expr) { expr->set_orig_expr(target_expr); } @@ -2610,7 +2617,7 @@ public: { set_expr_class(ObExpr::EXPR_CASE_OPERATOR); } - ObCaseOpRawExpr(common::ObIAllocator& alloc) + ObCaseOpRawExpr(common::ObIAllocator &alloc) : ObExpr(alloc), ObNonTerminalRawExpr(alloc), ObCaseOpExpr(), @@ -2624,34 +2631,34 @@ public: } virtual ~ObCaseOpRawExpr() {} - int assign(const ObCaseOpRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObCaseOpRawExpr& other, const uint64_t copy_types, + int assign(const ObCaseOpRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObCaseOpRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - const ObRawExpr* get_arg_param_expr() const; - const ObRawExpr* get_default_param_expr() const; - const ObRawExpr* get_when_param_expr(int64_t index) const; - const ObRawExpr* get_then_param_expr(int64_t index) const; - ObRawExpr*& get_arg_param_expr(); - inline common::ObIArray& get_when_param_exprs() + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + const ObRawExpr *get_arg_param_expr() const; + const ObRawExpr *get_default_param_expr() const; + const ObRawExpr *get_when_param_expr(int64_t index) const; + const ObRawExpr *get_then_param_expr(int64_t index) const; + ObRawExpr *&get_arg_param_expr(); + inline common::ObIArray &get_when_param_exprs() { return when_exprs_; } - inline common::ObIArray& get_then_param_exprs() + inline common::ObIArray &get_then_param_exprs() { return then_exprs_; } - ObRawExpr*& get_default_param_expr(); - ObRawExpr*& get_when_param_expr(int64_t index); - ObRawExpr*& get_then_param_expr(int64_t index); - void set_arg_param_expr(ObRawExpr* expr); - void set_default_param_expr(ObRawExpr* expr); - int add_when_param_expr(ObRawExpr* expr); - int add_then_param_expr(ObRawExpr* expr); - int replace_when_param_expr(int64_t index, ObRawExpr* expr); - int replace_then_param_expr(int64_t index, ObRawExpr* expr); - int replace_param_expr(int64_t index, ObRawExpr* new_expr); + ObRawExpr *&get_default_param_expr(); + ObRawExpr *&get_when_param_expr(int64_t index); + ObRawExpr *&get_then_param_expr(int64_t index); + void set_arg_param_expr(ObRawExpr *expr); + void set_default_param_expr(ObRawExpr *expr); + int add_when_param_expr(ObRawExpr *expr); + int add_then_param_expr(ObRawExpr *expr); + int replace_when_param_expr(int64_t index, ObRawExpr *expr); + int replace_then_param_expr(int64_t index, ObRawExpr *expr); + int replace_param_expr(int64_t index, ObRawExpr *new_expr); int64_t get_when_expr_size() const; int64_t get_then_expr_size() const; bool is_arg_case() const @@ -2665,13 +2672,13 @@ public: virtual void clear_child() override; virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual int64_t get_param_count() const override; - virtual const ObRawExpr* get_param_expr(int64_t index) const override; - virtual ObRawExpr*& get_param_expr(int64_t index) override; + virtual const ObRawExpr *get_param_expr(int64_t index) const override; + virtual ObRawExpr *&get_param_expr(int64_t index) override; // used for jit virtual int64_t get_children_count() const override @@ -2679,61 +2686,61 @@ public: return get_param_count(); } - virtual int get_children(jit::expr::ExprArray& jit_exprs) const override; + virtual int get_children(jit::expr::ExprArray &jit_exprs) const override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, K_(expr_levels), N_ARG_CASE, arg_expr_, N_DEFAULT, default_expr_, N_WHEN, when_exprs_, N_THEN, then_exprs_, N_DECODE, is_decode_func_); private: DISALLOW_COPY_AND_ASSIGN(ObCaseOpRawExpr); - ObRawExpr* arg_expr_; - common::ObSEArray when_exprs_; - common::ObSEArray then_exprs_; - ObRawExpr* default_expr_; + ObRawExpr *arg_expr_; + common::ObSEArray when_exprs_; + common::ObSEArray then_exprs_; + ObRawExpr *default_expr_; bool is_decode_func_; }; -inline const ObRawExpr* ObCaseOpRawExpr::get_arg_param_expr() const +inline const ObRawExpr *ObCaseOpRawExpr::get_arg_param_expr() const { return arg_expr_; } -inline const ObRawExpr* ObCaseOpRawExpr::get_default_param_expr() const +inline const ObRawExpr *ObCaseOpRawExpr::get_default_param_expr() const { return default_expr_; } -inline const ObRawExpr* ObCaseOpRawExpr::get_when_param_expr(int64_t index) const +inline const ObRawExpr *ObCaseOpRawExpr::get_when_param_expr(int64_t index) const { - ObRawExpr* expr = NULL; + ObRawExpr *expr = NULL; if (OB_LIKELY(index >= 0 && index < when_exprs_.count())) { expr = when_exprs_.at(index); } else { } return expr; } -inline const ObRawExpr* ObCaseOpRawExpr::get_then_param_expr(int64_t index) const +inline const ObRawExpr *ObCaseOpRawExpr::get_then_param_expr(int64_t index) const { - ObRawExpr* expr = NULL; + ObRawExpr *expr = NULL; if (OB_LIKELY(index >= 0 || index < then_exprs_.count())) { expr = then_exprs_.at(index); } else { } return expr; } -inline ObRawExpr*& ObCaseOpRawExpr::get_arg_param_expr() +inline ObRawExpr *&ObCaseOpRawExpr::get_arg_param_expr() { return arg_expr_; } -inline ObRawExpr*& ObCaseOpRawExpr::get_default_param_expr() +inline ObRawExpr *&ObCaseOpRawExpr::get_default_param_expr() { return default_expr_; } // here must return in two branch, because ret value is a *& -inline ObRawExpr*& ObCaseOpRawExpr::get_when_param_expr(int64_t index) +inline ObRawExpr *&ObCaseOpRawExpr::get_when_param_expr(int64_t index) { if (OB_LIKELY(index >= 0 && index < when_exprs_.count())) { return when_exprs_.at(index); @@ -2743,7 +2750,7 @@ inline ObRawExpr*& ObCaseOpRawExpr::get_when_param_expr(int64_t index) } // here must return in two branch, because ret value is a *& -inline ObRawExpr*& ObCaseOpRawExpr::get_then_param_expr(int64_t index) +inline ObRawExpr *&ObCaseOpRawExpr::get_then_param_expr(int64_t index) { if (OB_LIKELY(index >= 0 && index < then_exprs_.count())) { return then_exprs_.at(index); @@ -2751,26 +2758,26 @@ inline ObRawExpr*& ObCaseOpRawExpr::get_then_param_expr(int64_t index) return USELESS_POINTER; } } -inline void ObCaseOpRawExpr::set_arg_param_expr(ObRawExpr* expr) +inline void ObCaseOpRawExpr::set_arg_param_expr(ObRawExpr *expr) { arg_expr_ = expr; } -inline void ObCaseOpRawExpr::set_default_param_expr(ObRawExpr* expr) +inline void ObCaseOpRawExpr::set_default_param_expr(ObRawExpr *expr) { default_expr_ = expr; } -inline int ObCaseOpRawExpr::add_when_param_expr(ObRawExpr* expr) +inline int ObCaseOpRawExpr::add_when_param_expr(ObRawExpr *expr) { int ret = when_exprs_.push_back(expr); return ret; } -inline int ObCaseOpRawExpr::add_then_param_expr(ObRawExpr* expr) +inline int ObCaseOpRawExpr::add_then_param_expr(ObRawExpr *expr) { int ret = then_exprs_.push_back(expr); return ret; } -inline int ObCaseOpRawExpr::replace_when_param_expr(int64_t index, ObRawExpr* expr) +inline int ObCaseOpRawExpr::replace_when_param_expr(int64_t index, ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY((index < 0 || index >= when_exprs_.count()))) { @@ -2781,7 +2788,7 @@ inline int ObCaseOpRawExpr::replace_when_param_expr(int64_t index, ObRawExpr* ex return ret; } -inline int ObCaseOpRawExpr::replace_then_param_expr(int64_t index, ObRawExpr* expr) +inline int ObCaseOpRawExpr::replace_then_param_expr(int64_t index, ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY((index < 0 || index >= then_exprs_.count()))) { @@ -2849,7 +2856,7 @@ public: set_expr_class(ObExpr::EXPR_AGGR); order_items_.set_label(common::ObModIds::OB_SQL_AGGR_FUNC_ARR); } - ObAggFunRawExpr(common::ObIAllocator& alloc) + ObAggFunRawExpr(common::ObIAllocator &alloc) : ObRawExpr(alloc), real_param_exprs_(), push_down_sum_expr_(NULL), @@ -2865,7 +2872,7 @@ public: set_expr_class(ObExpr::EXPR_AGGR); order_items_.set_label(common::ObModIds::OB_SQL_AGGR_FUNC_ARR); } - ObAggFunRawExpr(const common::ObSEArray& real_param_exprs, + ObAggFunRawExpr(const common::ObSEArray &real_param_exprs, bool is_distinct, ObItemType expr_type = T_INVALID) : ObRawExpr(expr_type), real_param_exprs_(real_param_exprs), @@ -2884,73 +2891,73 @@ public: } virtual ~ObAggFunRawExpr() {} - int assign(const ObAggFunRawExpr& other); + int assign(const ObAggFunRawExpr &other); - int deep_copy(ObRawExprFactory& expr_factory, const ObAggFunRawExpr& other, const uint64_t copy_types, + int deep_copy(ObRawExprFactory &expr_factory, const ObAggFunRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - int add_real_param_expr(ObRawExpr* expr); - int replace_real_param_expr(int64_t index, ObRawExpr* expr); - int replace_param_expr(int64_t index, ObRawExpr* expr); - void set_push_down_sum_expr(ObRawExpr* expr); - void set_push_down_count_expr(ObRawExpr* expr); + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + int add_real_param_expr(ObRawExpr *expr); + int replace_real_param_expr(int64_t index, ObRawExpr *expr); + int replace_param_expr(int64_t index, ObRawExpr *expr); + void set_push_down_sum_expr(ObRawExpr *expr); + void set_push_down_count_expr(ObRawExpr *expr); bool contain_nested_aggr() const; bool is_param_distinct() const; void set_param_distinct(bool is_distinct); - void set_separator_param_expr(ObRawExpr* separator_param_expr); - void set_linear_inter_expr(ObRawExpr* linear_inter_expr); + void set_separator_param_expr(ObRawExpr *separator_param_expr); + void set_linear_inter_expr(ObRawExpr *linear_inter_expr); bool is_nested_aggr() const; void set_in_nested_aggr(bool is_nested); - int add_order_item(const OrderItem& order_item); + int add_order_item(const OrderItem &order_item); virtual void clear_child() override; virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; virtual int64_t get_param_count() const override { return real_param_exprs_.count() + order_items_.count(); } - virtual const ObRawExpr* get_param_expr(int64_t index) const override; - virtual ObRawExpr*& get_param_expr(int64_t index) override; + virtual const ObRawExpr *get_param_expr(int64_t index) const override; + virtual ObRawExpr *&get_param_expr(int64_t index) override; inline int64_t get_real_param_count() const { return real_param_exprs_.count(); } - inline const common::ObIArray& get_real_param_exprs() const + inline const common::ObIArray &get_real_param_exprs() const { return real_param_exprs_; } - inline common::ObIArray& get_real_param_exprs_for_update() + inline common::ObIArray &get_real_param_exprs_for_update() { return real_param_exprs_; } - virtual int do_visit(ObRawExprVisitor& visitor) override; - inline ObRawExpr*& get_push_down_sum_expr() + virtual int do_visit(ObRawExprVisitor &visitor) override; + inline ObRawExpr *&get_push_down_sum_expr() { return push_down_sum_expr_; } - inline ObRawExpr*& get_push_down_count_expr() + inline ObRawExpr *&get_push_down_count_expr() { return push_down_count_expr_; } - inline ObRawExpr*& get_push_down_synopsis_expr() + inline ObRawExpr *&get_push_down_synopsis_expr() { return push_down_synopsis_expr_; } - inline ObRawExpr* get_separator_param_expr() const + inline ObRawExpr *get_separator_param_expr() const { return separator_param_expr_; } - inline ObRawExpr* get_linear_inter_expr() const + inline ObRawExpr *get_linear_inter_expr() const { return linear_inter_expr_; } - inline const common::ObIArray& get_order_items() const + inline const common::ObIArray &get_order_items() const { return order_items_; } - inline common::ObIArray& get_order_items_for_update() + inline common::ObIArray &get_order_items_for_update() { return order_items_; } @@ -2973,14 +2980,14 @@ public: } // set udf meta to this expr - int set_udf_meta(const share::schema::ObUDF& udf); + int set_udf_meta(const share::schema::ObUDF &udf); const share::schema::ObUDFMeta get_udf_meta() { return udf_meta_; } - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; - const char* get_name_dblink(ObItemType expr_type) const; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; + const char *get_name_dblink(ObItemType expr_type) const; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, K_(expr_level), K_(expr_levels), N_CHILDREN, real_param_exprs_, N_DISTINCT, distinct_, N_ORDER_BY, order_items_, N_SEPARATOR_PARAM_EXPR, separator_param_expr_, K_(udf_meta), N_LINEAR_INTER_EXPR, linear_inter_expr_); @@ -2988,23 +2995,23 @@ public: private: DISALLOW_COPY_AND_ASSIGN(ObAggFunRawExpr); // real_param_exprs_.count() == 0 means '*' - common::ObSEArray real_param_exprs_; - ObRawExpr* push_down_sum_expr_; - ObRawExpr* push_down_count_expr_; - ObRawExpr* push_down_synopsis_expr_; + common::ObSEArray real_param_exprs_; + ObRawExpr *push_down_sum_expr_; + ObRawExpr *push_down_count_expr_; + ObRawExpr *push_down_synopsis_expr_; bool distinct_; // used for group_concat/rank/percent rank/dense rank/cume dist common::ObArray order_items_; - ObRawExpr* separator_param_expr_; + ObRawExpr *separator_param_expr_; // use for udf function info share::schema::ObUDFMeta udf_meta_; // a pre allocated expr used to compute linear interpolation // not contain any sharable expr, no need to deep copy - ObRawExpr* linear_inter_expr_; + ObRawExpr *linear_inter_expr_; bool is_nested_aggr_; }; -inline int ObAggFunRawExpr::add_real_param_expr(ObRawExpr* expr) +inline int ObAggFunRawExpr::add_real_param_expr(ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY(NULL == expr)) { @@ -3015,7 +3022,7 @@ inline int ObAggFunRawExpr::add_real_param_expr(ObRawExpr* expr) return ret; } -inline int ObAggFunRawExpr::replace_real_param_expr(int64_t index, ObRawExpr* expr) +inline int ObAggFunRawExpr::replace_real_param_expr(int64_t index, ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY(index < 0 || index >= real_param_exprs_.count())) { @@ -3023,13 +3030,13 @@ inline int ObAggFunRawExpr::replace_real_param_expr(int64_t index, ObRawExpr* ex } else if (OB_UNLIKELY(NULL == expr)) { ret = common::OB_INVALID_ARGUMENT; } else { - ObRawExpr*& target_expr = real_param_exprs_.at(index); + ObRawExpr *&target_expr = real_param_exprs_.at(index); target_expr = expr; } return ret; } -inline int ObAggFunRawExpr::replace_param_expr(int64_t index, ObRawExpr* expr) +inline int ObAggFunRawExpr::replace_param_expr(int64_t index, ObRawExpr *expr) { int ret = common::OB_SUCCESS; if (OB_UNLIKELY(index < 0 || index >= get_param_count())) { @@ -3037,20 +3044,20 @@ inline int ObAggFunRawExpr::replace_param_expr(int64_t index, ObRawExpr* expr) } else if (OB_UNLIKELY(NULL == expr)) { ret = common::OB_INVALID_ARGUMENT; } else if (index >= real_param_exprs_.count()) { - ObRawExpr*& target_expr = order_items_.at(index - real_param_exprs_.count()).expr_; + ObRawExpr *&target_expr = order_items_.at(index - real_param_exprs_.count()).expr_; target_expr = expr; } else { - ObRawExpr*& target_expr = real_param_exprs_.at(index); + ObRawExpr *&target_expr = real_param_exprs_.at(index); target_expr = expr; } return ret; } -inline void ObAggFunRawExpr::set_push_down_sum_expr(ObRawExpr* expr) +inline void ObAggFunRawExpr::set_push_down_sum_expr(ObRawExpr *expr) { push_down_sum_expr_ = expr; } -inline void ObAggFunRawExpr::set_push_down_count_expr(ObRawExpr* expr) +inline void ObAggFunRawExpr::set_push_down_count_expr(ObRawExpr *expr) { push_down_count_expr_ = expr; } @@ -3081,15 +3088,15 @@ inline void ObAggFunRawExpr::set_in_nested_aggr(bool is_nested) { is_nested_aggr_ = is_nested; } -inline void ObAggFunRawExpr::set_separator_param_expr(ObRawExpr* separator_param_expr) +inline void ObAggFunRawExpr::set_separator_param_expr(ObRawExpr *separator_param_expr) { separator_param_expr_ = separator_param_expr; } -inline void ObAggFunRawExpr::set_linear_inter_expr(ObRawExpr* linear_inter_expr) +inline void ObAggFunRawExpr::set_linear_inter_expr(ObRawExpr *linear_inter_expr) { linear_inter_expr_ = linear_inter_expr; } -inline int ObAggFunRawExpr::add_order_item(const OrderItem& order_item) +inline int ObAggFunRawExpr::add_order_item(const OrderItem &order_item) { return order_items_.push_back(order_item); } @@ -3099,7 +3106,7 @@ inline int ObAggFunRawExpr::add_order_item(const OrderItem& order_item) // for special system function, ObRawExpr::type_ can be reset. Such function may not need name class ObSysFunRawExpr : public ObOpRawExpr { public: - ObSysFunRawExpr(common::ObIAllocator& alloc) : ObOpRawExpr(alloc), func_name_(), operator_id_(common::OB_INVALID_ID) + ObSysFunRawExpr(common::ObIAllocator &alloc) : ObOpRawExpr(alloc), func_name_(), operator_id_(common::OB_INVALID_ID) { set_expr_class(ObExpr::EXPR_SYS_FUNC); } @@ -3109,18 +3116,18 @@ public: } virtual ~ObSysFunRawExpr() {} - virtual int assign(const ObSysFunRawExpr& other); - virtual int deep_copy(ObRawExprFactory& expr_factory, const ObSysFunRawExpr& other, const uint64_t copy_types, + virtual int assign(const ObSysFunRawExpr &other); + virtual int deep_copy(ObRawExprFactory &expr_factory, const ObSysFunRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - void set_func_name(const common::ObString& name); - const common::ObString& get_func_name() const; + void set_func_name(const common::ObString &name); + const common::ObString &get_func_name() const; virtual void clear_child() override; int check_param_num(); - virtual ObExprOperator* get_op() override; + virtual ObExprOperator *get_op() override; virtual void reset() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override { @@ -3128,9 +3135,9 @@ public: return hash_ret; } - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; - int get_cast_type_name(char* buf, int64_t buf_len, int64_t& pos) const; - int get_column_conv_name(char* buf, int64_t buf_len, int64_t& pos, ExplainType type) const; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; + int get_cast_type_name(char *buf, int64_t buf_len, int64_t &pos) const; + int get_column_conv_name(char *buf, int64_t buf_len, int64_t &pos, ExplainType type) const; void set_op_id(int64_t operator_id) { operator_id_ = operator_id; @@ -3149,31 +3156,31 @@ private: uint64_t operator_id_; }; -inline void ObSysFunRawExpr::set_func_name(const common::ObString& name) +inline void ObSysFunRawExpr::set_func_name(const common::ObString &name) { func_name_ = name; } -inline const common::ObString& ObSysFunRawExpr::get_func_name() const +inline const common::ObString &ObSysFunRawExpr::get_func_name() const { return func_name_; } class ObSequenceRawExpr : public ObSysFunRawExpr { public: - ObSequenceRawExpr(common::ObIAllocator& alloc) : ObSysFunRawExpr(alloc), name_(), action_(), sequence_id_(0) + ObSequenceRawExpr(common::ObIAllocator &alloc) : ObSysFunRawExpr(alloc), name_(), action_(), sequence_id_(0) {} ObSequenceRawExpr() : ObSysFunRawExpr(), name_(), action_(), sequence_id_(0) {} virtual ~ObSequenceRawExpr() = default; - virtual int assign(const ObSequenceRawExpr& other); - virtual int deep_copy(ObRawExprFactory& expr_factory, const ObSequenceRawExpr& other, const uint64_t copy_types, + virtual int assign(const ObSequenceRawExpr &other); + virtual int deep_copy(ObRawExprFactory &expr_factory, const ObSequenceRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - int set_sequence_meta(const common::ObString& name, const common::ObString& action, uint64_t sequence_id); - const common::ObString& get_name() + int set_sequence_meta(const common::ObString &name, const common::ObString &action, uint64_t sequence_id); + const common::ObString &get_name() { return name_; } - const common::ObString& get_action() + const common::ObString &get_action() { return action_; } @@ -3181,8 +3188,8 @@ public: { return sequence_id_; } - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; - virtual int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; + virtual int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; private: common::ObString name_; // sequence object name @@ -3192,23 +3199,23 @@ private: class ObNormalDllUdfRawExpr : public ObSysFunRawExpr { public: - ObNormalDllUdfRawExpr(common::ObIAllocator& alloc) : ObSysFunRawExpr(alloc), udf_meta_(), udf_attributes_() + ObNormalDllUdfRawExpr(common::ObIAllocator &alloc) : ObSysFunRawExpr(alloc), udf_meta_(), udf_attributes_() {} ObNormalDllUdfRawExpr() : ObSysFunRawExpr(), udf_meta_(), udf_attributes_() {} virtual ~ObNormalDllUdfRawExpr() {} - virtual int assign(const ObNormalDllUdfRawExpr& other); - virtual int deep_copy(ObRawExprFactory& expr_factory, const ObNormalDllUdfRawExpr& other, const uint64_t copy_types, + virtual int assign(const ObNormalDllUdfRawExpr &other); + virtual int deep_copy(ObRawExprFactory &expr_factory, const ObNormalDllUdfRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - int set_udf_meta(const share::schema::ObUDF& udf); - int add_udf_attribute_name(const common::ObString& name); - int add_udf_attribute(const ObRawExpr* expr, const ParseNode* node); - const share::schema::ObUDFMeta& get_udf_meta() const + int set_udf_meta(const share::schema::ObUDF &udf); + int add_udf_attribute_name(const common::ObString &name); + int add_udf_attribute(const ObRawExpr *expr, const ParseNode *node); + const share::schema::ObUDFMeta &get_udf_meta() const { return udf_meta_; } - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; private: // for udf function info @@ -3218,16 +3225,16 @@ private: class ObPLSQLCodeSQLErrmRawExpr : public ObSysFunRawExpr { public: - ObPLSQLCodeSQLErrmRawExpr(common::ObIAllocator& alloc) : ObSysFunRawExpr(alloc), is_sqlcode_(true) + ObPLSQLCodeSQLErrmRawExpr(common::ObIAllocator &alloc) : ObSysFunRawExpr(alloc), is_sqlcode_(true) {} ObPLSQLCodeSQLErrmRawExpr() : ObSysFunRawExpr(), is_sqlcode_(true) {} virtual ~ObPLSQLCodeSQLErrmRawExpr() {} - virtual int assign(const ObPLSQLCodeSQLErrmRawExpr& other); - virtual int deep_copy(ObRawExprFactory& expr_factory, const ObPLSQLCodeSQLErrmRawExpr& other, + virtual int assign(const ObPLSQLCodeSQLErrmRawExpr &other); + virtual int deep_copy(ObRawExprFactory &expr_factory, const ObPLSQLCodeSQLErrmRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - virtual ObExprOperator* get_op() override; + virtual ObExprOperator *get_op() override; void set_is_sqlcode(bool is_sqlcode) { is_sqlcode_ = is_sqlcode; @@ -3248,19 +3255,19 @@ private: class ObObjAccessRawExpr : public ObOpRawExpr { public: - ObObjAccessRawExpr(common::ObIAllocator& alloc) + ObObjAccessRawExpr(common::ObIAllocator &alloc) : ObOpRawExpr(alloc), get_attr_func_(0), func_name_(), var_indexs_(), for_write_(false) {} ObObjAccessRawExpr() : ObOpRawExpr(), get_attr_func_(0), func_name_(), var_indexs_(), for_write_(false) {} virtual ~ObObjAccessRawExpr() {} - int assign(const ObObjAccessRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObObjAccessRawExpr& other, const uint64_t copy_types, + int assign(const ObObjAccessRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObObjAccessRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - const common::ObIArray& get_var_indexs() const + const common::ObIArray &get_var_indexs() const { return var_indexs_; } @@ -3272,11 +3279,11 @@ public: { return get_attr_func_; } - void set_func_name(const common::ObString& func_name) + void set_func_name(const common::ObString &func_name) { func_name_ = func_name; } - const common::ObString& get_func_name() const + const common::ObString &get_func_name() const { return func_name_; } @@ -3317,7 +3324,7 @@ enum ObMultiSetModifier { class ObMultiSetRawExpr : public ObOpRawExpr { public: - ObMultiSetRawExpr(common::ObIAllocator& alloc) + ObMultiSetRawExpr(common::ObIAllocator &alloc) : ObOpRawExpr(alloc), ms_modifier_(ObMultiSetModifier::MULTISET_MODIFIER_INVALID), ms_type_(ObMultiSetType::MULTISET_TYPE_INVALID) @@ -3331,10 +3338,10 @@ public: virtual ~ObMultiSetRawExpr() {} - int assign(const ObMultiSetRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObMultiSetRawExpr& other, const uint64_t copy_types, + int assign(const ObMultiSetRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObMultiSetRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; inline ObMultiSetModifier get_multiset_modifier() const { @@ -3362,15 +3369,15 @@ private: class ObCollPredRawExpr : public ObMultiSetRawExpr { public: - ObCollPredRawExpr(common::ObIAllocator& alloc) : ObMultiSetRawExpr(alloc) + ObCollPredRawExpr(common::ObIAllocator &alloc) : ObMultiSetRawExpr(alloc) {} virtual ~ObCollPredRawExpr() {} - int assign(const ObCollPredRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObCollPredRawExpr& other, const uint64_t copy_types, + int assign(const ObCollPredRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObCollPredRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; private: DISALLOW_COPY_AND_ASSIGN(ObCollPredRawExpr); @@ -3389,7 +3396,7 @@ public: { set_expr_class(ObExpr::EXPR_DOMAIN_INDEX); } - ObFunMatchAgainst(common::ObIAllocator& alloc) + ObFunMatchAgainst(common::ObIAllocator &alloc) : ObNonTerminalRawExpr(alloc), mode_flag_(NATURAL_LANGUAGE_MODE), match_columns_(NULL), @@ -3403,10 +3410,10 @@ public: virtual ~ObFunMatchAgainst() {} - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; inline void set_mode_flag(ObMatchAgainstMode mode_flag) { mode_flag_ = mode_flag; @@ -3415,49 +3422,49 @@ public: { return mode_flag_; } - inline void set_match_columns(ObRawExpr* match_columns) + inline void set_match_columns(ObRawExpr *match_columns) { match_columns_ = match_columns; } - inline const ObRawExpr* get_match_columns() const + inline const ObRawExpr *get_match_columns() const { return match_columns_; } - inline ObRawExpr* get_match_columns() + inline ObRawExpr *get_match_columns() { return match_columns_; } - inline void set_search_key(ObRawExpr* search_key) + inline void set_search_key(ObRawExpr *search_key) { search_key_ = search_key; } - inline const ObRawExpr* get_search_key() const + inline const ObRawExpr *get_search_key() const { return search_key_; } - inline ObRawExpr* get_search_key() + inline ObRawExpr *get_search_key() { return search_key_; } - inline void set_real_column(ObColumnRefRawExpr* real_column) + inline void set_real_column(ObColumnRefRawExpr *real_column) { real_column_ = real_column; } - inline const ObColumnRefRawExpr* get_real_column() const + inline const ObColumnRefRawExpr *get_real_column() const { return real_column_; } // inline void set_search_tree(ObRawExpr *search_tree) { search_tree_ = search_tree; } // inline const ObRawExpr *get_search_tree() const { return search_tree_; } - inline void set_fulltext_filter(ObRawExpr* fulltext_key) + inline void set_fulltext_filter(ObRawExpr *fulltext_key) { fulltext_filter_ = fulltext_key; } - inline const ObRawExpr* get_fulltext_filter() const + inline const ObRawExpr *get_fulltext_filter() const { return fulltext_filter_; } - inline ObRawExpr* get_fulltext_filter() + inline ObRawExpr *get_fulltext_filter() { return fulltext_filter_; } @@ -3465,21 +3472,21 @@ public: { return 2; } - const ObRawExpr* get_param_expr(int64_t index) const override; - ObRawExpr*& get_param_expr(int64_t index) override; + const ObRawExpr *get_param_expr(int64_t index) const override; + ObRawExpr *&get_param_expr(int64_t index) override; void clear_child() override; virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; VIRTUAL_TO_STRING_KV( N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, K_(mode_flag)); private: DISALLOW_COPY_AND_ASSIGN(ObFunMatchAgainst); ObMatchAgainstMode mode_flag_; - ObRawExpr* match_columns_; - ObColumnRefRawExpr* real_column_; - ObRawExpr* search_key_; - ObRawExpr* fulltext_filter_; + ObRawExpr *match_columns_; + ObColumnRefRawExpr *real_column_; + ObRawExpr *search_key_; + ObRawExpr *fulltext_filter_; }; class ObSetIterRawExpr : public ObNonTerminalRawExpr { @@ -3488,30 +3495,30 @@ public: { set_expr_class(ObExpr::EXPR_DOMAIN_INDEX); } - ObSetIterRawExpr(common::ObIAllocator& alloc) : ObNonTerminalRawExpr(alloc), left_iter_(NULL), right_iter_(NULL) + ObSetIterRawExpr(common::ObIAllocator &alloc) : ObNonTerminalRawExpr(alloc), left_iter_(NULL), right_iter_(NULL) { set_expr_class(ObExpr::EXPR_DOMAIN_INDEX); } virtual ~ObSetIterRawExpr() {} - virtual int do_visit(ObRawExprVisitor& visitor) override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + virtual int do_visit(ObRawExprVisitor &visitor) override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; int64_t get_param_count() const override { return 2; } - const ObRawExpr* get_param_expr(int64_t index) const override; - ObRawExpr*& get_param_expr(int64_t index) override; - void set_left_expr(ObRawExpr* left_iter) + const ObRawExpr *get_param_expr(int64_t index) const override; + ObRawExpr *&get_param_expr(int64_t index) override; + void set_left_expr(ObRawExpr *left_iter) { left_iter_ = left_iter; } - void set_right_expr(ObRawExpr* right_iter) + void set_right_expr(ObRawExpr *right_iter) { right_iter_ = right_iter; } - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override { UNUSED(expr); UNUSED(check_context); @@ -3526,8 +3533,8 @@ public: private: DISALLOW_COPY_AND_ASSIGN(ObSetIterRawExpr); - ObRawExpr* left_iter_; - ObRawExpr* right_iter_; + ObRawExpr *left_iter_; + ObRawExpr *right_iter_; }; class ObRowIterRawExpr : public ObTerminalRawExpr { @@ -3536,21 +3543,21 @@ public: { set_expr_class(ObExpr::EXPR_DOMAIN_INDEX); } - ObRowIterRawExpr(common::ObIAllocator& alloc) : ObTerminalRawExpr(alloc), iter_idx_(common::OB_INVALID_INDEX) + ObRowIterRawExpr(common::ObIAllocator &alloc) : ObTerminalRawExpr(alloc), iter_idx_(common::OB_INVALID_INDEX) { set_expr_class(ObExpr::EXPR_DOMAIN_INDEX); } virtual ~ObRowIterRawExpr() {} - virtual int do_visit(ObRawExprVisitor& visitor) override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override + virtual int do_visit(ObRawExprVisitor &visitor) override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override { UNUSED(expr); UNUSED(check_context); return false; } - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; inline void set_iter_idx(int64_t iter_idx) { iter_idx_ = iter_idx; @@ -3595,24 +3602,24 @@ public: interval_expr_(NULL), date_unit_expr_(NULL) { - MEMSET(exprs_, 0, sizeof(ObRawExpr*) * BOUND_EXPR_MAX); + MEMSET(exprs_, 0, sizeof(ObRawExpr *) * BOUND_EXPR_MAX); } int deep_copy( - ObRawExprFactory& expr_factory, const Bound& other, const uint64_t copy_types, bool use_new_allocator = false); + ObRawExprFactory &expr_factory, const Bound &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs); + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs); bool same_as(const Bound &other, ObExprEqualCheckContext *check_context) const; BoundType type_; bool is_preceding_; bool is_nmb_literal_; - ObRawExpr* interval_expr_; - ObRawExpr* date_unit_expr_; + ObRawExpr *interval_expr_; + ObRawExpr *date_unit_expr_; ; - ObRawExpr* exprs_[BOUND_EXPR_MAX]; + ObRawExpr *exprs_[BOUND_EXPR_MAX]; TO_STRING_KV(K_(type), K_(is_preceding), K_(is_nmb_literal), KP_(interval_expr), K_(date_unit_expr)); }; @@ -3629,11 +3636,11 @@ public: { is_between_ = is_between; } - inline void set_upper(const Bound& upper) + inline void set_upper(const Bound &upper) { upper_ = upper; } - inline void set_lower(const Bound& lower) + inline void set_lower(const Bound &lower) { lower_ = lower; } @@ -3645,16 +3652,16 @@ public: { return is_between_; } - inline Bound& get_upper() + inline Bound &get_upper() { return upper_; } - inline Bound& get_lower() + inline Bound &get_lower() { return lower_; } - int assign(const ObFrame& other); + int assign(const ObFrame &other); WindowType win_type_; bool is_between_; @@ -3669,15 +3676,15 @@ public: partition_exprs_.set_label(common::ObModIds::OB_SQL_WINDOW_FUNC); order_items_.set_label(common::ObModIds::OB_SQL_WINDOW_FUNC); } - inline int set_partition_exprs(const common::ObIArray& exprs) + inline int set_partition_exprs(const common::ObIArray &exprs) { return partition_exprs_.assign(exprs); } - inline int set_order_items(const common::ObIArray& items) + inline int set_order_items(const common::ObIArray &items) { return order_items_.assign(items); } - inline void set_win_name(common::ObString& win_name) + inline void set_win_name(common::ObString &win_name) { win_name_ = win_name; } @@ -3685,7 +3692,7 @@ public: { has_frame_orig_ = has_frame_orig; } - inline common::ObString& get_win_name() + inline common::ObString &get_win_name() { return win_name_; } @@ -3697,26 +3704,26 @@ public: { return order_items_.count() > 0; } - inline const common::ObIArray& get_partition_exprs() const + inline const common::ObIArray &get_partition_exprs() const { return partition_exprs_; } - inline common::ObIArray& get_partition_exprs() + inline common::ObIArray &get_partition_exprs() { return partition_exprs_; } - inline const common::ObIArray& get_order_items() const + inline const common::ObIArray &get_order_items() const { return order_items_; } - inline common::ObIArray& get_order_items() + inline common::ObIArray &get_order_items() { return order_items_; } - int assign(const ObWindow& other); + int assign(const ObWindow &other); - common::ObArray partition_exprs_; + common::ObArray partition_exprs_; common::ObArray order_items_; // used in resolver common::ObString win_name_; @@ -3736,7 +3743,7 @@ public: { set_expr_class(ObExpr::EXPR_WINDOW); } - ObWinFunRawExpr(common::ObIAllocator& alloc) + ObWinFunRawExpr(common::ObIAllocator &alloc) : ObRawExpr(alloc), ObWindow(), func_type_(T_MAX), @@ -3750,12 +3757,12 @@ public: virtual ~ObWinFunRawExpr() {} - int assign(const ObWinFunRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObWinFunRawExpr& other, const uint64_t copy_types, + int assign(const ObWinFunRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObWinFunRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); - int replace_param_expr(int64_t partition_expr_index, ObRawExpr* expr); + int replace_param_expr(int64_t partition_expr_index, ObRawExpr *expr); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; inline void set_func_type(ObItemType func_type) { func_type_ = func_type; @@ -3772,11 +3779,11 @@ public: { is_from_first_ = is_from_first; } - inline int set_func_params(const common::ObIArray& params) + inline int set_func_params(const common::ObIArray ¶ms) { return func_params_.assign(params); } - inline void set_agg_expr(ObAggFunRawExpr* agg_expr) + inline void set_agg_expr(ObAggFunRawExpr *agg_expr) { agg_expr_ = agg_expr; } @@ -3796,25 +3803,25 @@ public: { return is_from_first_; } - inline const common::ObIArray& get_func_params() const + inline const common::ObIArray &get_func_params() const { return func_params_; } - inline common::ObIArray& get_func_params() + inline common::ObIArray &get_func_params() { return func_params_; } - inline ObAggFunRawExpr* get_agg_expr() + inline ObAggFunRawExpr *get_agg_expr() { return agg_expr_; } - inline ObAggFunRawExpr* get_agg_expr() const + inline ObAggFunRawExpr *get_agg_expr() const { return agg_expr_; } virtual void clear_child() override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; virtual int64_t get_param_count() const override { @@ -3822,7 +3829,7 @@ public: partition_exprs_.count() + order_items_.count() + (upper_.interval_expr_ != NULL ? 1 : 0) + (lower_.interval_expr_ != NULL ? 1 : 0); for (int64_t i = 0; i < 2; ++i) { - const Bound* bound = 0 == i ? &upper_ : &lower_; + const Bound *bound = 0 == i ? &upper_ : &lower_; for (int64_t j = 0; j < BOUND_EXPR_MAX; ++j) { if (NULL != bound->exprs_[j]) { cnt++; @@ -3831,13 +3838,13 @@ public: } return cnt; } - virtual const ObRawExpr* get_param_expr(int64_t index) const override; - virtual ObRawExpr*& get_param_expr(int64_t index) override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual const ObRawExpr *get_param_expr(int64_t index) const override; + virtual ObRawExpr *&get_param_expr(int64_t index) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; VIRTUAL_TO_STRING_KV(N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, K_(expr_level), K_(expr_levels), K_(func_type), K_(is_distinct), K_(func_params), K_(partition_exprs), K_(order_items), K_(win_type), K_(is_between), K_(upper), K_(lower), KPC_(agg_expr)); @@ -3851,8 +3858,8 @@ private: bool is_distinct_; bool is_ignore_null_; bool is_from_first_; - common::ObArray func_params_; - ObAggFunRawExpr* agg_expr_; + common::ObArray func_params_; + ObAggFunRawExpr *agg_expr_; }; //////////////////////////////////////////////////////////////// @@ -3862,21 +3869,21 @@ public: { set_expr_class(ObExpr::EXPR_PSEUDO_COLUMN); } - ObPseudoColumnRawExpr(common::ObIAllocator& alloc) : ObTerminalRawExpr(alloc), table_id_(common::OB_INVALID_ID) + ObPseudoColumnRawExpr(common::ObIAllocator &alloc) : ObTerminalRawExpr(alloc), table_id_(common::OB_INVALID_ID) { set_expr_class(ObExpr::EXPR_PSEUDO_COLUMN); } virtual ~ObPseudoColumnRawExpr(){}; - int assign(const ObPseudoColumnRawExpr& other); - int deep_copy(ObRawExprFactory& expr_factory, const ObPseudoColumnRawExpr& other, const uint64_t copy_types, + int assign(const ObPseudoColumnRawExpr &other); + int deep_copy(ObRawExprFactory &expr_factory, const ObPseudoColumnRawExpr &other, const uint64_t copy_types, bool use_new_allocator = false); virtual int replace_expr( - const common::ObIArray& other_exprs, const common::ObIArray& new_exprs) override; - virtual bool same_as(const ObRawExpr& expr, ObExprEqualCheckContext* check_context = NULL) const override; + const common::ObIArray &other_exprs, const common::ObIArray &new_exprs) override; + virtual bool same_as(const ObRawExpr &expr, ObExprEqualCheckContext *check_context = NULL) const override; - virtual int do_visit(ObRawExprVisitor& visitor) override; + virtual int do_visit(ObRawExprVisitor &visitor) override; virtual uint64_t hash_internal(uint64_t seed) const override; - int get_name_internal(char* buf, const int64_t buf_len, int64_t& pos, ExplainType type) const override; + int get_name_internal(char *buf, const int64_t buf_len, int64_t &pos, ExplainType type) const override; bool is_hierarchical_query_type() const { return type_ == T_LEVEL || type_ == T_CONNECT_BY_ISCYCLE || type_ == T_CONNECT_BY_ISLEAF; @@ -3885,12 +3892,12 @@ public: { return T_CTE_SEARCH_COLUMN == type_ || T_CTE_CYCLE_COLUMN == type_; } - void set_cte_cycle_value(ObRawExpr* v, ObRawExpr* d_v) + void set_cte_cycle_value(ObRawExpr *v, ObRawExpr *d_v) { cte_cycle_value_ = v; cte_cycle_default_value_ = d_v; }; - void get_cte_cycle_value(ObRawExpr*& v, ObRawExpr*& d_v) + void get_cte_cycle_value(ObRawExpr *&v, ObRawExpr *&d_v) { v = cte_cycle_value_; d_v = cte_cycle_default_value_; @@ -3908,8 +3915,8 @@ public: N_ITEM_TYPE, type_, N_RESULT_TYPE, result_type_, N_EXPR_INFO, info_, N_REL_ID, rel_ids_, N_TABLE_ID, table_id_); private: - ObRawExpr* cte_cycle_value_; - ObRawExpr* cte_cycle_default_value_; + ObRawExpr *cte_cycle_value_; + ObRawExpr *cte_cycle_default_value_; int64_t table_id_; DISALLOW_COPY_AND_ASSIGN(ObPseudoColumnRawExpr); }; @@ -3922,56 +3929,56 @@ public: {} // OP types: constants, ? etc. - virtual int visit(ObConstRawExpr& expr) = 0; + virtual int visit(ObConstRawExpr &expr) = 0; // OP types: ObObjtypes - virtual int visit(ObVarRawExpr& expr) = 0; + virtual int visit(ObVarRawExpr &expr) = 0; // OP types: subquery, cell index - virtual int visit(ObQueryRefRawExpr& expr) = 0; + virtual int visit(ObQueryRefRawExpr &expr) = 0; // OP types: identify, table.column - virtual int visit(ObColumnRefRawExpr& expr) = 0; + virtual int visit(ObColumnRefRawExpr &expr) = 0; // unary OP types: exists, not, negative, positive // binary OP types: +, -, *, /, >, <, =, <=>, IS, IN etc. // triple OP types: like, not like, btw, not btw // multi OP types: and, or, ROW - virtual int visit(ObOpRawExpr& expr) = 0; + virtual int visit(ObOpRawExpr &expr) = 0; // OP types: case, arg case - virtual int visit(ObCaseOpRawExpr& expr) = 0; + virtual int visit(ObCaseOpRawExpr &expr) = 0; // OP types: aggregate functions e.g. max, min, avg, count, sum - virtual int visit(ObAggFunRawExpr& expr) = 0; + virtual int visit(ObAggFunRawExpr &expr) = 0; // OP types: system functions - virtual int visit(ObSysFunRawExpr& expr) = 0; - virtual int visit(ObSetOpRawExpr& expr) = 0; - virtual int visit(ObAliasRefRawExpr& expr) + virtual int visit(ObSysFunRawExpr &expr) = 0; + virtual int visit(ObSetOpRawExpr &expr) = 0; + virtual int visit(ObAliasRefRawExpr &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual int visit(ObFunMatchAgainst& expr) + virtual int visit(ObFunMatchAgainst &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual int visit(ObSetIterRawExpr& expr) + virtual int visit(ObSetIterRawExpr &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual int visit(ObRowIterRawExpr& expr) + virtual int visit(ObRowIterRawExpr &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual int visit(ObWinFunRawExpr& expr) + virtual int visit(ObWinFunRawExpr &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual int visit(ObPseudoColumnRawExpr& expr) + virtual int visit(ObPseudoColumnRawExpr &expr) { UNUSED(expr); return common::OB_SUCCESS; } - virtual bool skip_child(ObRawExpr& expr) + virtual bool skip_child(ObRawExpr &expr) { UNUSED(expr); return false; @@ -3984,7 +3991,7 @@ private: class ObRawExprFactory { public: - explicit ObRawExprFactory(common::ObIAllocator& alloc) : allocator_(alloc), expr_store_(alloc) + explicit ObRawExprFactory(common::ObIAllocator &alloc) : allocator_(alloc), expr_store_(alloc) {} ~ObRawExprFactory() { @@ -3995,10 +4002,10 @@ public: //~ObRawExprFactory() { } template - inline int create_raw_expr(ObItemType expr_type, ExprType*& raw_expr) + inline int create_raw_expr(ObItemType expr_type, ExprType *&raw_expr) { int ret = common::OB_SUCCESS; - void* ptr = allocator_.alloc(sizeof(ExprType)); + void *ptr = allocator_.alloc(sizeof(ExprType)); raw_expr = NULL; if (OB_UNLIKELY(NULL == ptr)) { ret = common::OB_ALLOCATE_MEMORY_FAILED; @@ -4030,15 +4037,15 @@ public: expr_store_.destory(); } - inline common::ObIAllocator& get_allocator() + inline common::ObIAllocator &get_allocator() { return allocator_; } TO_STRING_KV("", ""); private: - common::ObIAllocator& allocator_; - common::ObObjStore expr_store_; + common::ObIAllocator &allocator_; + common::ObObjStore expr_store_; private: DISALLOW_COPY_AND_ASSIGN(ObRawExprFactory); @@ -4049,13 +4056,13 @@ public: ObRawExprPointer(); virtual ~ObRawExprPointer(); - int get(ObRawExpr*& expr); - int set(ObRawExpr* expr); - int add_ref(ObRawExpr** expr); + int get(ObRawExpr *&expr); + int set(ObRawExpr *expr); + int add_ref(ObRawExpr **expr); TO_STRING_KV("", ""); private: - common::ObSEArray expr_group_; + common::ObSEArray expr_group_; }; } // namespace sql diff --git a/src/storage/ob_dml_param.cpp b/src/storage/ob_dml_param.cpp index 3bbb9bca7cecdb36abab74453e0914b7f1dd01a3..00b510c83ec68b1cd1f4a9a1dc4ea68c3530ce0a 100644 --- a/src/storage/ob_dml_param.cpp +++ b/src/storage/ob_dml_param.cpp @@ -16,6 +16,7 @@ #include "share/ob_errno.h" #include "share/schema/ob_schema_struct.h" #include "share/schema/ob_table_dml_param.h" +#include "sql/engine/expr/ob_expr.h" namespace oceanbase { namespace storage { @@ -23,13 +24,13 @@ using namespace common; using namespace share::schema; int ObRow2ExprsProjector::init( - const sql::ObExprPtrIArray& exprs, sql::ObEvalCtx& eval_ctx, const common::ObIArray& projector) + const sql::ObExprPtrIArray &exprs, sql::ObEvalCtx &eval_ctx, const common::ObIArray &projector) { int ret = OB_SUCCESS; if (outputs_.empty()) { // not inited // first traverse, treat MapConvert::start_ as count for (int64_t i = 0; i < exprs.count(); i++) { - sql::ObExpr* e = exprs.at(i); + sql::ObExpr *e = exprs.at(i); // output should always be T_COLUMN_REF, only virtual column has argument. if (e->arg_cnt_ > 0) { has_virtual_ = true; @@ -60,7 +61,7 @@ int ObRow2ExprsProjector::init( int64_t other_end = other_idx_; // second traverse, setup MapConvert::end_ && outputs_ for (int64_t i = 0; i < exprs.count(); i++) { - sql::ObExpr* e = exprs.at(i); + sql::ObExpr *e = exprs.at(i); const int32_t obj_idx = projector.at(i); int64_t item_idx = 0; if (e->arg_cnt_ == 0 && obj_idx >= 0) { @@ -77,7 +78,7 @@ int ObRow2ExprsProjector::init( } else { item_idx = other_end++; } - Item& item = outputs_[item_idx]; + Item &item = outputs_[item_idx]; item.obj_idx_ = obj_idx; item.expr_idx_ = i; item.datum_ = &e->locate_datum_for_write(eval_ctx); @@ -90,7 +91,7 @@ int ObRow2ExprsProjector::init( }; int ObRow2ExprsProjector::project( - const sql::ObExprPtrIArray& exprs, const common::ObObj* cells, int16_t* nop_pos, int64_t& nop_cnt) + const sql::ObExprPtrIArray &exprs, const common::ObObj *cells, int16_t *nop_pos, int64_t &nop_cnt) { // performance critical, no parameter validity check. int ret = OB_SUCCESS; @@ -99,8 +100,8 @@ int ObRow2ExprsProjector::project( int_.project(outputs_.get_data(), cells, nop_pos, nop_cnt); for (int64_t i = other_idx_; OB_SUCC(ret) && i < outputs_.count(); i++) { - const Item& item = outputs_.at(i); - const ObObj* cell = NULL; + const Item &item = outputs_.at(i); + const ObObj *cell = NULL; if (OB_UNLIKELY(item.obj_idx_ < 0 || (cell = &cells[item.obj_idx_])->is_nop_value()) || (cell->is_urowid())) { // need to calc urowid col every time. otherwise may get old value. nop_pos[nop_cnt++] = item.expr_idx_; @@ -128,7 +129,7 @@ int ObTableScanParam::init_rowkey_column_orders() { int ret = OB_SUCCESS; int64_t rowkey_count = 0; - void* buf = NULL; + void *buf = NULL; if (!is_valid() || OB_NOT_NULL(column_orders_)) { ret = OB_INVALID_ARGUMENT; @@ -141,7 +142,7 @@ int ObTableScanParam::init_rowkey_column_orders() ret = OB_ALLOCATE_MEMORY_FAILED; STORAGE_LOG(WARN, "Failed to alloc memrory", K(ret)); } else { - const common::ObIArray& rowkey_columns = + const common::ObIArray &rowkey_columns = scan_flag_.is_index_back() ? table_param_->get_index_columns() : table_param_->get_columns(); rowkey_count = scan_flag_.is_index_back() ? table_param_->get_index_rowkey_cnt() : table_param_->get_main_rowkey_cnt();