Merge lp:~dveeden/percona-xtrabackup/lp733665 into lp:percona-xtrabackup/2.0
- lp733665
- Merge into 2.0
Proposed by
Daniël van Eeden
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Alexey Kopytov | ||||
Proposed branch: | lp:~dveeden/percona-xtrabackup/lp733665 | ||||
Merge into: | lp:percona-xtrabackup/2.0 | ||||
Diff against target: |
1690 lines (+1461/-16) (has conflicts) 8 files modified
Makefile (+38/-0) innobackupex (+15/-6) patches/mariadb53.patch (+1262/-0) test/bootstrap.sh (+36/-1) test/run.sh (+13/-2) test/t/ib_aria.sh (+67/-0) utils/build.sh (+27/-6) xtrabackup.c (+3/-1) Text conflict in test/bootstrap.sh |
||||
To merge this branch: | bzr merge lp:~dveeden/percona-xtrabackup/lp733665 | ||||
Related bugs: |
|
||||
Related blueprints: |
Add MariaDB support
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov | Pending | ||
Review via email: mp+78796@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote : | # |
Unmerged revisions
- 311. By Daniël van Eeden
-
Set sql_mode to NO_ENGINE_
SUBSTITUTION and only run the Aria test on MariaDB - 310. By Daniël van Eeden
-
Add test for backup of Aria engine
- 309. By Daniël van Eeden
-
Also backup .MAD and .MAI for the Aria engine.
- 308. By Daniël van Eeden
-
Check wget return code.
- 307. By Daniël van Eeden
-
Allow compilation against MariaDB 5.3
- 306. By Daniël van Eeden
-
Add SHA1 sum verification to bootstrap.sh
- 305. By Daniël van Eeden
-
Add MariaDB 5.3 to bootstrap.sh
- 304. By Daniël van Eeden
-
Initial support for MariaDB added to the test run.
- 303. By Daniël van Eeden
-
Initial MariaDB support
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile' |
2 | --- Makefile 2011-10-05 02:31:10 +0000 |
3 | +++ Makefile 2011-10-10 06:52:24 +0000 |
4 | @@ -114,6 +114,44 @@ |
5 | xtradb: TARGET := xtrabackup |
6 | xtradb: $(TARGET) |
7 | |
8 | +# MariaDB with XtraDB |
9 | +mariadb: INC=-I. -isystem.. -isystem./../include -isystem./../../include -isystem./../../../include |
10 | +mariadb: LIBS += -lrt |
11 | +mariadb: INNODBOBJS = ../libxtradb_la-btr0btr.o ../libxtradb_la-btr0cur.o ../libxtradb_la-btr0pcur.o \ |
12 | + ../libxtradb_la-btr0sea.o ../libxtradb_la-buf0buddy.o ../libxtradb_la-buf0buf.o \ |
13 | + ../libxtradb_la-buf0flu.o ../libxtradb_la-buf0lru.o ../libxtradb_la-buf0rea.o \ |
14 | + ../libxtradb_la-data0data.o ../libxtradb_la-data0type.o ../libxtradb_la-dict0boot.o \ |
15 | + ../libxtradb_la-dict0crea.o ../libxtradb_la-dict0dict.o ../libxtradb_la-dict0load.o \ |
16 | + ../libxtradb_la-dict0mem.o ../libxtradb_la-dyn0dyn.o ../libxtradb_la-eval0eval.o \ |
17 | + ../libxtradb_la-eval0proc.o ../libxtradb_la-fil0fil.o ../libxtradb_la-fsp0fsp.o \ |
18 | + ../libxtradb_la-fut0fut.o ../libxtradb_la-fut0lst.o ../libxtradb_la-ha0ha.o \ |
19 | + ../libxtradb_la-ha0storage.o ../libxtradb_la-hash0hash.o ../libxtradb_la-ibuf0ibuf.o \ |
20 | + ../libxtradb_la-lock0iter.o ../libxtradb_la-lock0lock.o ../libxtradb_la-log0log.o \ |
21 | + ../libxtradb_la-log0recv.o ../libxtradb_la-mach0data.o ../libxtradb_la-mem0mem.o \ |
22 | + ../libxtradb_la-mem0pool.o ../libxtradb_la-mtr0log.o ../libxtradb_la-mtr0mtr.o \ |
23 | + ../libxtradb_la-os0file.o ../libxtradb_la-os0proc.o ../libxtradb_la-os0sync.o \ |
24 | + ../libxtradb_la-os0thread.o ../libxtradb_la-page0cur.o ../libxtradb_la-page0page.o \ |
25 | + ../libxtradb_la-page0zip.o ../libxtradb_la-lexyy.o ../libxtradb_la-pars0grm.o \ |
26 | + ../libxtradb_la-pars0opt.o ../libxtradb_la-pars0pars.o ../libxtradb_la-pars0sym.o \ |
27 | + ../libxtradb_la-que0que.o ../libxtradb_la-read0read.o ../libxtradb_la-rem0cmp.o \ |
28 | + ../libxtradb_la-rem0rec.o ../libxtradb_la-row0ext.o ../libxtradb_la-row0ins.o \ |
29 | + ../libxtradb_la-row0merge.o ../libxtradb_la-row0mysql.o ../libxtradb_la-row0purge.o \ |
30 | + ../libxtradb_la-row0row.o ../libxtradb_la-row0sel.o ../libxtradb_la-row0uins.o \ |
31 | + ../libxtradb_la-row0umod.o ../libxtradb_la-row0undo.o ../libxtradb_la-row0upd.o \ |
32 | + ../libxtradb_la-row0vers.o ../libxtradb_la-srv0que.o ../libxtradb_la-srv0srv.o \ |
33 | + ../libxtradb_la-srv0start.o ../libxtradb_la-sync0arr.o ../libxtradb_la-sync0rw.o \ |
34 | + ../libxtradb_la-sync0sync.o ../libxtradb_la-thr0loc.o ../libxtradb_la-trx0purge.o \ |
35 | + ../libxtradb_la-trx0rec.o ../libxtradb_la-trx0roll.o ../libxtradb_la-trx0rseg.o \ |
36 | + ../libxtradb_la-trx0sys.o ../libxtradb_la-trx0trx.o ../libxtradb_la-trx0undo.o \ |
37 | + ../libxtradb_la-usr0sess.o ../libxtradb_la-ut0byte.o ../libxtradb_la-ut0dbg.o \ |
38 | + ../libxtradb_la-ut0list.o ../libxtradb_la-ut0mem.o ../libxtradb_la-ut0rnd.o \ |
39 | + ../libxtradb_la-ut0ut.o ../libxtradb_la-ut0vec.o ../libxtradb_la-ut0wqueue.o \ |
40 | + ../libxtradb_la-ut0rbt.o |
41 | +mariadb: MYSQLOBJS = ../../../mysys/libmysys.a ../../../strings/libmystrings.a ../../../zlib/.libs/libzlt.a ../../../dbug/libdbug.a |
42 | +mariadb: DEFS += -DXTRADB_BASED -DMARIADB_BASED |
43 | +mariadb: TARGET := xtrabackup |
44 | +mariadb: $(TARGET) |
45 | + |
46 | # XtraBackup for XtraDB 5.5 |
47 | xtradb55: INC=-I. -isystem.. -isystem./../include -isystem./../../include -isystem./../../../include |
48 | xtradb55: INNODBOBJS = ../libinnobase.a |
49 | |
50 | === modified file 'innobackupex' |
51 | --- innobackupex 2011-10-05 02:31:10 +0000 |
52 | +++ innobackupex 2011-10-10 06:52:24 +0000 |
53 | @@ -387,7 +387,7 @@ |
54 | |
55 | write_slave_info() if $option_slave_info; |
56 | |
57 | - # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files |
58 | + # backup .frm, .MRG, .MYD, .MYI, .MAD, .MAI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files |
59 | backup_files(); |
60 | |
61 | # resume ibbackup and wait till it has finished |
62 | @@ -1799,13 +1799,13 @@ |
63 | my @list; |
64 | my $file; |
65 | my $database; |
66 | - my $wildcard = '*.{frm,MYD,MYI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}'; |
67 | + my $wildcard = '*.{frm,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}'; |
68 | |
69 | opendir(DIR, $source_dir) |
70 | || Die "Can't open directory '$source_dir': $!\n"; |
71 | $now = current_time(); |
72 | print STDERR "\n$now $prefix Starting to backup .frm, .MRG, .MYD, .MYI,\n"; |
73 | - print STDERR "$prefix .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in\n"; |
74 | + print STDERR "$prefix .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV, .MAD, .MAI and .opt files in\n"; |
75 | print STDERR "$prefix subdirectories of '$source_dir'\n"; |
76 | # loop through all database directories |
77 | while (defined($database = readdir(DIR))) { |
78 | @@ -1832,7 +1832,7 @@ |
79 | |
80 | # copy files of this database |
81 | opendir(DBDIR, "$source_dir/$database"); |
82 | - @list = grep(/\.(frm)|(MYD)|(MYI)|(MRG)|(TRG)|(TRN)|(ARM)|(ARZ)|(CSM)|(CSV)|(opt)|(par)$/, readdir(DBDIR)); |
83 | + @list = grep(/\.(frm)|(MYD)|(MYI)|(MAD)|(MAI)|(MRG)|(TRG)|(TRN)|(ARM)|(ARZ)|(CSM)|(CSV)|(opt)|(par)$/, readdir(DBDIR)); |
84 | closedir DBDIR; |
85 | $file_c = @list; |
86 | if ($file_c <= $backup_file_print_limit) { |
87 | @@ -1888,7 +1888,7 @@ |
88 | closedir(DIR); |
89 | |
90 | $now = current_time(); |
91 | - print STDERR "$now $prefix Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files\n\n"; |
92 | + print STDERR "$now $prefix Finished backing up .frm, .MRG, .MYD, .MYI, .MAD, .MAI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files\n\n"; |
93 | } |
94 | |
95 | |
96 | @@ -2248,6 +2248,8 @@ |
97 | # MySQL 5.1.* with InnoDB plugin - xtrabackup |
98 | # Percona Server >= 11.0 - xtrabackup |
99 | # MySQL 5.5.* - xtrabackup_55 |
100 | +# MariaDB 5.2.* - xtrabackup |
101 | +# MariaDB 5.3.* - xtrabackup |
102 | |
103 | my @lines; |
104 | my $var_version = ''; |
105 | @@ -2276,6 +2278,12 @@ |
106 | if($var_version =~ m/5\.1\.\d/ and $var_innodb_version =~ m/1\.0\.\d+-\d/){ |
107 | $ibbackup_binary = ($win eq 1 ? 'xtrabackup.exe' : 'xtrabackup'); |
108 | } |
109 | +if($var_version =~ m/5\.2\.\d/){ |
110 | + $ibbackup_binary = ($win eq 1 ? 'xtrabackup.exe' : 'xtrabackup'); |
111 | +} |
112 | +if($var_version =~ m/5\.3\.\d/){ |
113 | + $ibbackup_binary = ($win eq 1 ? 'xtrabackup.exe' : 'xtrabackup'); |
114 | +} |
115 | if($var_version =~ m/5\.5\.\d/){ |
116 | $ibbackup_binary = ($win eq 1 ? 'xtrabackup.exe' : 'xtrabackup_55'); |
117 | } |
118 | @@ -2385,7 +2393,8 @@ |
119 | command makes a complete backup of all MyISAM and InnoDB tables and |
120 | indexes in all databases or in all of the databases specified with the |
121 | --databases option. The created backup contains .frm, .MRG, .MYD, |
122 | -.MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, CSV, .opt, .par, and InnoDB data and log files. |
123 | +.MYI, .MAD, .MAI, .TRG, .TRN, .ARM, .ARZ, .CSM, CSV, .opt, .par, and |
124 | +InnoDB data and log files. |
125 | The MY.CNF options file defines the location of the database. This command |
126 | connects to the MySQL server using the mysql client program, and runs |
127 | xtrabackup as a child process. |
128 | |
129 | === added file 'patches/mariadb53.patch' |
130 | --- patches/mariadb53.patch 1970-01-01 00:00:00 +0000 |
131 | +++ patches/mariadb53.patch 2011-10-10 06:52:24 +0000 |
132 | @@ -0,0 +1,1262 @@ |
133 | +diff -ruN a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c |
134 | +--- a/storage/xtradb/btr/btr0btr.c |
135 | ++++ b/storage/xtradb/btr/btr0btr.c |
136 | +@@ -120,7 +120,7 @@ |
137 | + /**************************************************************//** |
138 | + Gets the root node of a tree and x-latches it. |
139 | + @return root page, x-latched */ |
140 | +-static |
141 | ++//static |
142 | + buf_block_t* |
143 | + btr_root_block_get( |
144 | + /*===============*/ |
145 | +@@ -578,7 +578,7 @@ |
146 | + /************************************************************//** |
147 | + Returns the child page of a node pointer and x-latches it. |
148 | + @return child page, x-latched */ |
149 | +-static |
150 | ++//static |
151 | + buf_block_t* |
152 | + btr_node_ptr_get_child( |
153 | + /*===================*/ |
154 | +diff -ruN a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c |
155 | +--- a/storage/xtradb/buf/buf0buf.c |
156 | ++++ b/storage/xtradb/buf/buf0buf.c |
157 | +@@ -440,7 +440,7 @@ |
158 | + return(TRUE); |
159 | + } |
160 | + |
161 | +-#ifndef UNIV_HOTBACKUP |
162 | ++#ifdef UNDEFINED |
163 | + if (recv_lsn_checks_on) { |
164 | + ib_uint64_t current_lsn; |
165 | + |
166 | +@@ -2671,7 +2671,9 @@ |
167 | + ut_ad(zip_size == fil_space_get_zip_size(space)); |
168 | + ut_ad(ut_is_2pow(zip_size)); |
169 | + #ifndef UNIV_LOG_DEBUG |
170 | +- ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL)); |
171 | ++ /* ibuf_page() always returns FALSE with srv_fake_write=1 */ |
172 | ++ ut_ad(srv_fake_write || |
173 | ++ !ibuf_inside() || ibuf_page(space, zip_size, offset, NULL)); |
174 | + #endif |
175 | + if (innobase_get_slow_log()) { |
176 | + trx = innobase_get_trx(); |
177 | +@@ -4030,7 +4032,7 @@ |
178 | + recv_recover_page(TRUE, (buf_block_t*) bpage); |
179 | + } |
180 | + |
181 | +- if (uncompressed && !recv_no_ibuf_operations) { |
182 | ++ if (uncompressed && !recv_no_ibuf_operations && !srv_fake_write) { |
183 | + ibuf_merge_or_delete_for_page( |
184 | + /* Delete possible entries, if bpage is_corrupt */ |
185 | + (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL : |
186 | +diff -ruN a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c |
187 | +--- a/storage/xtradb/fil/fil0fil.c |
188 | ++++ b/storage/xtradb/fil/fil0fil.c |
189 | +@@ -294,7 +294,7 @@ |
190 | + |
191 | + /** The tablespace memory cache. This variable is NULL before the module is |
192 | + initialized. */ |
193 | +-static fil_system_t* fil_system = NULL; |
194 | ++fil_system_t* fil_system = NULL; |
195 | + |
196 | + |
197 | + /********************************************************************//** |
198 | +@@ -305,7 +305,7 @@ |
199 | + off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
200 | + mutex. */ |
201 | + static |
202 | +-void |
203 | ++ulint |
204 | + fil_node_prepare_for_io( |
205 | + /*====================*/ |
206 | + fil_node_t* node, /*!< in: file node */ |
207 | +@@ -630,7 +630,7 @@ |
208 | + Opens a the file of a node of a tablespace. The caller must own the fil_system |
209 | + mutex. */ |
210 | + static |
211 | +-void |
212 | ++ulint |
213 | + fil_node_open_file( |
214 | + /*===============*/ |
215 | + fil_node_t* node, /*!< in: file node */ |
216 | +@@ -664,7 +664,14 @@ |
217 | + node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success); |
218 | + if (!success) { |
219 | + /* The following call prints an error message */ |
220 | +- os_file_get_last_error(TRUE); |
221 | ++ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND) |
222 | ++ { |
223 | ++ ut_print_timestamp(stderr); |
224 | ++ fprintf(stderr, |
225 | ++ " InnoDB: Warning: cannot open %s\n", |
226 | ++ node->name); |
227 | ++ return(OS_FILE_NOT_FOUND); |
228 | ++ } |
229 | + |
230 | + ut_print_timestamp(stderr); |
231 | + |
232 | +@@ -754,8 +761,8 @@ |
233 | + } |
234 | + |
235 | + if (size_bytes >= 1024 * 1024) { |
236 | +- /* Truncate the size to whole megabytes. */ |
237 | +- size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
238 | ++ /* The size should be exact for after applying .delta */ |
239 | ++ //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
240 | + } |
241 | + |
242 | + if (!(flags & DICT_TF_ZSSIZE_MASK)) { |
243 | +@@ -800,6 +807,8 @@ |
244 | + /* Put the node to the LRU list */ |
245 | + UT_LIST_ADD_FIRST(LRU, system->LRU, node); |
246 | + } |
247 | ++ |
248 | ++ return(0); |
249 | + } |
250 | + |
251 | + /**********************************************************************//** |
252 | +@@ -1428,7 +1437,12 @@ |
253 | + the file yet; the following calls will open it and update the |
254 | + size fields */ |
255 | + |
256 | +- fil_node_prepare_for_io(node, fil_system, space); |
257 | ++ if (fil_node_prepare_for_io(node, fil_system, space)) |
258 | ++ { |
259 | ++ mutex_exit(&fil_system->mutex); |
260 | ++ |
261 | ++ return(0); |
262 | ++ } |
263 | + fil_node_complete_io(node, fil_system, OS_FILE_READ); |
264 | + } |
265 | + |
266 | +@@ -1480,7 +1494,12 @@ |
267 | + the file yet; the following calls will open it and update the |
268 | + size fields */ |
269 | + |
270 | +- fil_node_prepare_for_io(node, fil_system, space); |
271 | ++ if (fil_node_prepare_for_io(node, fil_system, space)) |
272 | ++ { |
273 | ++ mutex_exit(&fil_system->mutex); |
274 | ++ |
275 | ++ return(ULINT_UNDEFINED); |
276 | ++ } |
277 | + fil_node_complete_io(node, fil_system, OS_FILE_READ); |
278 | + } |
279 | + |
280 | +@@ -1929,7 +1948,7 @@ |
281 | + mem_free(path); |
282 | + } |
283 | + |
284 | +-#ifndef UNIV_HOTBACKUP |
285 | ++#if 0 |
286 | + /********************************************************//** |
287 | + Writes a log record about an .ibd file create/rename/delete. */ |
288 | + static |
289 | +@@ -2153,7 +2172,7 @@ |
290 | + if (fil_create_new_single_table_tablespace( |
291 | + space_id, name, FALSE, flags, |
292 | + FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
293 | +- ut_error; |
294 | ++ //ut_error; |
295 | + } |
296 | + } |
297 | + |
298 | +@@ -2316,7 +2335,7 @@ |
299 | + } |
300 | + |
301 | + if (success) { |
302 | +-#ifndef UNIV_HOTBACKUP |
303 | ++#ifdef UNDEFINED |
304 | + /* Write a log record about the deletion of the .ibd |
305 | + file, so that ibbackup can replay it in the |
306 | + --apply-log phase. We use a dummy mtr and the familiar |
307 | +@@ -2617,7 +2636,7 @@ |
308 | + |
309 | + mutex_exit(&fil_system->mutex); |
310 | + |
311 | +-#ifndef UNIV_HOTBACKUP |
312 | ++#ifdef UNDEFINED |
313 | + if (success) { |
314 | + mtr_t mtr; |
315 | + |
316 | +@@ -2807,7 +2826,7 @@ |
317 | + |
318 | + fil_node_create(path, size, space_id, FALSE); |
319 | + |
320 | +-#ifndef UNIV_HOTBACKUP |
321 | ++#ifdef UNDEFINED |
322 | + { |
323 | + mtr_t mtr; |
324 | + |
325 | +@@ -3060,19 +3079,97 @@ |
326 | + "InnoDB: open the tablespace file ", stderr); |
327 | + ut_print_filename(stderr, filepath); |
328 | + fputs("!\n" |
329 | +- "InnoDB: Have you moved InnoDB .ibd files around" |
330 | +- " without using the\n" |
331 | +- "InnoDB: commands DISCARD TABLESPACE and" |
332 | +- " IMPORT TABLESPACE?\n" |
333 | +- "InnoDB: It is also possible that this is" |
334 | +- " a temporary table #sql...,\n" |
335 | +- "InnoDB: and MySQL removed the .ibd file for this.\n" |
336 | +- "InnoDB: Please refer to\n" |
337 | +- "InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n" |
338 | +- "InnoDB: for how to resolve the issue.\n", stderr); |
339 | ++ "InnoDB: It will be removed from data dictionary.\n" |
340 | ++ , stderr); |
341 | + |
342 | + mem_free(filepath); |
343 | + |
344 | ++ /* removing from data dictionary */ |
345 | ++ { |
346 | ++ trx_t* trx; |
347 | ++ pars_info_t* info = NULL; |
348 | ++ |
349 | ++ trx = trx_allocate_for_mysql(); |
350 | ++ |
351 | ++ trx->op_info = "removing invalid table from data dictionary"; |
352 | ++ |
353 | ++ info = pars_info_create(); |
354 | ++ |
355 | ++ pars_info_add_str_literal(info, "table_name", name); |
356 | ++ |
357 | ++ que_eval_sql(info, |
358 | ++ "PROCEDURE DROP_TABLE_PROC () IS\n" |
359 | ++ "sys_foreign_id CHAR;\n" |
360 | ++ "table_id CHAR;\n" |
361 | ++ "index_id CHAR;\n" |
362 | ++ "foreign_id CHAR;\n" |
363 | ++ "found INT;\n" |
364 | ++ "BEGIN\n" |
365 | ++ "SELECT ID INTO table_id\n" |
366 | ++ "FROM SYS_TABLES\n" |
367 | ++ "WHERE NAME = :table_name\n" |
368 | ++ "LOCK IN SHARE MODE;\n" |
369 | ++ "IF (SQL % NOTFOUND) THEN\n" |
370 | ++ " RETURN;\n" |
371 | ++ "END IF;\n" |
372 | ++ "found := 1;\n" |
373 | ++ "SELECT ID INTO sys_foreign_id\n" |
374 | ++ "FROM SYS_TABLES\n" |
375 | ++ "WHERE NAME = 'SYS_FOREIGN'\n" |
376 | ++ "LOCK IN SHARE MODE;\n" |
377 | ++ "IF (SQL % NOTFOUND) THEN\n" |
378 | ++ " found := 0;\n" |
379 | ++ "END IF;\n" |
380 | ++ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
381 | ++ " found := 0;\n" |
382 | ++ "END IF;\n" |
383 | ++ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
384 | ++ " found := 0;\n" |
385 | ++ "END IF;\n" |
386 | ++ "WHILE found = 1 LOOP\n" |
387 | ++ " SELECT ID INTO foreign_id\n" |
388 | ++ " FROM SYS_FOREIGN\n" |
389 | ++ " WHERE FOR_NAME = :table_name\n" |
390 | ++ " AND TO_BINARY(FOR_NAME)\n" |
391 | ++ " = TO_BINARY(:table_name)\n" |
392 | ++ " LOCK IN SHARE MODE;\n" |
393 | ++ " IF (SQL % NOTFOUND) THEN\n" |
394 | ++ " found := 0;\n" |
395 | ++ " ELSE\n" |
396 | ++ " DELETE FROM SYS_FOREIGN_COLS\n" |
397 | ++ " WHERE ID = foreign_id;\n" |
398 | ++ " DELETE FROM SYS_FOREIGN\n" |
399 | ++ " WHERE ID = foreign_id;\n" |
400 | ++ " END IF;\n" |
401 | ++ "END LOOP;\n" |
402 | ++ "found := 1;\n" |
403 | ++ "WHILE found = 1 LOOP\n" |
404 | ++ " SELECT ID INTO index_id\n" |
405 | ++ " FROM SYS_INDEXES\n" |
406 | ++ " WHERE TABLE_ID = table_id\n" |
407 | ++ " LOCK IN SHARE MODE;\n" |
408 | ++ " IF (SQL % NOTFOUND) THEN\n" |
409 | ++ " found := 0;\n" |
410 | ++ " ELSE\n" |
411 | ++ " DELETE FROM SYS_FIELDS\n" |
412 | ++ " WHERE INDEX_ID = index_id;\n" |
413 | ++ " DELETE FROM SYS_INDEXES\n" |
414 | ++ " WHERE ID = index_id\n" |
415 | ++ " AND TABLE_ID = table_id;\n" |
416 | ++ " END IF;\n" |
417 | ++ "END LOOP;\n" |
418 | ++ "DELETE FROM SYS_COLUMNS\n" |
419 | ++ "WHERE TABLE_ID = table_id;\n" |
420 | ++ "DELETE FROM SYS_TABLES\n" |
421 | ++ "WHERE ID = table_id;\n" |
422 | ++ "END;\n" |
423 | ++ , FALSE, trx); |
424 | ++ |
425 | ++ trx_commit_for_mysql(trx); |
426 | ++ |
427 | ++ trx_free_for_mysql(trx); |
428 | ++ } |
429 | ++ |
430 | + return(FALSE); |
431 | + } |
432 | + |
433 | +@@ -3918,7 +4015,7 @@ |
434 | + idea is to read as much good data as we can and jump over bad data. |
435 | + @return 0 if ok, -1 if error even after the retries, 1 if at the end |
436 | + of the directory */ |
437 | +-static |
438 | ++//static |
439 | + int |
440 | + fil_file_readdir_next_file( |
441 | + /*=======================*/ |
442 | +@@ -4217,15 +4314,97 @@ |
443 | + "InnoDB: in InnoDB data dictionary" |
444 | + " has tablespace id %lu,\n" |
445 | + "InnoDB: but tablespace with that id" |
446 | +- " or name does not exist. Have\n" |
447 | +- "InnoDB: you deleted or moved .ibd files?\n" |
448 | +- "InnoDB: This may also be a table created with" |
449 | +- " CREATE TEMPORARY TABLE\n" |
450 | +- "InnoDB: whose .ibd and .frm files" |
451 | +- " MySQL automatically removed, but the\n" |
452 | +- "InnoDB: table still exists in the" |
453 | +- " InnoDB internal data dictionary.\n", |
454 | ++ " or name does not exist. It will be removed from data dictionary.\n" |
455 | ++ , |
456 | + (ulong) id); |
457 | ++ mem_free(path); |
458 | ++ mutex_exit(&fil_system->mutex); |
459 | ++ /* removing from data dictionary */ |
460 | ++ { |
461 | ++ trx_t* trx; |
462 | ++ pars_info_t* info = NULL; |
463 | ++ |
464 | ++ trx = trx_allocate_for_mysql(); |
465 | ++ |
466 | ++ trx->op_info = "removing invalid table from data dictionary"; |
467 | ++ |
468 | ++ info = pars_info_create(); |
469 | ++ |
470 | ++ pars_info_add_str_literal(info, "table_name", name); |
471 | ++ |
472 | ++ que_eval_sql(info, |
473 | ++ "PROCEDURE DROP_TABLE_PROC () IS\n" |
474 | ++ "sys_foreign_id CHAR;\n" |
475 | ++ "table_id CHAR;\n" |
476 | ++ "index_id CHAR;\n" |
477 | ++ "foreign_id CHAR;\n" |
478 | ++ "found INT;\n" |
479 | ++ "BEGIN\n" |
480 | ++ "SELECT ID INTO table_id\n" |
481 | ++ "FROM SYS_TABLES\n" |
482 | ++ "WHERE NAME = :table_name\n" |
483 | ++ "LOCK IN SHARE MODE;\n" |
484 | ++ "IF (SQL % NOTFOUND) THEN\n" |
485 | ++ " RETURN;\n" |
486 | ++ "END IF;\n" |
487 | ++ "found := 1;\n" |
488 | ++ "SELECT ID INTO sys_foreign_id\n" |
489 | ++ "FROM SYS_TABLES\n" |
490 | ++ "WHERE NAME = 'SYS_FOREIGN'\n" |
491 | ++ "LOCK IN SHARE MODE;\n" |
492 | ++ "IF (SQL % NOTFOUND) THEN\n" |
493 | ++ " found := 0;\n" |
494 | ++ "END IF;\n" |
495 | ++ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
496 | ++ " found := 0;\n" |
497 | ++ "END IF;\n" |
498 | ++ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
499 | ++ " found := 0;\n" |
500 | ++ "END IF;\n" |
501 | ++ "WHILE found = 1 LOOP\n" |
502 | ++ " SELECT ID INTO foreign_id\n" |
503 | ++ " FROM SYS_FOREIGN\n" |
504 | ++ " WHERE FOR_NAME = :table_name\n" |
505 | ++ " AND TO_BINARY(FOR_NAME)\n" |
506 | ++ " = TO_BINARY(:table_name)\n" |
507 | ++ " LOCK IN SHARE MODE;\n" |
508 | ++ " IF (SQL % NOTFOUND) THEN\n" |
509 | ++ " found := 0;\n" |
510 | ++ " ELSE\n" |
511 | ++ " DELETE FROM SYS_FOREIGN_COLS\n" |
512 | ++ " WHERE ID = foreign_id;\n" |
513 | ++ " DELETE FROM SYS_FOREIGN\n" |
514 | ++ " WHERE ID = foreign_id;\n" |
515 | ++ " END IF;\n" |
516 | ++ "END LOOP;\n" |
517 | ++ "found := 1;\n" |
518 | ++ "WHILE found = 1 LOOP\n" |
519 | ++ " SELECT ID INTO index_id\n" |
520 | ++ " FROM SYS_INDEXES\n" |
521 | ++ " WHERE TABLE_ID = table_id\n" |
522 | ++ " LOCK IN SHARE MODE;\n" |
523 | ++ " IF (SQL % NOTFOUND) THEN\n" |
524 | ++ " found := 0;\n" |
525 | ++ " ELSE\n" |
526 | ++ " DELETE FROM SYS_FIELDS\n" |
527 | ++ " WHERE INDEX_ID = index_id;\n" |
528 | ++ " DELETE FROM SYS_INDEXES\n" |
529 | ++ " WHERE ID = index_id\n" |
530 | ++ " AND TABLE_ID = table_id;\n" |
531 | ++ " END IF;\n" |
532 | ++ "END LOOP;\n" |
533 | ++ "DELETE FROM SYS_COLUMNS\n" |
534 | ++ "WHERE TABLE_ID = table_id;\n" |
535 | ++ "DELETE FROM SYS_TABLES\n" |
536 | ++ "WHERE ID = table_id;\n" |
537 | ++ "END;\n" |
538 | ++ , FALSE, trx); |
539 | ++ |
540 | ++ trx_commit_for_mysql(trx); |
541 | ++ |
542 | ++ trx_free_for_mysql(trx); |
543 | ++ } |
544 | ++ return(FALSE); |
545 | + } else { |
546 | + ut_print_timestamp(stderr); |
547 | + fputs(" InnoDB: Error: table ", stderr); |
548 | +@@ -4614,7 +4793,7 @@ |
549 | + off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
550 | + mutex. */ |
551 | + static |
552 | +-void |
553 | ++ulint |
554 | + fil_node_prepare_for_io( |
555 | + /*====================*/ |
556 | + fil_node_t* node, /*!< in: file node */ |
557 | +@@ -4634,10 +4813,13 @@ |
558 | + } |
559 | + |
560 | + if (node->open == FALSE) { |
561 | ++ ulint err; |
562 | + /* File is closed: open it */ |
563 | + ut_a(node->n_pending == 0); |
564 | + |
565 | +- fil_node_open_file(node, system, space); |
566 | ++ err = fil_node_open_file(node, system, space); |
567 | ++ if (err) |
568 | ++ return(err); |
569 | + } |
570 | + |
571 | + if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
572 | +@@ -4650,6 +4832,8 @@ |
573 | + } |
574 | + |
575 | + node->n_pending++; |
576 | ++ |
577 | ++ return(0); |
578 | + } |
579 | + |
580 | + /********************************************************************//** |
581 | +@@ -4786,7 +4970,9 @@ |
582 | + ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) |
583 | + || !ibuf_bitmap_page(zip_size, block_offset) |
584 | + || sync || is_log); |
585 | +- ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE) |
586 | ++ /* ibuf_page() always returns FALSE with srv_fake_write=1 */ |
587 | ++ ut_ad(srv_fake_write || |
588 | ++ !ibuf_inside() || is_log || (type == OS_FILE_WRITE) |
589 | + || ibuf_page(space_id, zip_size, block_offset, NULL)); |
590 | + # endif /* UNIV_LOG_DEBUG */ |
591 | + if (sync) { |
592 | +@@ -4835,6 +5021,16 @@ |
593 | + |
594 | + ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
595 | + |
596 | ++ if (space->size <= block_offset) { |
597 | ++ ulint actual_size; |
598 | ++ |
599 | ++ mutex_exit(&fil_system->mutex); |
600 | ++ fil_extend_space_to_desired_size(&actual_size, space->id, |
601 | ++ ((block_offset + 1) / 64 + 1) * 64); |
602 | ++ mutex_enter(&fil_system->mutex); |
603 | ++ /* should retry? but it may safe for xtrabackup for now. */ |
604 | ++ } |
605 | ++ |
606 | + node = UT_LIST_GET_FIRST(space->chain); |
607 | + |
608 | + for (;;) { |
609 | +diff -ruN a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc |
610 | +--- a/storage/xtradb/handler/ha_innodb.cc |
611 | ++++ b/storage/xtradb/handler/ha_innodb.cc |
612 | +@@ -343,12 +343,6 @@ |
613 | + "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.", |
614 | + NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0); |
615 | + |
616 | +-static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit_session, PLUGIN_VAR_RQCMDARG, |
617 | +- "Control innodb_flush_log_at_trx_commit for each sessions. " |
618 | +- "The value 0~2 are same meanings to innodb_flush_log_at_trx_commit. " |
619 | +- "The value 3 regards innodb_flush_log_at_trx_commit (default).", |
620 | +- NULL, NULL, 3, 0, 3, 0); |
621 | +- |
622 | + |
623 | + static handler *innobase_create_handler(handlerton *hton, |
624 | + TABLE_SHARE *table, |
625 | +@@ -729,17 +723,6 @@ |
626 | + return(THDVAR((THD*) thd, lock_wait_timeout)); |
627 | + } |
628 | + |
629 | +-/******************************************************************//** |
630 | +-*/ |
631 | +-extern "C" UNIV_INTERN |
632 | +-ulong |
633 | +-thd_flush_log_at_trx_commit_session( |
634 | +-/*================================*/ |
635 | +- void* thd) |
636 | +-{ |
637 | +- return(THDVAR((THD*) thd, flush_log_at_trx_commit_session)); |
638 | +-} |
639 | +- |
640 | + /********************************************************************//** |
641 | + Obtain the InnoDB transaction of a MySQL thread. |
642 | + @return reference to transaction pointer */ |
643 | +@@ -11775,7 +11758,6 @@ |
644 | + MYSQL_SYSVAR(flush_neighbor_pages), |
645 | + MYSQL_SYSVAR(read_ahead), |
646 | + MYSQL_SYSVAR(adaptive_checkpoint), |
647 | +- MYSQL_SYSVAR(flush_log_at_trx_commit_session), |
648 | + MYSQL_SYSVAR(enable_unsafe_group_commit), |
649 | + MYSQL_SYSVAR(expand_import), |
650 | + MYSQL_SYSVAR(extra_rsegments), |
651 | +diff -ruN a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c |
652 | +--- a/storage/xtradb/ibuf/ibuf0ibuf.c |
653 | ++++ b/storage/xtradb/ibuf/ibuf0ibuf.c |
654 | +@@ -1064,6 +1064,9 @@ |
655 | + |
656 | + ut_ad(!recv_no_ibuf_operations); |
657 | + |
658 | ++ if (srv_fake_write) |
659 | ++ return(FALSE); |
660 | ++ |
661 | + if (ibuf_fixed_addr_page(space, zip_size, page_no)) { |
662 | + |
663 | + return(TRUE); |
664 | +@@ -2280,6 +2283,9 @@ |
665 | + ulint n_bytes; |
666 | + ulint n_pag2; |
667 | + |
668 | ++ if (srv_fake_write) |
669 | ++ return(0); |
670 | ++ |
671 | + while (sum_pages < n_pages) { |
672 | + n_bytes = ibuf_contract_ext(&n_pag2, sync); |
673 | + |
674 | +diff -ruN a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h |
675 | +--- a/storage/xtradb/include/ha_prototypes.h |
676 | ++++ b/storage/xtradb/include/ha_prototypes.h |
677 | +@@ -268,12 +268,4 @@ |
678 | + void* thd); /*!< in: thread handle (THD*), or NULL to query |
679 | + the global innodb_lock_wait_timeout */ |
680 | + |
681 | +-/******************************************************************//** |
682 | +-*/ |
683 | +- |
684 | +-ulong |
685 | +-thd_flush_log_at_trx_commit_session( |
686 | +-/*================================*/ |
687 | +- void* thd); |
688 | +- |
689 | + #endif |
690 | +diff -ruN a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h |
691 | +--- a/storage/xtradb/include/log0recv.h |
692 | ++++ b/storage/xtradb/include/log0recv.h |
693 | +@@ -444,7 +444,7 @@ |
694 | + /* defined in os0file.c */ |
695 | + #define OS_AIO_MERGE_N_CONSECUTIVE 64 |
696 | + /* defined in log0recv.c */ |
697 | +-#define RECV_READ_AHEAD_AREA 32 |
698 | ++#define RECV_READ_AHEAD_AREA 128 |
699 | + time_t stats_recv_start_time; |
700 | + ulint stats_recv_turns; |
701 | + |
702 | +diff -ruN a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic |
703 | +--- a/storage/xtradb/include/mem0mem.ic |
704 | ++++ b/storage/xtradb/include/mem0mem.ic |
705 | +@@ -367,7 +367,7 @@ |
706 | + buf = (byte*)buf + MEM_FIELD_HEADER_SIZE; |
707 | + |
708 | + /* Check that the field lengths agree */ |
709 | +- ut_ad(n == (ulint)mem_field_header_get_len(buf)); |
710 | ++ ut_ad(n == (ulint)mem_field_header_get_len((byte *)buf)); |
711 | + #endif |
712 | + |
713 | + return(buf); |
714 | +diff -ruN a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h |
715 | +--- a/storage/xtradb/include/srv0srv.h |
716 | ++++ b/storage/xtradb/include/srv0srv.h |
717 | +@@ -228,6 +228,10 @@ |
718 | + |
719 | + extern ulong srv_replication_delay; |
720 | + |
721 | ++extern ibool srv_read_only; |
722 | ++extern ibool srv_fake_write; |
723 | ++extern ibool srv_apply_log_only; |
724 | ++ |
725 | + extern long long srv_ibuf_max_size; |
726 | + extern ulint srv_ibuf_active_contract; |
727 | + extern ulint srv_ibuf_accel_rate; |
728 | +diff -ruN a/storage/xtradb/include/srv0start.h b/storage/xtradb/include/srv0start.h |
729 | +--- a/storage/xtradb/include/srv0start.h |
730 | ++++ b/storage/xtradb/include/srv0start.h |
731 | +@@ -91,6 +91,8 @@ |
732 | + /** Log sequence number immediately after startup */ |
733 | + extern ib_uint64_t srv_start_lsn; |
734 | + |
735 | ++extern ib_uint64_t srv_oldest_lsn; |
736 | ++ |
737 | + #ifdef __NETWARE__ |
738 | + void set_panic_flag_for_netware(void); |
739 | + #endif |
740 | +diff -ruN a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h |
741 | +--- a/storage/xtradb/include/trx0trx.h |
742 | ++++ b/storage/xtradb/include/trx0trx.h |
743 | +@@ -497,7 +497,6 @@ |
744 | + FALSE, one can save CPU time and about |
745 | + 150 bytes in the undo log size as then |
746 | + we skip XA steps */ |
747 | +- ulint flush_log_at_trx_commit_session; |
748 | + ulint flush_log_later;/* In 2PC, we hold the |
749 | + prepare_commit mutex across |
750 | + both phases. In that case, we |
751 | +diff -ruN a/storage/xtradb/include/ut0byte.ic b/storage/xtradb/include/ut0byte.ic |
752 | +--- a/storage/xtradb/include/ut0byte.ic |
753 | ++++ b/storage/xtradb/include/ut0byte.ic |
754 | +@@ -168,6 +168,16 @@ |
755 | + dulint a, /*!< in: dulint */ |
756 | + ulint b) /*!< in: ulint */ |
757 | + { |
758 | ++#if SIZEOF_LONG != 4 |
759 | ++ { |
760 | ++ ulint b_h; |
761 | ++ |
762 | ++ b_h = b >> 32; |
763 | ++ b &= 0xFFFFFFFFUL; |
764 | ++ a.high += b_h; |
765 | ++ } |
766 | ++#endif |
767 | ++ |
768 | + if (0xFFFFFFFFUL - b >= a.low) { |
769 | + a.low += b; |
770 | + |
771 | +@@ -191,6 +201,16 @@ |
772 | + dulint a, /*!< in: dulint */ |
773 | + ulint b) /*!< in: ulint, b <= a */ |
774 | + { |
775 | ++#if SIZEOF_LONG != 4 |
776 | ++ { |
777 | ++ ulint b_h; |
778 | ++ |
779 | ++ b_h = b >> 32; |
780 | ++ b &= 0xFFFFFFFFUL; |
781 | ++ a.high -= b_h; |
782 | ++ } |
783 | ++#endif |
784 | ++ |
785 | + if (a.low >= b) { |
786 | + a.low -= b; |
787 | + |
788 | +@@ -235,6 +255,10 @@ |
789 | + |
790 | + ut_ad(diff > a.low); |
791 | + |
792 | ++#if SIZEOF_LONG != 4 |
793 | ++ diff += (a.high - b.high - 1) << 32; |
794 | ++#endif |
795 | ++ |
796 | + return(diff); |
797 | + } |
798 | + |
799 | +diff -ruN a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c |
800 | +--- a/storage/xtradb/log/log0log.c |
801 | ++++ b/storage/xtradb/log/log0log.c |
802 | +@@ -1370,7 +1370,7 @@ |
803 | + #endif /* UNIV_DEBUG */ |
804 | + ulint unlock; |
805 | + |
806 | +- if (recv_no_ibuf_operations) { |
807 | ++ if (recv_no_ibuf_operations || srv_fake_write) { |
808 | + /* Recovery is running and no operations on the log files are |
809 | + allowed yet (the variable name .._no_ibuf_.. is misleading) */ |
810 | + |
811 | +@@ -2032,7 +2032,7 @@ |
812 | + return(TRUE); |
813 | + } |
814 | + |
815 | +- ut_ad(log_sys->flushed_to_disk_lsn >= oldest_lsn); |
816 | ++ ut_ad(srv_fake_write || log_sys->flushed_to_disk_lsn >= oldest_lsn); |
817 | + |
818 | + if (log_sys->n_pending_checkpoint_writes > 0) { |
819 | + /* A checkpoint write is running */ |
820 | +@@ -3126,6 +3126,7 @@ |
821 | + for the 'very fast' shutdown, because the InnoDB layer may have |
822 | + committed or prepared transactions and we don't want to lose them. */ |
823 | + |
824 | ++ if (!srv_apply_log_only) { |
825 | + if (trx_n_mysql_transactions > 0 |
826 | + || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) { |
827 | + |
828 | +@@ -3133,6 +3134,7 @@ |
829 | + |
830 | + goto loop; |
831 | + } |
832 | ++ } |
833 | + |
834 | + if (srv_fast_shutdown == 2) { |
835 | + /* In this fastest shutdown we do not flush the buffer pool: |
836 | +diff -ruN a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c |
837 | +--- a/storage/xtradb/log/log0recv.c |
838 | ++++ b/storage/xtradb/log/log0recv.c |
839 | +@@ -42,27 +42,27 @@ |
840 | + #include "trx0undo.h" |
841 | + #include "trx0rec.h" |
842 | + #include "fil0fil.h" |
843 | +-#ifndef UNIV_HOTBACKUP |
844 | ++//#ifndef UNIV_HOTBACKUP |
845 | + # include "buf0rea.h" |
846 | + # include "srv0srv.h" |
847 | + # include "srv0start.h" |
848 | + # include "trx0roll.h" |
849 | + # include "row0merge.h" |
850 | + # include "sync0sync.h" |
851 | +-#else /* !UNIV_HOTBACKUP */ |
852 | ++//#else /* !UNIV_HOTBACKUP */ |
853 | + |
854 | + /** This is set to FALSE if the backup was originally taken with the |
855 | + ibbackup --include regexp option: then we do not want to create tables in |
856 | + directories which were not included */ |
857 | + UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
858 | +-#endif /* !UNIV_HOTBACKUP */ |
859 | ++//#endif /* !UNIV_HOTBACKUP */ |
860 | + |
861 | + /** Log records are stored in the hash table in chunks at most of this size; |
862 | + this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
863 | + #define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t)) |
864 | + |
865 | + /** Read-ahead area in applying log records to file pages */ |
866 | +-#define RECV_READ_AHEAD_AREA 32 |
867 | ++#define RECV_READ_AHEAD_AREA 128 |
868 | + |
869 | + /** The recovery system */ |
870 | + UNIV_INTERN recv_sys_t* recv_sys = NULL; |
871 | +@@ -621,7 +621,7 @@ |
872 | + /***********************************************************************//** |
873 | + Checks the consistency of the checkpoint info |
874 | + @return TRUE if ok */ |
875 | +-static |
876 | ++//static |
877 | + ibool |
878 | + recv_check_cp_is_consistent( |
879 | + /*========================*/ |
880 | +@@ -651,7 +651,7 @@ |
881 | + /********************************************************//** |
882 | + Looks for the maximum consistent checkpoint from the log groups. |
883 | + @return error code or DB_SUCCESS */ |
884 | +-static |
885 | ++//static |
886 | + ulint |
887 | + recv_find_max_checkpoint( |
888 | + /*=====================*/ |
889 | +@@ -840,7 +840,7 @@ |
890 | + InnoDB-3.23.52 where the checksum field contains the log block number. |
891 | + @return TRUE if ok, or if the log block may be in the format of InnoDB |
892 | + version predating 3.23.52 */ |
893 | +-static |
894 | ++//static |
895 | + ibool |
896 | + log_block_checksum_is_ok_or_old_format( |
897 | + /*===================================*/ |
898 | +@@ -2369,7 +2369,7 @@ |
899 | + || type == MLOG_FILE_RENAME |
900 | + || type == MLOG_FILE_DELETE) { |
901 | + ut_a(space); |
902 | +-#ifdef UNIV_HOTBACKUP |
903 | ++//#ifdef UNIV_HOTBACKUP |
904 | + if (recv_replay_file_ops) { |
905 | + |
906 | + /* In ibbackup --apply-log, replay an .ibd file |
907 | +@@ -2392,7 +2392,7 @@ |
908 | + ut_error; |
909 | + } |
910 | + } |
911 | +-#endif |
912 | ++//#endif |
913 | + /* In normal mysqld crash recovery we do not try to |
914 | + replay file operations */ |
915 | + #ifdef UNIV_LOG_LSN_DEBUG |
916 | +@@ -2809,8 +2809,11 @@ |
917 | + |
918 | + fprintf(stderr, |
919 | + "InnoDB: Doing recovery: scanned up to" |
920 | +- " log sequence number %llu\n", |
921 | +- *group_scanned_lsn); |
922 | ++ " log sequence number %llu (%lu %%)\n", |
923 | ++ *group_scanned_lsn, |
924 | ++ (ulong) (*group_scanned_lsn - srv_oldest_lsn) |
925 | ++ / (8 * log_group_get_capacity(UT_LIST_GET_FIRST(log_sys->log_groups))/900) |
926 | ++ ); |
927 | + } |
928 | + } |
929 | + |
930 | +@@ -2923,12 +2926,14 @@ |
931 | + |
932 | + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
933 | + |
934 | ++#ifdef UNDEFINED |
935 | + fprintf(stderr, |
936 | + "InnoDB: Restoring possible" |
937 | + " half-written data pages from" |
938 | + " the doublewrite\n" |
939 | + "InnoDB: buffer...\n"); |
940 | +- trx_sys_doublewrite_init_or_restore_pages(TRUE); |
941 | ++#endif |
942 | ++ trx_sys_doublewrite_init_or_restore_pages(FALSE); |
943 | + } |
944 | + } |
945 | + |
946 | +@@ -3096,6 +3101,7 @@ |
947 | + recv_sys->recovered_lsn = checkpoint_lsn; |
948 | + |
949 | + srv_start_lsn = checkpoint_lsn; |
950 | ++ srv_oldest_lsn = checkpoint_lsn; |
951 | + } |
952 | + |
953 | + contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
954 | +@@ -3454,6 +3460,7 @@ |
955 | + that the data dictionary tables will be free of any locks. |
956 | + The data dictionary latch should guarantee that there is at |
957 | + most one data dictionary transaction active at a time. */ |
958 | ++ if (!srv_apply_log_only) |
959 | + trx_rollback_or_clean_recovered(FALSE); |
960 | + } |
961 | + |
962 | +diff -ruN a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c |
963 | +--- a/storage/xtradb/os/os0file.c |
964 | ++++ b/storage/xtradb/os/os0file.c |
965 | +@@ -554,7 +554,7 @@ |
966 | + } |
967 | + |
968 | + #undef USE_FILE_LOCK |
969 | +-#define USE_FILE_LOCK |
970 | ++//#define USE_FILE_LOCK |
971 | + #if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) |
972 | + /* InnoDB Hot Backup does not lock the data files. |
973 | + * On Windows, mandatory locking is used. |
974 | +@@ -1356,8 +1356,9 @@ |
975 | + attributes = 0; |
976 | + ut_error; |
977 | + } |
978 | +- |
979 | ++ share_mode |= FILE_SHARE_WRITE; /* Why? */ |
980 | + file = CreateFile((LPCTSTR) name, |
981 | ++ (srv_read_only && create_flag == OPEN_EXISTING) ? GENERIC_READ : |
982 | + GENERIC_READ | GENERIC_WRITE, /* read and write |
983 | + access */ |
984 | + share_mode, /* File can be read also by other |
985 | +@@ -1416,7 +1417,11 @@ |
986 | + if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW |
987 | + || create_mode == OS_FILE_OPEN_RETRY) { |
988 | + mode_str = "OPEN"; |
989 | +- create_flag = O_RDWR; |
990 | ++ if (srv_read_only) { |
991 | ++ create_flag = O_RDONLY; |
992 | ++ } else { |
993 | ++ create_flag = O_RDWR; |
994 | ++ } |
995 | + } else if (create_mode == OS_FILE_CREATE) { |
996 | + mode_str = "CREATE"; |
997 | + create_flag = O_RDWR | O_CREAT | O_EXCL; |
998 | +@@ -2622,6 +2627,9 @@ |
999 | + ut_a((offset & 0xFFFFFFFFUL) == offset); |
1000 | + ut_a((n & 0xFFFFFFFFUL) == n); |
1001 | + |
1002 | ++ if (srv_fake_write) |
1003 | ++ return(TRUE); |
1004 | ++ |
1005 | + os_n_file_writes++; |
1006 | + |
1007 | + ut_ad(file); |
1008 | +@@ -2746,6 +2754,9 @@ |
1009 | + #else |
1010 | + ssize_t ret; |
1011 | + |
1012 | ++ if (srv_fake_write) |
1013 | ++ return(TRUE); |
1014 | ++ |
1015 | + ret = os_file_pwrite(file, buf, n, offset, offset_high); |
1016 | + |
1017 | + if ((ulint)ret == n) { |
1018 | +diff -ruN a/storage/xtradb/os/os0thread.c b/storage/xtradb/os/os0thread.c |
1019 | +--- a/storage/xtradb/os/os0thread.c |
1020 | ++++ b/storage/xtradb/os/os0thread.c |
1021 | +@@ -287,12 +287,17 @@ |
1022 | + #elif defined(__NETWARE__) |
1023 | + delay(tm / 1000); |
1024 | + #else |
1025 | ++ /* select() simetimes hang up from xtrabackup */ |
1026 | ++ /* change to use usleep() for now */ |
1027 | ++ usleep(tm); |
1028 | ++/* |
1029 | + struct timeval t; |
1030 | + |
1031 | + t.tv_sec = tm / 1000000; |
1032 | + t.tv_usec = tm % 1000000; |
1033 | + |
1034 | + select(0, NULL, NULL, NULL, &t); |
1035 | ++*/ |
1036 | + #endif |
1037 | + } |
1038 | + |
1039 | +diff -ruN a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c |
1040 | +--- a/storage/xtradb/row/row0merge.c |
1041 | ++++ b/storage/xtradb/row/row0merge.c |
1042 | +@@ -453,7 +453,9 @@ |
1043 | + rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); |
1044 | + offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
1045 | + |
1046 | +- innobase_rec_to_mysql(dup->table, rec, index, offsets); |
1047 | ++ //innobase_rec_to_mysql(dup->table, rec, index, offsets); |
1048 | ++ fprintf(stderr, "InnoDB: Error: row_merge_dup_report() is called.\n"); |
1049 | ++ ut_error; |
1050 | + |
1051 | + mem_heap_free(heap); |
1052 | + } |
1053 | +@@ -1464,8 +1466,11 @@ |
1054 | + case 0: |
1055 | + if (UNIV_UNLIKELY |
1056 | + (dict_index_is_unique(index) && !null_eq)) { |
1057 | +- innobase_rec_to_mysql(table, mrec0, |
1058 | +- index, offsets0); |
1059 | ++ //innobase_rec_to_mysql(table, mrec0, |
1060 | ++ // index, offsets0); |
1061 | ++ (void) table; |
1062 | ++ fprintf(stderr, "InnoDB: Error: row_merge_blocks() is called.\n"); |
1063 | ++ ut_error; |
1064 | + mem_heap_free(heap); |
1065 | + return(DB_DUPLICATE_KEY); |
1066 | + } |
1067 | +@@ -2593,7 +2598,9 @@ |
1068 | + |
1069 | + /* Reset the MySQL row buffer that is used when reporting |
1070 | + duplicate keys. */ |
1071 | +- innobase_rec_reset(table); |
1072 | ++ //innobase_rec_reset(table); |
1073 | ++ fprintf(stderr, "InnoDB: Error: row_merge_build_indexes() is called.\n"); |
1074 | ++ ut_error; |
1075 | + |
1076 | + /* Read clustered index of the table and create files for |
1077 | + secondary index entries for merge sort */ |
1078 | +diff -ruN a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c |
1079 | +--- a/storage/xtradb/srv/srv0srv.c |
1080 | ++++ b/storage/xtradb/srv/srv0srv.c |
1081 | +@@ -402,6 +402,10 @@ |
1082 | + |
1083 | + UNIV_INTERN ulong srv_replication_delay = 0; |
1084 | + |
1085 | ++UNIV_INTERN ibool srv_read_only = FALSE; |
1086 | ++UNIV_INTERN ibool srv_fake_write = FALSE; |
1087 | ++UNIV_INTERN ibool srv_apply_log_only = FALSE; |
1088 | ++ |
1089 | + UNIV_INTERN long long srv_ibuf_max_size = 0; |
1090 | + UNIV_INTERN ulint srv_ibuf_active_contract = 0; /* 0:disable 1:enable */ |
1091 | + UNIV_INTERN ulint srv_ibuf_accel_rate = 100; |
1092 | +@@ -1050,7 +1054,7 @@ |
1093 | + } |
1094 | + |
1095 | + /* Initialize some INFORMATION SCHEMA internal structures */ |
1096 | +- trx_i_s_cache_init(trx_i_s_cache); |
1097 | ++ //trx_i_s_cache_init(trx_i_s_cache); |
1098 | + } |
1099 | + |
1100 | + /*********************************************************************//** |
1101 | +@@ -1061,6 +1065,7 @@ |
1102 | + /*==========*/ |
1103 | + { |
1104 | + os_fast_mutex_free(&srv_conc_mutex); |
1105 | ++#ifdef UNDEFINED |
1106 | + mem_free(srv_conc_slots); |
1107 | + srv_conc_slots = NULL; |
1108 | + |
1109 | +@@ -1074,6 +1079,7 @@ |
1110 | + srv_mysql_table = NULL; |
1111 | + |
1112 | + trx_i_s_cache_free(trx_i_s_cache); |
1113 | ++#endif |
1114 | + } |
1115 | + |
1116 | + /*********************************************************************//** |
1117 | +diff -ruN a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c |
1118 | +--- a/storage/xtradb/srv/srv0start.c |
1119 | ++++ b/storage/xtradb/srv/srv0start.c |
1120 | +@@ -94,6 +94,8 @@ |
1121 | + /** Log sequence number at shutdown */ |
1122 | + UNIV_INTERN ib_uint64_t srv_shutdown_lsn; |
1123 | + |
1124 | ++UNIV_INTERN ib_uint64_t srv_oldest_lsn; |
1125 | ++ |
1126 | + #ifdef HAVE_DARWIN_THREADS |
1127 | + # include <sys/utsname.h> |
1128 | + /** TRUE if the F_FULLFSYNC option is available */ |
1129 | +@@ -544,7 +546,7 @@ |
1130 | + /*********************************************************************//** |
1131 | + Creates or opens the log files and closes them. |
1132 | + @return DB_SUCCESS or error code */ |
1133 | +-static |
1134 | ++//static |
1135 | + ulint |
1136 | + open_or_create_log_file( |
1137 | + /*====================*/ |
1138 | +@@ -702,7 +704,7 @@ |
1139 | + /*********************************************************************//** |
1140 | + Creates or opens database data files and closes them. |
1141 | + @return DB_SUCCESS or error code */ |
1142 | +-static |
1143 | ++//static |
1144 | + ulint |
1145 | + open_or_create_data_files( |
1146 | + /*======================*/ |
1147 | +@@ -1777,6 +1779,10 @@ |
1148 | + are initialized in trx_sys_init_at_db_start(). */ |
1149 | + |
1150 | + recv_recovery_from_checkpoint_finish(); |
1151 | ++ |
1152 | ++ if (srv_apply_log_only) |
1153 | ++ goto skip_processes; |
1154 | ++ |
1155 | + if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
1156 | + /* The following call is necessary for the insert |
1157 | + buffer to work with multiple tablespaces. We must |
1158 | +@@ -1952,7 +1958,18 @@ |
1159 | + |
1160 | + if (srv_auto_extend_last_data_file |
1161 | + && sum_of_data_file_sizes < tablespace_size_in_header) { |
1162 | ++ /* extend table space size aligning with header */ |
1163 | ++ ulint actual_size; |
1164 | ++ fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); |
1165 | ++ if (actual_size < tablespace_size_in_header) { |
1166 | ++ fprintf(stderr, |
1167 | ++"InnoDB: Warning: To extend tablespace size aligning with header seems to be failed.\n" |
1168 | ++"InnoDB: The acutual size %lu must be larger than %lu.\n", |
1169 | ++ (ulong) actual_size, |
1170 | ++ (ulong) tablespace_size_in_header); |
1171 | ++ } |
1172 | + |
1173 | ++#ifdef UNDEFINED |
1174 | + fprintf(stderr, |
1175 | + "InnoDB: Error: tablespace size stored in header" |
1176 | + " is %lu pages, but\n" |
1177 | +@@ -1977,6 +1994,7 @@ |
1178 | + |
1179 | + return(DB_ERROR); |
1180 | + } |
1181 | ++#endif |
1182 | + } |
1183 | + |
1184 | + /* Check that os_fast_mutexes work as expected */ |
1185 | +@@ -2079,6 +2097,7 @@ |
1186 | + ibuf_update_max_tablespace_id(); |
1187 | + } |
1188 | + |
1189 | ++skip_processes: |
1190 | + srv_file_per_table = srv_file_per_table_original_value; |
1191 | + |
1192 | + srv_was_started = TRUE; |
1193 | +diff -ruN a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c |
1194 | +--- a/storage/xtradb/trx/trx0purge.c |
1195 | ++++ b/storage/xtradb/trx/trx0purge.c |
1196 | +@@ -1113,6 +1113,9 @@ |
1197 | + /* que_thr_t* thr2; */ |
1198 | + ulint old_pages_handled; |
1199 | + |
1200 | ++ if (srv_fake_write) |
1201 | ++ return(0); |
1202 | ++ |
1203 | + mutex_enter(&(purge_sys->mutex)); |
1204 | + |
1205 | + if (purge_sys->trx->n_active_thrs > 0) { |
1206 | +diff -ruN a/storage/xtradb/trx/trx0rseg.c b/storage/xtradb/trx/trx0rseg.c |
1207 | +--- a/storage/xtradb/trx/trx0rseg.c |
1208 | ++++ b/storage/xtradb/trx/trx0rseg.c |
1209 | +@@ -143,9 +143,11 @@ |
1210 | + |
1211 | + mutex_free(&rseg->mutex); |
1212 | + |
1213 | ++ if (!srv_apply_log_only) { |
1214 | + /* There can't be any active transactions. */ |
1215 | + ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
1216 | + ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
1217 | ++ } |
1218 | + |
1219 | + undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
1220 | + |
1221 | +diff -ruN a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c |
1222 | +--- a/storage/xtradb/trx/trx0sys.c |
1223 | ++++ b/storage/xtradb/trx/trx0sys.c |
1224 | +@@ -1931,10 +1931,12 @@ |
1225 | + UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
1226 | + } |
1227 | + |
1228 | ++ if (!srv_apply_log_only) { |
1229 | + ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0); |
1230 | + ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0); |
1231 | + ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
1232 | + ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
1233 | ++ } |
1234 | + |
1235 | + mem_free(trx_sys); |
1236 | + |
1237 | +diff -ruN a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c |
1238 | +--- a/storage/xtradb/trx/trx0trx.c |
1239 | ++++ b/storage/xtradb/trx/trx0trx.c |
1240 | +@@ -109,8 +109,6 @@ |
1241 | + |
1242 | + trx->support_xa = TRUE; |
1243 | + |
1244 | +- trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */ |
1245 | +- |
1246 | + trx->check_foreigns = TRUE; |
1247 | + trx->check_unique_secondary = TRUE; |
1248 | + |
1249 | +@@ -493,8 +491,8 @@ |
1250 | + TRX_ID_PREP_PRINTF(trx->id)); |
1251 | + |
1252 | + if (srv_force_recovery == 0) { |
1253 | +- |
1254 | +- trx->conc_state = TRX_PREPARED; |
1255 | ++ /* xtrabackup should rollback it */ |
1256 | ++ trx->conc_state = TRX_ACTIVE; |
1257 | + } else { |
1258 | + fprintf(stderr, |
1259 | + "InnoDB: Since" |
1260 | +@@ -570,9 +568,9 @@ |
1261 | + trx->id)); |
1262 | + |
1263 | + if (srv_force_recovery == 0) { |
1264 | +- |
1265 | ++ /* xtrabackup should rollback it */ |
1266 | + trx->conc_state |
1267 | +- = TRX_PREPARED; |
1268 | ++ = TRX_ACTIVE; |
1269 | + } else { |
1270 | + fprintf(stderr, |
1271 | + "InnoDB: Since" |
1272 | +@@ -737,9 +735,6 @@ |
1273 | + generated by the same transaction, doesn't. */ |
1274 | + trx->support_xa = thd_supports_xa(trx->mysql_thd); |
1275 | + |
1276 | +- trx->flush_log_at_trx_commit_session = |
1277 | +- thd_flush_log_at_trx_commit_session(trx->mysql_thd); |
1278 | +- |
1279 | + mutex_enter(&kernel_mutex); |
1280 | + |
1281 | + ret = trx_start_low(trx, rseg_id); |
1282 | +@@ -921,7 +916,6 @@ |
1283 | + trx->read_view = NULL; |
1284 | + |
1285 | + if (lsn) { |
1286 | +- ulint flush_log_at_trx_commit; |
1287 | + |
1288 | + mutex_exit(&kernel_mutex); |
1289 | + |
1290 | +@@ -930,12 +924,6 @@ |
1291 | + trx_undo_insert_cleanup(trx); |
1292 | + } |
1293 | + |
1294 | +- if (trx->flush_log_at_trx_commit_session == 3) { |
1295 | +- flush_log_at_trx_commit = srv_flush_log_at_trx_commit; |
1296 | +- } else { |
1297 | +- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session; |
1298 | +- } |
1299 | +- |
1300 | + /* NOTE that we could possibly make a group commit more |
1301 | + efficient here: call os_thread_yield here to allow also other |
1302 | + trxs to come to commit! */ |
1303 | +@@ -967,9 +955,9 @@ |
1304 | + if (trx->flush_log_later) { |
1305 | + /* Do nothing yet */ |
1306 | + trx->must_flush_log_later = TRUE; |
1307 | +- } else if (flush_log_at_trx_commit == 0) { |
1308 | ++ } else if (srv_flush_log_at_trx_commit == 0) { |
1309 | + /* Do nothing */ |
1310 | +- } else if (flush_log_at_trx_commit == 1) { |
1311 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
1312 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
1313 | + /* Write the log but do not flush it to disk */ |
1314 | + |
1315 | +@@ -981,7 +969,7 @@ |
1316 | + |
1317 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
1318 | + } |
1319 | +- } else if (flush_log_at_trx_commit == 2) { |
1320 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
1321 | + |
1322 | + /* Write the log but do not flush it to disk */ |
1323 | + |
1324 | +@@ -1661,23 +1649,16 @@ |
1325 | + trx_t* trx) /*!< in: trx handle */ |
1326 | + { |
1327 | + ib_uint64_t lsn = trx->commit_lsn; |
1328 | +- ulint flush_log_at_trx_commit; |
1329 | + |
1330 | + ut_a(trx); |
1331 | + |
1332 | + trx->op_info = "flushing log"; |
1333 | + |
1334 | +- if (trx->flush_log_at_trx_commit_session == 3) { |
1335 | +- flush_log_at_trx_commit = srv_flush_log_at_trx_commit; |
1336 | +- } else { |
1337 | +- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session; |
1338 | +- } |
1339 | +- |
1340 | + if (!trx->must_flush_log_later) { |
1341 | + /* Do nothing */ |
1342 | +- } else if (flush_log_at_trx_commit == 0) { |
1343 | ++ } else if (srv_flush_log_at_trx_commit == 0) { |
1344 | + /* Do nothing */ |
1345 | +- } else if (flush_log_at_trx_commit == 1) { |
1346 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
1347 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
1348 | + /* Write the log but do not flush it to disk */ |
1349 | + |
1350 | +@@ -1688,7 +1669,7 @@ |
1351 | + |
1352 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
1353 | + } |
1354 | +- } else if (flush_log_at_trx_commit == 2) { |
1355 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
1356 | + |
1357 | + /* Write the log but do not flush it to disk */ |
1358 | + |
1359 | +@@ -1948,8 +1929,6 @@ |
1360 | + /*--------------------------------------*/ |
1361 | + |
1362 | + if (lsn) { |
1363 | +- ulint flush_log_at_trx_commit; |
1364 | +- |
1365 | + /* Depending on the my.cnf options, we may now write the log |
1366 | + buffer to the log files, making the prepared state of the |
1367 | + transaction durable if the OS does not crash. We may also |
1368 | +@@ -1969,15 +1948,9 @@ |
1369 | + |
1370 | + mutex_exit(&kernel_mutex); |
1371 | + |
1372 | +- if (trx->flush_log_at_trx_commit_session == 3) { |
1373 | +- flush_log_at_trx_commit = srv_flush_log_at_trx_commit; |
1374 | +- } else { |
1375 | +- flush_log_at_trx_commit = trx->flush_log_at_trx_commit_session; |
1376 | +- } |
1377 | +- |
1378 | +- if (flush_log_at_trx_commit == 0) { |
1379 | ++ if (srv_flush_log_at_trx_commit == 0) { |
1380 | + /* Do nothing */ |
1381 | +- } else if (flush_log_at_trx_commit == 1) { |
1382 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
1383 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
1384 | + /* Write the log but do not flush it to disk */ |
1385 | + |
1386 | +@@ -1989,7 +1962,7 @@ |
1387 | + |
1388 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
1389 | + } |
1390 | +- } else if (flush_log_at_trx_commit == 2) { |
1391 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
1392 | + |
1393 | + /* Write the log but do not flush it to disk */ |
1394 | + |
1395 | |
1396 | === modified file 'test/bootstrap.sh' |
1397 | --- test/bootstrap.sh 2011-09-21 05:08:24 +0000 |
1398 | +++ test/bootstrap.sh 2011-10-10 06:52:24 +0000 |
1399 | @@ -13,7 +13,7 @@ |
1400 | tests. |
1401 | |
1402 | If the argument is one of the build targets passed to build.sh |
1403 | -(i.e. innodb51_builtin innodb51 innodb55 xtradb51 xtradb55) then the |
1404 | +(i.e. innodb51_builtin innodb51 innodb55 xtradb51 xtradb55 mariadb53) then the |
1405 | appropriate Linux tarball is downloaded from a pre-defined location and |
1406 | unpacked into the specified installation directory ('./server' by default). |
1407 | |
1408 | @@ -36,18 +36,31 @@ |
1409 | innodb51_builtin | innodb51) |
1410 | url="http://s3.amazonaws.com/percona.com/downloads/community" |
1411 | tarball="mysql-5.1.49-linux-$arch-glibc23.tar.gz" |
1412 | + sha1sum="1113d7f9c1061f0c882142e2a0b066d07dd66873" |
1413 | ;; |
1414 | innodb55) |
1415 | url="http://s3.amazonaws.com/percona.com/downloads/community" |
1416 | +<<<<<<< TREE |
1417 | tarball="mysql-5.5.16-linux2.6-$arch.tar.gz" |
1418 | +======= |
1419 | + tarball="mysql-5.5.6-rc-linux2.6-$arch.tar.gz" |
1420 | + sha1sum="ea6616232d96e0fc768a0d4b33957e163bcc3b3d" |
1421 | +>>>>>>> MERGE-SOURCE |
1422 | ;; |
1423 | xtradb51) |
1424 | url="http://s3.amazonaws.com/percona.com/downloads/Percona-Server-5.1/Percona-Server-5.1.57-12.8/Linux/binary" |
1425 | tarball="Percona-Server-5.1.57-rel12.8-233-Linux-$arch.tar.gz" |
1426 | + sha1sum="18f8058e29080532d810da95a62be4ca3e3c783c" |
1427 | ;; |
1428 | xtradb55) |
1429 | url="http://s3.amazonaws.com/percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.11-20.2/Linux/binary" |
1430 | tarball="Percona-Server-5.5.11-rel20.2-116.Linux.$arch.tar.gz" |
1431 | + sha1sum="807b84e7f725634d354ce8154c1522695e638c0f" |
1432 | + ;; |
1433 | + mariadb53) |
1434 | + url="http://mirrors.supportex.net/mariadb/mariadb-5.3.1-beta/kvm-bintar-hardy-amd64/" |
1435 | + tarball="mariadb-5.3.1-beta-Linux-$arch.tar.gz" |
1436 | + sha1sum="bdd9bc0f0e495260c9bff0e618c4c656ee6d42e3" |
1437 | ;; |
1438 | *) |
1439 | if ! test -r "$1" |
1440 | @@ -69,7 +82,29 @@ |
1441 | if test -n "$url" |
1442 | then |
1443 | echo "Downloading $tarball" |
1444 | + set +e |
1445 | wget -qc "$url/$tarball" |
1446 | + wgeterr=$? |
1447 | + set -e |
1448 | + if [ $wgeterr -ne 0 ] |
1449 | + then |
1450 | + echo "Download failed. wget return code: $wgeterr" |
1451 | + exit 1 |
1452 | + fi |
1453 | +fi |
1454 | + |
1455 | +if test -n "$sha1sum" |
1456 | +then |
1457 | + if test -x /usr/bin/sha1sum |
1458 | + then |
1459 | + echo "Checking SHA1 checksum" |
1460 | + sum=`sha1sum $tarball | awk '{ print $1}'` |
1461 | + if [ $sum != $sha1sum ] |
1462 | + then |
1463 | + echo "Stored SHA1 sum (${sha1sum}) does not match calculated sum (${sum})" |
1464 | + exit 1 |
1465 | + fi |
1466 | + fi |
1467 | fi |
1468 | |
1469 | if test -d "$destdir" |
1470 | |
1471 | === modified file 'test/run.sh' |
1472 | --- test/run.sh 2011-07-05 06:22:41 +0000 |
1473 | +++ test/run.sh 2011-10-10 06:52:24 +0000 |
1474 | @@ -155,8 +155,14 @@ |
1475 | else |
1476 | XB_BIN="xtrabackup_innodb55" |
1477 | fi |
1478 | + elif [ "${MYSQL_VERSION:0:3}" = "5.2" ] # MariaDB 5.2 |
1479 | + then |
1480 | + XB_BIN="xtrabackup" |
1481 | + elif [ "${MYSQL_VERSION:0:3}" = "5.3" ] # MariaDB 5.3 |
1482 | + then |
1483 | + XB_BIN="xtrabackup" |
1484 | else |
1485 | - vlog "Uknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION" |
1486 | + vlog "Unknown MySQL/InnoDB version: $MYSQL_VERSION/$INNODB_VERSION" |
1487 | exit -1 |
1488 | fi |
1489 | fi |
1490 | @@ -226,7 +232,12 @@ |
1491 | |
1492 | if [ -n "$XTRADB_VERSION" ] |
1493 | then |
1494 | - echo "Running against Percona Server $MYSQL_VERSION (XtraDB $INNODB_VERSION)" | tee -a $OUTFILE |
1495 | + if [ ${MYSQL_VERSION:6:7} = "MariaDB" ] |
1496 | + then |
1497 | + echo "Running against MariaDB $MYSQL_VERSION (XtraDB $INNODB_VERSION)" | tee -a $OUTFILE |
1498 | + else |
1499 | + echo "Running against Percona Server $MYSQL_VERSION (XtraDB $INNODB_VERSION)" | tee -a $OUTFILE |
1500 | + fi |
1501 | else |
1502 | echo "Running against MySQL $MYSQL_VERSION (InnoDB $INNODB_VERSION)" | tee -a $OUTFILE |
1503 | fi |
1504 | |
1505 | === added file 'test/t/ib_aria.sh' |
1506 | --- test/t/ib_aria.sh 1970-01-01 00:00:00 +0000 |
1507 | +++ test/t/ib_aria.sh 2011-10-10 06:52:24 +0000 |
1508 | @@ -0,0 +1,67 @@ |
1509 | +. inc/common.sh |
1510 | + |
1511 | +if [ ${MYSQL_VERSION:6:7} != "MariaDB" ] |
1512 | +then |
1513 | + echo "Requires MariaDB" >$SKIPPED_REASON |
1514 | + exit $SKIPPED_EXIT_CODE |
1515 | +fi |
1516 | + |
1517 | +init |
1518 | +run_mysqld --innodb_file_per_table |
1519 | +run_cmd ${MYSQL} ${MYSQL_ARGS} -e "create database aria" |
1520 | +run_cmd ${MYSQL} ${MYSQL_ARGS} -e "set sql_mode='NO_ENGINE_SUBSTITUTION'; create table aria (a int NOT NULL ) ENGINE=Aria" aria |
1521 | +# Adding initial rows |
1522 | +vlog "Adding initial rows to database..." |
1523 | +numrow=100 |
1524 | +count=0 |
1525 | +while [ "$numrow" -gt "$count" ] |
1526 | +do |
1527 | + ${MYSQL} ${MYSQL_ARGS} -e "insert into aria values ($count);" aria |
1528 | + let "count=count+1" |
1529 | +done |
1530 | +vlog "Initial rows added" |
1531 | + |
1532 | +# Full backup |
1533 | +# backup root directory |
1534 | +mkdir -p $topdir/backup |
1535 | + |
1536 | +vlog "Starting backup" |
1537 | +innobackupex $topdir/backup > $OUTFILE 2>&1 |
1538 | +full_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{print $2}'` |
1539 | +vlog "Full backup done to directory $full_backup_dir" |
1540 | + |
1541 | +# Saving the checksum of original table |
1542 | +checksum_a=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table aria;" aria | awk '{print $2}'` |
1543 | +vlog "Table checksum is $checksum_a" |
1544 | + |
1545 | +vlog "Preparing backup" |
1546 | +# Prepare backup |
1547 | +echo "###########" >> $OUTFILE |
1548 | +echo "# PREPARE #" >> $OUTFILE |
1549 | +echo "###########" >> $OUTFILE |
1550 | +innobackupex --apply-log $full_backup_dir >> $OUTFILE 2>&1 |
1551 | +vlog "Data prepared for restore" |
1552 | + |
1553 | +# Destroying mysql data |
1554 | +stop_mysqld |
1555 | +rm -rf $mysql_datadir/* |
1556 | +vlog "Data destroyed" |
1557 | + |
1558 | +# Restore backup |
1559 | +vlog "Copying files" |
1560 | +echo "###########" >> $OUTFILE |
1561 | +echo "# RESTORE #" >> $OUTFILE |
1562 | +echo "###########" >> $OUTFILE |
1563 | +innobackupex --copy-back $full_backup_dir >> $OUTFILE 2>&1 |
1564 | +vlog "Data restored" |
1565 | + |
1566 | +run_mysqld --innodb_file_per_table |
1567 | +vlog "Checking checksums" |
1568 | +checksum_b=`${MYSQL} ${MYSQL_ARGS} -Ns -e "checksum table aria" incremental_sample | awk '{print $2}'` |
1569 | + |
1570 | +if [ $checksum_a -ne $checksum_b ] |
1571 | +then |
1572 | + vlog "Checksums are not equal" |
1573 | + exit -1 |
1574 | +fi |
1575 | +vlog "Checksums are OK" |
1576 | |
1577 | === modified file 'utils/build.sh' |
1578 | --- utils/build.sh 2011-10-05 02:31:10 +0000 |
1579 | +++ utils/build.sh 2011-10-10 06:52:24 +0000 |
1580 | @@ -4,6 +4,7 @@ |
1581 | |
1582 | MYSQL_51_VERSION=5.1.56 |
1583 | MYSQL_55_VERSION=5.5.10 |
1584 | +MARIADB_53_VERSION=5.3.1-beta |
1585 | |
1586 | AUTO_DOWNLOAD=${AUTO_DOWNLOAD:-no} |
1587 | MASTER_SITE="http://s3.amazonaws.com/percona.com/downloads/community" |
1588 | @@ -44,8 +45,9 @@ |
1589 | echo " innodb51_builtin | 5.1 build against built-in InnoDB in MySQL 5.1" |
1590 | echo " innodb51 | plugin build agsinst InnoDB plugin in MySQL 5.1" |
1591 | echo " innodb55 | 5.5 build against InnoDB in MySQL 5.5" |
1592 | - echo " xtradb51 | xtradb build against Percona Server with XtraDB 5.1" |
1593 | - echo " xtradb55 | xtradb55 build against Percona Server with XtraDB 5.5" |
1594 | + echo " xtradb51 | xtradb build against Percona Server with XtraDB 5.1" |
1595 | + echo " xtradb55 | xtradb55 build against Percona Server with XtraDB 5.5" |
1596 | + echo " mariadb53 | mariadb build against Percona Server with XtraDB 5.5" |
1597 | exit -1 |
1598 | } |
1599 | |
1600 | @@ -102,7 +104,7 @@ |
1601 | eval $configure_cmd |
1602 | |
1603 | echo "Building the server" |
1604 | - make_dirs include zlib strings mysys dbug extra |
1605 | + make_dirs include zlib strings mysys dbug extra libservices |
1606 | make_dirs $innodb_dir |
1607 | cd $top_dir |
1608 | } |
1609 | @@ -145,8 +147,8 @@ |
1610 | function build_all() |
1611 | { |
1612 | local mysql_version_short=${mysql_version:0:3} |
1613 | - server_dir=$top_dir/mysql-$mysql_version_short |
1614 | - server_tarball=mysql-$mysql_version.tar.gz |
1615 | + server_dir=$top_dir/$mysql_brand-$mysql_version_short |
1616 | + server_tarball=$mysql_brand-$mysql_version.tar.gz |
1617 | innodb_dir=$server_dir/storage/$innodb_name |
1618 | build_dir=$innodb_dir/xtrabackup |
1619 | |
1620 | @@ -157,7 +159,7 @@ |
1621 | |
1622 | echo "Preparing sources" |
1623 | unpack_and_patch $server_tarball $server_patch |
1624 | - mv $top_dir/mysql-$mysql_version $server_dir |
1625 | + mv $top_dir/$mysql_brand-$mysql_version $server_dir |
1626 | |
1627 | build_server |
1628 | |
1629 | @@ -177,6 +179,7 @@ |
1630 | |
1631 | case "$type" in |
1632 | "innodb51_builtin" | "5.1") |
1633 | + mysql_brand=mysql |
1634 | mysql_version=$MYSQL_51_VERSION |
1635 | server_patch=innodb51_builtin.patch |
1636 | innodb_name=innobase |
1637 | @@ -192,6 +195,7 @@ |
1638 | ;; |
1639 | |
1640 | "innodb51" | "plugin") |
1641 | + mysql_brand=mysql |
1642 | mysql_version=$MYSQL_51_VERSION |
1643 | server_patch=innodb51.patch |
1644 | innodb_name=innodb_plugin |
1645 | @@ -206,6 +210,7 @@ |
1646 | build_all |
1647 | ;; |
1648 | "innodb55" | "5.5") |
1649 | + mysql_brand=mysql |
1650 | mysql_version=$MYSQL_55_VERSION |
1651 | server_patch=innodb55.patch |
1652 | innodb_name=innobase |
1653 | @@ -222,6 +227,22 @@ |
1654 | build_all |
1655 | ;; |
1656 | |
1657 | +"mariadb53" | "mariadb") |
1658 | + mysql_brand=mariadb |
1659 | + mysql_version=$MARIADB_53_VERSION |
1660 | + server_patch=mariadb53.patch |
1661 | + innodb_name=xtradb |
1662 | + xtrabackup_target=mariadb |
1663 | + configure_cmd="./configure --enable-local-infile \ |
1664 | + --enable-thread-safe-client \ |
1665 | + --with-plugins=xtradb \ |
1666 | + --with-zlib-dir=bundled \ |
1667 | + --enable-shared \ |
1668 | + --with-extra-charsets=all $extra_config_51" |
1669 | + |
1670 | + build_all |
1671 | + ;; |
1672 | + |
1673 | "xtradb51" | "xtradb") |
1674 | server_dir=$top_dir/Percona-Server |
1675 | branch_dir=percona-server-5.1-xtrabackup |
1676 | |
1677 | === modified file 'xtrabackup.c' |
1678 | --- xtrabackup.c 2011-10-05 02:31:10 +0000 |
1679 | +++ xtrabackup.c 2011-10-10 06:52:24 +0000 |
1680 | @@ -1298,7 +1298,9 @@ |
1681 | { |
1682 | printf("%s version %s for %s %s %s (%s) (revision id: %s)\n", my_progname, |
1683 | XTRABACKUP_VERSION, |
1684 | -#ifdef XTRADB_BASED |
1685 | +#ifdef MARIADB_BASED |
1686 | + "MariaDB", |
1687 | +#elif XTRADB_BASED |
1688 | "Percona Server", |
1689 | #else |
1690 | "MySQL server", |
Superseded with https:/ /code.launchpad .net/~akopytov/ percona- xtrabackup/ mariadb- support- 2.0/+merge/ 131766