47.1 RecoveryLogRecordVisitor

If an instance of class RecoveryLogRecordVisitor is used to visit all the log records in order after the last valid check point then it will make the appropriate adjustments to the SUT and RPM for a recovery of the data. Note that data is only recovered when a snap shot record is encountered.


class RecoveryLogRecordVisitor : public ILogRecordVisitor
{
public:
    RecoveryLogRecordVisitor(LSS& lss, RecoveryScanInfo& rsi);
    void VisitPacketRecord(const PacketInfo& pi) override;
    void VisitSnapshotRecord(LogRecordPosition nextPos, TxnSeqNumber txsn, HPTime timeStamp) override;
    void VisitDeletePacketRecord(Seid seid) override;
    void VisitNextSeidHighLogRecord(SeidHigh seidHigh) override;
    void SetNextSegment(SegId segid);
    int GetTotalNumDataPacketsRecovered() const { return totalNumDataPacketsRecovered_; }
    int GetTotalNumSerialElementsDeleted() const { return totalNumDeletesRecovered_; }

private:
    enum
    {
        // Lowest 2 bits indicate one of three types
        REC_NEXT_SEGID,
        REC_DELETE,
        REC_PACKET,

        // Bit masks to provide additional information about packet recovery entries
        REC_HEAD_PACKET_MASK = 0x80,
        REC_CLEANING_PACKET_MASK = 0x40
    };
    
    // Used to record locations of data packets, and delete packet records for the purposes of a 
    // recovery
    struct RecoveryEntry
    {
        uint32 type_;       // See enum above
        Seid seid_;
        LogRecordPosition position_;
        int totalPacketSize_;
    };

    LSS& lss_;
    RecoveryScanInfo& rsi_;
    int numDataPackets_;
    int numDeletes_;
    int totalNumDataPacketsRecovered_;
    int totalNumDeletesRecovered_;
    std::deque recoveryEntries_;
};