Zero  0.1.0
logdef_gen.h
Go to the documentation of this file.
1 /*
2 
3 <std-header orig-src='shore' genfile='true'>
4 
5 SHORE -- Scalable Heterogeneous Object REpository
6 
7 Copyright (c) 1994-99 Computer Sciences Department, University of
8  Wisconsin -- Madison
9 All Rights Reserved.
10 
11 Permission to use, copy, modify and distribute this software and its
12 documentation is hereby granted, provided that both the copyright
13 notice and this permission notice appear in all copies of the
14 software, derivative works or modified versions, and any portions
15 thereof, and that both notices appear in supporting documentation.
16 
17 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
18 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
19 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
20 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
21 
22 This software was developed with support by the Advanced Research
23 Project Agency, ARPA order number 018 (formerly 8230), monitored by
24 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
25 Further funding for this work was provided by DARPA through
26 Rome Research Laboratory Contract No. F30602-97-2-0247.
27 
28 */
29 
30 #ifndef __LOGDEF_GEN_H
31 #define __LOGDEF_GEN_H
32 
33 #include "w_defines.h"
34 #include "alloc_page.h"
35 #include "stnode_page.h"
36 #include "w_base.h"
37 #include "w_okvl.h"
38 #include "logrec.h"
39 
40 struct comment_log : public logrec_t {
41  static constexpr kind_t TYPE = logrec_t::t_comment;
42 
43  void construct(const char* msg);
44 };
45 
46 struct compensate_log : public logrec_t {
47  static constexpr kind_t TYPE = logrec_t::t_compensate;
48 
49  void construct(const lsn_t& rec_lsn);
50 };
51 
52 struct skip_log : public logrec_t {
53  static constexpr kind_t TYPE = logrec_t::t_skip;
54 
55  void construct();
56 };
57 
58 struct chkpt_begin_log : public logrec_t {
59  static constexpr kind_t TYPE = logrec_t::t_chkpt_begin;
60 
61  void construct();
62 };
63 
64 struct add_backup_log : public logrec_t {
65  static constexpr kind_t TYPE = logrec_t::t_add_backup;
66 
67  void construct(const string& path, lsn_t backupLSN);
68 };
69 
70 struct evict_page_log : public logrec_t {
71  static constexpr kind_t TYPE = logrec_t::t_evict_page;
72 
73  void construct(PageID pid, bool was_dirty, lsn_t page_lsn);
74 };
75 
76 struct fetch_page_log : public logrec_t {
77  static constexpr kind_t TYPE = logrec_t::t_fetch_page;
78 
79  void construct(PageID pid, lsn_t page_lsn, StoreID store);
80 };
81 
82 struct xct_abort_log : public logrec_t {
83  static constexpr kind_t TYPE = logrec_t::t_xct_abort;
84 
85  void construct();
86 };
87 
88 struct xct_end_log : public logrec_t {
89  static constexpr kind_t TYPE = logrec_t::t_xct_end;
90 
91  void construct();
92 };
93 
94 struct xct_latency_dump_log : public logrec_t {
96 
97  void construct(unsigned long nsec);
98 };
99 
100 struct alloc_page_log : public logrec_t {
101  static constexpr kind_t TYPE = logrec_t::t_alloc_page;
102 
103  template<class Ptr>
104  void construct(Ptr, PageID pid);
105 
106  template<class Ptr>
107  void redo(Ptr);
108 };
109 
110 struct dealloc_page_log : public logrec_t {
112 
113  template<class Ptr>
114  void construct(Ptr, PageID pid);
115 
116  template<class Ptr>
117  void redo(Ptr);
118 };
119 
120 struct stnode_format_log : public logrec_t {
122 
123  template<class Ptr>
124  void construct(Ptr) {}
125 
126  template<class Ptr>
127  void redo(Ptr p) {
128  auto stpage = p->get_generic_page();
129  if (stpage->pid != stnode_page::stpid) {
130  stpage->pid = stnode_page::stpid;
131  }
132  }
133 };
134 
135 struct alloc_format_log : public logrec_t {
137 
138  template<class Ptr>
139  void construct(Ptr) {}
140 
141  template<class Ptr>
142  void redo(Ptr p) {
143  auto page = reinterpret_cast<alloc_page*>(p->get_generic_page());
144  page->format_empty();
145  }
146 };
147 
148 struct create_store_log : public logrec_t {
150 
151  template<class PagePtr>
152  void construct(PagePtr page, PageID root_pid, StoreID snum);
153 
154  template<class Ptr>
155  void redo(Ptr);
156 };
157 
158 struct append_extent_log : public logrec_t {
160 
161  template<class Ptr>
162  void construct(Ptr, StoreID, extent_id_t ext);
163 
164  template<class Ptr>
165  void redo(Ptr);
166 };
167 
170 
171  void construct();
172 };
173 
174 struct loganalysis_end_log : public logrec_t {
176 
177  void construct();
178 };
179 
180 struct redo_done_log : public logrec_t {
181  static constexpr kind_t TYPE = logrec_t::t_redo_done;
182 
183  void construct();
184 };
185 
186 struct undo_done_log : public logrec_t {
187  static constexpr kind_t TYPE = logrec_t::t_undo_done;
188 
189  void construct();
190 };
191 
192 struct restore_begin_log : public logrec_t {
194 
195  void construct(PageID page_cnt);
196 };
197 
198 struct restore_segment_log : public logrec_t {
200 
201  void construct(uint32_t segment);
202 
203  template<class Ptr>
204  void redo(Ptr);
205 };
206 
207 struct restore_end_log : public logrec_t {
208  static constexpr kind_t TYPE = logrec_t::t_restore_end;
209 
210  void construct();
211 
212  template<class Ptr>
213  void redo(Ptr);
214 };
215 
216 struct warmup_done_log : public logrec_t {
217  static constexpr kind_t TYPE = logrec_t::t_warmup_done;
218 
219  void construct() {}
220 };
221 
222 struct page_img_format_log : public logrec_t {
224 
225  template<class PagePtr>
226  void construct(const PagePtr page);
227 
228  template<class Ptr>
229  void redo(Ptr);
230 
231  template<class Ptr>
232  void undo(Ptr);
233 };
234 
235 struct update_emlsn_log : public logrec_t {
237 
238  template<class PagePtr>
239  void construct(const PagePtr page, general_recordid_t child_slot, lsn_t child_lsn);
240 
241  template<class Ptr>
242  void redo(Ptr);
243 };
244 
247 
248  template<class PagePtr>
249  void construct(const PagePtr page, const PagePtr page2, PageID new_page_id, const w_keystr_t& fence,
250  const w_keystr_t& chain_fence_high);
251 
252  template<class Ptr>
253  void redo(Ptr);
254 };
255 
256 struct btree_insert_log : public logrec_t {
258 
259  template<class PagePtr>
260  void construct(const PagePtr page, const w_keystr_t& key, const cvec_t& el, const bool sys_txn);
261 
262  template<class Ptr>
263  void redo(Ptr);
264 
265  template<class Ptr>
266  void undo(Ptr);
267 };
268 
271 
272  template<class PagePtr>
273  void construct(const PagePtr page, const w_keystr_t& key, const cvec_t& el, const bool sys_txn);
274 
275  template<class Ptr>
276  void redo(Ptr);
277 
278  template<class Ptr>
279  void undo(Ptr);
280 };
281 
282 struct btree_update_log : public logrec_t {
284 
285  template<class PagePtr>
286  void construct(const PagePtr page, const w_keystr_t& key, const char* old_el, int old_elen, const cvec_t& new_el);
287 
288  template<class Ptr>
289  void redo(Ptr);
290 
291  template<class Ptr>
292  void undo(Ptr);
293 };
294 
295 struct btree_overwrite_log : public logrec_t {
297 
298  template<class PagePtr>
299  void construct(const PagePtr page, const w_keystr_t& key, const char* old_el, const char* new_el, size_t offset,
300  size_t elen);
301 
302  template<class Ptr>
303  void redo(Ptr);
304 
305  template<class Ptr>
306  void undo(Ptr);
307 };
308 
311 
312  template<class PagePtr>
313  void construct(const PagePtr page, const vector<slotid_t>& slots, const bool sys_txn);
314 
315  template<class Ptr>
316  void redo(Ptr);
317 
318  template<class Ptr>
319  void undo(Ptr);
320 };
321 
324 
325  template<class PagePtr>
326  void construct(const PagePtr page, const vector<slotid_t>& slots);
327 
328  template<class Ptr>
329  void redo(Ptr);
330 };
331 
334 
335  template<class PagePtr>
336  void construct(const PagePtr page, const w_keystr_t& key, int element_length);
337 
338  template<class Ptr>
339  void redo(Ptr);
340 };
341 
344 
345  template<class PagePtr>
346  void construct(const PagePtr page, const PagePtr page2, PageID new_child_pid, lsn_t child_emlsn,
347  const w_keystr_t& new_child_key);
348 
349  template<class Ptr>
350  void redo(Ptr);
351 };
352 
353 struct btree_split_log : public logrec_t {
354  static constexpr kind_t TYPE = logrec_t::t_btree_split;
355 
356  template<class PagePtr>
357  void construct(const PagePtr page, const PagePtr page2, uint16_t move_count, const w_keystr_t& new_high_fence,
358  const w_keystr_t& new_chain);
359 
360  template<class Ptr>
361  void redo(Ptr);
362 };
363 
366 
367  template<class PagePtr>
368  void construct(const PagePtr page, const w_keystr_t& low, const w_keystr_t& high, const w_keystr_t& chain);
369 
370  template<class Ptr>
371  void redo(Ptr);
372 };
373 
374 struct tick_sec_log : public logrec_t {
375  static constexpr kind_t TYPE = logrec_t::t_tick_sec;
376 
377  void construct();
378 };
379 
380 struct tick_msec_log : public logrec_t {
381  static constexpr kind_t TYPE = logrec_t::t_tick_msec;
382 
383  void construct();
384 };
385 
386 struct benchmark_start_log : public logrec_t {
388 
389  void construct();
390 };
391 
392 struct page_write_log : public logrec_t {
393  static constexpr kind_t TYPE = logrec_t::t_page_write;
394 
395  void construct(PageID pid, lsn_t lsn, uint32_t count = 1);
396 };
397 
398 struct page_read_log : public logrec_t {
399  static constexpr kind_t TYPE = logrec_t::t_page_read;
400 
401  void construct(PageID pid, uint32_t count);
402 };
403 
404 #endif // __LOGDEF_GEN_H
Definition: logrec.h:189
Definition: logrec.h:195
Definition: logdef_gen.h:353
Definition: logdef_gen.h:282
void format_empty()
Definition: alloc_page.cpp:7
Definition: logrec.h:183
Definition: logdef_gen.h:46
Definition: logdef_gen.h:245
Definition: logrec.h:157
Definition: logrec.h:197
void undo(PagePtr)
Definition: logrec.cpp:412
void redo()
Definition: logrec.cpp:395
Definition: logrec.h:176
const lsn_t & lsn() const
Definition: logrec.h:336
int16_t general_recordid_t
An integer to point to any record in B-tree pages.
Definition: basics.h:71
Definition: logdef_gen.h:135
Definition: logrec.h:185
Definition: logrec.h:188
Definition: logdef_gen.h:40
PageID pid() const
Definition: logrec.h:506
Definition: logrec.h:166
Definition: logdef_gen.h:392
Definition: logrec.h:181
Definition: logrec.h:179
void construct(const char *msg)
Definition: logrec.cpp:633
Definition: logrec.h:172
uint32_t StoreID
Definition: basics.h:47
Key string class which can represent a few special values.
Definition: w_key.h:47
Definition: logdef_gen.h:295
Definition: logdef_gen.h:58
Definition: logrec.h:160
Definition: logdef_gen.h:76
uint32_t extent_id_t
Definition: alloc_page.h:12
A constant vec_t (meaning things pointed to cannot be changed).
Definition: vec_t.h:95
Represents a transactional log record.
Definition: logrec.h:143
Definition: logrec.h:152
Definition: logdef_gen.h:269
Definition: logrec.h:173
Definition: logrec.h:153
Definition: logrec.h:150
Definition: logdef_gen.h:64
Definition: logrec.h:158
Definition: logdef_gen.h:94
uint32_t PageID
Definition: basics.h:45
Definition: logrec.h:184
Definition: logrec.h:196
Log Sequence Number. See Log Sequence Numbers (LSN).
Definition: lsn.h:243
Definition: logdef_gen.h:374
Definition: logdef_gen.h:158
Definition: logrec.h:180
Definition: logdef_gen.h:342
Definition: logrec.h:167
void redo(Ptr p)
Definition: logdef_gen.h:127
Definition: logdef_gen.h:88
void construct(Ptr)
Definition: logdef_gen.h:124
Definition: logrec.h:187
Free-page allocation/deallocation page.
Definition: alloc_page.h:28
Definition: logrec.h:163
static constexpr kind_t TYPE
Definition: logdef_gen.h:41
Definition: logdef_gen.h:322
Definition: logrec.h:199
Definition: logdef_gen.h:100
void construct()
Definition: logdef_gen.h:219
Definition: logdef_gen.h:198
Definition: logdef_gen.h:120
void construct(Ptr)
Definition: logdef_gen.h:139
Definition: logdef_gen.h:235
Definition: logdef_gen.h:332
static constexpr PageID stpid
Definition: stnode_page.h:68
Definition: logrec.h:171
Definition: logdef_gen.h:398
Definition: logdef_gen.h:174
Definition: logdef_gen.h:82
Definition: logrec.h:169
Definition: logrec.h:186
Definition: logrec.h:194
Definition: logdef_gen.h:180
Definition: logdef_gen.h:256
Definition: logdef_gen.h:216
Definition: logrec.h:170
Definition: logrec.h:165
Definition: logdef_gen.h:186
Definition: logrec.h:175
Definition: logdef_gen.h:70
Definition: logrec.h:178
Definition: logdef_gen.h:207
Definition: logdef_gen.h:386
Definition: logdef_gen.h:148
Definition: logrec.h:198
Definition: logrec.h:162
Definition: logrec.h:151
Definition: logrec.h:174
void redo(Ptr p)
Definition: logdef_gen.h:142
Definition: logdef_gen.h:168
Definition: logrec.h:182
Definition: logdef_gen.h:52
Definition: logrec.h:168
Definition: logdef_gen.h:222
kind_t
Definition: logrec.h:149
Definition: logdef_gen.h:192
Definition: logrec.h:159
Definition: logrec.h:161
Definition: logrec.h:200
Definition: logdef_gen.h:110
Definition: logdef_gen.h:364
Definition: logdef_gen.h:309
Definition: logdef_gen.h:380