Class: Innodb::UndoLog
- Inherits:
-
Object
- Object
- Innodb::UndoLog
- Defined in:
- lib/innodb/undo_log.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
- #dump ⇒ Object
- #header ⇒ Object
-
#initialize(page, position) ⇒ UndoLog
constructor
A new instance of UndoLog.
- #next_address ⇒ Object
- #prev_address ⇒ Object
- #read_header(cursor) ⇒ Object
- #size_header ⇒ Object
- #size_xa_header ⇒ Object
- #undo_log ⇒ Object
Constructor Details
#initialize(page, position) ⇒ UndoLog
Returns a new instance of UndoLog.
5 6 7 8 |
# File 'lib/innodb/undo_log.rb', line 5 def initialize(page, position) @page = page @position = position end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/innodb/undo_log.rb', line 3 def page @page end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
4 5 6 |
# File 'lib/innodb/undo_log.rb', line 4 def position @position end |
Instance Method Details
#dump ⇒ Object
68 69 70 71 72 |
# File 'lib/innodb/undo_log.rb', line 68 def dump puts "header:" pp header puts end |
#header ⇒ Object
56 57 58 |
# File 'lib/innodb/undo_log.rb', line 56 def header undo_log[:header] end |
#next_address ⇒ Object
64 65 66 |
# File 'lib/innodb/undo_log.rb', line 64 def next_address header[:history_list_node][:next] end |
#prev_address ⇒ Object
60 61 62 |
# File 'lib/innodb/undo_log.rb', line 60 def prev_address header[:history_list_node][:prev] end |
#read_header(cursor) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/innodb/undo_log.rb', line 18 def read_header(cursor) cursor.name("header") do |c| xid_exists = nil { :trx_id => c.name("trx_id") { c.get_hex(8) }, :trx_no => c.name("trx_no") { c.get_uint64 }, :delete_marks => c.name("delete_marks") { (c.get_uint16 != 0) }, :log_start => c.name("log_start") { c.get_uint16 }, :xid_exists => c.name("xid_exists") { xid_exists = (c.get_uint8 != 0) }, :dict_trans => c.name("dict_trans") { (c.get_uint8 != 0) }, :table_id => c.name("table_id") { c.get_uint64 }, :next_log => c.name("next_log") { c.get_uint16 }, :prev_log => c.name("prev_log") { c.get_uint16 }, :history_list_node => c.name("history_list_node") { Innodb::List.get_node(c) }, :xid => c.name("xid") { if xid_exists { :format => c.name("format") { c.get_uint32 }, :trid_len => c.name("trid_len") { c.get_uint32 }, :bqual_len => c.name("bqual_len") { c.get_uint32 }, :data => c.name("data") { c.get_bytes(128) }, } end }, } end end |
#size_header ⇒ Object
14 15 16 |
# File 'lib/innodb/undo_log.rb', line 14 def size_header 8 + 8 + 2 + 2 + 1 + 1 + 8 + 2 + 2 + Innodb::List::NODE_SIZE + size_xa_header end |
#size_xa_header ⇒ Object
10 11 12 |
# File 'lib/innodb/undo_log.rb', line 10 def size_xa_header 4 + 4 + 4 + 128 end |
#undo_log ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/innodb/undo_log.rb', line 48 def undo_log @undo_log ||= page.cursor(position).name("undo_log") do |c| { :header => read_header(c), } end end |