File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1159,6 +1159,21 @@ GetEpoch(Safekeeper *sk)
1159
1159
return GetHighestTerm (& sk -> voteResponse .termHistory );
1160
1160
}
1161
1161
1162
+ /* If LSN points to the page header, skip it */
1163
+ static XLogRecPtr
1164
+ SkipXLogPageHeader (XLogRecPtr lsn )
1165
+ {
1166
+ if (XLogSegmentOffset (lsn , wal_segment_size ) == 0 )
1167
+ {
1168
+ lsn += SizeOfXLogLongPHD ;
1169
+ }
1170
+ else if (lsn % XLOG_BLCKSZ == 0 )
1171
+ {
1172
+ lsn += SizeOfXLogShortPHD ;
1173
+ }
1174
+ return lsn ;
1175
+ }
1176
+
1162
1177
/*
1163
1178
* Called after majority of acceptors gave votes, it calculates the most
1164
1179
* advanced safekeeper (who will be the donor) and epochStartLsn -- LSN since
@@ -1260,7 +1275,13 @@ DetermineEpochStartLsn(void)
1260
1275
*/
1261
1276
if (!syncSafekeepers )
1262
1277
{
1263
- if (propEpochStartLsn != GetRedoStartLsn ())
1278
+ /*
1279
+ * Basebackup LSN always points to the beginning of the record (not the
1280
+ * page), as StartupXLOG most probably wants it this way. Safekeepers
1281
+ * don't skip header as they need continious stream of data, so
1282
+ * correct LSN for comparison.
1283
+ */
1284
+ if (SkipXLogPageHeader (propEpochStartLsn ) != GetRedoStartLsn ())
1264
1285
{
1265
1286
/*
1266
1287
* However, allow to proceed if previously elected leader was me; plain
You can’t perform that action at this time.
0 commit comments