Merge lp:~percona-dev/percona-xtradb/fix-import-extern-pages into lp:~percona-dev/percona-xtradb/extensions-1.0

Proposed by Yasufumi Kinoshita
Status: Merged
Merged at revision: not available
Proposed branch: lp:~percona-dev/percona-xtradb/fix-import-extern-pages
Merge into: lp:~percona-dev/percona-xtradb/extensions-1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~percona-dev/percona-xtradb/fix-import-extern-pages
Reviewer Review Type Date Requested Status
Vadim Tkachenko Approve
Review via email: mp+11586@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vadim Tkachenko (vadim-tk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_expand_import.patch'
2--- innodb_expand_import.patch 2009-09-09 05:07:10 +0000
3+++ innodb_expand_import.patch 2009-09-11 06:54:50 +0000
4@@ -21,7 +21,7 @@
5 if (!success) {
6 /* The following call prints an error message */
7 os_file_get_last_error(TRUE);
8-@@ -2981,6 +2985,275 @@
9+@@ -2981,6 +2985,329 @@
10 space_id = fsp_header_get_space_id(page);
11 space_flags = fsp_header_get_flags(page);
12
13@@ -135,9 +135,45 @@
14 + fprintf(stderr, "InnoDB: Progress in %:");
15 +
16 + for (offset = 0; offset < size_bytes; offset += UNIV_PAGE_SIZE) {
17++ ulint checksum_field;
18++ ulint old_checksum_field;
19++
20 + success = os_file_read(file, page,
21 + (ulint)(offset & 0xFFFFFFFFUL),
22 + (ulint)(offset >> 32), UNIV_PAGE_SIZE);
23++
24++ /* skip inconsistent pages, it may be free page. */
25++ if (memcmp(page + FIL_PAGE_LSN + 4,
26++ page + UNIV_PAGE_SIZE
27++ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
28++
29++ goto skip_write;
30++ }
31++
32++ checksum_field = mach_read_from_4(page
33++ + FIL_PAGE_SPACE_OR_CHKSUM);
34++
35++ old_checksum_field = mach_read_from_4(
36++ page + UNIV_PAGE_SIZE
37++ - FIL_PAGE_END_LSN_OLD_CHKSUM);
38++
39++ if (old_checksum_field != mach_read_from_4(page
40++ + FIL_PAGE_LSN)
41++ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
42++ && old_checksum_field
43++ != buf_calc_page_old_checksum(page)) {
44++
45++ goto skip_write;
46++ }
47++
48++ if (checksum_field != 0
49++ && checksum_field != BUF_NO_CHECKSUM_MAGIC
50++ && checksum_field
51++ != buf_calc_page_new_checksum(page)) {
52++
53++ goto skip_write;
54++ }
55++
56 + if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
57 + mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
58 +
59@@ -167,13 +203,30 @@
60 + n_recs = page_get_n_recs(page);
61 +
62 + while (rec && rec != supremum && n_recs > 0) {
63++ ulint n_fields;
64++ ulint i;
65 + ulint offset = index->trx_id_offset;
66++ offsets = rec_get_offsets(rec, index, offsets,
67++ ULINT_UNDEFINED, &heap);
68++ n_fields = rec_offs_n_fields(offsets);
69 + if (!offset) {
70-+ offsets = rec_get_offsets(rec, index, offsets,
71-+ ULINT_UNDEFINED, &heap);
72 + offset = row_get_trx_id_offset(rec, index, offsets);
73 + }
74 + trx_write_trx_id(rec + offset, ut_dulint_create(0, 1));
75++
76++ for (i = 0; i < n_fields; i++) {
77++ if (rec_offs_nth_extern(offsets, i)) {
78++ ulint local_len;
79++ byte* data;
80++
81++ data = rec_get_nth_field(rec, offsets, i, &local_len);
82++
83++ local_len -= BTR_EXTERN_FIELD_REF_SIZE;
84++
85++ mach_write_to_4(data + local_len + BTR_EXTERN_SPACE_ID, id);
86++ }
87++ }
88++
89 + rec = page_rec_get_next(rec);
90 + n_recs--;
91 + }
92@@ -207,6 +260,7 @@
93 + (ulint)(offset >> 32), UNIV_PAGE_SIZE);
94 + }
95 +
96++skip_write:
97 + if (size_bytes
98 + && ((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / size_bytes)
99 + != ((offset * 100) / size_bytes)) {

Subscribers

People subscribed via source and target branches

to all changes: