Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freed root index page should be skipped #164

Open
lichang98 opened this issue Dec 12, 2022 · 0 comments
Open

Freed root index page should be skipped #164

lichang98 opened this issue Dec 12, 2022 · 0 comments

Comments

@lichang98
Copy link

lichang98 commented Dec 12, 2022

Description

Some root index page are freed ones during bulk load, and they should not be considered as a real index root.

How to repeat

Firstly, prepare data with sysbench.

./sysbench --mysql-host=<host> --mysql-port=<port> --mysql-db=<db> --mysql-user=<user> --rand-type=gaussian --threads=4 --table-size=640000 --tables=1 oltp_read_write prepare

Then run innodb_space.

innodb_space -f ./sbtest1.ibd  space-indexes 

How to fix it

--- a/lib/innodb/space.rb
+++ b/lib/innodb/space.rb
@@ -327,7 +327,10 @@ module Innodb
         # for IBD files, if they haven't added indexes online.
+        xdes = xdes_for_page(3)
         (3...@pages).each do |page_number|
           page = page(page_number)
-          yield page_number if page.type == :INDEX && page.root?
+          xdes = xdes_for_page(page_number)
+                                                if (page_number % pages_per_extent).zero?
+          xdes_status = xdes.page_status(page_number)
+          yield page_number if !xdes_status[:free] && page.type == :INDEX &&
+                               page.root?
         end
       end
@lichang98 lichang98 changed the title Freed root index page should skipped Freed root index page should be skipped Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant