提交 6343ac5c 编写于 作者: S simonjoylet 提交者: wangzelin.wzl

ddl kv mgr online

上级 5048204f
......@@ -253,9 +253,9 @@ int ObExprToOutfileRow::print_field(char *buf, const int64_t buf_len, int64_t &p
if (wchar == '\0') {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(print_wchar_to_buf(buf, buf_len, pos, '0', out_info.print_params_.cs_type_));
} else if (wchar == out_info.wchar_enclose_ || wchar == out_info.wchar_escape_) {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(copy_string_to_buf(buf, buf_len, pos, code_point));
} else if (wchar == out_info.wchar_enclose_ || wchar == out_info.wchar_escape_) {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(copy_string_to_buf(buf, buf_len, pos, code_point));
} else if (!need_enclose && (wchar == out_info.wchar_field_ ||
wchar == out_info.wchar_line_)) {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
......
......@@ -58,7 +58,6 @@ int ObDDLRedoLogReplayer::replay_start(const ObDDLStartLog &log, const int64_t l
ObITable::TableKey table_key = log.get_table_key();
ObDDLKvMgrHandle ddl_kv_mgr_handle;
bool need_replay = true;
LOG_INFO("start to replay ddl start log", K(log));
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("ObDDLRedoLogReplayer has not been inited", K(ret));
......@@ -81,6 +80,7 @@ int ObDDLRedoLogReplayer::replay_start(const ObDDLStartLog &log, const int64_t l
} else {
LOG_INFO("succeed to replay ddl start log", K(ret), K(log));
}
LOG_INFO("finish replay ddl start log", K(ret), K(need_replay), K(log));
return ret;
}
......@@ -94,7 +94,6 @@ int ObDDLRedoLogReplayer::replay_redo(const ObDDLRedoLog &log, const int64_t log
ObDDLKV *ddl_kv = nullptr;
DEBUG_SYNC(BEFORE_REPLAY_DDL_MACRO_BLOCK);
LOG_INFO("start to replay ddl redo log", K(log));
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
......@@ -144,6 +143,7 @@ int ObDDLRedoLogReplayer::replay_redo(const ObDDLRedoLog &log, const int64_t log
}
}
}
LOG_INFO("finish replay ddl redo log", K(ret), K(need_replay), K(log));
return ret;
}
......@@ -158,7 +158,6 @@ int ObDDLRedoLogReplayer::replay_prepare(const ObDDLPrepareLog &log, const int64
bool need_replay = true;
DEBUG_SYNC(BEFORE_REPLAY_DDL_PREPRARE);
LOG_INFO("start to replay ddl prepare log", K(log));
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
......@@ -182,6 +181,7 @@ int ObDDLRedoLogReplayer::replay_prepare(const ObDDLPrepareLog &log, const int64
} else {
LOG_INFO("replay ddl prepare log success", K(ret), K(table_key), K(log_ts));
}
LOG_INFO("finish replay ddl prepare log", K(ret), K(need_replay), K(log));
return ret;
}
......@@ -196,7 +196,6 @@ int ObDDLRedoLogReplayer::replay_commit(const ObDDLCommitLog &log, const int64_t
bool need_replay = true;
DEBUG_SYNC(BEFORE_REPLAY_DDL_COMMIT);
LOG_INFO("start to replay ddl commit log", K(log));
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
......@@ -223,6 +222,7 @@ int ObDDLRedoLogReplayer::replay_commit(const ObDDLCommitLog &log, const int64_t
} else {
tablet_handle.get_obj()->remove_ddl_kv_mgr();
}
LOG_INFO("finish replay ddl commit log", K(ret), K(need_replay), K(log));
return ret;
}
......
......@@ -309,6 +309,38 @@ int ObTabletDDLKvMgr::cleanup()
return ret;
}
int ObTabletDDLKvMgr::online()
{
int ret = OB_SUCCESS;
ObLSHandle ls_handle;
ObTabletHandle tablet_handle;
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_FAIL(MTL(ObLSService *)->get_ls(ls_id_, ls_handle, ObLSGetMod::DDL_MOD))) {
LOG_WARN("failed to get log stream", K(ret), K(ls_id_));
} else if (OB_FAIL(ls_handle.get_ls()->get_tablet(tablet_id_,
tablet_handle,
ObTabletCommon::NO_CHECK_GET_TABLET_TIMEOUT_US))) {
LOG_WARN("get tablet handle failed", K(ret), K(ls_id_), K(tablet_id_));
} else {
const ObTabletMeta &tablet_meta = tablet_handle.get_obj()->get_tablet_meta();
ObITable::TableKey table_key;
table_key.table_type_ = ObITable::TableType::MAJOR_SSTABLE;
table_key.tablet_id_ = tablet_meta.tablet_id_;
table_key.version_range_.base_version_ = 0;
table_key.version_range_.snapshot_version_ = tablet_meta.ddl_snapshot_version_;
const int64_t start_log_ts = tablet_meta.ddl_start_log_ts_;
if (OB_FAIL(ddl_start(table_key,
start_log_ts,
GET_MIN_CLUSTER_VERSION(),
tablet_meta.ddl_checkpoint_ts_))) {
LOG_WARN("start ddl kv manager failed", K(ret), K(tablet_meta));
}
}
return ret;
}
int ObTabletDDLKvMgr::update_tablet(const int64_t start_log_ts, const int64_t snapshot_version, const int64_t ddl_checkpoint_ts)
{
int ret = OB_SUCCESS;
......
......@@ -54,6 +54,7 @@ public:
bool is_commit_success() const { return is_commit_success_; }
common::ObTabletID get_tablet_id() const { return tablet_id_; }
int cleanup();
int online();
OB_INLINE void inc_ref() { ATOMIC_INC(&ref_cnt_); }
OB_INLINE int64_t dec_ref() { return ATOMIC_SAF(&ref_cnt_, 1 /* just sub 1 */); }
OB_INLINE int64_t get_ref() const { return ATOMIC_LOAD(&ref_cnt_); }
......
......@@ -101,6 +101,29 @@ int ObLSDDLLogHandler::online()
ret = OB_NOT_INIT;
LOG_WARN("ddl log handler not init", K(ret));
} else {
ObLSTabletIterator tablet_iter(ObTabletCommon::NO_CHECK_GET_TABLET_TIMEOUT_US);
if (OB_FAIL(ls_->get_tablet_svr()->build_tablet_iter(tablet_iter))) {
LOG_WARN("failed to build ls tablet iter", K(ret), K(ls_));
} else {
while (OB_SUCC(ret)) {
ObDDLKvMgrHandle ddl_kv_mgr_handle;
if (OB_FAIL(tablet_iter.get_next_ddl_kv_mgr(ddl_kv_mgr_handle))) {
if (OB_ITER_END == ret) {
ret = OB_SUCCESS;
break;
} else {
LOG_WARN("failed to get ddl kv mgr", K(ret), K(ddl_kv_mgr_handle));
}
} else if (OB_UNLIKELY(!ddl_kv_mgr_handle.is_valid())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid tablet handle", K(ret), K(ddl_kv_mgr_handle));
} else if (OB_FAIL(ddl_kv_mgr_handle.get_obj()->online())) {
LOG_WARN("ddl kv mgr cleanup failed", K(ret), "ls_meta", ls_->get_ls_meta(), "tablet_id", ddl_kv_mgr_handle.get_obj()->get_tablet_id());
}
}
}
}
if (OB_SUCC(ret)) {
TCWLockGuard guard(online_lock_);
is_online_ = true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册