【共享存储】add lock check mechanism
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
dms_commit_id=e3e57f04172da967232eb5ec593e5576ee1563a4
|
||||
dss_commit_id=2b1567f18e8d78c0473b781b97cae963a06d1735
|
||||
dms_commit_id=f93c331c3922c74b2b72cbb2f63245d9c525be14
|
||||
dss_commit_id=e4ac8ded9a66ef2ebf5c871f39796fe60ba592e5
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user