diff --git a/src/gausskernel/ddes/adapter/ss_transaction.cpp b/src/gausskernel/ddes/adapter/ss_transaction.cpp index 329a2ad9f..62a763a6e 100644 --- a/src/gausskernel/ddes/adapter/ss_transaction.cpp +++ b/src/gausskernel/ddes/adapter/ss_transaction.cpp @@ -1033,6 +1033,8 @@ bool SSCanFetchLocalSnapshotTxnRelatedInfo() bool snap_available = xmin_info->snapshot_available; SpinLockRelease(&xmin_info->snapshot_available_lock); return snap_available; + } else if (SS_STANDBY_FAILOVER && t_thrd.role == STARTUP) { + return true; } return false; diff --git a/src/gausskernel/storage/access/transam/twophase.cpp b/src/gausskernel/storage/access/transam/twophase.cpp index 8f2b68aea..51b090f9d 100644 --- a/src/gausskernel/storage/access/transam/twophase.cpp +++ b/src/gausskernel/storage/access/transam/twophase.cpp @@ -127,6 +127,7 @@ #endif #include "instruments/instr_statement.h" #include "storage/file/fio_device.h" +#include "ddes/dms/ss_reform_common.h" /* * Directory where Two-phase commit files reside within PGDATA @@ -2182,7 +2183,12 @@ static void XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len) char *errormsg = NULL; errno_t rc = 0; - xlogreader = XLogReaderAllocate(&read_local_xlog_page, NULL); + if (ENABLE_DMS) { + xlogreader = SSXLogReaderAllocate(&read_local_xlog_page, NULL, ALIGNOF_BUFFER); + } else { + xlogreader = XLogReaderAllocate(&read_local_xlog_page, NULL); + } + if (xlogreader == NULL) { ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"), errdetail("Failed while allocating an XLog reading processor."))); diff --git a/src/gausskernel/storage/access/transam/xlogutils.cpp b/src/gausskernel/storage/access/transam/xlogutils.cpp index c21bf94c0..df5f929fc 100644 --- a/src/gausskernel/storage/access/transam/xlogutils.cpp +++ b/src/gausskernel/storage/access/transam/xlogutils.cpp @@ -1644,10 +1644,18 @@ static void XLogRead(char *buf, TimeLineID tli, XLogRecPtr startptr, Size count) XLByteToSeg(recptr, t_thrd.xlog_cxt.sendSegNo); - errorno = snprintf_s(path, MAXPGPATH, MAXPGPATH - 1, "%s/%08X%08X%08X", SS_XLOGDIR, tli, - (uint32)((t_thrd.xlog_cxt.sendSegNo) / XLogSegmentsPerXLogId), - (uint32)((t_thrd.xlog_cxt.sendSegNo) % XLogSegmentsPerXLogId)); - securec_check_ss(errorno, "", ""); + /* in shard storage mode, read xlog from recovery_xlog_dir during recovery */ + if (SS_STANDBY_FAILOVER) { + errorno = snprintf_s(path, MAXPGPATH, MAXPGPATH - 1, "%s/%08X%08X%08X", g_instance.dms_cxt.SSRecoveryInfo.recovery_xlog_dir, tli, + (uint32)((t_thrd.xlog_cxt.sendSegNo) / XLogSegmentsPerXLogId), + (uint32)((t_thrd.xlog_cxt.sendSegNo) % XLogSegmentsPerXLogId)); + securec_check_ss(errorno, "", ""); + } else { + errorno = snprintf_s(path, MAXPGPATH, MAXPGPATH - 1, "%s/%08X%08X%08X", SS_XLOGDIR, tli, + (uint32)((t_thrd.xlog_cxt.sendSegNo) / XLogSegmentsPerXLogId), + (uint32)((t_thrd.xlog_cxt.sendSegNo) % XLogSegmentsPerXLogId)); + securec_check_ss(errorno, "", ""); + } t_thrd.xlog_cxt.sendFile = BasicOpenFile(path, O_RDONLY | PG_BINARY, 0);