Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Fix handling of SMGR create and truncate records and sequence create …
Browse files Browse the repository at this point in the history
…records
  • Loading branch information
ants committed Nov 21, 2017
1 parent 29fd391 commit f20f95c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/include/wbpgtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ typedef struct XLogRecord
#define XLOG_SWITCH 0x40
#define XLOG_FPI 0xA0

#define XLOG_SMGR_CREATE 0x10
#define XLOG_SMGR_TRUNCATE 0x20

#define XLOG_SEQ_LOG 0x00

#define REC_HEADER_LEN 24

#define XLR_MAX_BLOCK_ID 32
Expand Down
23 changes: 23 additions & 0 deletions src/wbfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,29 @@ WbFProcessWalDataBlock(ReplMessage* msg, FilterData* fl, XLogRecPtr *retryPos)
parse_debug(" - Xlog switch, copying %d bytes ", fl->dataNeeded);
break;
}
else if (rec->xl_rmid == RM_SMGR_ID && (rec->xl_info & 0xF0) == XLOG_SMGR_CREATE)
{
fl->state = FS_BUFFER_FILENODE;
fl->dataNeeded = sizeof(RelFileNode);
parse_debug(" - SMGR record, buffering %d bytes for filenode", fl->dataNeeded);
break;
}
else if (rec->xl_rmid == RM_SMGR_ID && (rec->xl_info & 0xF0) == XLOG_SMGR_TRUNCATE)
{
fl->state = FS_BUFFER_FILENODE;
// Here we rely on the fact that FS_BUFFER_FILENODE will ignore any extra data
fl->recordRemaining -= sizeof(BlockNumber);
fl->dataNeeded = sizeof(BlockNumber) + sizeof(RelFileNode);
parse_debug(" - SMGR record, buffering %d bytes for filenode", fl->dataNeeded);
break;
}
else if (rec->xl_rmid == RM_SEQ_ID && (rec->xl_info & 0xF0) == XLOG_SEQ_LOG)
{
fl->state = FS_BUFFER_FILENODE;
fl->dataNeeded = sizeof(RelFileNode);
parse_debug(" - SMGR record, buffering %d bytes for filenode", fl->dataNeeded);
break;
}
else if (fl->recordRemaining == 0)
{
fl->state = FS_COPY_NORMAL;
Expand Down

0 comments on commit f20f95c

Please sign in to comment.