Zero  0.1.0
verifylog.h
Go to the documentation of this file.
1 #ifndef __VERIFYLOG_H
2 #define __VERIFYLOG_H
3 
4 #include <unordered_map>
5 
6 #include "command.h"
7 #include "handler.h"
8 
9 class VerifyLog : public LogScannerCommand {
10 public:
11  void setupOptions();
12 
13  void run();
14 
15 private:
17 
18  string dbfile;
19 };
20 
21 class VerifyHandler : public Handler {
22 public:
23  VerifyHandler(bool merge);
24 
25  virtual ~VerifyHandler() {};
26 
27  virtual void invoke(logrec_t& r);
28 
29  virtual void finalize();
30 
31  virtual void newFile(const char* fname);
32 
33 private:
34  std::unordered_map<PageID, lsn_t> pageLSNs;
35 
36  std::unordered_set<PageID> allocatedPages;
37 
39 
41 
43 
45 
46  long count;
47 
48  bool merge;
49 
50  lsn_t getCurrentPageLSN(PageID pid);
51 
52  void checkRedo(logrec_t& r, PageID pid, lsn_t lsn, lsn_t prev_lsn);
53 
54  void checkAlloc(logrec_t& r);
55 };
56 
57 #endif // __VERIFYLOG_H
lsn_t lastLSN
Definition: verifylog.h:42
virtual ~VerifyHandler()
Definition: verifylog.h:25
bool merge
Definition: command.h:87
std::unordered_set< PageID > allocatedPages
Definition: verifylog.h:36
Represents a transactional log record.
Definition: logrec.h:143
long count
Definition: verifylog.h:46
uint32_t PageID
Definition: basics.h:45
Log Sequence Number. See Log Sequence Numbers (LSN).
Definition: lsn.h:243
Definition: command.h:70
Definition: verifylog.h:21
Definition: verifylog.h:9
Definition: handler.h:11
void run()
Definition: verifylog.cpp:28
void setupOptions()
Definition: verifylog.cpp:8
lsn_t maxLSN
Definition: verifylog.h:40
bool merge
Definition: verifylog.h:48
string dbfile
Definition: verifylog.h:18
std::unordered_map< PageID, lsn_t > pageLSNs
Definition: verifylog.h:34
bool verify_alloc
Definition: verifylog.h:16
PageID lastPID
Definition: verifylog.h:44
lsn_t minLSN
Definition: verifylog.h:38