Distinguish XLOG_FPI records generated for hint-bit updates.
Add a new XLOG_FPI_FOR_HINT record type, and use that for full-page images generated for hint bit updates, when checksums are enabled. The new record type is replayed exactly the same as XLOG_FPI, but allows them to be tallied separately e.g. in pg_xlogdump.
This commit is contained in:
parent
e2dc3f5772
commit
0bd624d63b
@ -74,7 +74,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
|
|||||||
|
|
||||||
appendStringInfo(buf, "%s", xlrec->rp_name);
|
appendStringInfo(buf, "%s", xlrec->rp_name);
|
||||||
}
|
}
|
||||||
else if (info == XLOG_FPI)
|
else if (info == XLOG_FPI || info == XLOG_FPI_FOR_HINT)
|
||||||
{
|
{
|
||||||
/* no further information to print */
|
/* no further information to print */
|
||||||
}
|
}
|
||||||
@ -170,6 +170,9 @@ xlog_identify(uint8 info)
|
|||||||
case XLOG_FPI:
|
case XLOG_FPI:
|
||||||
id = "FPI";
|
id = "FPI";
|
||||||
break;
|
break;
|
||||||
|
case XLOG_FPI_FOR_HINT:
|
||||||
|
id = "FPI_FOR_HINT";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
@ -8545,7 +8545,8 @@ xlog_redo(XLogReaderState *record)
|
|||||||
XLogRecPtr lsn = record->EndRecPtr;
|
XLogRecPtr lsn = record->EndRecPtr;
|
||||||
|
|
||||||
/* in XLOG rmgr, backup blocks are only used by XLOG_FPI records */
|
/* in XLOG rmgr, backup blocks are only used by XLOG_FPI records */
|
||||||
Assert(!XLogRecHasAnyBlockRefs(record) || info == XLOG_FPI);
|
Assert(info == XLOG_FPI || info == XLOG_FPI_FOR_HINT ||
|
||||||
|
!XLogRecHasAnyBlockRefs(record));
|
||||||
|
|
||||||
if (info == XLOG_NEXTOID)
|
if (info == XLOG_NEXTOID)
|
||||||
{
|
{
|
||||||
@ -8730,7 +8731,7 @@ xlog_redo(XLogReaderState *record)
|
|||||||
{
|
{
|
||||||
/* nothing to do here */
|
/* nothing to do here */
|
||||||
}
|
}
|
||||||
else if (info == XLOG_FPI)
|
else if (info == XLOG_FPI || info == XLOG_FPI_FOR_HINT)
|
||||||
{
|
{
|
||||||
Buffer buffer;
|
Buffer buffer;
|
||||||
|
|
||||||
@ -8739,12 +8740,15 @@ xlog_redo(XLogReaderState *record)
|
|||||||
* block. The block reference must include a full-page image -
|
* block. The block reference must include a full-page image -
|
||||||
* otherwise there would be no point in this record.
|
* otherwise there would be no point in this record.
|
||||||
*
|
*
|
||||||
* Since the only change in these backup block are hint bits, there
|
* No recovery conflicts are generated by these generic records - if a
|
||||||
* are no recovery conflicts generated.
|
* resource manager needs to generate conflicts, it has to define a
|
||||||
|
* separate WAL record type and redo routine.
|
||||||
*
|
*
|
||||||
* This also means there is no corresponding API call for this, so an
|
* XLOG_FPI_FOR_HINT records are generated when a page needs to be
|
||||||
* smgr implementation has no need to implement anything. Which means
|
* WAL- logged because of a hint bit update. They are only generated
|
||||||
* nothing is needed in md.c etc
|
* when checksums are enabled. There is no difference in handling
|
||||||
|
* XLOG_FPI and XLOG_FPI_FOR_HINT records, they use a different info
|
||||||
|
* code just to distinguish them for statistics purposes.
|
||||||
*/
|
*/
|
||||||
if (XLogReadBufferForRedo(record, 0, &buffer) != BLK_RESTORED)
|
if (XLogReadBufferForRedo(record, 0, &buffer) != BLK_RESTORED)
|
||||||
elog(ERROR, "unexpected XLogReadBufferForRedo result when restoring backup block");
|
elog(ERROR, "unexpected XLogReadBufferForRedo result when restoring backup block");
|
||||||
|
@ -786,7 +786,7 @@ XLogSaveBufferForHint(Buffer buffer, bool buffer_std)
|
|||||||
BufferGetTag(buffer, &rnode, &forkno, &blkno);
|
BufferGetTag(buffer, &rnode, &forkno, &blkno);
|
||||||
XLogRegisterBlock(0, &rnode, forkno, blkno, copied_buffer, flags);
|
XLogRegisterBlock(0, &rnode, forkno, blkno, copied_buffer, flags);
|
||||||
|
|
||||||
recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI);
|
recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI_FOR_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return recptr;
|
return recptr;
|
||||||
|
@ -170,6 +170,7 @@ DecodeXLogOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
|
|||||||
case XLOG_PARAMETER_CHANGE:
|
case XLOG_PARAMETER_CHANGE:
|
||||||
case XLOG_RESTORE_POINT:
|
case XLOG_RESTORE_POINT:
|
||||||
case XLOG_FPW_CHANGE:
|
case XLOG_FPW_CHANGE:
|
||||||
|
case XLOG_FPI_FOR_HINT:
|
||||||
case XLOG_FPI:
|
case XLOG_FPI:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -67,7 +67,8 @@ typedef struct CheckPoint
|
|||||||
#define XLOG_RESTORE_POINT 0x70
|
#define XLOG_RESTORE_POINT 0x70
|
||||||
#define XLOG_FPW_CHANGE 0x80
|
#define XLOG_FPW_CHANGE 0x80
|
||||||
#define XLOG_END_OF_RECOVERY 0x90
|
#define XLOG_END_OF_RECOVERY 0x90
|
||||||
#define XLOG_FPI 0xA0
|
#define XLOG_FPI_FOR_HINT 0xA0
|
||||||
|
#define XLOG_FPI 0xB0
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user