ddcw / ibd2sql

parse mysql ibd file to sql for learn or recovery data
GNU General Public License v3.0
236 stars 71 forks source link

读取ibd时报错 KeyError: 'hidden' #10

Closed xiaojiafei520 closed 8 months ago

xiaojiafei520 commented 8 months ago

操作 对ibd进行ddl输出

PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main> .\main.py C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd --ddl Traceback (most recent call last): File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\main.py", line 161, in ddcw.init() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\ibd2sql.py", line 112, in init self.sdi = sdi(self.read(),debug=self.debug) #sdi页 File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 161, in init self._init_table() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 263, in _init_table if x['length'] == 4294967295 or x['hidden']: KeyError: 'hidden' PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main>

Debug

PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main> .\main.py C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd --ddl --debug [2024-04-04 00:43:17] [DEBUG] DEBUG MODE ON [2024-04-04 00:43:17] [DEBUG] INIT ibd2sql [2024-04-04 00:43:17] [DEBUG] FORCE False [2024-04-04 00:43:17] [DEBUG] SET False [2024-04-04 00:43:17] [DEBUG] MULTIVALUE False [2024-04-04 00:43:17] [DEBUG] AUTO_DEBUG True [2024-04-04 00:43:17] [DEBUG] FILTER: 0 < TRX < 281474976710656 0 < ROLLPTR < 72057594037927936 [2024-04-04 00:43:17] [DEBUG] OPEN IBD FILE: C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd [2024-04-04 00:43:17] [DEBUG] ANALYZE FIRST PAGE: FIL_PAGE_TYPE_FSP_HDR [2024-04-04 00:43:17] [DEBUG] ibd2sql.read PAGE: 0 [2024-04-04 00:43:17] [DEBUG] ANALYZE FIRST PAGE FINISH [2024-04-04 00:43:17] [DEBUG] SDI PAGE NO: 3 [2024-04-04 00:43:17] [DEBUG] ANALYZE SDI PAGE [2024-04-04 00:43:17] [DEBUG] ibd2sql.read PAGE: 3 Traceback (most recent call last): File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\main.py", line 161, in ddcw.init() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\ibd2sql.py", line 112, in init self.sdi = sdi(self.read(),debug=self.debug) #sdi页 File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 161, in init self._init_table() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 263, in _init_table if x['length'] == 4294967295 or x['hidden']: KeyError: 'hidden' PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main>

ddcw commented 8 months ago

操作 对ibd进行ddl输出

PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main> .\main.py C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd --ddl Traceback (most recent call last): File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\main.py", line 161, in ddcw.init() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\ibd2sql.py", line 112, in init self.sdi = sdi(self.read(),debug=self.debug) #sdi页 File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 161, in init self._init_table() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 263, in _init_table if x['length'] == 4294967295 or x['hidden']: KeyError: 'hidden' PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main>

Debug

PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main> .\main.py C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd --ddl --debug [2024-04-04 00:43:17] [DEBUG] DEBUG MODE ON [2024-04-04 00:43:17] [DEBUG] INIT ibd2sql [2024-04-04 00:43:17] [DEBUG] FORCE False [2024-04-04 00:43:17] [DEBUG] SET False [2024-04-04 00:43:17] [DEBUG] MULTIVALUE False [2024-04-04 00:43:17] [DEBUG] AUTO_DEBUG True [2024-04-04 00:43:17] [DEBUG] FILTER: 0 < TRX < 281474976710656 0 < ROLLPTR < 72057594037927936 [2024-04-04 00:43:17] [DEBUG] OPEN IBD FILE: C:\Users\xiaoj\Desktop\DataBaseWorkSpace\test.ibd [2024-04-04 00:43:17] [DEBUG] ANALYZE FIRST PAGE: FIL_PAGE_TYPE_FSP_HDR [2024-04-04 00:43:17] [DEBUG] ibd2sql.read PAGE: 0 [2024-04-04 00:43:17] [DEBUG] ANALYZE FIRST PAGE FINISH [2024-04-04 00:43:17] [DEBUG] SDI PAGE NO: 3 [2024-04-04 00:43:17] [DEBUG] ANALYZE SDI PAGE [2024-04-04 00:43:17] [DEBUG] ibd2sql.read PAGE: 3 Traceback (most recent call last): File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\main.py", line 161, in ddcw.init() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\ibd2sql.py", line 112, in init self.sdi = sdi(self.read(),debug=self.debug) #sdi页 File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 161, in init self._init_table() File "C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main\ibd2sql\innodb_page_sdi.py", line 263, in _init_table if x['length'] == 4294967295 or x['hidden']: KeyError: 'hidden' PS C:\Users\xiaoj\Desktop\DataBaseWorkSpace\ibd2sql-main>

报错是 ibdsdi page解析出来的元数据信息 索引字段中 无 hidden属性, 是和版本有关系, 请问Mysql的具体版本是哪个呢? 解决办法: 注释掉hidder即可. 编辑 ibd2sql\innodb_page_sdi.py 的263行. 修改为如下:

if x['length'] == 4294967295:
xiaojiafei520 commented 8 months ago

Mysql版本:8.0.12 经过修改后正常读取ddl