[共享存储]fix bug xlog not recycling
This commit is contained in:
@ -5030,7 +5030,7 @@ static void assign_replconninfo1(const char* newval, void* extra)
|
||||
/* perceive single --> primary_standby */
|
||||
if (t_thrd.postmaster_cxt.HaShmData != NULL &&
|
||||
t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE &&
|
||||
!GetReplCurArrayIsNull()) {
|
||||
!GetReplCurArrayIsNull() && !g_instance.attr.attr_storage.dms_attr.enable_dms) {
|
||||
t_thrd.postmaster_cxt.HaShmData->current_mode = PRIMARY_MODE;
|
||||
NotifyGscHotStandby();
|
||||
}
|
||||
|
||||
@ -78,12 +78,22 @@ static int SSXLogFileReadAnyTLI(XLogSegNo segno, int emode, uint32 sources, char
|
||||
|
||||
return fd;
|
||||
}
|
||||
if (FILE_POSSIBLY_DELETED(errno)) { /* unexpected failure? */
|
||||
if (!FILE_POSSIBLY_DELETED(errno)) {
|
||||
ereport(PANIC, (errcode_for_file_access(), errmsg("could not open file \"%s\" (log segment %s): %m", path,
|
||||
XLogFileNameP(t_thrd.xlog_cxt.ThisTimeLineID, segno))));
|
||||
}
|
||||
}
|
||||
|
||||
/* Couldn't find it. For simplicity, complain about front timeline */
|
||||
errorno = snprintf_s(path, MAXPGPATH, MAXPGPATH - 1, "%s/%08X%08X%08X", SS_XLOGDIR,
|
||||
t_thrd.xlog_cxt.recoveryTargetTLI, (uint32)((segno) / XLogSegmentsPerXLogId),
|
||||
(uint32)((segno) % XLogSegmentsPerXLogId));
|
||||
securec_check_ss(errorno, "", "");
|
||||
|
||||
errno = ENOENT;
|
||||
ereport(emode, (errcode_for_file_access(), errmsg("could not open file \"%s\" (log segment %s): %m", path,
|
||||
XLogFileNameP(t_thrd.xlog_cxt.ThisTimeLineID, segno))));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -13290,8 +13290,11 @@ static void KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo, XLogRecPtr curIns
|
||||
* If false, just keep log; otherwise, keep log only if walSize less than config.
|
||||
* 3.When standby is not alive in dummy standby mode, just keep log.
|
||||
* 4.Notice the users if slot is invalid
|
||||
*
|
||||
* while dms and dss enable, t_thrd.xlog_cxt.server_mode only is normal_mode, we do additional
|
||||
* check for dms and dss enabling.
|
||||
*/
|
||||
if (t_thrd.xlog_cxt.server_mode == PRIMARY_MODE) {
|
||||
if (!ENABLE_DMS && t_thrd.xlog_cxt.server_mode == PRIMARY_MODE) {
|
||||
if (WalSndInProgress(SNDROLE_PRIMARY_BUILDSTANDBY) ||
|
||||
pg_atomic_read_u32(&g_instance.comm_cxt.current_gsrewind_count) > 0) {
|
||||
/* segno = 1 show all file should be keep */
|
||||
|
||||
Reference in New Issue
Block a user