fix unity build compilation errors

This commit is contained in:
xy0 2022-01-27 10:57:53 +08:00 committed by LINxiansheng
parent 81df42d4da
commit b0e85791f2
15 changed files with 2389 additions and 2366 deletions

View File

@ -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<PreArchiveLinkedPGKey*>(link);
link_pg_key = static_cast<PreArchiveLinkedPGKey *>(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;

File diff suppressed because it is too large Load Diff

View File

@ -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<char*>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
} else if (OB_UNLIKELY(
NULL == (tmp_ptr = static_cast<char *>(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<char*>(tmp_ptr))) {
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char*>(allocator_->alloc(OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
} else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) {
} else if (OB_UNLIKELY(
NULL == (tmp_ptr = static_cast<char *>(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<char*>(tmp_ptr);
column_type_str_ = static_cast<char *>(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<const ObTableSchema*> table_schema_array;
const ObDatabaseSchema *database_schema = NULL;
ObArray<const ObTableSchema *> 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<ObString>& 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<ObString> &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<char*>(allocator_->realloc(
NULL == (column_type_str_ = static_cast<char *>(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<char*>(allocator_->alloc(buf_len))))) {
if (OB_UNLIKELY(NULL == (buf = static_cast<char *>(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<char*>(allocator_->alloc(buf_len))))) {
if (OB_UNLIKELY(NULL == (buf = static_cast<char *>(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))) {

View File

@ -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<ObString> &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<const share::schema::ObDatabaseSchema*, 8> database_schema_array_;
common::ObSEArray<const share::schema::ObTableSchema*, 16> filter_table_schema_array_;
common::ObSEArray<const share::schema::ObDatabaseSchema *, 8> database_schema_array_;
common::ObSEArray<const share::schema::ObTableSchema *, 16> filter_table_schema_array_;
};
} // namespace observer
} // namespace oceanbase

View File

@ -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<share::ObNonFrozenBackupPieceInfo>& 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<share::ObNonFrozenBackupPieceInfo> &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<share::ObNonFrozenBackupPieceInfo>& new_user_piece_array)
const common::ObIArray<share::ObNonFrozenBackupPieceInfo> &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<share::ObNonFrozenBackupPieceInfo>& 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<share::ObNonFrozenBackupPieceInfo> &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<uint64_t>& tenant_ids)
int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBackupInfo &sys_info,
const share::ObNonFrozenBackupPieceInfo &non_frozen_piece, const common::ObArray<uint64_t> &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<uint64_t>& 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<uint64_t> &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<uint64_t>& tenant_ids, const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece)
const common::ObIArray<uint64_t> &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<uint64_t>& tenant_ids, const share::ObLogArchiveBackupInfo& cur_sys_info,
const share::ObNonFrozenBackupPieceInfo& sys_non_frozen_piece)
const common::ObIArray<uint64_t> &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<uint64_t> 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<uint64_t>& tenant_ids)
int ObLogArchiveScheduler::get_tenant_ids_from_schema_(common::ObIArray<uint64_t> &tenant_ids)
{
int ret = OB_SUCCESS;
int64_t user_tenant_count = 0;
int64_t stop_tenant_count = 0;
hash::ObHashMap<uint64_t, ObTenantLogArchiveStatus*> log_archive_status_map;
hash::ObHashMap<uint64_t, ObTenantLogArchiveStatus *> log_archive_status_map;
ObArenaAllocator allocator;
ObLogArchiveBackupInfoMgr info_mgr;
@ -2689,7 +2690,7 @@ int ObLogArchiveScheduler::get_tenant_ids_from_schema_(common::ObIArray<uint64_t
}
int ObLogArchiveScheduler::check_server_stop_backup_(
share::ObLogArchiveBackupInfo& sys_info, common::ObIArray<uint64_t>& tenant_ids, bool& is_all_stop)
share::ObLogArchiveBackupInfo &sys_info, common::ObIArray<uint64_t> &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<uint64_t>& tenant_ids, const share::ObLogArchiveBackupInfo& cur_sys_info)
const common::ObIArray<uint64_t> &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<common::ObAddr>& inactive_server_list)
int ObLogArchiveScheduler::check_server_status_(ObArray<common::ObAddr> &inactive_server_list)
{
int ret = OB_SUCCESS;
common::ObZone inactive_zone;
@ -3180,7 +3181,7 @@ int ObLogArchiveScheduler::check_server_status_(ObArray<common::ObAddr>& 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<common::ObAddr>& 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;

View File

@ -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;

View File

@ -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<ObString>& pool_list)
int ObRestoreScheduler::assign_pool_list(const char *str, common::ObIArray<ObString> &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<char*>(str) : NULL), ",", &save_ptr);
item_str = strtok_r((NULL == item_str ? const_cast<char *>(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<ObStr
}
int ObRestoreScheduler::fill_restore_backup_info_param(
share::ObPhysicalRestoreJob& job, share::ObRestoreBackupInfoUtil::GetRestoreBackupInfoParam& param)
share::ObPhysicalRestoreJob &job, share::ObRestoreBackupInfoUtil::GetRestoreBackupInfoParam &param)
{
int ret = OB_SUCCESS;
ObPhysicalRestoreBackupDestList& dest_list = job.multi_restore_path_list_;
ObPhysicalRestoreBackupDestList &dest_list = job.multi_restore_path_list_;
if (!inited_) {
ret = OB_NOT_INIT;
LOG_WARN("not inited", KR(ret));
@ -444,7 +445,7 @@ int ObRestoreScheduler::fill_restore_backup_info_param(
return ret;
}
int ObRestoreScheduler::fill_backup_info(ObPhysicalRestoreJob& job, ObCreateTenantArg& arg)
int ObRestoreScheduler::fill_backup_info(ObPhysicalRestoreJob &job, ObCreateTenantArg &arg)
{
int ret = OB_SUCCESS;
ObRestoreBackupInfo backup_info;
@ -475,7 +476,7 @@ int ObRestoreScheduler::fill_backup_info(ObPhysicalRestoreJob& job, ObCreateTena
return ret;
}
int ObRestoreScheduler::fill_pkeys_for_physical_restore_log(const ObPhysicalRestoreJob& job, ObCreateTenantArg& arg)
int ObRestoreScheduler::fill_pkeys_for_physical_restore_log(const ObPhysicalRestoreJob &job, ObCreateTenantArg &arg)
{
int ret = OB_SUCCESS;
common::hash::ObHashSet<uint64_t> 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<ObPhysicalRestoreTaskInfo> 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<ObCopySSTableTaskInfo> 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<const PhysicalRestorePartition*> persist_partitions;
ObArray<const PhysicalRestorePartition *> 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<ObPartitionKey, ObPartitionReplica::MemberList>& member_list_map)
const uint64_t tenant_id, common::hash::ObHashMap<ObPartitionKey, ObPartitionReplica::MemberList> &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<const PhysicalRestorePartition*>& persist_partitions, const ObPhysicalRestoreStat& stat)
ObArray<const PhysicalRestorePartition *> &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<char*>(allocator.alloc(length)))) {
char *member_list_str = NULL;
if (NULL == (member_list_str = static_cast<char *>(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<uint64_t> 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<obrpc::ObTableItem>& table_items = job_info.white_list_.get_table_white_list();
const ObSArray<obrpc::ObTableItem> &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<obrpc::ObTableItem>& table_items, common::hash::ObHashSet<uint64_t>& table_white_list,
common::hash::ObHashSet<uint64_t>& tablegroup_white_list)
int ObRestoreScheduler::gen_white_list(const ObPhysicalRestoreJob &job_info,
const ObIArray<obrpc::ObTableItem> &table_items, common::hash::ObHashSet<uint64_t> &table_white_list,
common::hash::ObHashSet<uint64_t> &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<const ObDatabaseSchema*> databases;
ObArray<const ObDatabaseSchema *> 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<uint64_t>& table_white_list)
const uint64_t tenant_id, const common::hash::ObHashSet<uint64_t> &table_white_list)
{
int ret = OB_SUCCESS;
ObSchemaGetterGuard schema_guard;
ObArray<const ObSimpleTableSchemaV2*> tables;
ObArray<const ObSimpleTableSchemaV2 *> 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<uint64_t>& table_white_list)
int ObRestoreScheduler::try_drop_foreign_key(ObSchemaGetterGuard &schema_guard,
const share::schema::ObSimpleTableSchemaV2 &table, const common::hash::ObHashSet<uint64_t> &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<ObForeignKeyInfo>& foreign_keys = full_table->get_foreign_key_infos();
const ObIArray<ObForeignKeyInfo> &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<uint64_t>& table_white_list)
const uint64_t tenant_id, const common::hash::ObHashSet<uint64_t> &table_white_list)
{
int ret = OB_SUCCESS;
ObSchemaGetterGuard schema_guard;
ObArray<const ObSimpleTableSchemaV2*> tables;
ObArray<const ObSimpleTableSchemaV2 *> 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<uint64_t>& tablegroup_white_list)
const uint64_t tenant_id, const common::hash::ObHashSet<uint64_t> &tablegroup_white_list)
{
int ret = OB_SUCCESS;
ObSchemaGetterGuard schema_guard;
ObArray<const ObSimpleTablegroupSchema*> tablegroups;
ObArray<const ObSimpleTablegroupSchema *> 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<const ObDatabaseSchema*> databases;
ObArray<const ObDatabaseSchema *> 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<const ObTablegroupSchema*> tablegroups;
const ObTenantSchema *tenant_schema = NULL;
ObArray<const ObTablegroupSchema *> 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<share::ObZoneReplicaAttrSet> 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<const ObSimpleTableSchemaV2*> tables;
const ObTenantSchema *tenant_schema = NULL;
ObArray<const ObSimpleTableSchemaV2 *> 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<share::ObZoneReplicaAttrSet> 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<const ObSimpleTableSchemaV2*> table_schemas;
ObArray<const ObSimpleTableSchemaV2 *> 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<uint64_t>& index_ids, ObIndexStatus index_status)
int ObRestoreScheduler::update_index_status(const common::ObIArray<uint64_t> &index_ids, ObIndexStatus index_status)
{
int ret = OB_SUCCESS;
if (!inited_) {
@ -2505,7 +2506,7 @@ int ObRestoreScheduler::update_index_status(const common::ObIArray<uint64_t>& 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<const ObSimpleTableSchemaV2*> tables;
ObArray<const ObTablegroupSchema*> tablegroups;
ObArray<const ObSimpleTableSchemaV2 *> tables;
ObArray<const ObTablegroupSchema *> 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<const ObTableSchema*>(schema);
const ObTableSchema *table = static_cast<const ObTableSchema *>(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<PhysicalRestoreStatus>(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))) {

View File

@ -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<ObBackupBackupPieceJobInfo>& item_list)
int ObIBackupBackupPieceJobOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy,
common::ObIArray<ObBackupBackupPieceJobInfo> &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<ObBackupBackupPieceJobInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceJobInfo> &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<ObBackupBackupPieceJobInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceJobInfo> &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<ObBackupBackupPieceTaskInfo>& item_list)
int ObIBackupBackupPieceTaskOperator::get_item_list(const common::ObSqlString &sql, common::ObISQLClient &proxy,
common::ObIArray<ObBackupBackupPieceTaskInfo> &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<ObBackupBackupPieceTaskInfo>& items)
const int64_t job_id, common::ObISQLClient &proxy, ObIArray<ObBackupBackupPieceTaskInfo> &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<ObBackupBackupPieceTaskInfo>& items)
common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceTaskInfo> &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<ObBackupBackupPieceTaskInfo> 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<ObBackupBackupPieceTaskInfo> 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<ObBackupBackupPieceTaskInfo>& items)
const int64_t job_id, common::ObISQLClient &proxy, common::ObIArray<ObBackupBackupPieceTaskInfo> &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<ObBackupBackupPieceTaskInfo>& items, common::ObISQLClient& proxy)
const common::ObIArray<ObBackupBackupPieceTaskInfo> &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));

View File

@ -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<ObBackupBackupsetJobItem>& item_list, common::ObISQLClient& proxy)
const common::ObSqlString &sql, common::ObIArray<ObBackupBackupsetJobItem> &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<ObBackupBackupsetJobItem>& item_list, common::ObISQLClient& proxy)
common::ObIArray<ObBackupBackupsetJobItem> &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<ObBackupBackupsetJobItem>& item_list, common::ObISQLClient& proxy)
common::ObIArray<ObBackupBackupsetJobItem> &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<ObBackupBackupsetJobItem>& item_list, common::ObISQLClient& proxy)
common::ObIArray<ObBackupBackupsetJobItem> &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<ObTenantBackupBackupsetTaskItem>& 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<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant,
const int64_t job_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
const int64_t job_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
int ObTenantBackupBackupsetOperator::get_unfinished_task_items(const share::SimpleBackupBackupsetTenant &tenant,
const int64_t job_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
int ObTenantBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant,
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items,
common::ObISQLClient& proxy)
const int64_t copy_id, const bool for_update, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items,
common::ObISQLClient& proxy)
const share::ObBackupDest &dest, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
const int64_t copy_id, const int64_t backup_set_id, const share::ObBackupDest &backup_dest,
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
const uint64_t tenant_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items,
common::ObISQLClient& client)
const uint64_t tenant_id, const int64_t backup_set_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& client)
const uint64_t tenant_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& client)
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& client)
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<ObTenantBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
const uint64_t tenant_id, common::ObIArray<ObTenantBackupBackupsetTaskItem> &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<uint64_t>& tenant_ids, common::ObISQLClient& proxy)
const int64_t backup_set_id, common::ObIArray<uint64_t> &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<uint64_t>& tenant_ids, common::ObISQLClient& proxy)
const int64_t snapshot_version, common::ObIArray<uint64_t> &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<ObPGBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
int ObPGBackupBackupsetOperator::batch_report_task(const share::SimpleBackupBackupsetTenant &tenant,
const common::ObIArray<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& 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<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
common::ObIArray<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& items, common::ObISQLClient& proxy)
common::ObIArray<ObPGBackupBackupsetTaskItem> &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<share::ObBackupBackupsetArg>& args, const common::ObIArray<int32_t>& results,
const ObPGBackupBackupsetTaskItem::TaskStatus& status, common::ObISQLClient& proxy)
int ObPGBackupBackupsetOperator::batch_update_result_and_status(const share::SimpleBackupBackupsetTenant &tenant,
const common::ObIArray<share::ObBackupBackupsetArg> &args, const common::ObIArray<int32_t> &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<ObPGBackupBackupsetTaskItem>& 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<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& 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<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& item_list,
common::ObISQLClient& proxy)
int ObPGBackupBackupsetOperator::get_task_items(const share::SimpleBackupBackupsetTenant &tenant,
const common::ObSqlString &sql, common::ObIArray<ObPGBackupBackupsetTaskItem> &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<ObPGBackupBackupsetTaskItem>& tasks,
common::ObISQLClient& proxy)
int ObPGBackupBackupsetOperator::get_same_trace_id_tasks(const share::SimpleBackupBackupsetTenant &tenant,
const ObPGBackupBackupsetTaskItem &task, common::ObIArray<ObPGBackupBackupsetTaskItem> &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<share::ObPGBackupBackupsetTaskRowKey>& row_key_list, common::ObISQLClient& proxy)
int ObPGBackupBackupsetOperator::get_batch_end_key_for_remove(const share::SimpleBackupBackupsetTenant &tenant,
common::ObIArray<share::ObPGBackupBackupsetTaskRowKey> &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<share::ObPGBackupBackupsetTaskRowKey> 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));
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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 &params) : 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<int32_t>(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<int32_t>(value_node.str_len_), 6))) {
0 == strncasecmp(value_node.str_value_, "oracle", std::min(static_cast<int32_t>(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<int32_t>(set_node.children_[0]->str_len_));
charset.assign_ptr(set_node.children_[0]->str_value_, static_cast<int32_t>(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<int32_t>(set_node.children_[0]->str_len_));
names_node.charset_.assign_ptr(
set_node.children_[0]->str_value_, static_cast<int32_t>(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 &params) : 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));
}
}

View File

@ -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 &params);
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 &params);
virtual ~ObAlterSessionSetResolver();
virtual int resolve(const ParseNode& parse_tree);
virtual int resolve(const ParseNode &parse_tree);
private:
DISALLOW_COPY_AND_ASSIGN(ObAlterSessionSetResolver);

File diff suppressed because it is too large Load Diff

View File

@ -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<int32_t>& projector)
const sql::ObExprPtrIArray &exprs, sql::ObEvalCtx &eval_ctx, const common::ObIArray<int32_t> &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<ObColumnParam*>& rowkey_columns =
const common::ObIArray<ObColumnParam *> &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();