Documentation ¶
Index ¶
- Constants
- func NewInvalidPageHeaderError() error
- func NewNotEnoughDataToShrinkError(dataRemained int, toShrink int) error
- func NewZeroPageHeaderError() error
- type AlignedReader
- type BlockLocation
- type CantSavePartialParserError
- type ContinuationNotFoundError
- type InconsistentBlockDataStateError
- type InconsistentBlockImageHoleStateError
- type InconsistentBlockImageLengthError
- type InconsistentXLogRecordTotalLengthError
- type InvalidPageHeaderError
- type InvalidRecordBlockIdError
- type InvalidXLogRecordResourceManagerIDError
- type NoPrevRelFileNodeError
- type NotEnoughDataToShrinkError
- type Oid
- type OutOfOrderBlockIdError
- type PartialPageError
- type RelFileNode
- type ShrinkableReader
- type TimeLineID
- type WalPageReader
- type WalParser
- type XLogPage
- type XLogPageHeader
- type XLogRecord
- type XLogRecordBlock
- type XLogRecordBlockHeader
- type XLogRecordBlockImageHeader
- type XLogRecordHeader
- type XLogRecordPtr
- type ZeroPageError
- type ZeroPageHeaderError
- type ZeroRecordHeaderError
Constants ¶
const ( RmXlogID = iota RmXactID RmSmgrID RmClogID RmDBaseID RmTblSpcID RmMultiXactID RmRelMapID RmStandbyID RmHeap2ID RmHeapID RmBTreeID RmHashID RmGinID RmGistID RmSeqID RmSPGistID RmBrinID RmCommitTsID RmReplOriginID RmGenericID RmLogicalMsgID RmNextFreeID )
const ( WalPageSize uint16 = 8192 BlockSize uint16 = 8192 XLogRecordAlignment = 8 )
const ( /* When record crosses page boundary, set this flag in new page's header */ XlpFirstIsContRecord = 0x0001 /* This flag indicates a "long" page header */ XlpLongHeader = 0x0002 /* This flag indicates backup blocks starting in this page are optional */ XlpBkpRemovable = 0x0004 /* All defined flag bits in xlp_info (used for validity checking of header) */ XlpAllFlags = 0x0007 )
const ( XLogSwitch = 0x40 WalSwitchRecordSize = XLogRecordHeaderSize )
const ( XlrMaxBlockId = 32 XlrBlockIdDataShort = 255 XlrBlockIdDataLong = 254 XlrBlockIdOrigin = 253 BkpBlockForkMask uint8 = 0x0F BkpBlockFlagMask uint8 = 0xF0 BkpBlockHasImage uint8 = 0x10 BkpBlockHasData uint8 = 0x20 BkpBlockWillInit uint8 = 0x40 BkpBlockSameRel uint8 = 0x80 )
const ( BkpImageHasHole uint8 = 0x01 BkpImageIsCompressed uint8 = 0x02 BkpImageApply uint8 = 0x04 )
const ( XlrInfoMask = 0x0F XlrRmgrInfoMask = 0xF0 XlrSpecialRelUpdate = 0x01 XlrCheckConsistency = 0x02 XLogRecordHeaderSize = 24 )
Variables ¶
This section is empty.
Functions ¶
func NewInvalidPageHeaderError ¶
func NewInvalidPageHeaderError() error
func NewZeroPageHeaderError ¶
func NewZeroPageHeaderError() error
Types ¶
type AlignedReader ¶
type AlignedReader struct {
// contains filtered or unexported fields
}
func NewAlignedReader ¶
func NewAlignedReader(source io.Reader, alignment int) *AlignedReader
func (*AlignedReader) ReadToAlignment ¶
func (reader *AlignedReader) ReadToAlignment() error
type BlockLocation ¶
type BlockLocation struct { RelationFileNode RelFileNode BlockNo uint32 }
func NewBlockLocation ¶
func NewBlockLocation(spcNode, dbNode, relNode Oid, blockNo uint32) *BlockLocation
type CantSavePartialParserError ¶
type CantSavePartialParserError struct {
// contains filtered or unexported fields
}
func NewCantSavePartialParserError ¶
func NewCantSavePartialParserError() CantSavePartialParserError
func (CantSavePartialParserError) Error ¶
func (err CantSavePartialParserError) Error() string
type ContinuationNotFoundError ¶
type ContinuationNotFoundError struct {
// contains filtered or unexported fields
}
func NewContinuationNotFoundError ¶
func NewContinuationNotFoundError() ContinuationNotFoundError
type InconsistentBlockDataStateError ¶
type InconsistentBlockDataStateError struct {
// contains filtered or unexported fields
}
func NewInconsistentBlockDataStateError ¶
func NewInconsistentBlockDataStateError(hasData bool, dataLength uint16) InconsistentBlockDataStateError
func (InconsistentBlockDataStateError) Error ¶
func (err InconsistentBlockDataStateError) Error() string
type InconsistentBlockImageHoleStateError ¶
type InconsistentBlockImageHoleStateError struct {
// contains filtered or unexported fields
}
func NewInconsistentBlockImageHoleStateError ¶
func NewInconsistentBlockImageHoleStateError(holeOffset uint16, holeLength uint16, imageLength uint16, hasHole bool) InconsistentBlockImageHoleStateError
func (InconsistentBlockImageHoleStateError) Error ¶
func (err InconsistentBlockImageHoleStateError) Error() string
type InconsistentBlockImageLengthError ¶
type InconsistentBlockImageLengthError struct {
// contains filtered or unexported fields
}
func NewInconsistentBlockImageLengthError ¶
func NewInconsistentBlockImageLengthError(hasHole bool, isCompressed bool, length uint16) InconsistentBlockImageLengthError
func (InconsistentBlockImageLengthError) Error ¶
func (err InconsistentBlockImageLengthError) Error() string
type InconsistentXLogRecordTotalLengthError ¶
type InconsistentXLogRecordTotalLengthError struct {
// contains filtered or unexported fields
}
func NewInconsistentXLogRecordTotalLengthError ¶
func NewInconsistentXLogRecordTotalLengthError(totalRecordLength uint32) InconsistentXLogRecordTotalLengthError
func (InconsistentXLogRecordTotalLengthError) Error ¶
func (err InconsistentXLogRecordTotalLengthError) Error() string
type InvalidPageHeaderError ¶
type InvalidPageHeaderError struct {
// contains filtered or unexported fields
}
func (InvalidPageHeaderError) Error ¶
func (err InvalidPageHeaderError) Error() string
type InvalidRecordBlockIdError ¶
type InvalidRecordBlockIdError struct {
// contains filtered or unexported fields
}
func NewInvalidRecordBlockIdError ¶
func NewInvalidRecordBlockIdError(blockId uint8) InvalidRecordBlockIdError
func (InvalidRecordBlockIdError) Error ¶
func (err InvalidRecordBlockIdError) Error() string
type InvalidXLogRecordResourceManagerIDError ¶
type InvalidXLogRecordResourceManagerIDError struct {
// contains filtered or unexported fields
}
func NewInvalidXLogRecordResourceManagerIDError ¶
func NewInvalidXLogRecordResourceManagerIDError(resourceManagerID uint8) InvalidXLogRecordResourceManagerIDError
func (InvalidXLogRecordResourceManagerIDError) Error ¶
func (err InvalidXLogRecordResourceManagerIDError) Error() string
type NoPrevRelFileNodeError ¶
type NoPrevRelFileNodeError struct {
// contains filtered or unexported fields
}
func NewNoPrevRelFileNodeError ¶
func NewNoPrevRelFileNodeError() NoPrevRelFileNodeError
func (NoPrevRelFileNodeError) Error ¶
func (err NoPrevRelFileNodeError) Error() string
type NotEnoughDataToShrinkError ¶
type NotEnoughDataToShrinkError struct {
// contains filtered or unexported fields
}
func (NotEnoughDataToShrinkError) Error ¶
func (err NotEnoughDataToShrinkError) Error() string
type OutOfOrderBlockIdError ¶
type OutOfOrderBlockIdError struct {
// contains filtered or unexported fields
}
func NewOutOfOrderBlockIdError ¶
func NewOutOfOrderBlockIdError(actualBlockId int, expectedBlockId int) OutOfOrderBlockIdError
func (OutOfOrderBlockIdError) Error ¶
func (err OutOfOrderBlockIdError) Error() string
type PartialPageError ¶
type PartialPageError struct {
// contains filtered or unexported fields
}
func NewPartialPageError ¶
func NewPartialPageError() PartialPageError
func (PartialPageError) Error ¶
func (err PartialPageError) Error() string
type RelFileNode ¶
This struct corresponds to postgres struct RelFileNode. * For clarification you can find it in postgres: * src/include/storage/relfilenode.h
type ShrinkableReader ¶
type ShrinkableReader struct {
// contains filtered or unexported fields
}
func (*ShrinkableReader) Shrink ¶
func (reader *ShrinkableReader) Shrink(length int) error
type TimeLineID ¶
type TimeLineID uint32
type WalPageReader ¶
type WalPageReader struct {
// contains filtered or unexported fields
}
func NewWalPageReader ¶
func NewWalPageReader(walFileReader io.Reader) *WalPageReader
func (*WalPageReader) ReadPageData ¶
func (reader *WalPageReader) ReadPageData() ([]byte, error)
ReadPageData reads data corresponding to one page
type WalParser ¶
type WalParser struct {
// contains filtered or unexported fields
}
func NewWalParser ¶
func NewWalParser() *WalParser
func (*WalParser) GetCurrentRecordData ¶
func (*WalParser) Invalidate ¶
func (parser *WalParser) Invalidate()
func (*WalParser) ParseRecordsFromPage ¶
func (parser *WalParser) ParseRecordsFromPage(reader io.Reader) (prevRecordTail []byte, pageRecords []XLogRecord, err error)
For now we suppose that no wal record crosses whole wal page. If there is no currentRecordData (e. g. we look at the first record in the file), then we return prevRecordTail and discard it in parser.
type XLogPage ¶
type XLogPage struct { Header XLogPageHeader PrevRecordTrailingData []byte Records []XLogRecord NextRecordHeadingData []byte }
type XLogPageHeader ¶
type XLogPageHeader struct { Magic uint16 Info uint16 TimeLineID TimeLineID PageAddress XLogRecordPtr RemainingDataLen uint32 }
This struct corresponds to postgres struct XLogPageHeaderData. * For clarification you can find it in postgres: * src/include/access/xlog_internal.h
func (*XLogPageHeader) HasContinuationRecord ¶
func (pageHeader *XLogPageHeader) HasContinuationRecord() bool
func (*XLogPageHeader) IsLong ¶
func (pageHeader *XLogPageHeader) IsLong() bool
func (*XLogPageHeader) IsValid ¶
func (pageHeader *XLogPageHeader) IsValid() bool
type XLogRecord ¶
type XLogRecord struct { Header XLogRecordHeader MainDataLen uint32 Origin uint16 Blocks []XLogRecordBlock MainData []byte }
func NewXLogRecord ¶
func NewXLogRecord(header XLogRecordHeader) *XLogRecord
func ParseXLogRecordFromBytes ¶
func ParseXLogRecordFromBytes(data []byte) (*XLogRecord, error)
func (*XLogRecord) IsZero ¶
func (record *XLogRecord) IsZero() bool
type XLogRecordBlock ¶
type XLogRecordBlock struct { Header XLogRecordBlockHeader Image []byte Data []byte }
type XLogRecordBlockHeader ¶
type XLogRecordBlockHeader struct { BlockId uint8 ForkFlags uint8 DataLength uint16 ImageHeader XLogRecordBlockImageHeader BlockLocation BlockLocation }
func NewXLogRecordBlockHeader ¶
func NewXLogRecordBlockHeader(blockId uint8) *XLogRecordBlockHeader
func (*XLogRecordBlockHeader) ForkNum ¶
func (blockHeader *XLogRecordBlockHeader) ForkNum() uint8
func (*XLogRecordBlockHeader) HasData ¶
func (blockHeader *XLogRecordBlockHeader) HasData() bool
func (*XLogRecordBlockHeader) HasImage ¶
func (blockHeader *XLogRecordBlockHeader) HasImage() bool
func (*XLogRecordBlockHeader) HasSameRel ¶
func (blockHeader *XLogRecordBlockHeader) HasSameRel() bool
func (*XLogRecordBlockHeader) WillInit ¶
func (blockHeader *XLogRecordBlockHeader) WillInit() bool
type XLogRecordBlockImageHeader ¶
type XLogRecordBlockImageHeader struct { ImageLength uint16 HoleOffset uint16 HoleLength uint16 Info uint8 }
func (*XLogRecordBlockImageHeader) ApplyImage ¶
func (imageHeader *XLogRecordBlockImageHeader) ApplyImage() bool
func (*XLogRecordBlockImageHeader) HasHole ¶
func (imageHeader *XLogRecordBlockImageHeader) HasHole() bool
func (*XLogRecordBlockImageHeader) IsCompressed ¶
func (imageHeader *XLogRecordBlockImageHeader) IsCompressed() bool
type XLogRecordHeader ¶
type XLogRecordHeader struct { TotalRecordLength uint32 XactID uint32 PrevRecordPtr XLogRecordPtr Info uint8 ResourceManagerID uint8 /* 2 bytes of padding here, initialize to zero */ Crc32Hash uint32 }
This struct corresponds to postgres struct XLogRecord. * For clarification you can find it in postgres: * src/include/access/xlogrecord.h
type XLogRecordPtr ¶
type XLogRecordPtr uint64
type ZeroPageError ¶
type ZeroPageError struct {
// contains filtered or unexported fields
}
func NewZeroPageError ¶
func NewZeroPageError() ZeroPageError
func (ZeroPageError) Error ¶
func (err ZeroPageError) Error() string
type ZeroPageHeaderError ¶
type ZeroPageHeaderError struct {
// contains filtered or unexported fields
}
func (ZeroPageHeaderError) Error ¶
func (err ZeroPageHeaderError) Error() string
type ZeroRecordHeaderError ¶
type ZeroRecordHeaderError struct {
// contains filtered or unexported fields
}
func NewZeroRecordHeaderError ¶
func NewZeroRecordHeaderError() ZeroRecordHeaderError
func (ZeroRecordHeaderError) Error ¶
func (err ZeroRecordHeaderError) Error() string
Source Files ¶
- aligned_reader.go
- block_location.go
- parsing_errors.go
- read_xlog_page.go
- read_xlog_record.go
- rel_file_node.go
- resource_manager_list.go
- shrinkable_reader.go
- util.go
- wal_file_page_reader.go
- wal_parser.go
- xlog_page.go
- xlog_page_header.go
- xlog_record.go
- xlog_record_block.go
- xlog_record_block_header.go
- xlog_record_block_image_header.go
- xlog_record_header.go