diff --git a/src/gausskernel/ddes/adapter/ss_dms_callback.cpp b/src/gausskernel/ddes/adapter/ss_dms_callback.cpp index 1f2731dbb..95dfa1291 100644 --- a/src/gausskernel/ddes/adapter/ss_dms_callback.cpp +++ b/src/gausskernel/ddes/adapter/ss_dms_callback.cpp @@ -1560,6 +1560,24 @@ static int CBXLogWaitFlush(void *db_handle, unsigned long long lsn) return GS_SUCCESS; } +static int CBDBCheckLock(void *db_handle) +{ + if (t_thrd.storage_cxt.num_held_lwlocks > 0) { + ereport(PANIC, (errmsg("hold lock, lock address:%p, lock mode:%u", + t_thrd.storage_cxt.held_lwlocks[0].lock, t_thrd.storage_cxt.held_lwlocks[0].mode))); + return GS_ERROR; + } + return GS_SUCCESS; +} + +static int CBCacheMsg(void *db_handle, char* msg) +{ + errno_t rc = memcpy_s(t_thrd.dms_cxt.msg_backup, sizeof(t_thrd.dms_cxt.msg_backup), msg, + sizeof(t_thrd.dms_cxt.msg_backup)); + securec_check(rc, "\0", "\0"); + return GS_SUCCESS; +} + void DmsCallbackThreadShmemInit(unsigned char need_startup, char **reg_data) { IsUnderPostmaster = true; @@ -1670,4 +1688,6 @@ void DmsInitCallback(dms_callback_t *callback) callback->reform_done_notify = CBReformDoneNotify; callback->log_wait_flush = CBXLogWaitFlush; callback->drc_validate = CBDrcBufValidate; + callback->db_check_lock = CBDBCheckLock; + callback->cache_msg = CBCacheMsg; } diff --git a/src/gausskernel/ddes/ddes_commit_id b/src/gausskernel/ddes/ddes_commit_id index a5287c572..d54fb5061 100644 --- a/src/gausskernel/ddes/ddes_commit_id +++ b/src/gausskernel/ddes/ddes_commit_id @@ -1,2 +1,2 @@ -dms_commit_id=e3e57f04172da967232eb5ec593e5576ee1563a4 -dss_commit_id=2b1567f18e8d78c0473b781b97cae963a06d1735 +dms_commit_id=f93c331c3922c74b2b72cbb2f63245d9c525be14 +dss_commit_id=e4ac8ded9a66ef2ebf5c871f39796fe60ba592e5 diff --git a/src/gausskernel/process/threadpool/knl_thread.cpp b/src/gausskernel/process/threadpool/knl_thread.cpp index aba42822f..e01799295 100755 --- a/src/gausskernel/process/threadpool/knl_thread.cpp +++ b/src/gausskernel/process/threadpool/knl_thread.cpp @@ -1702,6 +1702,8 @@ static void knl_t_dms_context_init(knl_t_dms_context *dms_cxt) dms_cxt->offset = 0; dms_cxt->size = 0; dms_cxt->file_size = 0; + errno_t rc = memset_s(dms_cxt->msg_backup, sizeof(dms_cxt->msg_backup), 0, sizeof(dms_cxt->msg_backup)); + securec_check(rc, "\0", "\0"); } static void knl_t_rc_init(knl_t_rc_context* rc_cxt) { diff --git a/src/include/ddes/dms/dms_api.h b/src/include/ddes/dms/dms_api.h index 7ff26c803..8d41ad882 100644 --- a/src/include/ddes/dms/dms_api.h +++ b/src/include/ddes/dms/dms_api.h @@ -619,6 +619,8 @@ typedef int (*dms_log_wait_flush)(void *db_handle, unsigned long long lsn); typedef int (*dms_wait_ckpt)(void *db_handle); typedef void (*dms_verify_page)(dms_buf_ctrl_t *buf_ctrl, char *new_page); typedef int (*dms_drc_validate)(void *db_handle); +typedef int (*dms_db_check_lock)(void *db_handle); +typedef int (*dms_cache_msg)(void *db_handle, char* msg); typedef struct st_dms_callback { // used in reform @@ -742,6 +744,8 @@ typedef struct st_dms_callback { dms_wait_ckpt wait_ckpt; dms_drc_validate drc_validate; + dms_db_check_lock db_check_lock; + dms_cache_msg cache_msg; } dms_callback_t; typedef struct st_dms_instance_net_addr { @@ -811,7 +815,7 @@ typedef struct st_logger_param { #define DMS_LOCAL_MINOR_VER_WEIGHT 1000 #define DMS_LOCAL_MAJOR_VERSION 0 #define DMS_LOCAL_MINOR_VERSION 0 -#define DMS_LOCAL_VERSION 54 +#define DMS_LOCAL_VERSION 56 #ifdef __cplusplus } diff --git a/src/include/knl/knl_thread.h b/src/include/knl/knl_thread.h index a4005121e..3663c6c1c 100755 --- a/src/include/knl/knl_thread.h +++ b/src/include/knl/knl_thread.h @@ -3343,6 +3343,7 @@ typedef struct knl_t_dms_context { int size; /* aligned buffer size */ int offset; /* current read/write position in aligned_buf */ int file_size; /* initialized as pg_internal.init file size, will decrease after read */ + char msg_backup[24]; // 24 is sizeof mes_message_head_t } knl_t_dms_context; /* thread context. */