diff --git a/src/gausskernel/ddes/adapter/ss_dms.cpp b/src/gausskernel/ddes/adapter/ss_dms.cpp index ee759b06d2cbd7d3302a90ccd4ed14c33657a817..b95ef62e5f537a8b3bf1f69f38acff4588d0df40 100644 --- a/src/gausskernel/ddes/adapter/ss_dms.cpp +++ b/src/gausskernel/ddes/adapter/ss_dms.cpp @@ -307,9 +307,9 @@ int dms_get_ssl_param(const char *param_name, char *param_value, unsigned int si return g_ss_dms_func.dms_get_ssl_param(param_name, param_value, size); } -int dms_recovery_page_need_skip(char pageid[DMS_PAGEID_SIZE], unsigned char *skip) +int dms_recovery_page_need_skip(char pageid[DMS_PAGEID_SIZE], unsigned char *skip, unsigned int alloc) { - return g_ss_dms_func.dms_recovery_page_need_skip(pageid, skip); + return g_ss_dms_func.dms_recovery_page_need_skip(pageid, skip, alloc); } int dms_reform_failed(void) diff --git a/src/gausskernel/ddes/adapter/ss_dms_bufmgr.cpp b/src/gausskernel/ddes/adapter/ss_dms_bufmgr.cpp index 7bea64e4218c883f1c4604c5b0b8df8e1ac542ab..97656b595384758ceada5becc41274ae5925a468 100644 --- a/src/gausskernel/ddes/adapter/ss_dms_bufmgr.cpp +++ b/src/gausskernel/ddes/adapter/ss_dms_bufmgr.cpp @@ -724,7 +724,7 @@ bool CheckPageNeedSkipInRecovery(Buffer buf) char pageid[DMS_PAGEID_SIZE]; errno_t err = memcpy_s(pageid, DMS_PAGEID_SIZE, &(buf_desc->tag), sizeof(BufferTag)); securec_check(err, "\0", "\0"); - int ret = dms_recovery_page_need_skip(pageid, (unsigned char *)&skip); + int ret = dms_recovery_page_need_skip(pageid, (unsigned char *)&skip, false); if (ret != DMS_SUCCESS) { ereport(PANIC, (errmsg("DMS Internal error happened during recovery, errno %d", ret))); } diff --git a/src/gausskernel/ddes/ddes_commit_id b/src/gausskernel/ddes/ddes_commit_id index c14e6068b2fc517a614058d1db5dd711c5bfb923..811136323324188261eb365f1ef20ddb649e0aae 100644 --- a/src/gausskernel/ddes/ddes_commit_id +++ b/src/gausskernel/ddes/ddes_commit_id @@ -1,3 +1,3 @@ -dms_commit_id=85eaf1d9de8d7486fdfa7a154405701bf294f490 +dms_commit_id=d7095d9b169a766461b00aa4bc0e19b4fc8ea657 dss_commit_id=87adc9bafa80354bb138a6bf9f8ff63077f3aebf cbb_commit_id=7a7e77f3dec94b6b958bea12c97b92d21dfa0bb5 \ No newline at end of file diff --git a/src/include/ddes/dms/dms_api.h b/src/include/ddes/dms/dms_api.h index 8aa775b9b3148e48d93bba09c8bae3bdaefe51ec..03bd86b2df2dd512d038ef0eb498afd6300b7dd5 100644 --- a/src/include/ddes/dms/dms_api.h +++ b/src/include/ddes/dms/dms_api.h @@ -442,12 +442,6 @@ typedef struct st_dw_recovery_info { unsigned long long bitmap_new_join; // the new-join-inst bitmap in dw_recovery phase } dw_recovery_info_t; -typedef struct st_file_orglsn_recovery_info { - unsigned long long bitmap_old_join; // the old-join-inst bitmap in dw_recovery phase - unsigned long long bitmap_old_remove; // the old-remove-inst bitmap in dw_recovery phase - unsigned long long bitmap_new_join; // the new-join-inst bitmap in dw_recovery phase -} file_orglsn_recovery_info_t; - typedef struct st_inst_list { unsigned char inst_id_list[DMS_MAX_INSTANCES]; unsigned char inst_id_count; @@ -553,6 +547,39 @@ typedef enum en_dms_inst_behavior { DMS_INST_BEHAVIOR_IN_BACKUP, } dms_inst_behavior_t; +typedef struct st_stat_buf_info { + int instance_id; + unsigned char lock_mode; /* which lock held by instance of this buffer */ + unsigned long int mem_lsn; /* page lsn in memory */ + unsigned long int rec_lsn; /* recovery LSN */ + unsigned long int lsn_on_disk; /* page lsn in dick */ + unsigned long int dirty_queue_loc; /* actual location of dirty page queue */ + char aio_in_progress; /* indicate aio is in progress */ + char data[DMS_RESID_SIZE]; /* user defined resource(page) identifier */ +} stat_buf_info_t; +/* +* used by openGauss server to get DRC information +*/ +typedef struct st_stat_drc_info { + stat_buf_info_t buf_info[DMS_MAX_INSTANCES]; /* save buffer related information */ + dms_context_t dms_ctx; + unsigned char master_id; + unsigned long long copy_insts; /* bitmap for owners, for S mode, more than one owner may exist */ + unsigned char claimed_owner; /* owner */ + unsigned char lock_mode; /* current DRC lock mode */ + unsigned char last_edp; /* the newest edp instance id */ + unsigned char type; /* page or lock */ + unsigned char in_recovery; /* in recovery or not */ + unsigned char copy_promote; /* copy promote to owner, can not release, may need flush */ + unsigned short part_id; /* which partition id that current page belongs to */ + unsigned long long edp_map; /* indicate which instance has current page's EDP(Earlier Dirty Page) */ + unsigned long long lsn; /* the newest edp LSN of current page in the cluster */ + unsigned short len; /* the length of data below */ + unsigned char recovery_skip; /* DRC is accessed in recovery and skip because drc has owner */ + unsigned char recycling; + char data[DMS_RESID_SIZE]; /* user defined resource(page) identifier */ +} stat_drc_info_t; + typedef int(*dms_get_list_stable)(void *db_handle, unsigned long long *list_stable, unsigned char *reformer_id); typedef int(*dms_save_list_stable)(void *db_handle, unsigned long long list_stable, unsigned char reformer_id, unsigned long long list_in, unsigned int save_ctrl); @@ -569,7 +596,6 @@ typedef int(*dms_disk_lsn)(void *db_handle, char *pageid, unsigned long long *ls typedef int(*dms_recovery)(void *db_handle, void *recovery_list, int is_reformer); typedef int(*dms_dw_recovery)(void *db_handle, void *recovery_list, int is_reformer); typedef int(*dms_df_recovery)(void *db_handle); -typedef int(*dms_file_orglsn_recovery)(void *db_handle, void *recovery_list, int is_reformer); typedef int(*dms_opengauss_startup)(void *db_handle); typedef int(*dms_opengauss_recovery_standby)(void *db_handle, int inst_id); typedef int(*dms_opengauss_recovery_primary)(void *db_handle, int inst_id); @@ -711,6 +737,7 @@ typedef int (*dms_verify_page_checksum)(void *db_handle, dms_buf_ctrl_t *ctrl, u typedef int (*dms_update_node_oldest_xmin)(void *db_handle, unsigned char inst_id, unsigned long long oldest_xmin); typedef void (*dms_set_inst_behavior)(void *db_handle, dms_inst_behavior_t inst_behavior); typedef int (*dms_db_prepare)(void *db_handle); +typedef void (*dms_get_buf_info)(char* resid, stat_buf_info_t *buf_info); typedef struct st_dms_callback { // used in reform @@ -725,10 +752,9 @@ typedef struct st_dms_callback { dms_edp_lsn edp_lsn; dms_disk_lsn disk_lsn; dms_recovery recovery; + dms_recovery recovery_analyse; dms_dw_recovery dw_recovery; dms_df_recovery df_recovery; - dms_file_orglsn_recovery file_orglsn_recovery_part1; - dms_file_orglsn_recovery file_orglsn_recovery_part2; dms_db_is_primary db_is_primary; dms_get_open_status get_open_status; dms_undo_init undo_init; @@ -856,6 +882,8 @@ typedef struct st_dms_callback { //for shared storage backup dms_set_inst_behavior set_inst_behavior; dms_db_prepare db_prepare; + + dms_get_buf_info get_buf_info; } dms_callback_t; typedef struct st_dms_instance_net_addr { @@ -927,19 +955,19 @@ typedef enum en_dms_info_id { DMS_INFO_REFORM_LAST = 1, } dms_info_id_e; -typedef enum st_protocol_version { - PROTO_VER_0 = 0, // invalid version - PROTO_VER_1 = 1, // first version -} protocol_version_e; +typedef enum st_dms_protocol_version { + DMS_PROTO_VER_0 = 0, // invalid version + DMS_PROTO_VER_1 = 1, // first version +} dms_protocol_version_e; -#define INVALID_PROTO_VER PROTO_VER_0 -#define SW_PROTO_VER PROTO_VER_1 +#define DMS_INVALID_PROTO_VER DMS_PROTO_VER_0 +#define DMS_SW_PROTO_VER DMS_PROTO_VER_1 #define DMS_LOCAL_MAJOR_VER_WEIGHT 1000000 #define DMS_LOCAL_MINOR_VER_WEIGHT 1000 #define DMS_LOCAL_MAJOR_VERSION 0 #define DMS_LOCAL_MINOR_VERSION 0 -#define DMS_LOCAL_VERSION 89 +#define DMS_LOCAL_VERSION 92 #ifdef __cplusplus } diff --git a/src/include/ddes/dms/ss_dms.h b/src/include/ddes/dms/ss_dms.h index 1bf0d8fdabf02f72abb687a6ce78cce619250d7f..77ca5148ebb6071058da0ba6f684147c13f8d532 100644 --- a/src/include/ddes/dms/ss_dms.h +++ b/src/include/ddes/dms/ss_dms.h @@ -65,7 +65,7 @@ typedef struct st_ss_dms_func { int (*dms_register_ssl_decrypt_pwd)(dms_decrypt_pwd_t cb_func); int (*dms_set_ssl_param)(const char *param_name, const char *param_value); int (*dms_get_ssl_param)(const char *param_name, char *param_value, unsigned int size); - int (*dms_recovery_page_need_skip)(char pageid[DMS_PAGEID_SIZE], unsigned char *skip); + int (*dms_recovery_page_need_skip)(char pageid[DMS_PAGEID_SIZE], unsigned char *skip, unsigned int alloc); int (*dms_reform_failed)(void); int (*dms_switchover)(unsigned int sess_id); int (*dms_drc_accessible)(unsigned char res_type); @@ -117,7 +117,7 @@ int drc_get_page_master_id(char pageid[DMS_PAGEID_SIZE], unsigned char *master_i int dms_register_ssl_decrypt_pwd(dms_decrypt_pwd_t cb_func); int dms_set_ssl_param(const char *param_name, const char *param_value); int dms_get_ssl_param(const char *param_name, char *param_value, unsigned int size); -int dms_recovery_page_need_skip(char pageid[DMS_PAGEID_SIZE], unsigned char *skip); +int dms_recovery_page_need_skip(char pageid[DMS_PAGEID_SIZE], unsigned char *skip, unsigned int alloc); int dms_reform_failed(void); int dms_switchover(unsigned int sess_id); int dms_drc_accessible(unsigned char res_type);