fix clog return code retry
This commit is contained in:
committed by
wangzelin.wzl
parent
3772f41232
commit
f72d873722
@ -771,3 +771,11 @@ int ObDDLUtil::ddl_get_tablet(
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObDDLUtil::need_remote_write(const int ret_code)
|
||||||
|
{
|
||||||
|
return OB_NOT_MASTER == ret_code
|
||||||
|
|| OB_NOT_RUNNING == ret_code
|
||||||
|
|| OB_LS_LOCATION_LEADER_NOT_EXIST == ret_code
|
||||||
|
|| OB_EAGAIN == ret_code;
|
||||||
|
}
|
||||||
|
|||||||
@ -274,6 +274,7 @@ public:
|
|||||||
return OB_TRY_LOCK_ROW_CONFLICT == ret || OB_NOT_MASTER == ret || OB_TIMEOUT == ret
|
return OB_TRY_LOCK_ROW_CONFLICT == ret || OB_NOT_MASTER == ret || OB_TIMEOUT == ret
|
||||||
|| OB_EAGAIN == ret || OB_LS_LOCATION_LEADER_NOT_EXIST == ret;
|
|| OB_EAGAIN == ret || OB_LS_LOCATION_LEADER_NOT_EXIST == ret;
|
||||||
}
|
}
|
||||||
|
static bool need_remote_write(const int ret_code);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int generate_column_name_str(
|
static int generate_column_name_str(
|
||||||
|
|||||||
@ -656,6 +656,10 @@ int ObDDLRedoLogWriter::write_ddl_start_log(ObDDLKvMgrHandle &ddl_kv_mgr_handle,
|
|||||||
lsn,
|
lsn,
|
||||||
log_ts))) {
|
log_ts))) {
|
||||||
LOG_WARN("fail to submit ddl start log", K(ret), K(buffer_size));
|
LOG_WARN("fail to submit ddl start log", K(ret), K(buffer_size));
|
||||||
|
if (ObDDLUtil::need_remote_write(ret)) {
|
||||||
|
ret = OB_NOT_MASTER;
|
||||||
|
LOG_INFO("overwrite return to OB_NOT_MASTER");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ObDDLClogCb *tmp_cb = cb;
|
ObDDLClogCb *tmp_cb = cb;
|
||||||
cb = nullptr;
|
cb = nullptr;
|
||||||
@ -996,7 +1000,7 @@ int ObDDLSSTableRedoWriter::write_redo_log(const ObDDLMacroBlockRedoInfo &redo_i
|
|||||||
LOG_WARN("allocate memory failed", K(ret), K(BUF_SIZE));
|
LOG_WARN("allocate memory failed", K(ret), K(BUF_SIZE));
|
||||||
} else if (!remote_write_) {
|
} else if (!remote_write_) {
|
||||||
if (OB_FAIL(ObDDLMacroBlockRedoWriter::write_macro_redo(redo_info, ls->get_ls_id(), ls->get_log_handler(), macro_block_id, buffer_, ddl_redo_handle_))) {
|
if (OB_FAIL(ObDDLMacroBlockRedoWriter::write_macro_redo(redo_info, ls->get_ls_id(), ls->get_log_handler(), macro_block_id, buffer_, ddl_redo_handle_))) {
|
||||||
if (need_remote_write(ret)) {
|
if (ObDDLUtil::need_remote_write(ret)) {
|
||||||
if (OB_FAIL(switch_to_remote_write())) {
|
if (OB_FAIL(switch_to_remote_write())) {
|
||||||
LOG_WARN("fail to switch to remote write", K(ret));
|
LOG_WARN("fail to switch to remote write", K(ret));
|
||||||
}
|
}
|
||||||
@ -1073,7 +1077,7 @@ int ObDDLSSTableRedoWriter::write_prepare_log(const ObITable::TableKey &table_ke
|
|||||||
LOG_ERROR("ls should not be null", K(ret), K(table_key));
|
LOG_ERROR("ls should not be null", K(ret), K(table_key));
|
||||||
} else if (!remote_write_) {
|
} else if (!remote_write_) {
|
||||||
if (OB_FAIL(ObDDLRedoLogWriter::get_instance().write_ddl_finish_log(log, ObDDLClogType::DDL_PREPARE_LOG, ls->get_log_handler(), handle))) {
|
if (OB_FAIL(ObDDLRedoLogWriter::get_instance().write_ddl_finish_log(log, ObDDLClogType::DDL_PREPARE_LOG, ls->get_log_handler(), handle))) {
|
||||||
if (need_remote_write(ret)) {
|
if (ObDDLUtil::need_remote_write(ret)) {
|
||||||
if (OB_FAIL(switch_to_remote_write())) {
|
if (OB_FAIL(switch_to_remote_write())) {
|
||||||
LOG_WARN("fail to switch to remote write", K(ret), K(table_key));
|
LOG_WARN("fail to switch to remote write", K(ret), K(table_key));
|
||||||
}
|
}
|
||||||
@ -1127,7 +1131,7 @@ int ObDDLSSTableRedoWriter::write_commit_log(const ObITable::TableKey &table_key
|
|||||||
LOG_ERROR("ls should not be null", K(ret), K(table_key));
|
LOG_ERROR("ls should not be null", K(ret), K(table_key));
|
||||||
} else if (!remote_write_) {
|
} else if (!remote_write_) {
|
||||||
if (OB_FAIL(ObDDLRedoLogWriter::get_instance().write_ddl_finish_log(log, ObDDLClogType::DDL_COMMIT_LOG, ls->get_log_handler(), handle))) {
|
if (OB_FAIL(ObDDLRedoLogWriter::get_instance().write_ddl_finish_log(log, ObDDLClogType::DDL_COMMIT_LOG, ls->get_log_handler(), handle))) {
|
||||||
if (need_remote_write(ret)) {
|
if (ObDDLUtil::need_remote_write(ret)) {
|
||||||
if (OB_FAIL(switch_to_remote_write())) {
|
if (OB_FAIL(switch_to_remote_write())) {
|
||||||
LOG_WARN("fail to switch to remote write", K(ret), K(table_key));
|
LOG_WARN("fail to switch to remote write", K(ret), K(table_key));
|
||||||
}
|
}
|
||||||
@ -1154,13 +1158,6 @@ int ObDDLSSTableRedoWriter::write_commit_log(const ObITable::TableKey &table_key
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObDDLSSTableRedoWriter::need_remote_write(int ret_code)
|
|
||||||
{
|
|
||||||
return OB_NOT_MASTER == ret_code
|
|
||||||
|| OB_NOT_RUNNING == ret_code
|
|
||||||
|| OB_LS_LOCATION_LEADER_NOT_EXIST == ret_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObDDLSSTableRedoWriter::switch_to_remote_write()
|
int ObDDLSSTableRedoWriter::switch_to_remote_write()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
|||||||
@ -259,7 +259,6 @@ public:
|
|||||||
OB_INLINE void set_start_log_ts(const int64_t start_log_ts) { ATOMIC_SET(&start_log_ts_, start_log_ts); }
|
OB_INLINE void set_start_log_ts(const int64_t start_log_ts) { ATOMIC_SET(&start_log_ts_, start_log_ts); }
|
||||||
OB_INLINE int64_t get_start_log_ts() const { return ATOMIC_LOAD(&start_log_ts_); }
|
OB_INLINE int64_t get_start_log_ts() const { return ATOMIC_LOAD(&start_log_ts_); }
|
||||||
private:
|
private:
|
||||||
bool need_remote_write(int ret_code);
|
|
||||||
int switch_to_remote_write();
|
int switch_to_remote_write();
|
||||||
private:
|
private:
|
||||||
bool is_inited_;
|
bool is_inited_;
|
||||||
|
|||||||
Reference in New Issue
Block a user