UNDO log pages marked as free cannot be dumped

47 views
Skip to first unread message

noj.n...@gmail.com

unread,
Nov 27, 2014, 7:39:40 AM11/27/14
to innod...@googlegroups.com
Hi

This might be valid for other page types as well, but I ran into it when inspecting a page with UNDO_LOG page type.

The page is marked as free and the extent is on the free list, as shown by page-account:

$ sudo innodb_space -s /mysql_data/data/ibdata1 -p 391880 page-account
Accounting for page 391880:
Page type is UNDO_LOG (Undo log, stores previous values of modified records).
Extent descriptor for pages 391872-391935 is at page 376832, offset 9558.
Extent is fully allocated to fseg 109269244.
Page is marked as free in extent descriptor.
Extent is in free list of space.

But dumping the page fails since it tries to output the UNDO Segment Header and the UNDO log.

$ sudo innodb_space -s /mysql_data/data/ibdata1 -p 391880 page-dump
#<Innodb::Page::UndoLog:0x0000000273e590>:

fil header:
{:checksum=>1063756241,
:offset=>391880,
:prev=>0,
:next=>0,
:lsn=>4867726853994,
:type=>:UNDO_LOG,
:flush_lsn=>0,
:space_id=>0}

undo page header:
{:type=>:update,
:latest_log_record_offset=>56,
:free_offset=>16324,
:page_list_node=>
{:prev=>{:page=>53, :offset=>44}, :next=>{:page=>391881, :offset=>44}}}

undo segment header:
/var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page.rb:44:in `initialize': Page can't be initialized from nil space or buffer (space: #<Innodb::Space:0x0000000277d830>, buffer: ) (RuntimeError)
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page.rb:24:in `new'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page.rb:24:in `parse'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/space.rb:231:in `page'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/fseg_entry.rb:29:in `get_inode'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page/undo_log.rb:63:in `block (2 levels) in undo_segment_header'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/util/buffer_cursor.rb:136:in `name'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page/undo_log.rb:63:in `block in undo_segment_header'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/util/buffer_cursor.rb:136:in `name'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page/undo_log.rb:59:in `undo_segment_header'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/lib/innodb/page/undo_log.rb:85:in `dump'
from /var/lib/gems/1.9.1/gems/innodb_ruby-0.9.12/bin/innodb_space:1498:in `<top (required)>'
from /usr/local/bin/innodb_space:23:in `load'
from /usr/local/bin/innodb_space:23:in `<main>'

Hacking around a bit, it works fine to suppress the output in undo_log.rb:

if self.space.xdes_for_page(self.offset).page_status(self.offset)[:free] != true
puts "undo segment header:"
pp undo_segment_header
puts

puts "last undo log:"
if undo_segment_header[:last_log_offset] != 0
undo_log(undo_segment_header[:last_log_offset]).dump
end
else
puts "page is marked as free"
end

But this is likely a rather bad solution, I just wanted to understand what failed.

Or perhaps this page is indeed in bad shape, I am not sure what the page layout _should_ be for freed UNDO pages. But if the page is valid, it would make sense to handle this when dumping it.

Anyway, the toolkit is awesome and extremely helpful!
Thanks
/Olle

Jeremy Cole

unread,
Nov 27, 2014, 5:59:18 PM11/27/14
to noj.n...@gmail.com, innod...@googlegroups.com
Olle,

Yes, this is basically expected as InnoDB does not clear a page when it is freed, it is only added to the free lists and marked as free in the extent descriptor. So it is not possible to determine from a page itself whether or not it is really free. This has the side effect that various structures in a freed page may point to invalid pages, other structures, etc.

Your solution (or something very similar) is pretty reasonable. However I would say it is normal to get exceptions thrown for all many different pages when using page-dump mode, for the reasons above. I will take a look if this one can be more reasonable at least.

I am glad you are making good use of innodb_ruby!

Regards,

Jeremy
--
You received this message because you are subscribed to the Google Groups "innodb_ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innodb_ruby...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

olle nilsson

unread,
Nov 28, 2014, 3:14:12 AM11/28/14
to Jeremy Cole, innod...@googlegroups.com
Hi Jeremy

Ok, that makes perfect sense. I just wanted to verify that there was nothing wrong/strange with the page itself, and page-account already indicated this quite clearly.
Thanks a lot for getting back so quickly!!

Best Regards
/Olle
Reply all
Reply to author
Forward
0 new messages