diff --git a/src/interface/dms_api.h b/src/interface/dms_api.h index 9119d0f50f888b28e8189ef1d5501b56be4ac00a..2db37b43cff617c7fb6f7e928adf2077f029a48a 100644 --- a/src/interface/dms_api.h +++ b/src/interface/dms_api.h @@ -36,7 +36,7 @@ extern "C" { #define DMS_LOCAL_MINOR_VER_WEIGHT 1000 #define DMS_LOCAL_MAJOR_VERSION 0 #define DMS_LOCAL_MINOR_VERSION 0 -#define DMS_LOCAL_VERSION 177 +#define DMS_LOCAL_VERSION 178 #define DMS_SUCCESS 0 #define DMS_ERROR (-1) @@ -1005,6 +1005,7 @@ typedef int (*dms_az_switchover_demote_approve)(void *db_handle); typedef int (*dms_az_switchover_demote_phase2)(void *db_handle); typedef int (*dms_az_switchover_promote_prepare)(void *db_handle); typedef int (*dms_az_switchover_promote_phase1)(void *db_handle); +typedef int (*dms_az_switchover_promote_switch_log)(void *db_handle); typedef int (*dms_az_switchover_promote_phase2)(void *db_handle); typedef int (*dms_az_promote_success)(void *db_handle); typedef void (*dms_dyn_log)(void *db_handle, long long dyn_log_time); @@ -1217,6 +1218,7 @@ typedef struct st_dms_callback { dms_az_switchover_demote_phase2 az_switchover_demote_phase2; dms_az_switchover_promote_prepare az_switchover_promote_prepare; dms_az_switchover_promote_phase1 az_switchover_promote_phase1; + dms_az_switchover_promote_switch_log az_switchover_promote_switch_log; dms_az_switchover_promote_phase2 az_switchover_promote_phase2; dms_az_promote_success az_promote_success; dms_az_failover_promote_phase1 az_failover_promote_phase1; diff --git a/src/rc/dms_reform.h b/src/rc/dms_reform.h index 59d7b92297844212b5b6d22913afa16440e462c6..758c698dcb16c0684f1ee87513638fda5c4d554f 100644 --- a/src/rc/dms_reform.h +++ b/src/rc/dms_reform.h @@ -190,8 +190,8 @@ typedef enum en_reform_step { DMS_REFORM_STEP_RELOAD_TXN, DMS_REFORM_STEP_SYNC_NODE_LFN, + DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_SWITCH_LOG, // for Gauss100, AZ SWITCHOVER standby to primary DMS_REFORM_STEP_AZ_PROMOTE_SUCCESS, - DMS_REFORM_STEP_COUNT } reform_step_t; diff --git a/src/rc/dms_reform_judge_switch.c b/src/rc/dms_reform_judge_switch.c index f68f7ba33f673f583f83191713e9a8673cda7ab8..45275df5fb0414f818bca4d6bceab6f77a282057 100644 --- a/src/rc/dms_reform_judge_switch.c +++ b/src/rc/dms_reform_judge_switch.c @@ -78,6 +78,8 @@ void dms_reform_judgement_az_promote_phase1(void) dms_reform_add_step(DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_PREPARE); dms_reform_add_step(DMS_REFORM_STEP_SYNC_WAIT); dms_reform_add_step(DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_PHASE1); + dms_reform_add_step(DMS_REFORM_STEP_SYNC_WAIT); + dms_reform_add_step(DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_SWITCH_LOG); share_info->promote_id = (uint8)g_dms.inst_id; } @@ -104,6 +106,8 @@ void dms_reform_judgement_az_failover_promote_phase1(void) } dms_reform_add_step(DMS_REFORM_STEP_SYNC_WAIT); dms_reform_add_step(DMS_REFORM_STEP_AZ_FAILOVER_PROMOTE_PHASE1); + dms_reform_add_step(DMS_REFORM_STEP_SYNC_WAIT); + dms_reform_add_step(DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_SWITCH_LOG); share_info->promote_id = (uint8)g_dms.inst_id; } diff --git a/src/rc/dms_reform_proc.c b/src/rc/dms_reform_proc.c index 083f9b44fdaa96b278172090745246550bd11793..f93c2d2d07c8a83d134a0c263c7966204b44073f 100644 --- a/src/rc/dms_reform_proc.c +++ b/src/rc/dms_reform_proc.c @@ -433,6 +433,22 @@ static int dms_reform_az_switchover_promote_phase1(void) return DMS_SUCCESS; } +static int dms_reform_az_switchover_promote_switch_log(void) +{ + int ret = DMS_SUCCESS; + + LOG_RUN_FUNC_ENTER; + ret = g_dms.callback.az_switchover_promote_switch_log(g_dms.reform_ctx.handle_normal); + if (ret != DMS_SUCCESS) { + LOG_RUN_FUNC_FAIL; + return ret; + } + + LOG_RUN_FUNC_SUCCESS; + dms_reform_next_step(); + return DMS_SUCCESS; +} + static int dms_reform_az_switchover_promote_phase2(void) { int ret = DMS_SUCCESS; @@ -2003,6 +2019,8 @@ dms_reform_proc_t g_dms_reform_procs[DMS_REFORM_STEP_COUNT] = { dms_reform_az_failover_promote_phase2, NULL, CM_FALSE }, [DMS_REFORM_STEP_RELOAD_TXN] = { "RELOAD_TXN", dms_reform_reload_txn, NULL, CM_FALSE }, [DMS_REFORM_STEP_SYNC_NODE_LFN] = { "SYNC_NODE_LFN", dms_reform_sync_node_lfn, NULL, CM_FALSE }, + [DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_SWITCH_LOG] = { "AZ_SWITCH_PROMOTE_SWITCH_LOG", + dms_reform_az_switchover_promote_switch_log, NULL, CM_FALSE }, }; static int dms_reform_proc_inner(void) diff --git a/src/rc/dms_reform_proc_stat.c b/src/rc/dms_reform_proc_stat.c index 6e7231724bbfce7c0eb145aec38a4d4358767d40..9bb1574347ace07484081fdf6fdd8231b588bd15 100644 --- a/src/rc/dms_reform_proc_stat.c +++ b/src/rc/dms_reform_proc_stat.c @@ -275,6 +275,7 @@ drps_desc_t g_drps_desc_t[] = { {DMS_REFORM_STEP_AZ_FAILOVER_PROMOTE_PHASE2, DRPS_LEVEL_TOP, "AZ_FAILOVER_PROMOTE_PHASE2"}, {DMS_REFORM_STEP_RELOAD_TXN, DRPS_LEVEL_TOP, "RELOAD_TXN"}, {DMS_REFORM_STEP_SYNC_NODE_LFN, DRPS_LEVEL_TOP, "SYNC_NODE_LFN"}, + {DMS_REFORM_STEP_AZ_SWITCH_PROMOTE_SWITCH_LOG, DRPS_LEVEL_TOP, "AZ_SWITCH_PROMOTE_SWITCH_LOG"}, };