-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathibd2sdi.1
823 lines (823 loc) · 15 KB
/
ibd2sdi.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
'\" t
.\" Title: ibd2sdi
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 10/11/2024
.\" Manual: MySQL Database System
.\" Source: MySQL 9.0
.\" Language: English
.\"
.TH "IBD2SDI" "1" "10/11/2024" "MySQL 9\&.0" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ibd2sdi \- InnoDB utility for extracting serialized dictionary information (SDI) from an InnoDB tablespace
.SH "SYNOPSIS"
.HP \w'\fBibd2sdi\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIfile_name1\fR\fR\fB\ [\fR\fB\fIfile_name2\ file_name3\ \&.\&.\&.]\fR\fR\ 'u
\fBibd2sdi [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIfile_name1\fR\fR\fB [\fR\fB\fIfile_name2 file_name3 \&.\&.\&.]\fR\fR
.SH "DESCRIPTION"
.PP
\fBibd2sdi\fR
is a utility for extracting
serialized dictionary information
(SDI) from
InnoDB
tablespace files\&. SDI data is present in all persistent
InnoDB
tablespace files\&.
.PP
\fBibd2sdi\fR
can be run on
file\-per\-table
tablespace files (*\&.ibd
files),
general tablespace
files (*\&.ibd
files),
system tablespace
files (ibdata*
files), and the data dictionary tablespace (mysql\&.ibd)\&. It is not supported for use with temporary tablespaces or undo tablespaces\&.
.PP
\fBibd2sdi\fR
can be used at runtime or while the server is offline\&. During
DDL
operations,
ROLLBACK
operations, and undo log purge operations related to SDI, there may be a short interval of time when
\fBibd2sdi\fR
fails to read SDI data stored in the tablespace\&.
.PP
\fBibd2sdi\fR
performs an uncommitted read of SDI from the specified tablespace\&. Redo logs and undo logs are not accessed\&.
.PP
Invoke the
\fBibd2sdi\fR
utility like this:
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi [\fIoptions\fR] \fIfile_name1\fR [\fIfile_name2 file_name3 \&.\&.\&.\fR]
.fi
.if n \{\
.RE
.\}
.PP
\fBibd2sdi\fR
supports multi\-file tablespaces like the
InnoDB
system tablespace, but it cannot be run on more than one tablespace at a time\&. For multi\-file tablespaces, specify each file:
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi ibdata1 ibdata2
.fi
.if n \{\
.RE
.\}
.PP
The files of a multi\-file tablespace must be specified in order of the ascending page number\&. If two successive files have the same space ID, the later file must start with the last page number of the previous file + 1\&.
.PP
\fBibd2sdi\fR
outputs SDI (containing id, type, and data fields) in
JSON
format\&.
ibd2sdi Options
.PP
\fBibd2sdi\fR
supports the following options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-help\fR,
\fB\-h\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--help
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
false
T}
.TE
.sp 1
Display a help message and exit\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
Usage: \&./ibd2sdi [\-v] [\-c <strict\-check>] [\-d <dump file name>] [\-n] filename1 [filenames]
See http://dev\&.mysql\&.com/doc/refman/9\&.0/en/ibd2sdi\&.html for usage hints\&.
\-h, \-\-help Display this help and exit\&.
\-v, \-\-version Display version information and exit\&.
\-#, \-\-debug[=name] Output debug log\&. See
http://dev\&.mysql\&.com/doc/refman/9\&.0/en/dbug\-package\&.html
\-d, \-\-dump\-file=name
Dump the tablespace SDI into the file passed by user\&.
Without the filename, it will default to stdout
\-s, \-\-skip\-data Skip retrieving data from SDI records\&. Retrieve only id
and type\&.
\-i, \-\-id=# Retrieve the SDI record matching the id passed by user\&.
\-t, \-\-type=# Retrieve the SDI records matching the type passed by
user\&.
\-c, \-\-strict\-check=name
Specify the strict checksum algorithm by the user\&.
Allowed values are innodb, crc32, none\&.
\-n, \-\-no\-check Ignore the checksum verification\&.
\-p, \-\-pretty Pretty format the SDI output\&.If false, SDI would be not
human readable but it will be of less size
(Defaults to on; use \-\-skip\-pretty to disable\&.)
Variables (\-\-variable\-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
debug (No default value)
dump\-file (No default value)
skip\-data FALSE
id 0
type 0
strict\-check crc32
no\-check FALSE
pretty TRUE
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-version\fR,
\fB\-v\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--version
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
false
T}
.TE
.sp 1
Display version information and exit\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi Ver 9\&.0\&.1 for Linux on x86_64 (Source distribution)
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--debug=options
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Prints a debug log\&. For debug options, refer to
Section\ \&7.9.4, \(lqThe DBUG Package\(rq\&.
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-\-debug=d:t /tmp/ibd2sdi\&.trace
.fi
.if n \{\
.RE
.\}
.sp
This option is available only if MySQL was built using
\fBWITH_DEBUG\fR\&. MySQL release binaries provided by Oracle are
\fInot\fR
built using this option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-dump\-file=\fR,
\fB\-d\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--dump-file=file
T}
T{
Type
T}:T{
File name
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Dumps serialized dictionary information (SDI) into the specified dump file\&. If a dump file is not specified, the tablespace SDI is dumped to
stdout\&.
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-\-dump\-file=\fIfile_name\fR \&.\&./data/test/t1\&.ibd
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-data\fR,
\fB\-s\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--skip-data
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
false
T}
.TE
.sp 1
Skips retrieval of
data
field values from the serialized dictionary information (SDI) and only retrieves the
id
and
type
field values, which are primary keys for SDI records\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBibd2sdi \-\-skip\-data \&.\&./data/test/t1\&.ibd\fR
["ibd2sdi"
,
{
"type": 1,
"id": 330
}
,
{
"type": 2,
"id": 7
}
]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-id=\fR\fB\fI#\fR\fR,
\fB\-i \fR\fB\fI#\fR\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--id=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
0
T}
.TE
.sp 1
Retrieves serialized dictionary information (SDI) matching the specified table or tablespace object id\&. An object id is unique to the object type\&. Table and tablespace object IDs are also found in the
id
column of the
mysql\&.tables
and
mysql\&.tablespace
data dictionary tables\&. For information about data dictionary tables, see
Section\ \&16.1, \(lqData Dictionary Schema\(rq\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBibd2sdi \-\-id=7 \&.\&./data/test/t1\&.ibd\fR
["ibd2sdi"
,
{
"type": 2,
"id": 7,
"object":
{
"mysqld_version_id": 80003,
"dd_version": 80003,
"sdi_version": 1,
"dd_object_type": "Tablespace",
"dd_object": {
"name": "test/t1",
"comment": "",
"options": "",
"se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
"engine": "InnoDB",
"files": [
{
"ordinal_position": 1,
"filename": "\&./test/t1\&.ibd",
"se_private_data": "id=2;"
}
]
}
}
}
]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-type=\fR\fB\fI#\fR\fR,
\fB\-t \fR\fB\fI#\fR\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--type=#
T}
T{
Type
T}:T{
Enumeration
T}
T{
Default Value
T}:T{
0
T}
T{
Valid Values
T}:T{
.PP
1
.PP
2
T}
.TE
.sp 1
Retrieves serialized dictionary information (SDI) matching the specified object type\&. SDI is provided for table (type=1) and tablespace (type=2) objects\&.
.sp
This example shows output for a tablespace
ts1
in the
test
database:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBibd2sdi \-\-type=2 \&.\&./data/test/ts1\&.ibd\fR
["ibd2sdi"
,
{
"type": 2,
"id": 7,
"object":
{
"mysqld_version_id": 80003,
"dd_version": 80003,
"sdi_version": 1,
"dd_object_type": "Tablespace",
"dd_object": {
"name": "test/ts1",
"comment": "",
"options": "",
"se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
"engine": "InnoDB",
"files": [
{
"ordinal_position": 1,
"filename": "\&./test/ts1\&.ibd",
"se_private_data": "id=2;"
}
]
}
}
}
]
.fi
.if n \{\
.RE
.\}
.sp
Due to the way in which
InnoDB
handles default value metadata, a default value may be present and non\-empty in
\fBibd2sdi\fR
output for a given table column even if it is not defined using
DEFAULT\&. Consider the two tables created using the following statements, in the database named
i:
.sp
.if n \{\
.RS 4
.\}
.nf
CREATE TABLE t1 (c VARCHAR(16) NOT NULL);
CREATE TABLE t2 (c VARCHAR(16) NOT NULL DEFAULT "Sakila");
.fi
.if n \{\
.RE
.\}
.sp
Using
\fBibd2sdi\fR, we can see that the
default_value
for column
c
is nonempty and is in fact padded to length in both tables, like this:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBibd2sdi \&.\&./data/i/t1\&.ibd | grep \-m1 \*(Aq\e"default_value\e"\*(Aq | cut \-b34\- | sed \-e s/,//\fR
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\enAAAAAAAAAAA="
$> \fBibd2sdi \&.\&./data/i/t2\&.ibd | grep \-m1 \*(Aq\e"default_value\e"\*(Aq | cut \-b34\- | sed \-e s/,//\fR
"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\enAAAAAAAAAAA="
.fi
.if n \{\
.RE
.\}
.sp
Examination of
\fBibd2sdi\fR
output may be easier using a JSON\-aware utility like
\fB\m[blue]\fBjq\fR\m[]\&\s-2\u[1]\d\s+2\fR, as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBibd2sdi \&.\&./data/i/t1\&.ibd | jq \*(Aq\&.[1]["object"]["dd_object"]["columns"][0]["default_value"]\*(Aq\fR
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\enAAAAAAAAAAA="
$> \fBibd2sdi \&.\&./data/i/t2\&.ibd | jq \*(Aq\&.[1]["object"]["dd_object"]["columns"][0]["default_value"]\*(Aq\fR
"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\enAAAAAAAAAAA="
.fi
.if n \{\
.RE
.\}
.sp
For more information, see the
\m[blue]\fBMySQL Internals documentation\fR\m[]\&\s-2\u[2]\d\s+2\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-strict\-check\fR,
\fB\-c\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--strict-check=algorithm
T}
T{
Type
T}:T{
Enumeration
T}
T{
Default Value
T}:T{
crc32
T}
T{
Valid Values
T}:T{
.PP
crc32
.PP
innodb
.PP
none
T}
.TE
.sp 1
Specifies a strict checksum algorithm for validating the checksum of pages that are read\&. Options include
innodb,
crc32, and
none\&.
.sp
In this example, the strict version of the
innodb
checksum algorithm is specified:
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-\-strict\-check=innodb \&.\&./data/test/t1\&.ibd
.fi
.if n \{\
.RE
.\}
.sp
In this example, the strict version of
crc32
checksum algorithm is specified:
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-c crc32 \&.\&./data/test/t1\&.ibd
.fi
.if n \{\
.RE
.\}
.sp
If you do not specify the
\fB\-\-strict\-check\fR
option, validation is performed against non\-strict
innodb,
crc32
and
none
checksums\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-check\fR,
\fB\-n\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--no-check
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
false
T}
.TE
.sp 1
Skips checksum validation for pages that are read\&.
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-\-no\-check \&.\&./data/test/t1\&.ibd
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-pretty\fR,
\fB\-p\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--pretty
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
false
T}
.TE
.sp 1
Outputs SDI data in JSON pretty print format\&. Enabled by default\&. If disabled, SDI is not human readable but is smaller in size\&. Use
\-\-skip\-pretty
to disable\&.
.sp
.if n \{\
.RS 4
.\}
.nf
ibd2sdi \-\-skip\-pretty \&.\&./data/test/t1\&.ibd
.fi
.if n \{\
.RE
.\}
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 1997, 2024, Oracle and/or its affiliates.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "NOTES"
.IP " 1." 4
jq
.RS 4
\%https://stedolan.github.io/jq/
.RE
.IP " 2." 4
MySQL Internals documentation
.RS 4
\%https://dev.mysql.com/doc/dev/mysql-server/latest/
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).