Merge lp:~percona-dev/percona-xtrabackup/port-to-ps-5.5 into lp:percona-xtrabackup/2.0
- port-to-ps-5.5
- Merge into 2.0
Status: | Merged |
---|---|
Approved by: | Vadim Tkachenko |
Approved revision: | no longer in the source branch. |
Merged at revision: | 234 |
Proposed branch: | lp:~percona-dev/percona-xtrabackup/port-to-ps-5.5 |
Merge into: | lp:percona-xtrabackup/2.0 |
Diff against target: |
4080 lines (+1337/-2442) 10 files modified
Makefile (+21/-29) fix_innodb_for_backup55.patch (+0/-1100) fix_innodb_for_backup_5.1_plugin.patch (+0/-1137) patches/xtradb51.patch (+53/-44) patches/xtradb55.patch (+1189/-0) utils/build.sh (+69/-44) utils/build51tree.sh (+0/-29) utils/buildtree.sh (+0/-27) utils/prepare_tree_for_rpm.sh (+0/-31) xtrabackup.c (+5/-1) |
To merge this branch: | bzr merge lp:~percona-dev/percona-xtrabackup/port-to-ps-5.5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vadim Tkachenko | Approve | ||
Valentine Gostev (community) | qa | Approve | |
Review via email: mp+53521@code.launchpad.net |
Commit message
Description of the change
Vadim Tkachenko (vadim-tk) wrote : | # |
Alexey Kopytov (akopytov) wrote : | # |
Updated the branch to address Vadim's comments: support for building against MySQL 5.5 and InnoDB plugin in MySQL 5.1 was removed.
Vadim Tkachenko (vadim-tk) wrote : | # |
Asking Valentine to confirm that all tests pass against Percona Server 5.5
Valentine Gostev (longbow) wrote : | # |
Alexey,
could you please clarify warnings? I get many warnings while attempting build on CentOS 5.5:
[root@gval-
<snip>
[100%] /root/port-
/root/port-
/root/port-
/root/port-
/root/port-
/root/port-
/root/port-
/root/port-
/root/port-
/root/port-
<snip>
gmake[2]: Entering directory `/root/
[100%] Building C object extra/CMakeFile
Linking C executable perror
CMakeFiles/
/root/port-
/root/port-
<snip>
[ 69%] Building C object storage/
/root/port-
<snip>
[ 77%] Building C object storage/
/root/port-
In file included from /root/port-
/root/port-
<snip>
[ 83%] Building C object storage/
/root/port-
[ 88%] Building C object storage/
/root/port-
/root/port-
/root/port-
Valentine Gostev (longbow) : | # |
Vadim Tkachenko (vadim-tk) wrote : | # |
Valentine,
warnings are not related to XtraBackup, it should go to Percona Server.
Please test XtraBackup functionality.
Alexey Kopytov (akopytov) wrote : | # |
Valentine,
Yes, there are still a lot of warnings when building the server with xtrabackup patches, tar4ibd and xtrabackup itself. They were present before my work on porting. I didn't fix them because that wasn't a goal of my work on this.
Valentine Gostev (longbow) wrote : | # |
tests are ok,
besides ib_partiotion (but reason there is in innobackupex)
Vadim Tkachenko (vadim-tk) wrote : | # |
good to merge then
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2011-03-13 15:52:22 +0000 |
3 | +++ Makefile 2011-03-15 21:59:23 +0000 |
4 | @@ -1,17 +1,16 @@ |
5 | # Makefile to build XtraBackup for Percona Server and different versions of MySQL |
6 | # |
7 | # Syntax: |
8 | -# make [5.1|5.5|plugin|xtradb] |
9 | +# make [5.1|xtradb|xtradb55] |
10 | # |
11 | -# Default is xtradb - to build XtraBackup for Percona Server |
12 | -# 5.1 - XtraBackup for MySQL versions 5.1.* with plugin innobase |
13 | -# 5.5 - XtraBackup for MySQL versions 5.5.8 and up with plugin innobase |
14 | -# plugin - XtraBackup for MySQL versions 5.1.* with plugin innodb_plugin |
15 | +# Default is xtradb - to build XtraBackup for Percona Server 5.1 |
16 | +# xtradb55 - Xtrabackup for Percona Server 5.5 |
17 | +# 5.1 - XtraBackup for MySQL versions 5.1.* with builtin InnoDB |
18 | |
19 | LIBS = -lpthread |
20 | DEFS = -DUNIV_LINUX -DMYSQL_SERVER |
21 | |
22 | -CFLAGS += -O3 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 |
23 | +CFLAGS += -O3 -g |
24 | |
25 | TARGET=xtrabackup |
26 | PREFIX=/usr |
27 | @@ -53,29 +52,6 @@ |
28 | 5.1: TARGET := xtrabackup_51 |
29 | 5.1: $(TARGET) |
30 | |
31 | -# XtraBackup for MySQL with InnoDB Plugin |
32 | -plugin: INC = -I. -I.. -I./../include -I./../../include -I./../../../include |
33 | -plugin: INNODBOBJS = ../ha_innodb_plugin_la-btr0btr.o ../ha_innodb_plugin_la-btr0cur.o ../ha_innodb_plugin_la-btr0pcur.o ../ha_innodb_plugin_la-btr0sea.o ../ha_innodb_plugin_la-buf0buddy.o ../ha_innodb_plugin_la-buf0buf.o ../ha_innodb_plugin_la-buf0flu.o ../ha_innodb_plugin_la-buf0lru.o ../ha_innodb_plugin_la-buf0rea.o ../ha_innodb_plugin_la-data0data.o ../ha_innodb_plugin_la-data0type.o ../ha_innodb_plugin_la-dict0boot.o ../ha_innodb_plugin_la-dict0crea.o ../ha_innodb_plugin_la-dict0dict.o ../ha_innodb_plugin_la-dict0load.o ../ha_innodb_plugin_la-dict0mem.o ../ha_innodb_plugin_la-dyn0dyn.o ../ha_innodb_plugin_la-eval0eval.o ../ha_innodb_plugin_la-eval0proc.o ../ha_innodb_plugin_la-fil0fil.o ../ha_innodb_plugin_la-fsp0fsp.o ../ha_innodb_plugin_la-fut0fut.o ../ha_innodb_plugin_la-fut0lst.o ../ha_innodb_plugin_la-ha0ha.o ../ha_innodb_plugin_la-ha0storage.o ../ha_innodb_plugin_la-hash0hash.o ../ha_innodb_plugin_la-ibuf0ibuf.o ../ha_innodb_plugin_la-lock0iter.o ../ha_innodb_plugin_la-lock0lock.o ../ha_innodb_plugin_la-log0log.o ../ha_innodb_plugin_la-log0recv.o ../ha_innodb_plugin_la-mach0data.o ../ha_innodb_plugin_la-mem0mem.o ../ha_innodb_plugin_la-mem0pool.o ../ha_innodb_plugin_la-mtr0log.o ../ha_innodb_plugin_la-mtr0mtr.o ../ha_innodb_plugin_la-os0file.o ../ha_innodb_plugin_la-os0proc.o ../ha_innodb_plugin_la-os0sync.o ../ha_innodb_plugin_la-os0thread.o ../ha_innodb_plugin_la-page0cur.o ../ha_innodb_plugin_la-page0page.o ../ha_innodb_plugin_la-page0zip.o ../ha_innodb_plugin_la-lexyy.o ../ha_innodb_plugin_la-pars0grm.o ../ha_innodb_plugin_la-pars0opt.o ../ha_innodb_plugin_la-pars0pars.o ../ha_innodb_plugin_la-pars0sym.o ../ha_innodb_plugin_la-que0que.o ../ha_innodb_plugin_la-read0read.o ../ha_innodb_plugin_la-rem0cmp.o ../ha_innodb_plugin_la-rem0rec.o ../ha_innodb_plugin_la-row0ext.o ../ha_innodb_plugin_la-row0ins.o ../ha_innodb_plugin_la-row0merge.o ../ha_innodb_plugin_la-row0mysql.o ../ha_innodb_plugin_la-row0purge.o ../ha_innodb_plugin_la-row0row.o ../ha_innodb_plugin_la-row0sel.o ../ha_innodb_plugin_la-row0uins.o ../ha_innodb_plugin_la-row0umod.o ../ha_innodb_plugin_la-row0undo.o ../ha_innodb_plugin_la-row0upd.o ../ha_innodb_plugin_la-row0vers.o ../ha_innodb_plugin_la-srv0que.o ../ha_innodb_plugin_la-srv0srv.o ../ha_innodb_plugin_la-srv0start.o ../ha_innodb_plugin_la-sync0arr.o ../ha_innodb_plugin_la-sync0rw.o ../ha_innodb_plugin_la-sync0sync.o ../ha_innodb_plugin_la-thr0loc.o ../ha_innodb_plugin_la-trx0purge.o ../ha_innodb_plugin_la-trx0rec.o ../ha_innodb_plugin_la-trx0roll.o ../ha_innodb_plugin_la-trx0rseg.o ../ha_innodb_plugin_la-trx0sys.o ../ha_innodb_plugin_la-trx0trx.o ../ha_innodb_plugin_la-trx0undo.o ../ha_innodb_plugin_la-usr0sess.o ../ha_innodb_plugin_la-ut0byte.o ../ha_innodb_plugin_la-ut0dbg.o ../ha_innodb_plugin_la-ut0list.o ../ha_innodb_plugin_la-ut0mem.o ../ha_innodb_plugin_la-ut0rnd.o ../ha_innodb_plugin_la-ut0ut.o ../ha_innodb_plugin_la-ut0vec.o ../ha_innodb_plugin_la-ut0wqueue.o ../ha_innodb_plugin_la-ut0rbt.o |
34 | - |
35 | -plugin: MYSQLOBJS= ../../../mysys/libmysys.a ../../../strings/libmystrings.a ../../../zlib/.libs/libzlt.a |
36 | -plugin: TARGET := xtrabackup_plugin |
37 | -plugin: $(TARGET) |
38 | - |
39 | -# XtraBackup for MySQL 5.5 |
40 | -5.5: INC = -I. -I.. -I./../include -I./../../include -I./../../../include |
41 | -5.5: INNODBOBJS= ../libinnobase.a |
42 | - |
43 | -5.5: MYSQLOBJS= ../../../mysys/libmysys.a ../../../strings/libstrings.a ../../../zlib/libzlib.a |
44 | -ifeq ($(shell uname -s),Linux) |
45 | -5.5: LIBS += -laio |
46 | -endif |
47 | -5.5: TARGET := xtrabackup_55 |
48 | -# In CMake server builds it is important to build with exactly the same preprocessor flags |
49 | -# as were used to build InnoDB |
50 | -5.5: DEFS = $(shell grep C_DEFINES ../CMakeFiles/innobase.dir/flags.make | \ |
51 | - sed -e 's/C_DEFINES = //') |
52 | -5.5: $(TARGET) |
53 | - |
54 | # XtraBackup for XtraDB |
55 | xtradb: INC=-I. -I.. -I./../include -I./../../include -I./../../../include |
56 | xtradb: INNODBOBJS = ../libinnobase_a-btr0btr.o ../libinnobase_a-btr0cur.o ../libinnobase_a-btr0pcur.o \ |
57 | @@ -113,6 +89,22 @@ |
58 | xtradb: TARGET := xtrabackup |
59 | xtradb: $(TARGET) |
60 | |
61 | +# XtraBackup for XtraDB 5.5 |
62 | +xtradb55: INC=-I. -I.. -I./../include -I./../../include -I./../../../include |
63 | +xtradb55: INNODBOBJS = ../libinnobase.a |
64 | +ifeq ($(shell uname -s),Linux) |
65 | +xtradb55: LIBS += -laio |
66 | +endif |
67 | +xtradb55: MYSQLOBJS = ../../../mysys/libmysys.a ../../../strings/libstrings.a ../../../zlib/libzlib.a |
68 | +# In CMake server builds it is important to build with exactly the same preprocessor flags |
69 | +# as were used to build InnoDB |
70 | +xtradb55: DEFS = $(shell grep C_DEFINES ../CMakeFiles/innobase.dir/flags.make | \ |
71 | + sed -e 's/C_DEFINES = //') |
72 | +xtradb55: DEFS += -DXTRADB_BASED -DXTRADB55 |
73 | +xtradb55: TARGET := xtrabackup_55 |
74 | +xtradb55: $(TARGET) |
75 | + |
76 | + |
77 | xtrabackup.o: xtrabackup.c |
78 | $(CC) $(CFLAGS) $(INC) $(DEFS) -c $*.c |
79 | |
80 | |
81 | === removed file 'fix_innodb_for_backup55.patch' |
82 | --- fix_innodb_for_backup55.patch 2011-03-13 15:52:22 +0000 |
83 | +++ fix_innodb_for_backup55.patch 1970-01-01 00:00:00 +0000 |
84 | @@ -1,1100 +0,0 @@ |
85 | ---- a/storage/innobase/btr/btr0btr.c 2011-01-19 14:37:08.000000000 -0800 |
86 | -+++ b/storage/innobase/btr/btr0btr.c 2011-03-11 07:20:18.000000000 -0800 |
87 | -@@ -120,7 +120,7 @@ |
88 | - /**************************************************************//** |
89 | - Gets the root node of a tree and x-latches it. |
90 | - @return root page, x-latched */ |
91 | --static |
92 | -+//static |
93 | - buf_block_t* |
94 | - btr_root_block_get( |
95 | - /*===============*/ |
96 | -@@ -566,7 +566,7 @@ |
97 | - /************************************************************//** |
98 | - Returns the child page of a node pointer and x-latches it. |
99 | - @return child page, x-latched */ |
100 | --static |
101 | -+//static |
102 | - buf_block_t* |
103 | - btr_node_ptr_get_child( |
104 | - /*===================*/ |
105 | ---- a/storage/innobase/buf/buf0buf.c 2011-01-19 14:37:08.000000000 -0800 |
106 | -+++ b/storage/innobase/buf/buf0buf.c 2011-03-11 07:20:18.000000000 -0800 |
107 | -@@ -517,7 +517,7 @@ |
108 | - return(TRUE); |
109 | - } |
110 | - |
111 | --#ifndef UNIV_HOTBACKUP |
112 | -+#ifdef UNDEFINED |
113 | - if (recv_lsn_checks_on) { |
114 | - ib_uint64_t current_lsn; |
115 | - |
116 | -@@ -4056,7 +4056,7 @@ |
117 | - recv_recover_page(TRUE, (buf_block_t*) bpage); |
118 | - } |
119 | - |
120 | -- if (uncompressed && !recv_no_ibuf_operations) { |
121 | -+ if (uncompressed && !recv_no_ibuf_operations && !srv_fake_write) { |
122 | - ibuf_merge_or_delete_for_page( |
123 | - (buf_block_t*) bpage, bpage->space, |
124 | - bpage->offset, buf_page_get_zip_size(bpage), |
125 | ---- a/storage/innobase/buf/buf0rea.c 2011-01-19 14:37:08.000000000 -0800 |
126 | -+++ b/storage/innobase/buf/buf0rea.c 2011-03-11 07:20:18.000000000 -0800 |
127 | -@@ -122,6 +122,45 @@ |
128 | - bpage = buf_page_init_for_read(err, mode, space, zip_size, unzip, |
129 | - tablespace_version, offset); |
130 | - if (bpage == NULL) { |
131 | -+ if (recv_recovery_is_on() && *err == DB_TABLESPACE_DELETED) { |
132 | -+ /* hashed log recs must be treated here */ |
133 | -+ recv_addr_t* recv_addr; |
134 | -+ |
135 | -+ mutex_enter(&(recv_sys->mutex)); |
136 | -+ |
137 | -+ if (recv_sys->apply_log_recs == FALSE) { |
138 | -+ mutex_exit(&(recv_sys->mutex)); |
139 | -+ goto not_to_recover; |
140 | -+ } |
141 | -+ |
142 | -+ /* recv_get_fil_addr_struct() */ |
143 | -+ recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, |
144 | -+ hash_calc_hash(ut_fold_ulint_pair(space, offset), |
145 | -+ recv_sys->addr_hash)); |
146 | -+ while (recv_addr) { |
147 | -+ if ((recv_addr->space == space) |
148 | -+ && (recv_addr->page_no == offset)) { |
149 | -+ break; |
150 | -+ } |
151 | -+ recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); |
152 | -+ } |
153 | -+ |
154 | -+ if ((recv_addr == NULL) |
155 | -+ || (recv_addr->state == RECV_BEING_PROCESSED) |
156 | -+ || (recv_addr->state == RECV_PROCESSED)) { |
157 | -+ mutex_exit(&(recv_sys->mutex)); |
158 | -+ goto not_to_recover; |
159 | -+ } |
160 | -+ |
161 | -+ fprintf(stderr, " (cannot find space: %lu)", space); |
162 | -+ recv_addr->state = RECV_PROCESSED; |
163 | -+ |
164 | -+ ut_a(recv_sys->n_addrs); |
165 | -+ recv_sys->n_addrs--; |
166 | -+ |
167 | -+ mutex_exit(&(recv_sys->mutex)); |
168 | -+ } |
169 | -+not_to_recover: |
170 | - |
171 | - return(0); |
172 | - } |
173 | -@@ -604,6 +643,50 @@ |
174 | - /* It is a single table tablespace and the .ibd file is |
175 | - missing: do nothing */ |
176 | - |
177 | -+ /* the log records should be treated here same reason |
178 | -+ for http://bugs.mysql.com/bug.php?id=43948 */ |
179 | -+ |
180 | -+ if (recv_recovery_is_on()) { |
181 | -+ recv_addr_t* recv_addr; |
182 | -+ |
183 | -+ mutex_enter(&(recv_sys->mutex)); |
184 | -+ |
185 | -+ if (recv_sys->apply_log_recs == FALSE) { |
186 | -+ mutex_exit(&(recv_sys->mutex)); |
187 | -+ goto not_to_recover; |
188 | -+ } |
189 | -+ |
190 | -+ for (i = 0; i < n_stored; i++) { |
191 | -+ /* recv_get_fil_addr_struct() */ |
192 | -+ recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, |
193 | -+ hash_calc_hash(ut_fold_ulint_pair(space, page_nos[i]), |
194 | -+ recv_sys->addr_hash)); |
195 | -+ while (recv_addr) { |
196 | -+ if ((recv_addr->space == space) |
197 | -+ && (recv_addr->page_no == page_nos[i])) { |
198 | -+ break; |
199 | -+ } |
200 | -+ recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); |
201 | -+ } |
202 | -+ |
203 | -+ if ((recv_addr == NULL) |
204 | -+ || (recv_addr->state == RECV_BEING_PROCESSED) |
205 | -+ || (recv_addr->state == RECV_PROCESSED)) { |
206 | -+ continue; |
207 | -+ } |
208 | -+ |
209 | -+ recv_addr->state = RECV_PROCESSED; |
210 | -+ |
211 | -+ ut_a(recv_sys->n_addrs); |
212 | -+ recv_sys->n_addrs--; |
213 | -+ } |
214 | -+ |
215 | -+ mutex_exit(&(recv_sys->mutex)); |
216 | -+ |
217 | -+ fprintf(stderr, " (cannot find space: %lu)", space); |
218 | -+ } |
219 | -+not_to_recover: |
220 | -+ |
221 | - return; |
222 | - } |
223 | - |
224 | ---- a/storage/innobase/fil/fil0fil.c 2011-01-19 14:37:08.000000000 -0800 |
225 | -+++ b/storage/innobase/fil/fil0fil.c 2011-03-11 07:20:18.000000000 -0800 |
226 | -@@ -40,6 +40,8 @@ |
227 | - #include "dict0dict.h" |
228 | - #include "page0page.h" |
229 | - #include "page0zip.h" |
230 | -+#include "pars0pars.h" |
231 | -+#include "que0que.h" |
232 | - #ifndef UNIV_HOTBACKUP |
233 | - # include "buf0lru.h" |
234 | - # include "ibuf0ibuf.h" |
235 | -@@ -297,7 +299,7 @@ |
236 | - |
237 | - /** The tablespace memory cache. This variable is NULL before the module is |
238 | - initialized. */ |
239 | --static fil_system_t* fil_system = NULL; |
240 | -+fil_system_t* fil_system = NULL; |
241 | - |
242 | - #ifdef UNIV_DEBUG |
243 | - /** Try fil_validate() every this many times */ |
244 | -@@ -336,7 +338,7 @@ |
245 | - off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
246 | - mutex. */ |
247 | - static |
248 | --void |
249 | -+ulint |
250 | - fil_node_prepare_for_io( |
251 | - /*====================*/ |
252 | - fil_node_t* node, /*!< in: file node */ |
253 | -@@ -661,7 +663,7 @@ |
254 | - Opens a the file of a node of a tablespace. The caller must own the fil_system |
255 | - mutex. */ |
256 | - static |
257 | --void |
258 | -+ulint |
259 | - fil_node_open_file( |
260 | - /*===============*/ |
261 | - fil_node_t* node, /*!< in: file node */ |
262 | -@@ -696,7 +698,14 @@ |
263 | - OS_FILE_READ_ONLY, &success); |
264 | - if (!success) { |
265 | - /* The following call prints an error message */ |
266 | -- os_file_get_last_error(TRUE); |
267 | -+ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND) |
268 | -+ { |
269 | -+ ut_print_timestamp(stderr); |
270 | -+ fprintf(stderr, |
271 | -+ " InnoDB: Warning: cannot open %s\n", |
272 | -+ node->name); |
273 | -+ return(OS_FILE_NOT_FOUND); |
274 | -+ } |
275 | - |
276 | - ut_print_timestamp(stderr); |
277 | - |
278 | -@@ -786,8 +795,8 @@ |
279 | - } |
280 | - |
281 | - if (size_bytes >= 1024 * 1024) { |
282 | -- /* Truncate the size to whole megabytes. */ |
283 | -- size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
284 | -+ /* The size should be exact for after applying .delta */ |
285 | -+ //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
286 | - } |
287 | - |
288 | - if (!(flags & DICT_TF_ZSSIZE_MASK)) { |
289 | -@@ -838,6 +847,8 @@ |
290 | - /* Put the node to the LRU list */ |
291 | - UT_LIST_ADD_FIRST(LRU, system->LRU, node); |
292 | - } |
293 | -+ |
294 | -+ return(0); |
295 | - } |
296 | - |
297 | - /**********************************************************************//** |
298 | -@@ -1463,7 +1474,12 @@ |
299 | - the file yet; the following calls will open it and update the |
300 | - size fields */ |
301 | - |
302 | -- fil_node_prepare_for_io(node, fil_system, space); |
303 | -+ if (fil_node_prepare_for_io(node, fil_system, space)) |
304 | -+ { |
305 | -+ mutex_exit(&fil_system->mutex); |
306 | -+ |
307 | -+ return(0); |
308 | -+ } |
309 | - fil_node_complete_io(node, fil_system, OS_FILE_READ); |
310 | - } |
311 | - |
312 | -@@ -1515,7 +1531,12 @@ |
313 | - the file yet; the following calls will open it and update the |
314 | - size fields */ |
315 | - |
316 | -- fil_node_prepare_for_io(node, fil_system, space); |
317 | -+ if (fil_node_prepare_for_io(node, fil_system, space)) |
318 | -+ { |
319 | -+ mutex_exit(&fil_system->mutex); |
320 | -+ |
321 | -+ return(ULINT_UNDEFINED); |
322 | -+ } |
323 | - fil_node_complete_io(node, fil_system, OS_FILE_READ); |
324 | - } |
325 | - |
326 | -@@ -2180,7 +2201,7 @@ |
327 | - if (fil_create_new_single_table_tablespace( |
328 | - space_id, name, FALSE, flags, |
329 | - FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
330 | -- ut_error; |
331 | -+ //ut_error; |
332 | - } |
333 | - } |
334 | - |
335 | -@@ -2343,7 +2364,7 @@ |
336 | - } |
337 | - |
338 | - if (success) { |
339 | --#ifndef UNIV_HOTBACKUP |
340 | -+#ifdef UNDEFINED |
341 | - /* Write a log record about the deletion of the .ibd |
342 | - file, so that ibbackup can replay it in the |
343 | - --apply-log phase. We use a dummy mtr and the familiar |
344 | -@@ -2644,7 +2665,7 @@ |
345 | - |
346 | - mutex_exit(&fil_system->mutex); |
347 | - |
348 | --#ifndef UNIV_HOTBACKUP |
349 | -+#ifdef UNDEFINED |
350 | - if (success) { |
351 | - mtr_t mtr; |
352 | - |
353 | -@@ -2835,7 +2856,7 @@ |
354 | - |
355 | - fil_node_create(path, size, space_id, FALSE); |
356 | - |
357 | --#ifndef UNIV_HOTBACKUP |
358 | -+#ifdef UNDEFINED |
359 | - { |
360 | - mtr_t mtr; |
361 | - |
362 | -@@ -3090,19 +3111,97 @@ |
363 | - "InnoDB: open the tablespace file ", stderr); |
364 | - ut_print_filename(stderr, filepath); |
365 | - fputs("!\n" |
366 | -- "InnoDB: Have you moved InnoDB .ibd files around" |
367 | -- " without using the\n" |
368 | -- "InnoDB: commands DISCARD TABLESPACE and" |
369 | -- " IMPORT TABLESPACE?\n" |
370 | -- "InnoDB: It is also possible that this is" |
371 | -- " a temporary table #sql...,\n" |
372 | -- "InnoDB: and MySQL removed the .ibd file for this.\n" |
373 | -- "InnoDB: Please refer to\n" |
374 | -- "InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n" |
375 | -- "InnoDB: for how to resolve the issue.\n", stderr); |
376 | -+ "InnoDB: It will be removed from data dictionary.\n" |
377 | -+ , stderr); |
378 | - |
379 | - mem_free(filepath); |
380 | - |
381 | -+ /* removing from data dictionary */ |
382 | -+ { |
383 | -+ trx_t* trx; |
384 | -+ pars_info_t* info = NULL; |
385 | -+ |
386 | -+ trx = trx_allocate_for_mysql(); |
387 | -+ |
388 | -+ trx->op_info = "removing invalid table from data dictionary"; |
389 | -+ |
390 | -+ info = pars_info_create(); |
391 | -+ |
392 | -+ pars_info_add_str_literal(info, "table_name", name); |
393 | -+ |
394 | -+ que_eval_sql(info, |
395 | -+ "PROCEDURE DROP_TABLE_PROC () IS\n" |
396 | -+ "sys_foreign_id CHAR;\n" |
397 | -+ "table_id CHAR;\n" |
398 | -+ "index_id CHAR;\n" |
399 | -+ "foreign_id CHAR;\n" |
400 | -+ "found INT;\n" |
401 | -+ "BEGIN\n" |
402 | -+ "SELECT ID INTO table_id\n" |
403 | -+ "FROM SYS_TABLES\n" |
404 | -+ "WHERE NAME = :table_name\n" |
405 | -+ "LOCK IN SHARE MODE;\n" |
406 | -+ "IF (SQL % NOTFOUND) THEN\n" |
407 | -+ " RETURN;\n" |
408 | -+ "END IF;\n" |
409 | -+ "found := 1;\n" |
410 | -+ "SELECT ID INTO sys_foreign_id\n" |
411 | -+ "FROM SYS_TABLES\n" |
412 | -+ "WHERE NAME = 'SYS_FOREIGN'\n" |
413 | -+ "LOCK IN SHARE MODE;\n" |
414 | -+ "IF (SQL % NOTFOUND) THEN\n" |
415 | -+ " found := 0;\n" |
416 | -+ "END IF;\n" |
417 | -+ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
418 | -+ " found := 0;\n" |
419 | -+ "END IF;\n" |
420 | -+ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
421 | -+ " found := 0;\n" |
422 | -+ "END IF;\n" |
423 | -+ "WHILE found = 1 LOOP\n" |
424 | -+ " SELECT ID INTO foreign_id\n" |
425 | -+ " FROM SYS_FOREIGN\n" |
426 | -+ " WHERE FOR_NAME = :table_name\n" |
427 | -+ " AND TO_BINARY(FOR_NAME)\n" |
428 | -+ " = TO_BINARY(:table_name)\n" |
429 | -+ " LOCK IN SHARE MODE;\n" |
430 | -+ " IF (SQL % NOTFOUND) THEN\n" |
431 | -+ " found := 0;\n" |
432 | -+ " ELSE\n" |
433 | -+ " DELETE FROM SYS_FOREIGN_COLS\n" |
434 | -+ " WHERE ID = foreign_id;\n" |
435 | -+ " DELETE FROM SYS_FOREIGN\n" |
436 | -+ " WHERE ID = foreign_id;\n" |
437 | -+ " END IF;\n" |
438 | -+ "END LOOP;\n" |
439 | -+ "found := 1;\n" |
440 | -+ "WHILE found = 1 LOOP\n" |
441 | -+ " SELECT ID INTO index_id\n" |
442 | -+ " FROM SYS_INDEXES\n" |
443 | -+ " WHERE TABLE_ID = table_id\n" |
444 | -+ " LOCK IN SHARE MODE;\n" |
445 | -+ " IF (SQL % NOTFOUND) THEN\n" |
446 | -+ " found := 0;\n" |
447 | -+ " ELSE\n" |
448 | -+ " DELETE FROM SYS_FIELDS\n" |
449 | -+ " WHERE INDEX_ID = index_id;\n" |
450 | -+ " DELETE FROM SYS_INDEXES\n" |
451 | -+ " WHERE ID = index_id\n" |
452 | -+ " AND TABLE_ID = table_id;\n" |
453 | -+ " END IF;\n" |
454 | -+ "END LOOP;\n" |
455 | -+ "DELETE FROM SYS_COLUMNS\n" |
456 | -+ "WHERE TABLE_ID = table_id;\n" |
457 | -+ "DELETE FROM SYS_TABLES\n" |
458 | -+ "WHERE ID = table_id;\n" |
459 | -+ "END;\n" |
460 | -+ , FALSE, trx); |
461 | -+ |
462 | -+ trx_commit_for_mysql(trx); |
463 | -+ |
464 | -+ trx_free_for_mysql(trx); |
465 | -+ } |
466 | -+ |
467 | - return(FALSE); |
468 | - } |
469 | - |
470 | -@@ -3334,7 +3433,7 @@ |
471 | - cannot be ok. */ |
472 | - |
473 | - size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low; |
474 | --#ifndef UNIV_HOTBACKUP |
475 | -+#ifdef UNDEFINED |
476 | - if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { |
477 | - fprintf(stderr, |
478 | - "InnoDB: Error: the size of single-table tablespace" |
479 | -@@ -3475,7 +3574,7 @@ |
480 | - idea is to read as much good data as we can and jump over bad data. |
481 | - @return 0 if ok, -1 if error even after the retries, 1 if at the end |
482 | - of the directory */ |
483 | --static |
484 | -+//static |
485 | - int |
486 | - fil_file_readdir_next_file( |
487 | - /*=======================*/ |
488 | -@@ -3774,15 +3873,97 @@ |
489 | - "InnoDB: in InnoDB data dictionary" |
490 | - " has tablespace id %lu,\n" |
491 | - "InnoDB: but tablespace with that id" |
492 | -- " or name does not exist. Have\n" |
493 | -- "InnoDB: you deleted or moved .ibd files?\n" |
494 | -- "InnoDB: This may also be a table created with" |
495 | -- " CREATE TEMPORARY TABLE\n" |
496 | -- "InnoDB: whose .ibd and .frm files" |
497 | -- " MySQL automatically removed, but the\n" |
498 | -- "InnoDB: table still exists in the" |
499 | -- " InnoDB internal data dictionary.\n", |
500 | -+ " or name does not exist. It will be removed from data dictionary.\n" |
501 | -+ , |
502 | - (ulong) id); |
503 | -+ mem_free(path); |
504 | -+ mutex_exit(&fil_system->mutex); |
505 | -+ /* removing from data dictionary */ |
506 | -+ { |
507 | -+ trx_t* trx; |
508 | -+ pars_info_t* info = NULL; |
509 | -+ |
510 | -+ trx = trx_allocate_for_mysql(); |
511 | -+ |
512 | -+ trx->op_info = "removing invalid table from data dictionary"; |
513 | -+ |
514 | -+ info = pars_info_create(); |
515 | -+ |
516 | -+ pars_info_add_str_literal(info, "table_name", name); |
517 | -+ |
518 | -+ que_eval_sql(info, |
519 | -+ "PROCEDURE DROP_TABLE_PROC () IS\n" |
520 | -+ "sys_foreign_id CHAR;\n" |
521 | -+ "table_id CHAR;\n" |
522 | -+ "index_id CHAR;\n" |
523 | -+ "foreign_id CHAR;\n" |
524 | -+ "found INT;\n" |
525 | -+ "BEGIN\n" |
526 | -+ "SELECT ID INTO table_id\n" |
527 | -+ "FROM SYS_TABLES\n" |
528 | -+ "WHERE NAME = :table_name\n" |
529 | -+ "LOCK IN SHARE MODE;\n" |
530 | -+ "IF (SQL % NOTFOUND) THEN\n" |
531 | -+ " RETURN;\n" |
532 | -+ "END IF;\n" |
533 | -+ "found := 1;\n" |
534 | -+ "SELECT ID INTO sys_foreign_id\n" |
535 | -+ "FROM SYS_TABLES\n" |
536 | -+ "WHERE NAME = 'SYS_FOREIGN'\n" |
537 | -+ "LOCK IN SHARE MODE;\n" |
538 | -+ "IF (SQL % NOTFOUND) THEN\n" |
539 | -+ " found := 0;\n" |
540 | -+ "END IF;\n" |
541 | -+ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
542 | -+ " found := 0;\n" |
543 | -+ "END IF;\n" |
544 | -+ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
545 | -+ " found := 0;\n" |
546 | -+ "END IF;\n" |
547 | -+ "WHILE found = 1 LOOP\n" |
548 | -+ " SELECT ID INTO foreign_id\n" |
549 | -+ " FROM SYS_FOREIGN\n" |
550 | -+ " WHERE FOR_NAME = :table_name\n" |
551 | -+ " AND TO_BINARY(FOR_NAME)\n" |
552 | -+ " = TO_BINARY(:table_name)\n" |
553 | -+ " LOCK IN SHARE MODE;\n" |
554 | -+ " IF (SQL % NOTFOUND) THEN\n" |
555 | -+ " found := 0;\n" |
556 | -+ " ELSE\n" |
557 | -+ " DELETE FROM SYS_FOREIGN_COLS\n" |
558 | -+ " WHERE ID = foreign_id;\n" |
559 | -+ " DELETE FROM SYS_FOREIGN\n" |
560 | -+ " WHERE ID = foreign_id;\n" |
561 | -+ " END IF;\n" |
562 | -+ "END LOOP;\n" |
563 | -+ "found := 1;\n" |
564 | -+ "WHILE found = 1 LOOP\n" |
565 | -+ " SELECT ID INTO index_id\n" |
566 | -+ " FROM SYS_INDEXES\n" |
567 | -+ " WHERE TABLE_ID = table_id\n" |
568 | -+ " LOCK IN SHARE MODE;\n" |
569 | -+ " IF (SQL % NOTFOUND) THEN\n" |
570 | -+ " found := 0;\n" |
571 | -+ " ELSE\n" |
572 | -+ " DELETE FROM SYS_FIELDS\n" |
573 | -+ " WHERE INDEX_ID = index_id;\n" |
574 | -+ " DELETE FROM SYS_INDEXES\n" |
575 | -+ " WHERE ID = index_id\n" |
576 | -+ " AND TABLE_ID = table_id;\n" |
577 | -+ " END IF;\n" |
578 | -+ "END LOOP;\n" |
579 | -+ "DELETE FROM SYS_COLUMNS\n" |
580 | -+ "WHERE TABLE_ID = table_id;\n" |
581 | -+ "DELETE FROM SYS_TABLES\n" |
582 | -+ "WHERE ID = table_id;\n" |
583 | -+ "END;\n" |
584 | -+ , FALSE, trx); |
585 | -+ |
586 | -+ trx_commit_for_mysql(trx); |
587 | -+ |
588 | -+ trx_free_for_mysql(trx); |
589 | -+ } |
590 | -+ return(FALSE); |
591 | - } else { |
592 | - ut_print_timestamp(stderr); |
593 | - fputs(" InnoDB: Error: table ", stderr); |
594 | -@@ -4171,7 +4352,7 @@ |
595 | - off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
596 | - mutex. */ |
597 | - static |
598 | --void |
599 | -+ulint |
600 | - fil_node_prepare_for_io( |
601 | - /*====================*/ |
602 | - fil_node_t* node, /*!< in: file node */ |
603 | -@@ -4191,10 +4372,13 @@ |
604 | - } |
605 | - |
606 | - if (node->open == FALSE) { |
607 | -+ ulint err; |
608 | - /* File is closed: open it */ |
609 | - ut_a(node->n_pending == 0); |
610 | - |
611 | -- fil_node_open_file(node, system, space); |
612 | -+ err = fil_node_open_file(node, system, space); |
613 | -+ if (err) |
614 | -+ return(err); |
615 | - } |
616 | - |
617 | - if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
618 | -@@ -4207,6 +4391,8 @@ |
619 | - } |
620 | - |
621 | - node->n_pending++; |
622 | -+ |
623 | -+ return(0); |
624 | - } |
625 | - |
626 | - /********************************************************************//** |
627 | -@@ -4391,6 +4577,16 @@ |
628 | - |
629 | - ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
630 | - |
631 | -+ if (space->size <= block_offset) { |
632 | -+ ulint actual_size; |
633 | -+ |
634 | -+ mutex_exit(&fil_system->mutex); |
635 | -+ fil_extend_space_to_desired_size(&actual_size, space->id, |
636 | -+ ((block_offset + 1) / 64 + 1) * 64); |
637 | -+ mutex_enter(&fil_system->mutex); |
638 | -+ /* should retry? but it may safe for xtrabackup for now. */ |
639 | -+ } |
640 | -+ |
641 | - node = UT_LIST_GET_FIRST(space->chain); |
642 | - |
643 | - for (;;) { |
644 | ---- a/storage/innobase/ibuf/ibuf0ibuf.c 2011-01-19 14:37:08.000000000 -0800 |
645 | -+++ b/storage/innobase/ibuf/ibuf0ibuf.c 2011-03-11 07:20:18.000000000 -0800 |
646 | -@@ -1160,6 +1160,9 @@ |
647 | - ut_ad(!recv_no_ibuf_operations); |
648 | - ut_ad(x_latch || mtr == NULL); |
649 | - |
650 | -+ if (srv_fake_write) |
651 | -+ return(FALSE); |
652 | -+ |
653 | - if (ibuf_fixed_addr_page(space, zip_size, page_no)) { |
654 | - |
655 | - return(TRUE); |
656 | -@@ -2691,6 +2694,9 @@ |
657 | - ulint n_bytes; |
658 | - ulint n_pag2; |
659 | - |
660 | -+ if (srv_fake_write) |
661 | -+ return(0); |
662 | -+ |
663 | - while (sum_pages < n_pages) { |
664 | - n_bytes = ibuf_contract_ext(&n_pag2, sync); |
665 | - |
666 | ---- a/storage/innobase/include/srv0srv.h 2011-01-19 14:37:08.000000000 -0800 |
667 | -+++ b/storage/innobase/include/srv0srv.h 2011-03-11 07:20:18.000000000 -0800 |
668 | -@@ -211,6 +211,10 @@ |
669 | - extern ulong srv_max_purge_lag; |
670 | - |
671 | - extern ulong srv_replication_delay; |
672 | -+ |
673 | -+extern ibool srv_read_only; |
674 | -+extern ibool srv_fake_write; |
675 | -+extern ibool srv_apply_log_only; |
676 | - /*-------------------------------------------*/ |
677 | - |
678 | - extern ulint srv_n_rows_inserted; |
679 | ---- a/storage/innobase/include/srv0start.h 2011-01-19 14:37:08.000000000 -0800 |
680 | -+++ b/storage/innobase/include/srv0start.h 2011-03-11 07:20:18.000000000 -0800 |
681 | -@@ -91,6 +91,8 @@ |
682 | - /** Log sequence number immediately after startup */ |
683 | - extern ib_uint64_t srv_start_lsn; |
684 | - |
685 | -+extern ib_uint64_t srv_oldest_lsn; |
686 | -+ |
687 | - #ifdef HAVE_DARWIN_THREADS |
688 | - /** TRUE if the F_FULLFSYNC option is available */ |
689 | - extern ibool srv_have_fullfsync; |
690 | ---- a/storage/innobase/log/log0log.c 2011-01-19 14:37:08.000000000 -0800 |
691 | -+++ b/storage/innobase/log/log0log.c 2011-03-11 07:20:18.000000000 -0800 |
692 | -@@ -576,7 +576,9 @@ |
693 | - |
694 | - offset = (gr_lsn_size_offset + difference) % group_size; |
695 | - |
696 | -+ if (sizeof(ulint) == 4) { |
697 | - ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */ |
698 | -+ } |
699 | - |
700 | - /* fprintf(stderr, |
701 | - "Offset is %lu gr_lsn_offset is %lu difference is %lu\n", |
702 | -@@ -1354,7 +1356,7 @@ |
703 | - #endif /* UNIV_DEBUG */ |
704 | - ulint unlock; |
705 | - |
706 | -- if (recv_no_ibuf_operations) { |
707 | -+ if (recv_no_ibuf_operations || srv_fake_write) { |
708 | - /* Recovery is running and no operations on the log files are |
709 | - allowed yet (the variable name .._no_ibuf_.. is misleading) */ |
710 | - |
711 | -@@ -3114,6 +3116,7 @@ |
712 | - for the 'very fast' shutdown, because the InnoDB layer may have |
713 | - committed or prepared transactions and we don't want to lose them. */ |
714 | - |
715 | -+ if (!srv_apply_log_only) { |
716 | - if (trx_n_mysql_transactions > 0 |
717 | - || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) { |
718 | - |
719 | -@@ -3121,6 +3124,7 @@ |
720 | - |
721 | - goto loop; |
722 | - } |
723 | -+ } |
724 | - |
725 | - if (srv_fast_shutdown == 2) { |
726 | - /* In this fastest shutdown we do not flush the buffer pool: |
727 | ---- a/storage/innobase/log/log0recv.c 2011-01-19 14:37:08.000000000 -0800 |
728 | -+++ b/storage/innobase/log/log0recv.c 2011-03-11 07:20:18.000000000 -0800 |
729 | -@@ -42,27 +42,27 @@ |
730 | - #include "trx0undo.h" |
731 | - #include "trx0rec.h" |
732 | - #include "fil0fil.h" |
733 | --#ifndef UNIV_HOTBACKUP |
734 | -+//#ifndef UNIV_HOTBACKUP |
735 | - # include "buf0rea.h" |
736 | - # include "srv0srv.h" |
737 | - # include "srv0start.h" |
738 | - # include "trx0roll.h" |
739 | - # include "row0merge.h" |
740 | - # include "sync0sync.h" |
741 | --#else /* !UNIV_HOTBACKUP */ |
742 | -+//#else /* !UNIV_HOTBACKUP */ |
743 | - |
744 | - /** This is set to FALSE if the backup was originally taken with the |
745 | - ibbackup --include regexp option: then we do not want to create tables in |
746 | - directories which were not included */ |
747 | - UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
748 | --#endif /* !UNIV_HOTBACKUP */ |
749 | -+//#endif /* !UNIV_HOTBACKUP */ |
750 | - |
751 | - /** Log records are stored in the hash table in chunks at most of this size; |
752 | - this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
753 | - #define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t)) |
754 | - |
755 | - /** Read-ahead area in applying log records to file pages */ |
756 | --#define RECV_READ_AHEAD_AREA 32 |
757 | -+#define RECV_READ_AHEAD_AREA 128 |
758 | - |
759 | - /** The recovery system */ |
760 | - UNIV_INTERN recv_sys_t* recv_sys = NULL; |
761 | -@@ -259,7 +259,7 @@ |
762 | - { |
763 | - recv_lsn_checks_on = FALSE; |
764 | - |
765 | -- recv_n_pool_free_frames = 256; |
766 | -+ recv_n_pool_free_frames = 1024; |
767 | - |
768 | - recv_recovery_on = FALSE; |
769 | - |
770 | -@@ -285,7 +285,7 @@ |
771 | - |
772 | - recv_max_parsed_page_no = 0; |
773 | - |
774 | -- recv_n_pool_free_frames = 256; |
775 | -+ recv_n_pool_free_frames = 1024; |
776 | - |
777 | - recv_max_page_lsn = 0; |
778 | - } |
779 | -@@ -623,7 +623,7 @@ |
780 | - /***********************************************************************//** |
781 | - Checks the consistency of the checkpoint info |
782 | - @return TRUE if ok */ |
783 | --static |
784 | -+//static |
785 | - ibool |
786 | - recv_check_cp_is_consistent( |
787 | - /*========================*/ |
788 | -@@ -653,7 +653,7 @@ |
789 | - /********************************************************//** |
790 | - Looks for the maximum consistent checkpoint from the log groups. |
791 | - @return error code or DB_SUCCESS */ |
792 | --static |
793 | -+//static |
794 | - ulint |
795 | - recv_find_max_checkpoint( |
796 | - /*=====================*/ |
797 | -@@ -828,7 +828,7 @@ |
798 | - InnoDB-3.23.52 where the checksum field contains the log block number. |
799 | - @return TRUE if ok, or if the log block may be in the format of InnoDB |
800 | - version predating 3.23.52 */ |
801 | --static |
802 | -+//static |
803 | - ibool |
804 | - log_block_checksum_is_ok_or_old_format( |
805 | - /*===================================*/ |
806 | -@@ -1496,6 +1496,7 @@ |
807 | - buf_block_get_page_no(block)); |
808 | - |
809 | - if ((recv_addr == NULL) |
810 | -+ || (recv_addr->state == RECV_BEING_READ && !just_read_in) |
811 | - || (recv_addr->state == RECV_BEING_PROCESSED) |
812 | - || (recv_addr->state == RECV_PROCESSED)) { |
813 | - |
814 | -@@ -2308,7 +2309,7 @@ |
815 | - || type == MLOG_FILE_RENAME |
816 | - || type == MLOG_FILE_DELETE) { |
817 | - ut_a(space); |
818 | --#ifdef UNIV_HOTBACKUP |
819 | -+//#ifdef UNIV_HOTBACKUP |
820 | - if (recv_replay_file_ops) { |
821 | - |
822 | - /* In ibbackup --apply-log, replay an .ibd file |
823 | -@@ -2331,7 +2332,7 @@ |
824 | - ut_error; |
825 | - } |
826 | - } |
827 | --#endif |
828 | -+//#endif |
829 | - /* In normal mysqld crash recovery we do not try to |
830 | - replay file operations */ |
831 | - #ifdef UNIV_LOG_LSN_DEBUG |
832 | -@@ -2748,8 +2749,11 @@ |
833 | - |
834 | - fprintf(stderr, |
835 | - "InnoDB: Doing recovery: scanned up to" |
836 | -- " log sequence number %llu\n", |
837 | -- *group_scanned_lsn); |
838 | -+ " log sequence number %llu (%lu %%)\n", |
839 | -+ *group_scanned_lsn, |
840 | -+ (ulong) (*group_scanned_lsn - srv_oldest_lsn) |
841 | -+ / (8 * log_group_get_capacity(UT_LIST_GET_FIRST(log_sys->log_groups))/900) |
842 | -+ ); |
843 | - } |
844 | - } |
845 | - |
846 | -@@ -2863,12 +2867,14 @@ |
847 | - |
848 | - if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
849 | - |
850 | -+#ifdef UNDEFINED |
851 | - fprintf(stderr, |
852 | - "InnoDB: Restoring possible" |
853 | - " half-written data pages from" |
854 | - " the doublewrite\n" |
855 | - "InnoDB: buffer...\n"); |
856 | -- trx_sys_doublewrite_init_or_restore_pages(TRUE); |
857 | -+#endif |
858 | -+ trx_sys_doublewrite_init_or_restore_pages(FALSE); |
859 | - } |
860 | - } |
861 | - |
862 | -@@ -3018,6 +3024,7 @@ |
863 | - recv_sys->recovered_lsn = checkpoint_lsn; |
864 | - |
865 | - srv_start_lsn = checkpoint_lsn; |
866 | -+ srv_oldest_lsn = checkpoint_lsn; |
867 | - } |
868 | - |
869 | - contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
870 | -@@ -3299,6 +3306,7 @@ |
871 | - that the data dictionary tables will be free of any locks. |
872 | - The data dictionary latch should guarantee that there is at |
873 | - most one data dictionary transaction active at a time. */ |
874 | -+ if (!srv_apply_log_only) |
875 | - trx_rollback_or_clean_recovered(FALSE); |
876 | - } |
877 | - |
878 | ---- a/storage/innobase/os/os0file.c 2011-01-19 14:37:08.000000000 -0800 |
879 | -+++ b/storage/innobase/os/os0file.c 2011-03-11 07:20:18.000000000 -0800 |
880 | -@@ -656,7 +656,7 @@ |
881 | - } |
882 | - |
883 | - #undef USE_FILE_LOCK |
884 | --#define USE_FILE_LOCK |
885 | -+//#define USE_FILE_LOCK |
886 | - #if defined(UNIV_HOTBACKUP) || defined(__WIN__) |
887 | - /* InnoDB Hot Backup does not lock the data files. |
888 | - * On Windows, mandatory locking is used. |
889 | -@@ -1456,8 +1456,9 @@ |
890 | - attributes = 0; |
891 | - ut_error; |
892 | - } |
893 | -- |
894 | -+ share_mode |= FILE_SHARE_WRITE; /* Why? */ |
895 | - file = CreateFile((LPCTSTR) name, |
896 | -+ (srv_read_only && create_flag == OPEN_EXISTING) ? GENERIC_READ : |
897 | - GENERIC_READ | GENERIC_WRITE, /* read and write |
898 | - access */ |
899 | - share_mode, /* File can be read also by other |
900 | -@@ -1516,7 +1517,11 @@ |
901 | - if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW |
902 | - || create_mode == OS_FILE_OPEN_RETRY) { |
903 | - mode_str = "OPEN"; |
904 | -- create_flag = O_RDWR; |
905 | -+ if (srv_read_only) { |
906 | -+ create_flag = O_RDONLY; |
907 | -+ } else { |
908 | -+ create_flag = O_RDWR; |
909 | -+ } |
910 | - } else if (create_mode == OS_FILE_CREATE) { |
911 | - mode_str = "CREATE"; |
912 | - create_flag = O_RDWR | O_CREAT | O_EXCL; |
913 | -@@ -2694,6 +2699,9 @@ |
914 | - ut_a((offset & 0xFFFFFFFFUL) == offset); |
915 | - ut_a((n & 0xFFFFFFFFUL) == n); |
916 | - |
917 | -+ if (srv_fake_write) |
918 | -+ return(TRUE); |
919 | -+ |
920 | - os_n_file_writes++; |
921 | - |
922 | - ut_ad(file); |
923 | -@@ -2818,6 +2826,9 @@ |
924 | - #else |
925 | - ssize_t ret; |
926 | - |
927 | -+ if (srv_fake_write) |
928 | -+ return(TRUE); |
929 | -+ |
930 | - ret = os_file_pwrite(file, buf, n, offset, offset_high); |
931 | - |
932 | - if ((ulint)ret == n) { |
933 | ---- a/storage/innobase/os/os0thread.c 2011-01-19 14:37:08.000000000 -0800 |
934 | -+++ b/storage/innobase/os/os0thread.c 2011-03-11 07:20:18.000000000 -0800 |
935 | -@@ -266,12 +266,17 @@ |
936 | - #ifdef __WIN__ |
937 | - Sleep((DWORD) tm / 1000); |
938 | - #else |
939 | -+ /* select() simetimes hang up from xtrabackup */ |
940 | -+ /* change to use usleep() for now */ |
941 | -+ usleep(tm); |
942 | -+/* |
943 | - struct timeval t; |
944 | - |
945 | - t.tv_sec = tm / 1000000; |
946 | - t.tv_usec = tm % 1000000; |
947 | - |
948 | - select(0, NULL, NULL, NULL, &t); |
949 | -+*/ |
950 | - #endif |
951 | - } |
952 | - |
953 | ---- a/storage/innobase/row/row0merge.c 2011-01-19 14:37:08.000000000 -0800 |
954 | -+++ b/storage/innobase/row/row0merge.c 2011-03-11 07:20:18.000000000 -0800 |
955 | -@@ -459,7 +459,9 @@ |
956 | - rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); |
957 | - offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
958 | - |
959 | -- innobase_rec_to_mysql(dup->table, rec, index, offsets); |
960 | -+ //innobase_rec_to_mysql(dup->table, rec, index, offsets); |
961 | -+ fprintf(stderr, "InnoDB: Error: row_merge_dup_report() is called.\n"); |
962 | -+ ut_error; |
963 | - |
964 | - mem_heap_free(heap); |
965 | - } |
966 | -@@ -1478,8 +1480,10 @@ |
967 | - case 0: |
968 | - if (UNIV_UNLIKELY |
969 | - (dict_index_is_unique(index) && !null_eq)) { |
970 | -- innobase_rec_to_mysql(table, mrec0, |
971 | -- index, offsets0); |
972 | -+ //innobase_rec_to_mysql(table, mrec0, |
973 | -+ // index, offsets0); |
974 | -+ fprintf(stderr, "InnoDB: Error: row_merge_blocks() is called.\n"); |
975 | -+ ut_error; |
976 | - mem_heap_free(heap); |
977 | - return(DB_DUPLICATE_KEY); |
978 | - } |
979 | -@@ -2604,7 +2608,9 @@ |
980 | - |
981 | - /* Reset the MySQL row buffer that is used when reporting |
982 | - duplicate keys. */ |
983 | -- innobase_rec_reset(table); |
984 | -+ //innobase_rec_reset(table); |
985 | -+ fprintf(stderr, "InnoDB: Error: row_merge_build_indexes() is called.\n"); |
986 | -+ ut_error; |
987 | - |
988 | - /* Read clustered index of the table and create files for |
989 | - secondary index entries for merge sort */ |
990 | ---- a/storage/innobase/srv/srv0srv.c 2011-01-19 14:37:08.000000000 -0800 |
991 | -+++ b/storage/innobase/srv/srv0srv.c 2011-03-11 07:20:18.000000000 -0800 |
992 | -@@ -396,6 +396,9 @@ |
993 | - |
994 | - UNIV_INTERN ulong srv_replication_delay = 0; |
995 | - |
996 | -+UNIV_INTERN ibool srv_read_only = FALSE; |
997 | -+UNIV_INTERN ibool srv_fake_write = FALSE; |
998 | -+UNIV_INTERN ibool srv_apply_log_only = FALSE; |
999 | - /*-------------------------------------------*/ |
1000 | - UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
1001 | - UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
1002 | -@@ -1094,7 +1097,7 @@ |
1003 | - } |
1004 | - |
1005 | - /* Initialize some INFORMATION SCHEMA internal structures */ |
1006 | -- trx_i_s_cache_init(trx_i_s_cache); |
1007 | -+ //trx_i_s_cache_init(trx_i_s_cache); |
1008 | - } |
1009 | - |
1010 | - /*********************************************************************//** |
1011 | -@@ -1105,6 +1108,7 @@ |
1012 | - /*==========*/ |
1013 | - { |
1014 | - os_fast_mutex_free(&srv_conc_mutex); |
1015 | -+#ifdef UNDEFINED |
1016 | - mem_free(srv_conc_slots); |
1017 | - srv_conc_slots = NULL; |
1018 | - |
1019 | -@@ -1118,6 +1122,7 @@ |
1020 | - srv_mysql_table = NULL; |
1021 | - |
1022 | - trx_i_s_cache_free(trx_i_s_cache); |
1023 | -+#endif |
1024 | - } |
1025 | - |
1026 | - /*********************************************************************//** |
1027 | -@@ -1713,7 +1718,7 @@ |
1028 | - } |
1029 | - |
1030 | - /* Record the lock wait time for this thread */ |
1031 | -- thd_set_lock_wait_time(trx->mysql_thd, diff_time); |
1032 | -+ //thd_set_lock_wait_time(trx->mysql_thd, diff_time); |
1033 | - } |
1034 | - |
1035 | - if (trx->was_chosen_as_deadlock_victim) { |
1036 | ---- a/storage/innobase/srv/srv0start.c 2011-01-19 14:37:08.000000000 -0800 |
1037 | -+++ b/storage/innobase/srv/srv0start.c 2011-03-11 07:35:47.000000000 -0800 |
1038 | -@@ -94,6 +94,8 @@ |
1039 | - /** Log sequence number at shutdown */ |
1040 | - UNIV_INTERN ib_uint64_t srv_shutdown_lsn; |
1041 | - |
1042 | -+UNIV_INTERN ib_uint64_t srv_oldest_lsn; |
1043 | -+ |
1044 | - #ifdef HAVE_DARWIN_THREADS |
1045 | - # include <sys/utsname.h> |
1046 | - /** TRUE if the F_FULLFSYNC option is available */ |
1047 | -@@ -549,7 +551,7 @@ |
1048 | - /*********************************************************************//** |
1049 | - Creates or opens the log files and closes them. |
1050 | - @return DB_SUCCESS or error code */ |
1051 | --static |
1052 | -+//static |
1053 | - ulint |
1054 | - open_or_create_log_file( |
1055 | - /*====================*/ |
1056 | -@@ -709,7 +711,7 @@ |
1057 | - /*********************************************************************//** |
1058 | - Creates or opens database data files and closes them. |
1059 | - @return DB_SUCCESS or error code */ |
1060 | --static |
1061 | -+//static |
1062 | - ulint |
1063 | - open_or_create_data_files( |
1064 | - /*======================*/ |
1065 | -@@ -1411,7 +1413,7 @@ |
1066 | - } |
1067 | - #endif /* UNIV_LOG_ARCHIVE */ |
1068 | - |
1069 | -- if (srv_n_log_files * srv_log_file_size >= 262144) { |
1070 | -+ if (sizeof(ulint) == 4 && srv_n_log_files * srv_log_file_size >= 262144) { |
1071 | - ut_print_timestamp(stderr); |
1072 | - fprintf(stderr, |
1073 | - " InnoDB: Error: combined size of log files" |
1074 | -@@ -1706,6 +1708,10 @@ |
1075 | - are initialized in trx_sys_init_at_db_start(). */ |
1076 | - |
1077 | - recv_recovery_from_checkpoint_finish(); |
1078 | -+ |
1079 | -+ if (srv_apply_log_only) |
1080 | -+ goto skip_processes; |
1081 | -+ |
1082 | - if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
1083 | - /* The following call is necessary for the insert |
1084 | - buffer to work with multiple tablespaces. We must |
1085 | -@@ -1865,6 +1871,17 @@ |
1086 | - if (!srv_auto_extend_last_data_file |
1087 | - && sum_of_data_file_sizes != tablespace_size_in_header) { |
1088 | - |
1089 | -+ /* extend table space size aligning with header */ |
1090 | -+ ulint actual_size; |
1091 | -+ fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); |
1092 | -+ if (actual_size < tablespace_size_in_header) { |
1093 | -+ fprintf(stderr, |
1094 | -+"InnoDB: Warning: To extend tablespace size aligning with header seems to be failed.\n" |
1095 | -+"InnoDB: The acutual size %lu must be larger than %lu.\n", |
1096 | -+ (ulong) actual_size, |
1097 | -+ (ulong) tablespace_size_in_header); |
1098 | -+ } |
1099 | -+#ifdef UNDEFINED |
1100 | - ut_print_timestamp(stderr); |
1101 | - fprintf(stderr, |
1102 | - " InnoDB: Error: tablespace size" |
1103 | -@@ -1944,6 +1961,7 @@ |
1104 | - |
1105 | - return(DB_ERROR); |
1106 | - } |
1107 | -+#endif |
1108 | - } |
1109 | - |
1110 | - /* Check that os_fast_mutexes work as expected */ |
1111 | -@@ -2056,6 +2074,7 @@ |
1112 | - ibuf_update_max_tablespace_id(); |
1113 | - } |
1114 | - |
1115 | -+skip_processes: |
1116 | - srv_file_per_table = srv_file_per_table_original_value; |
1117 | - |
1118 | - srv_was_started = TRUE; |
1119 | ---- a/storage/innobase/trx/trx0purge.c 2011-01-19 14:37:08.000000000 -0800 |
1120 | -+++ b/storage/innobase/trx/trx0purge.c 2011-03-11 07:20:18.000000000 -0800 |
1121 | -@@ -1100,6 +1100,9 @@ |
1122 | - /* que_thr_t* thr2; */ |
1123 | - ulint old_pages_handled; |
1124 | - |
1125 | -+ if (srv_fake_write) |
1126 | -+ return(0); |
1127 | -+ |
1128 | - mutex_enter(&(purge_sys->mutex)); |
1129 | - |
1130 | - if (purge_sys->trx->n_active_thrs > 0) { |
1131 | ---- a/storage/innobase/trx/trx0rseg.c 2011-01-19 14:37:08.000000000 -0800 |
1132 | -+++ b/storage/innobase/trx/trx0rseg.c 2011-03-11 07:20:18.000000000 -0800 |
1133 | -@@ -140,9 +140,11 @@ |
1134 | - |
1135 | - mutex_free(&rseg->mutex); |
1136 | - |
1137 | -+ if (!srv_apply_log_only) { |
1138 | - /* There can't be any active transactions. */ |
1139 | - ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
1140 | - ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
1141 | -+ } |
1142 | - |
1143 | - undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
1144 | - |
1145 | ---- a/storage/innobase/trx/trx0sys.c 2011-01-19 14:37:08.000000000 -0800 |
1146 | -+++ b/storage/innobase/trx/trx0sys.c 2011-03-11 07:20:18.000000000 -0800 |
1147 | -@@ -1641,10 +1641,12 @@ |
1148 | - UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
1149 | - } |
1150 | - |
1151 | -+ if (!srv_apply_log_only) { |
1152 | - ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0); |
1153 | - ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0); |
1154 | - ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
1155 | - ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
1156 | -+ } |
1157 | - |
1158 | - mem_free(trx_sys); |
1159 | - |
1160 | ---- a/storage/innobase/trx/trx0trx.c 2011-01-19 14:37:08.000000000 -0800 |
1161 | -+++ b/storage/innobase/trx/trx0trx.c 2011-03-11 07:20:18.000000000 -0800 |
1162 | -@@ -469,8 +469,8 @@ |
1163 | - (ullint) trx->id); |
1164 | - |
1165 | - if (srv_force_recovery == 0) { |
1166 | -- |
1167 | -- trx->conc_state = TRX_PREPARED; |
1168 | -+ /* xtrabackup should rollback it */ |
1169 | -+ trx->conc_state = TRX_ACTIVE; |
1170 | - } else { |
1171 | - fprintf(stderr, |
1172 | - "InnoDB: Since" |
1173 | -@@ -544,9 +544,9 @@ |
1174 | - (ullint) trx->id); |
1175 | - |
1176 | - if (srv_force_recovery == 0) { |
1177 | -- |
1178 | -+ /* xtrabackup should rollback it */ |
1179 | - trx->conc_state |
1180 | -- = TRX_PREPARED; |
1181 | -+ = TRX_ACTIVE; |
1182 | - } else { |
1183 | - fprintf(stderr, |
1184 | - "InnoDB: Since" |
1185 | |
1186 | === removed file 'fix_innodb_for_backup_5.1_plugin.patch' |
1187 | --- fix_innodb_for_backup_5.1_plugin.patch 2011-03-13 15:52:22 +0000 |
1188 | +++ fix_innodb_for_backup_5.1_plugin.patch 1970-01-01 00:00:00 +0000 |
1189 | @@ -1,1137 +0,0 @@ |
1190 | ---- a/storage/innodb_plugin/btr/btr0btr.c 2011-03-12 06:27:32.000000000 -0800 |
1191 | -+++ b/storage/innodb_plugin/btr/btr0btr.c 2011-03-12 06:28:08.000000000 -0800 |
1192 | -@@ -120,7 +120,7 @@ |
1193 | - /**************************************************************//** |
1194 | - Gets the root node of a tree and x-latches it. |
1195 | - @return root page, x-latched */ |
1196 | --static |
1197 | -+//static |
1198 | - buf_block_t* |
1199 | - btr_root_block_get( |
1200 | - /*===============*/ |
1201 | -@@ -566,7 +566,7 @@ |
1202 | - /************************************************************//** |
1203 | - Returns the child page of a node pointer and x-latches it. |
1204 | - @return child page, x-latched */ |
1205 | --static |
1206 | -+//static |
1207 | - buf_block_t* |
1208 | - btr_node_ptr_get_child( |
1209 | - /*===================*/ |
1210 | ---- a/storage/innodb_plugin/buf/buf0buf.c 2011-03-12 06:27:32.000000000 -0800 |
1211 | -+++ b/storage/innodb_plugin/buf/buf0buf.c 2011-03-12 06:28:08.000000000 -0800 |
1212 | -@@ -358,7 +358,7 @@ |
1213 | - return(TRUE); |
1214 | - } |
1215 | - |
1216 | --#ifndef UNIV_HOTBACKUP |
1217 | -+#ifdef UNDEFINED |
1218 | - if (recv_lsn_checks_on) { |
1219 | - ib_uint64_t current_lsn; |
1220 | - |
1221 | -@@ -3257,7 +3257,7 @@ |
1222 | - recv_recover_page(TRUE, (buf_block_t*) bpage); |
1223 | - } |
1224 | - |
1225 | -- if (uncompressed && !recv_no_ibuf_operations) { |
1226 | -+ if (uncompressed && !recv_no_ibuf_operations && !srv_fake_write) { |
1227 | - ibuf_merge_or_delete_for_page( |
1228 | - (buf_block_t*) bpage, bpage->space, |
1229 | - bpage->offset, buf_page_get_zip_size(bpage), |
1230 | ---- a/storage/innodb_plugin/buf/buf0rea.c 2011-03-12 06:27:32.000000000 -0800 |
1231 | -+++ b/storage/innodb_plugin/buf/buf0rea.c 2011-03-12 06:28:08.000000000 -0800 |
1232 | -@@ -120,6 +120,45 @@ |
1233 | - bpage = buf_page_init_for_read(err, mode, space, zip_size, unzip, |
1234 | - tablespace_version, offset); |
1235 | - if (bpage == NULL) { |
1236 | -+ if (recv_recovery_is_on() && *err == DB_TABLESPACE_DELETED) { |
1237 | -+ /* hashed log recs must be treated here */ |
1238 | -+ recv_addr_t* recv_addr; |
1239 | -+ |
1240 | -+ mutex_enter(&(recv_sys->mutex)); |
1241 | -+ |
1242 | -+ if (recv_sys->apply_log_recs == FALSE) { |
1243 | -+ mutex_exit(&(recv_sys->mutex)); |
1244 | -+ goto not_to_recover; |
1245 | -+ } |
1246 | -+ |
1247 | -+ /* recv_get_fil_addr_struct() */ |
1248 | -+ recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, |
1249 | -+ hash_calc_hash(ut_fold_ulint_pair(space, offset), |
1250 | -+ recv_sys->addr_hash)); |
1251 | -+ while (recv_addr) { |
1252 | -+ if ((recv_addr->space == space) |
1253 | -+ && (recv_addr->page_no == offset)) { |
1254 | -+ break; |
1255 | -+ } |
1256 | -+ recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); |
1257 | -+ } |
1258 | -+ |
1259 | -+ if ((recv_addr == NULL) |
1260 | -+ || (recv_addr->state == RECV_BEING_PROCESSED) |
1261 | -+ || (recv_addr->state == RECV_PROCESSED)) { |
1262 | -+ mutex_exit(&(recv_sys->mutex)); |
1263 | -+ goto not_to_recover; |
1264 | -+ } |
1265 | -+ |
1266 | -+ fprintf(stderr, " (cannot find space: %lu)", space); |
1267 | -+ recv_addr->state = RECV_PROCESSED; |
1268 | -+ |
1269 | -+ ut_a(recv_sys->n_addrs); |
1270 | -+ recv_sys->n_addrs--; |
1271 | -+ |
1272 | -+ mutex_exit(&(recv_sys->mutex)); |
1273 | -+ } |
1274 | -+not_to_recover: |
1275 | - |
1276 | - return(0); |
1277 | - } |
1278 | -@@ -594,6 +633,50 @@ |
1279 | - /* It is a single table tablespace and the .ibd file is |
1280 | - missing: do nothing */ |
1281 | - |
1282 | -+ /* the log records should be treated here same reason |
1283 | -+ for http://bugs.mysql.com/bug.php?id=43948 */ |
1284 | -+ |
1285 | -+ if (recv_recovery_is_on()) { |
1286 | -+ recv_addr_t* recv_addr; |
1287 | -+ |
1288 | -+ mutex_enter(&(recv_sys->mutex)); |
1289 | -+ |
1290 | -+ if (recv_sys->apply_log_recs == FALSE) { |
1291 | -+ mutex_exit(&(recv_sys->mutex)); |
1292 | -+ goto not_to_recover; |
1293 | -+ } |
1294 | -+ |
1295 | -+ for (i = 0; i < n_stored; i++) { |
1296 | -+ /* recv_get_fil_addr_struct() */ |
1297 | -+ recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, |
1298 | -+ hash_calc_hash(ut_fold_ulint_pair(space, page_nos[i]), |
1299 | -+ recv_sys->addr_hash)); |
1300 | -+ while (recv_addr) { |
1301 | -+ if ((recv_addr->space == space) |
1302 | -+ && (recv_addr->page_no == page_nos[i])) { |
1303 | -+ break; |
1304 | -+ } |
1305 | -+ recv_addr = HASH_GET_NEXT(addr_hash, recv_addr); |
1306 | -+ } |
1307 | -+ |
1308 | -+ if ((recv_addr == NULL) |
1309 | -+ || (recv_addr->state == RECV_BEING_PROCESSED) |
1310 | -+ || (recv_addr->state == RECV_PROCESSED)) { |
1311 | -+ continue; |
1312 | -+ } |
1313 | -+ |
1314 | -+ recv_addr->state = RECV_PROCESSED; |
1315 | -+ |
1316 | -+ ut_a(recv_sys->n_addrs); |
1317 | -+ recv_sys->n_addrs--; |
1318 | -+ } |
1319 | -+ |
1320 | -+ mutex_exit(&(recv_sys->mutex)); |
1321 | -+ |
1322 | -+ fprintf(stderr, " (cannot find space: %lu)", space); |
1323 | -+ } |
1324 | -+not_to_recover: |
1325 | -+ |
1326 | - return; |
1327 | - } |
1328 | - |
1329 | ---- a/storage/innodb_plugin/fil/fil0fil.c 2011-03-12 06:27:32.000000000 -0800 |
1330 | -+++ b/storage/innodb_plugin/fil/fil0fil.c 2011-03-12 06:28:08.000000000 -0800 |
1331 | -@@ -48,6 +48,7 @@ |
1332 | - #else /* !UNIV_HOTBACKUP */ |
1333 | - static ulint srv_data_read, srv_data_written; |
1334 | - #endif /* !UNIV_HOTBACKUP */ |
1335 | -+#include "pars0pars.h" |
1336 | - |
1337 | - /* |
1338 | - IMPLEMENTATION OF THE TABLESPACE MEMORY CACHE |
1339 | -@@ -287,7 +288,7 @@ |
1340 | - |
1341 | - /** The tablespace memory cache. This variable is NULL before the module is |
1342 | - initialized. */ |
1343 | --static fil_system_t* fil_system = NULL; |
1344 | -+fil_system_t* fil_system = NULL; |
1345 | - |
1346 | - |
1347 | - /********************************************************************//** |
1348 | -@@ -298,7 +299,7 @@ |
1349 | - off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
1350 | - mutex. */ |
1351 | - static |
1352 | --void |
1353 | -+ulint |
1354 | - fil_node_prepare_for_io( |
1355 | - /*====================*/ |
1356 | - fil_node_t* node, /*!< in: file node */ |
1357 | -@@ -623,7 +624,7 @@ |
1358 | - Opens a the file of a node of a tablespace. The caller must own the fil_system |
1359 | - mutex. */ |
1360 | - static |
1361 | --void |
1362 | -+ulint |
1363 | - fil_node_open_file( |
1364 | - /*===============*/ |
1365 | - fil_node_t* node, /*!< in: file node */ |
1366 | -@@ -657,7 +658,14 @@ |
1367 | - node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success); |
1368 | - if (!success) { |
1369 | - /* The following call prints an error message */ |
1370 | -- os_file_get_last_error(TRUE); |
1371 | -+ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND) |
1372 | -+ { |
1373 | -+ ut_print_timestamp(stderr); |
1374 | -+ fprintf(stderr, |
1375 | -+ " InnoDB: Warning: cannot open %s\n", |
1376 | -+ node->name); |
1377 | -+ return(OS_FILE_NOT_FOUND); |
1378 | -+ } |
1379 | - |
1380 | - ut_print_timestamp(stderr); |
1381 | - |
1382 | -@@ -747,8 +755,8 @@ |
1383 | - } |
1384 | - |
1385 | - if (size_bytes >= 1024 * 1024) { |
1386 | -- /* Truncate the size to whole megabytes. */ |
1387 | -- size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
1388 | -+ /* The size should be exact for after applying .delta */ |
1389 | -+ //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
1390 | - } |
1391 | - |
1392 | - if (!(flags & DICT_TF_ZSSIZE_MASK)) { |
1393 | -@@ -793,6 +801,8 @@ |
1394 | - /* Put the node to the LRU list */ |
1395 | - UT_LIST_ADD_FIRST(LRU, system->LRU, node); |
1396 | - } |
1397 | -+ |
1398 | -+ return(0); |
1399 | - } |
1400 | - |
1401 | - /**********************************************************************//** |
1402 | -@@ -1418,7 +1428,13 @@ |
1403 | - the file yet; the following calls will open it and update the |
1404 | - size fields */ |
1405 | - |
1406 | -- fil_node_prepare_for_io(node, fil_system, space); |
1407 | -+ if (fil_node_prepare_for_io(node, fil_system, space)) |
1408 | -+ { |
1409 | -+ mutex_exit(&fil_system->mutex); |
1410 | -+ |
1411 | -+ return(0); |
1412 | -+ |
1413 | -+ } |
1414 | - fil_node_complete_io(node, fil_system, OS_FILE_READ); |
1415 | - } |
1416 | - |
1417 | -@@ -1470,7 +1486,12 @@ |
1418 | - the file yet; the following calls will open it and update the |
1419 | - size fields */ |
1420 | - |
1421 | -- fil_node_prepare_for_io(node, fil_system, space); |
1422 | -+ if (fil_node_prepare_for_io(node, fil_system, space)) |
1423 | -+ { |
1424 | -+ mutex_exit(&fil_system->mutex); |
1425 | -+ |
1426 | -+ return(ULINT_UNDEFINED); |
1427 | -+ } |
1428 | - fil_node_complete_io(node, fil_system, OS_FILE_READ); |
1429 | - } |
1430 | - |
1431 | -@@ -2134,7 +2155,7 @@ |
1432 | - if (fil_create_new_single_table_tablespace( |
1433 | - space_id, name, FALSE, flags, |
1434 | - FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
1435 | -- ut_error; |
1436 | -+ //ut_error; |
1437 | - } |
1438 | - } |
1439 | - |
1440 | -@@ -2297,7 +2318,7 @@ |
1441 | - } |
1442 | - |
1443 | - if (success) { |
1444 | --#ifndef UNIV_HOTBACKUP |
1445 | -+#ifdef UNDEFINED |
1446 | - /* Write a log record about the deletion of the .ibd |
1447 | - file, so that ibbackup can replay it in the |
1448 | - --apply-log phase. We use a dummy mtr and the familiar |
1449 | -@@ -2598,7 +2619,7 @@ |
1450 | - |
1451 | - mutex_exit(&fil_system->mutex); |
1452 | - |
1453 | --#ifndef UNIV_HOTBACKUP |
1454 | -+#ifdef UNDEFINED |
1455 | - if (success) { |
1456 | - mtr_t mtr; |
1457 | - |
1458 | -@@ -2788,7 +2809,7 @@ |
1459 | - |
1460 | - fil_node_create(path, size, space_id, FALSE); |
1461 | - |
1462 | --#ifndef UNIV_HOTBACKUP |
1463 | -+#ifdef UNDEFINED |
1464 | - { |
1465 | - mtr_t mtr; |
1466 | - |
1467 | -@@ -3041,19 +3062,97 @@ |
1468 | - "InnoDB: open the tablespace file ", stderr); |
1469 | - ut_print_filename(stderr, filepath); |
1470 | - fputs("!\n" |
1471 | -- "InnoDB: Have you moved InnoDB .ibd files around" |
1472 | -- " without using the\n" |
1473 | -- "InnoDB: commands DISCARD TABLESPACE and" |
1474 | -- " IMPORT TABLESPACE?\n" |
1475 | -- "InnoDB: It is also possible that this is" |
1476 | -- " a temporary table #sql...,\n" |
1477 | -- "InnoDB: and MySQL removed the .ibd file for this.\n" |
1478 | -- "InnoDB: Please refer to\n" |
1479 | -- "InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n" |
1480 | -- "InnoDB: for how to resolve the issue.\n", stderr); |
1481 | -+ "InnoDB: It will be removed from data dictionary.\n" |
1482 | -+ , stderr); |
1483 | - |
1484 | - mem_free(filepath); |
1485 | - |
1486 | -+ /* removing from data dictionary */ |
1487 | -+ { |
1488 | -+ trx_t* trx; |
1489 | -+ pars_info_t* info = NULL; |
1490 | -+ |
1491 | -+ trx = trx_allocate_for_mysql(); |
1492 | -+ |
1493 | -+ trx->op_info = "removing invalid table from data dictionary"; |
1494 | -+ |
1495 | -+ info = pars_info_create(); |
1496 | -+ |
1497 | -+ pars_info_add_str_literal(info, "table_name", name); |
1498 | -+ |
1499 | -+ que_eval_sql(info, |
1500 | -+ "PROCEDURE DROP_TABLE_PROC () IS\n" |
1501 | -+ "sys_foreign_id CHAR;\n" |
1502 | -+ "table_id CHAR;\n" |
1503 | -+ "index_id CHAR;\n" |
1504 | -+ "foreign_id CHAR;\n" |
1505 | -+ "found INT;\n" |
1506 | -+ "BEGIN\n" |
1507 | -+ "SELECT ID INTO table_id\n" |
1508 | -+ "FROM SYS_TABLES\n" |
1509 | -+ "WHERE NAME = :table_name\n" |
1510 | -+ "LOCK IN SHARE MODE;\n" |
1511 | -+ "IF (SQL % NOTFOUND) THEN\n" |
1512 | -+ " RETURN;\n" |
1513 | -+ "END IF;\n" |
1514 | -+ "found := 1;\n" |
1515 | -+ "SELECT ID INTO sys_foreign_id\n" |
1516 | -+ "FROM SYS_TABLES\n" |
1517 | -+ "WHERE NAME = 'SYS_FOREIGN'\n" |
1518 | -+ "LOCK IN SHARE MODE;\n" |
1519 | -+ "IF (SQL % NOTFOUND) THEN\n" |
1520 | -+ " found := 0;\n" |
1521 | -+ "END IF;\n" |
1522 | -+ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
1523 | -+ " found := 0;\n" |
1524 | -+ "END IF;\n" |
1525 | -+ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
1526 | -+ " found := 0;\n" |
1527 | -+ "END IF;\n" |
1528 | -+ "WHILE found = 1 LOOP\n" |
1529 | -+ " SELECT ID INTO foreign_id\n" |
1530 | -+ " FROM SYS_FOREIGN\n" |
1531 | -+ " WHERE FOR_NAME = :table_name\n" |
1532 | -+ " AND TO_BINARY(FOR_NAME)\n" |
1533 | -+ " = TO_BINARY(:table_name)\n" |
1534 | -+ " LOCK IN SHARE MODE;\n" |
1535 | -+ " IF (SQL % NOTFOUND) THEN\n" |
1536 | -+ " found := 0;\n" |
1537 | -+ " ELSE\n" |
1538 | -+ " DELETE FROM SYS_FOREIGN_COLS\n" |
1539 | -+ " WHERE ID = foreign_id;\n" |
1540 | -+ " DELETE FROM SYS_FOREIGN\n" |
1541 | -+ " WHERE ID = foreign_id;\n" |
1542 | -+ " END IF;\n" |
1543 | -+ "END LOOP;\n" |
1544 | -+ "found := 1;\n" |
1545 | -+ "WHILE found = 1 LOOP\n" |
1546 | -+ " SELECT ID INTO index_id\n" |
1547 | -+ " FROM SYS_INDEXES\n" |
1548 | -+ " WHERE TABLE_ID = table_id\n" |
1549 | -+ " LOCK IN SHARE MODE;\n" |
1550 | -+ " IF (SQL % NOTFOUND) THEN\n" |
1551 | -+ " found := 0;\n" |
1552 | -+ " ELSE\n" |
1553 | -+ " DELETE FROM SYS_FIELDS\n" |
1554 | -+ " WHERE INDEX_ID = index_id;\n" |
1555 | -+ " DELETE FROM SYS_INDEXES\n" |
1556 | -+ " WHERE ID = index_id\n" |
1557 | -+ " AND TABLE_ID = table_id;\n" |
1558 | -+ " END IF;\n" |
1559 | -+ "END LOOP;\n" |
1560 | -+ "DELETE FROM SYS_COLUMNS\n" |
1561 | -+ "WHERE TABLE_ID = table_id;\n" |
1562 | -+ "DELETE FROM SYS_TABLES\n" |
1563 | -+ "WHERE ID = table_id;\n" |
1564 | -+ "END;\n" |
1565 | -+ , FALSE, trx); |
1566 | -+ |
1567 | -+ trx_commit_for_mysql(trx); |
1568 | -+ |
1569 | -+ trx_free_for_mysql(trx); |
1570 | -+ } |
1571 | -+ |
1572 | - return(FALSE); |
1573 | - } |
1574 | - |
1575 | -@@ -3284,7 +3383,7 @@ |
1576 | - cannot be ok. */ |
1577 | - |
1578 | - size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low; |
1579 | --#ifndef UNIV_HOTBACKUP |
1580 | -+#ifdef UNDEFINED |
1581 | - if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { |
1582 | - fprintf(stderr, |
1583 | - "InnoDB: Error: the size of single-table tablespace" |
1584 | -@@ -3425,7 +3524,7 @@ |
1585 | - idea is to read as much good data as we can and jump over bad data. |
1586 | - @return 0 if ok, -1 if error even after the retries, 1 if at the end |
1587 | - of the directory */ |
1588 | --static |
1589 | -+//static |
1590 | - int |
1591 | - fil_file_readdir_next_file( |
1592 | - /*=======================*/ |
1593 | -@@ -3724,15 +3823,97 @@ |
1594 | - "InnoDB: in InnoDB data dictionary" |
1595 | - " has tablespace id %lu,\n" |
1596 | - "InnoDB: but tablespace with that id" |
1597 | -- " or name does not exist. Have\n" |
1598 | -- "InnoDB: you deleted or moved .ibd files?\n" |
1599 | -- "InnoDB: This may also be a table created with" |
1600 | -- " CREATE TEMPORARY TABLE\n" |
1601 | -- "InnoDB: whose .ibd and .frm files" |
1602 | -- " MySQL automatically removed, but the\n" |
1603 | -- "InnoDB: table still exists in the" |
1604 | -- " InnoDB internal data dictionary.\n", |
1605 | -+ " or name does not exist. It will be removed from data dictionary.\n" |
1606 | -+ , |
1607 | - (ulong) id); |
1608 | -+ mem_free(path); |
1609 | -+ mutex_exit(&fil_system->mutex); |
1610 | -+ /* removing from data dictionary */ |
1611 | -+ { |
1612 | -+ trx_t* trx; |
1613 | -+ pars_info_t* info = NULL; |
1614 | -+ |
1615 | -+ trx = trx_allocate_for_mysql(); |
1616 | -+ |
1617 | -+ trx->op_info = "removing invalid table from data dictionary"; |
1618 | -+ |
1619 | -+ info = pars_info_create(); |
1620 | -+ |
1621 | -+ pars_info_add_str_literal(info, "table_name", name); |
1622 | -+ |
1623 | -+ que_eval_sql(info, |
1624 | -+ "PROCEDURE DROP_TABLE_PROC () IS\n" |
1625 | -+ "sys_foreign_id CHAR;\n" |
1626 | -+ "table_id CHAR;\n" |
1627 | -+ "index_id CHAR;\n" |
1628 | -+ "foreign_id CHAR;\n" |
1629 | -+ "found INT;\n" |
1630 | -+ "BEGIN\n" |
1631 | -+ "SELECT ID INTO table_id\n" |
1632 | -+ "FROM SYS_TABLES\n" |
1633 | -+ "WHERE NAME = :table_name\n" |
1634 | -+ "LOCK IN SHARE MODE;\n" |
1635 | -+ "IF (SQL % NOTFOUND) THEN\n" |
1636 | -+ " RETURN;\n" |
1637 | -+ "END IF;\n" |
1638 | -+ "found := 1;\n" |
1639 | -+ "SELECT ID INTO sys_foreign_id\n" |
1640 | -+ "FROM SYS_TABLES\n" |
1641 | -+ "WHERE NAME = 'SYS_FOREIGN'\n" |
1642 | -+ "LOCK IN SHARE MODE;\n" |
1643 | -+ "IF (SQL % NOTFOUND) THEN\n" |
1644 | -+ " found := 0;\n" |
1645 | -+ "END IF;\n" |
1646 | -+ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
1647 | -+ " found := 0;\n" |
1648 | -+ "END IF;\n" |
1649 | -+ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
1650 | -+ " found := 0;\n" |
1651 | -+ "END IF;\n" |
1652 | -+ "WHILE found = 1 LOOP\n" |
1653 | -+ " SELECT ID INTO foreign_id\n" |
1654 | -+ " FROM SYS_FOREIGN\n" |
1655 | -+ " WHERE FOR_NAME = :table_name\n" |
1656 | -+ " AND TO_BINARY(FOR_NAME)\n" |
1657 | -+ " = TO_BINARY(:table_name)\n" |
1658 | -+ " LOCK IN SHARE MODE;\n" |
1659 | -+ " IF (SQL % NOTFOUND) THEN\n" |
1660 | -+ " found := 0;\n" |
1661 | -+ " ELSE\n" |
1662 | -+ " DELETE FROM SYS_FOREIGN_COLS\n" |
1663 | -+ " WHERE ID = foreign_id;\n" |
1664 | -+ " DELETE FROM SYS_FOREIGN\n" |
1665 | -+ " WHERE ID = foreign_id;\n" |
1666 | -+ " END IF;\n" |
1667 | -+ "END LOOP;\n" |
1668 | -+ "found := 1;\n" |
1669 | -+ "WHILE found = 1 LOOP\n" |
1670 | -+ " SELECT ID INTO index_id\n" |
1671 | -+ " FROM SYS_INDEXES\n" |
1672 | -+ " WHERE TABLE_ID = table_id\n" |
1673 | -+ " LOCK IN SHARE MODE;\n" |
1674 | -+ " IF (SQL % NOTFOUND) THEN\n" |
1675 | -+ " found := 0;\n" |
1676 | -+ " ELSE\n" |
1677 | -+ " DELETE FROM SYS_FIELDS\n" |
1678 | -+ " WHERE INDEX_ID = index_id;\n" |
1679 | -+ " DELETE FROM SYS_INDEXES\n" |
1680 | -+ " WHERE ID = index_id\n" |
1681 | -+ " AND TABLE_ID = table_id;\n" |
1682 | -+ " END IF;\n" |
1683 | -+ "END LOOP;\n" |
1684 | -+ "DELETE FROM SYS_COLUMNS\n" |
1685 | -+ "WHERE TABLE_ID = table_id;\n" |
1686 | -+ "DELETE FROM SYS_TABLES\n" |
1687 | -+ "WHERE ID = table_id;\n" |
1688 | -+ "END;\n" |
1689 | -+ , FALSE, trx); |
1690 | -+ |
1691 | -+ trx_commit_for_mysql(trx); |
1692 | -+ |
1693 | -+ trx_free_for_mysql(trx); |
1694 | -+ } |
1695 | -+ return(FALSE); |
1696 | - } else { |
1697 | - ut_print_timestamp(stderr); |
1698 | - fputs(" InnoDB: Error: table ", stderr); |
1699 | -@@ -4121,7 +4302,7 @@ |
1700 | - off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
1701 | - mutex. */ |
1702 | - static |
1703 | --void |
1704 | -+ulint |
1705 | - fil_node_prepare_for_io( |
1706 | - /*====================*/ |
1707 | - fil_node_t* node, /*!< in: file node */ |
1708 | -@@ -4141,10 +4322,13 @@ |
1709 | - } |
1710 | - |
1711 | - if (node->open == FALSE) { |
1712 | -+ ulint err; |
1713 | - /* File is closed: open it */ |
1714 | - ut_a(node->n_pending == 0); |
1715 | - |
1716 | -- fil_node_open_file(node, system, space); |
1717 | -+ err = fil_node_open_file(node, system, space); |
1718 | -+ if (err) |
1719 | -+ return(err); |
1720 | - } |
1721 | - |
1722 | - if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
1723 | -@@ -4157,6 +4341,8 @@ |
1724 | - } |
1725 | - |
1726 | - node->n_pending++; |
1727 | -+ |
1728 | -+ return(0); |
1729 | - } |
1730 | - |
1731 | - /********************************************************************//** |
1732 | -@@ -4341,6 +4527,16 @@ |
1733 | - |
1734 | - ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
1735 | - |
1736 | -+ if (space->size <= block_offset) { |
1737 | -+ ulint actual_size; |
1738 | -+ |
1739 | -+ mutex_exit(&fil_system->mutex); |
1740 | -+ fil_extend_space_to_desired_size(&actual_size, space->id, |
1741 | -+ ((block_offset + 1) / 64 + 1) * 64); |
1742 | -+ mutex_enter(&fil_system->mutex); |
1743 | -+ /* should retry? but it may safe for xtrabackup for now. */ |
1744 | -+ } |
1745 | -+ |
1746 | - node = UT_LIST_GET_FIRST(space->chain); |
1747 | - |
1748 | - for (;;) { |
1749 | ---- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-12 06:27:32.000000000 -0800 |
1750 | -+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-12 06:28:08.000000000 -0800 |
1751 | -@@ -1061,6 +1061,9 @@ |
1752 | - |
1753 | - ut_ad(!recv_no_ibuf_operations); |
1754 | - |
1755 | -+ if (srv_fake_write) |
1756 | -+ return(FALSE); |
1757 | -+ |
1758 | - if (ibuf_fixed_addr_page(space, zip_size, page_no)) { |
1759 | - |
1760 | - return(TRUE); |
1761 | -@@ -2277,6 +2280,9 @@ |
1762 | - ulint n_bytes; |
1763 | - ulint n_pag2; |
1764 | - |
1765 | -+ if (srv_fake_write) |
1766 | -+ return(0); |
1767 | -+ |
1768 | - while (sum_pages < n_pages) { |
1769 | - n_bytes = ibuf_contract_ext(&n_pag2, sync); |
1770 | - |
1771 | ---- a/storage/innodb_plugin/include/srv0srv.h 2011-03-12 06:27:32.000000000 -0800 |
1772 | -+++ b/storage/innodb_plugin/include/srv0srv.h 2011-03-12 06:28:08.000000000 -0800 |
1773 | -@@ -196,6 +196,10 @@ |
1774 | - extern ulong srv_max_purge_lag; |
1775 | - |
1776 | - extern ulong srv_replication_delay; |
1777 | -+ |
1778 | -+extern ibool srv_read_only; |
1779 | -+extern ibool srv_fake_write; |
1780 | -+extern ibool srv_apply_log_only; |
1781 | - /*-------------------------------------------*/ |
1782 | - |
1783 | - extern ulint srv_n_rows_inserted; |
1784 | ---- a/storage/innodb_plugin/include/srv0start.h 2011-03-12 06:27:32.000000000 -0800 |
1785 | -+++ b/storage/innodb_plugin/include/srv0start.h 2011-03-12 06:28:08.000000000 -0800 |
1786 | -@@ -91,6 +91,8 @@ |
1787 | - /** Log sequence number immediately after startup */ |
1788 | - extern ib_uint64_t srv_start_lsn; |
1789 | - |
1790 | -+extern ib_uint64_t srv_oldest_lsn; |
1791 | -+ |
1792 | - #ifdef __NETWARE__ |
1793 | - void set_panic_flag_for_netware(void); |
1794 | - #endif |
1795 | ---- a/storage/innodb_plugin/include/ut0byte.ic 2011-03-12 06:27:32.000000000 -0800 |
1796 | -+++ b/storage/innodb_plugin/include/ut0byte.ic 2011-03-12 06:28:08.000000000 -0800 |
1797 | -@@ -168,6 +168,14 @@ |
1798 | - dulint a, /*!< in: dulint */ |
1799 | - ulint b) /*!< in: ulint */ |
1800 | - { |
1801 | -+ if (sizeof(ulint) != 4) { |
1802 | -+ ulint b_h; |
1803 | -+ |
1804 | -+ b_h = b >> 32; |
1805 | -+ b &= 0xFFFFFFFFUL; |
1806 | -+ a.high += b_h; |
1807 | -+ } |
1808 | -+ |
1809 | - if (0xFFFFFFFFUL - b >= a.low) { |
1810 | - a.low += b; |
1811 | - |
1812 | -@@ -191,6 +199,14 @@ |
1813 | - dulint a, /*!< in: dulint */ |
1814 | - ulint b) /*!< in: ulint, b <= a */ |
1815 | - { |
1816 | -+ if (sizeof(ulint) != 4) { |
1817 | -+ ulint b_h; |
1818 | -+ |
1819 | -+ b_h = b >> 32; |
1820 | -+ b &= 0xFFFFFFFFUL; |
1821 | -+ a.high -= b_h; |
1822 | -+ } |
1823 | -+ |
1824 | - if (a.low >= b) { |
1825 | - a.low -= b; |
1826 | - |
1827 | -@@ -235,6 +251,10 @@ |
1828 | - |
1829 | - ut_ad(diff > a.low); |
1830 | - |
1831 | -+ if (sizeof(ulint) != 4) { |
1832 | -+ diff += (a.high - b.high - 1) << 32; |
1833 | -+ } |
1834 | -+ |
1835 | - return(diff); |
1836 | - } |
1837 | - |
1838 | ---- a/storage/innodb_plugin/log/log0log.c 2011-03-12 06:27:32.000000000 -0800 |
1839 | -+++ b/storage/innodb_plugin/log/log0log.c 2011-03-12 06:28:08.000000000 -0800 |
1840 | -@@ -564,7 +564,9 @@ |
1841 | - |
1842 | - offset = (gr_lsn_size_offset + difference) % group_size; |
1843 | - |
1844 | -+ if (sizeof(ulint) == 4) { |
1845 | - ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */ |
1846 | -+ } |
1847 | - |
1848 | - /* fprintf(stderr, |
1849 | - "Offset is %lu gr_lsn_offset is %lu difference is %lu\n", |
1850 | -@@ -1336,7 +1338,7 @@ |
1851 | - #endif /* UNIV_DEBUG */ |
1852 | - ulint unlock; |
1853 | - |
1854 | -- if (recv_no_ibuf_operations) { |
1855 | -+ if (recv_no_ibuf_operations || srv_fake_write) { |
1856 | - /* Recovery is running and no operations on the log files are |
1857 | - allowed yet (the variable name .._no_ibuf_.. is misleading) */ |
1858 | - |
1859 | -@@ -3089,6 +3091,7 @@ |
1860 | - for the 'very fast' shutdown, because the InnoDB layer may have |
1861 | - committed or prepared transactions and we don't want to lose them. */ |
1862 | - |
1863 | -+ if (!srv_apply_log_only) { |
1864 | - if (trx_n_mysql_transactions > 0 |
1865 | - || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) { |
1866 | - |
1867 | -@@ -3096,6 +3099,7 @@ |
1868 | - |
1869 | - goto loop; |
1870 | - } |
1871 | -+ } |
1872 | - |
1873 | - if (srv_fast_shutdown == 2) { |
1874 | - /* In this fastest shutdown we do not flush the buffer pool: |
1875 | ---- a/storage/innodb_plugin/log/log0recv.c 2011-03-12 06:27:32.000000000 -0800 |
1876 | -+++ b/storage/innodb_plugin/log/log0recv.c 2011-03-12 06:28:08.000000000 -0800 |
1877 | -@@ -42,27 +42,27 @@ |
1878 | - #include "trx0undo.h" |
1879 | - #include "trx0rec.h" |
1880 | - #include "fil0fil.h" |
1881 | --#ifndef UNIV_HOTBACKUP |
1882 | -+//#ifndef UNIV_HOTBACKUP |
1883 | - # include "buf0rea.h" |
1884 | - # include "srv0srv.h" |
1885 | - # include "srv0start.h" |
1886 | - # include "trx0roll.h" |
1887 | - # include "row0merge.h" |
1888 | - # include "sync0sync.h" |
1889 | --#else /* !UNIV_HOTBACKUP */ |
1890 | -+//#else /* !UNIV_HOTBACKUP */ |
1891 | - |
1892 | - /** This is set to FALSE if the backup was originally taken with the |
1893 | - ibbackup --include regexp option: then we do not want to create tables in |
1894 | - directories which were not included */ |
1895 | - UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
1896 | --#endif /* !UNIV_HOTBACKUP */ |
1897 | -+//#endif /* !UNIV_HOTBACKUP */ |
1898 | - |
1899 | - /** Log records are stored in the hash table in chunks at most of this size; |
1900 | - this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
1901 | - #define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t)) |
1902 | - |
1903 | - /** Read-ahead area in applying log records to file pages */ |
1904 | --#define RECV_READ_AHEAD_AREA 32 |
1905 | -+#define RECV_READ_AHEAD_AREA 128 |
1906 | - |
1907 | - /** The recovery system */ |
1908 | - UNIV_INTERN recv_sys_t* recv_sys = NULL; |
1909 | -@@ -251,7 +251,7 @@ |
1910 | - { |
1911 | - recv_lsn_checks_on = FALSE; |
1912 | - |
1913 | -- recv_n_pool_free_frames = 256; |
1914 | -+ recv_n_pool_free_frames = 1024; |
1915 | - |
1916 | - recv_recovery_on = FALSE; |
1917 | - |
1918 | -@@ -277,7 +277,7 @@ |
1919 | - |
1920 | - recv_max_parsed_page_no = 0; |
1921 | - |
1922 | -- recv_n_pool_free_frames = 256; |
1923 | -+ recv_n_pool_free_frames = 1024; |
1924 | - |
1925 | - recv_max_page_lsn = 0; |
1926 | - } |
1927 | -@@ -613,7 +613,7 @@ |
1928 | - /***********************************************************************//** |
1929 | - Checks the consistency of the checkpoint info |
1930 | - @return TRUE if ok */ |
1931 | --static |
1932 | -+//static |
1933 | - ibool |
1934 | - recv_check_cp_is_consistent( |
1935 | - /*========================*/ |
1936 | -@@ -643,7 +643,7 @@ |
1937 | - /********************************************************//** |
1938 | - Looks for the maximum consistent checkpoint from the log groups. |
1939 | - @return error code or DB_SUCCESS */ |
1940 | --static |
1941 | -+//static |
1942 | - ulint |
1943 | - recv_find_max_checkpoint( |
1944 | - /*=====================*/ |
1945 | -@@ -818,7 +818,7 @@ |
1946 | - InnoDB-3.23.52 where the checksum field contains the log block number. |
1947 | - @return TRUE if ok, or if the log block may be in the format of InnoDB |
1948 | - version predating 3.23.52 */ |
1949 | --static |
1950 | -+//static |
1951 | - ibool |
1952 | - log_block_checksum_is_ok_or_old_format( |
1953 | - /*===================================*/ |
1954 | -@@ -1486,6 +1486,7 @@ |
1955 | - buf_block_get_page_no(block)); |
1956 | - |
1957 | - if ((recv_addr == NULL) |
1958 | -+ || (recv_addr->state == RECV_BEING_READ && !just_read_in) |
1959 | - || (recv_addr->state == RECV_BEING_PROCESSED) |
1960 | - || (recv_addr->state == RECV_PROCESSED)) { |
1961 | - |
1962 | -@@ -2297,7 +2298,7 @@ |
1963 | - || type == MLOG_FILE_RENAME |
1964 | - || type == MLOG_FILE_DELETE) { |
1965 | - ut_a(space); |
1966 | --#ifdef UNIV_HOTBACKUP |
1967 | -+//#ifdef UNIV_HOTBACKUP |
1968 | - if (recv_replay_file_ops) { |
1969 | - |
1970 | - /* In ibbackup --apply-log, replay an .ibd file |
1971 | -@@ -2320,7 +2321,7 @@ |
1972 | - ut_error; |
1973 | - } |
1974 | - } |
1975 | --#endif |
1976 | -+//#endif |
1977 | - /* In normal mysqld crash recovery we do not try to |
1978 | - replay file operations */ |
1979 | - #ifdef UNIV_LOG_LSN_DEBUG |
1980 | -@@ -2737,8 +2738,11 @@ |
1981 | - |
1982 | - fprintf(stderr, |
1983 | - "InnoDB: Doing recovery: scanned up to" |
1984 | -- " log sequence number %llu\n", |
1985 | -- *group_scanned_lsn); |
1986 | -+ " log sequence number %llu (%lu %)\n", |
1987 | -+ *group_scanned_lsn, |
1988 | -+ (ulong) (*group_scanned_lsn - srv_oldest_lsn) |
1989 | -+ / (8 * log_group_get_capacity(UT_LIST_GET_FIRST(log_sys->log_groups))/900) |
1990 | -+ ); |
1991 | - } |
1992 | - } |
1993 | - |
1994 | -@@ -2850,12 +2854,14 @@ |
1995 | - |
1996 | - if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
1997 | - |
1998 | -+#ifdef UNDEFINED |
1999 | - fprintf(stderr, |
2000 | - "InnoDB: Restoring possible" |
2001 | - " half-written data pages from" |
2002 | - " the doublewrite\n" |
2003 | - "InnoDB: buffer...\n"); |
2004 | -- trx_sys_doublewrite_init_or_restore_pages(TRUE); |
2005 | -+#endif |
2006 | -+ trx_sys_doublewrite_init_or_restore_pages(FALSE); |
2007 | - } |
2008 | - } |
2009 | - |
2010 | -@@ -3005,6 +3011,7 @@ |
2011 | - recv_sys->recovered_lsn = checkpoint_lsn; |
2012 | - |
2013 | - srv_start_lsn = checkpoint_lsn; |
2014 | -+ srv_oldest_lsn = checkpoint_lsn; |
2015 | - } |
2016 | - |
2017 | - contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
2018 | -@@ -3286,6 +3293,7 @@ |
2019 | - that the data dictionary tables will be free of any locks. |
2020 | - The data dictionary latch should guarantee that there is at |
2021 | - most one data dictionary transaction active at a time. */ |
2022 | -+ if (!srv_apply_log_only) |
2023 | - trx_rollback_or_clean_recovered(FALSE); |
2024 | - } |
2025 | - |
2026 | ---- a/storage/innodb_plugin/os/os0file.c 2011-03-12 06:27:32.000000000 -0800 |
2027 | -+++ b/storage/innodb_plugin/os/os0file.c 2011-03-12 06:28:08.000000000 -0800 |
2028 | -@@ -514,7 +514,7 @@ |
2029 | - } |
2030 | - |
2031 | - #undef USE_FILE_LOCK |
2032 | --#define USE_FILE_LOCK |
2033 | -+//#define USE_FILE_LOCK |
2034 | - #if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) |
2035 | - /* InnoDB Hot Backup does not lock the data files. |
2036 | - * On Windows, mandatory locking is used. |
2037 | -@@ -1316,8 +1316,9 @@ |
2038 | - attributes = 0; |
2039 | - ut_error; |
2040 | - } |
2041 | -- |
2042 | -+ share_mode |= FILE_SHARE_WRITE; /* Why? */ |
2043 | - file = CreateFile((LPCTSTR) name, |
2044 | -+ (srv_read_only && create_flag == OPEN_EXISTING) ? GENERIC_READ : |
2045 | - GENERIC_READ | GENERIC_WRITE, /* read and write |
2046 | - access */ |
2047 | - share_mode, /* File can be read also by other |
2048 | -@@ -1376,7 +1377,11 @@ |
2049 | - if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW |
2050 | - || create_mode == OS_FILE_OPEN_RETRY) { |
2051 | - mode_str = "OPEN"; |
2052 | -- create_flag = O_RDWR; |
2053 | -+ if (srv_read_only) { |
2054 | -+ create_flag = O_RDONLY; |
2055 | -+ } else { |
2056 | -+ create_flag = O_RDWR; |
2057 | -+ } |
2058 | - } else if (create_mode == OS_FILE_CREATE) { |
2059 | - mode_str = "CREATE"; |
2060 | - create_flag = O_RDWR | O_CREAT | O_EXCL; |
2061 | -@@ -2545,6 +2550,9 @@ |
2062 | - ut_a((offset & 0xFFFFFFFFUL) == offset); |
2063 | - ut_a((n & 0xFFFFFFFFUL) == n); |
2064 | - |
2065 | -+ if (srv_fake_write) |
2066 | -+ return(TRUE); |
2067 | -+ |
2068 | - os_n_file_writes++; |
2069 | - |
2070 | - ut_ad(file); |
2071 | -@@ -2669,6 +2677,9 @@ |
2072 | - #else |
2073 | - ssize_t ret; |
2074 | - |
2075 | -+ if (srv_fake_write) |
2076 | -+ return(TRUE); |
2077 | -+ |
2078 | - ret = os_file_pwrite(file, buf, n, offset, offset_high); |
2079 | - |
2080 | - if ((ulint)ret == n) { |
2081 | ---- a/storage/innodb_plugin/os/os0thread.c 2011-03-12 06:27:32.000000000 -0800 |
2082 | -+++ b/storage/innodb_plugin/os/os0thread.c 2011-03-12 06:28:08.000000000 -0800 |
2083 | -@@ -287,12 +287,17 @@ |
2084 | - #elif defined(__NETWARE__) |
2085 | - delay(tm / 1000); |
2086 | - #else |
2087 | -+ /* select() simetimes hang up from xtrabackup */ |
2088 | -+ /* change to use usleep() for now */ |
2089 | -+ usleep(tm); |
2090 | -+/* |
2091 | - struct timeval t; |
2092 | - |
2093 | - t.tv_sec = tm / 1000000; |
2094 | - t.tv_usec = tm % 1000000; |
2095 | - |
2096 | - select(0, NULL, NULL, NULL, &t); |
2097 | -+*/ |
2098 | - #endif |
2099 | - } |
2100 | - |
2101 | ---- a/storage/innodb_plugin/row/row0merge.c 2011-03-12 06:27:32.000000000 -0800 |
2102 | -+++ b/storage/innodb_plugin/row/row0merge.c 2011-03-12 06:28:08.000000000 -0800 |
2103 | -@@ -453,7 +453,9 @@ |
2104 | - rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); |
2105 | - offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
2106 | - |
2107 | -- innobase_rec_to_mysql(dup->table, rec, index, offsets); |
2108 | -+ //innobase_rec_to_mysql(dup->table, rec, index, offsets); |
2109 | -+ fprintf(stderr, "InnoDB: Error: row_merge_dup_report() is called.\n"); |
2110 | -+ ut_error; |
2111 | - |
2112 | - mem_heap_free(heap); |
2113 | - } |
2114 | -@@ -1457,8 +1459,11 @@ |
2115 | - case 0: |
2116 | - if (UNIV_UNLIKELY |
2117 | - (dict_index_is_unique(index) && !null_eq)) { |
2118 | -- innobase_rec_to_mysql(table, mrec0, |
2119 | -- index, offsets0); |
2120 | -+ //innobase_rec_to_mysql(table, mrec0, |
2121 | -+ // index, offsets0); |
2122 | -+ fprintf(stderr, "InnoDB: Error: " |
2123 | -+ "row_merge_blocks() is called.\n"); |
2124 | -+ ut_error; |
2125 | - mem_heap_free(heap); |
2126 | - return(DB_DUPLICATE_KEY); |
2127 | - } |
2128 | -@@ -2584,7 +2589,10 @@ |
2129 | - |
2130 | - /* Reset the MySQL row buffer that is used when reporting |
2131 | - duplicate keys. */ |
2132 | -- innobase_rec_reset(table); |
2133 | -+ //innobase_rec_reset(table); |
2134 | -+ fprintf(stderr, "InnoDB: Error: row_merge_build_indexes() is called." |
2135 | -+ "\n"); |
2136 | -+ ut_error; |
2137 | - |
2138 | - /* Read clustered index of the table and create files for |
2139 | - secondary index entries for merge sort */ |
2140 | ---- a/storage/innodb_plugin/srv/srv0srv.c 2011-03-12 06:27:32.000000000 -0800 |
2141 | -+++ b/storage/innodb_plugin/srv/srv0srv.c 2011-03-12 06:28:08.000000000 -0800 |
2142 | -@@ -367,6 +367,9 @@ |
2143 | - |
2144 | - UNIV_INTERN ulong srv_replication_delay = 0; |
2145 | - |
2146 | -+UNIV_INTERN ibool srv_read_only = FALSE; |
2147 | -+UNIV_INTERN ibool srv_fake_write = FALSE; |
2148 | -+UNIV_INTERN ibool srv_apply_log_only = FALSE; |
2149 | - /*-------------------------------------------*/ |
2150 | - UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
2151 | - UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
2152 | -@@ -995,7 +998,7 @@ |
2153 | - } |
2154 | - |
2155 | - /* Initialize some INFORMATION SCHEMA internal structures */ |
2156 | -- trx_i_s_cache_init(trx_i_s_cache); |
2157 | -+ //trx_i_s_cache_init(trx_i_s_cache); |
2158 | - } |
2159 | - |
2160 | - /*********************************************************************//** |
2161 | -@@ -1006,6 +1009,7 @@ |
2162 | - /*==========*/ |
2163 | - { |
2164 | - os_fast_mutex_free(&srv_conc_mutex); |
2165 | -+#ifdef UNDEFINED |
2166 | - mem_free(srv_conc_slots); |
2167 | - srv_conc_slots = NULL; |
2168 | - |
2169 | -@@ -1019,6 +1023,7 @@ |
2170 | - srv_mysql_table = NULL; |
2171 | - |
2172 | - trx_i_s_cache_free(trx_i_s_cache); |
2173 | -+#endif |
2174 | - } |
2175 | - |
2176 | - /*********************************************************************//** |
2177 | ---- a/storage/innodb_plugin/srv/srv0start.c 2011-03-12 06:27:32.000000000 -0800 |
2178 | -+++ b/storage/innodb_plugin/srv/srv0start.c 2011-03-12 06:28:08.000000000 -0800 |
2179 | -@@ -94,6 +94,8 @@ |
2180 | - /** Log sequence number at shutdown */ |
2181 | - UNIV_INTERN ib_uint64_t srv_shutdown_lsn; |
2182 | - |
2183 | -+UNIV_INTERN ib_uint64_t srv_oldest_lsn; |
2184 | -+ |
2185 | - #ifdef HAVE_DARWIN_THREADS |
2186 | - # include <sys/utsname.h> |
2187 | - /** TRUE if the F_FULLFSYNC option is available */ |
2188 | -@@ -544,7 +546,7 @@ |
2189 | - /*********************************************************************//** |
2190 | - Creates or opens the log files and closes them. |
2191 | - @return DB_SUCCESS or error code */ |
2192 | --static |
2193 | -+//static |
2194 | - ulint |
2195 | - open_or_create_log_file( |
2196 | - /*====================*/ |
2197 | -@@ -702,7 +704,7 @@ |
2198 | - /*********************************************************************//** |
2199 | - Creates or opens database data files and closes them. |
2200 | - @return DB_SUCCESS or error code */ |
2201 | --static |
2202 | -+//static |
2203 | - ulint |
2204 | - open_or_create_data_files( |
2205 | - /*======================*/ |
2206 | -@@ -1353,7 +1355,7 @@ |
2207 | - } |
2208 | - #endif /* UNIV_LOG_ARCHIVE */ |
2209 | - |
2210 | -- if (srv_n_log_files * srv_log_file_size >= 262144) { |
2211 | -+ if (sizeof(ulint) == 4 && srv_n_log_files * srv_log_file_size >= 262144) { |
2212 | - fprintf(stderr, |
2213 | - "InnoDB: Error: combined size of log files" |
2214 | - " must be < 4 GB\n"); |
2215 | -@@ -1595,6 +1597,10 @@ |
2216 | - are initialized in trx_sys_init_at_db_start(). */ |
2217 | - |
2218 | - recv_recovery_from_checkpoint_finish(); |
2219 | -+ |
2220 | -+ if (srv_apply_log_only) |
2221 | -+ goto skip_processes; |
2222 | -+ |
2223 | - if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
2224 | - /* The following call is necessary for the insert |
2225 | - buffer to work with multiple tablespaces. We must |
2226 | -@@ -1741,7 +1747,18 @@ |
2227 | - |
2228 | - if (srv_auto_extend_last_data_file |
2229 | - && sum_of_data_file_sizes < tablespace_size_in_header) { |
2230 | -+ /* extend table space size aligning with header */ |
2231 | -+ ulint actual_size; |
2232 | -+ fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); |
2233 | -+ if (actual_size < tablespace_size_in_header) { |
2234 | -+ fprintf(stderr, |
2235 | -+"InnoDB: Warning: To extend tablespace size aligning with header seems to be failed.\n" |
2236 | -+"InnoDB: The acutual size %lu must be larger than %lu.\n", |
2237 | -+ (ulong) actual_size, |
2238 | -+ (ulong) tablespace_size_in_header); |
2239 | -+ } |
2240 | - |
2241 | -+#ifdef UNDEFINED |
2242 | - fprintf(stderr, |
2243 | - "InnoDB: Error: tablespace size stored in header" |
2244 | - " is %lu pages, but\n" |
2245 | -@@ -1766,6 +1783,7 @@ |
2246 | - |
2247 | - return(DB_ERROR); |
2248 | - } |
2249 | -+#endif |
2250 | - } |
2251 | - |
2252 | - /* Check that os_fast_mutexes work as expected */ |
2253 | -@@ -1861,6 +1879,7 @@ |
2254 | - ibuf_update_max_tablespace_id(); |
2255 | - } |
2256 | - |
2257 | -+skip_processes: |
2258 | - srv_file_per_table = srv_file_per_table_original_value; |
2259 | - |
2260 | - srv_was_started = TRUE; |
2261 | ---- a/storage/innodb_plugin/trx/trx0purge.c 2011-03-12 06:27:32.000000000 -0800 |
2262 | -+++ b/storage/innodb_plugin/trx/trx0purge.c 2011-03-12 06:28:08.000000000 -0800 |
2263 | -@@ -1087,6 +1087,9 @@ |
2264 | - /* que_thr_t* thr2; */ |
2265 | - ulint old_pages_handled; |
2266 | - |
2267 | -+ if (srv_fake_write) |
2268 | -+ return(0); |
2269 | -+ |
2270 | - mutex_enter(&(purge_sys->mutex)); |
2271 | - |
2272 | - if (purge_sys->trx->n_active_thrs > 0) { |
2273 | ---- a/storage/innodb_plugin/trx/trx0rseg.c 2011-03-12 06:27:32.000000000 -0800 |
2274 | -+++ b/storage/innodb_plugin/trx/trx0rseg.c 2011-03-12 06:28:08.000000000 -0800 |
2275 | -@@ -143,9 +143,11 @@ |
2276 | - |
2277 | - mutex_free(&rseg->mutex); |
2278 | - |
2279 | -+ if (!srv_apply_log_only) { |
2280 | - /* There can't be any active transactions. */ |
2281 | - ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
2282 | - ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
2283 | -+ } |
2284 | - |
2285 | - undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
2286 | - |
2287 | ---- a/storage/innodb_plugin/trx/trx0sys.c 2011-03-12 06:27:32.000000000 -0800 |
2288 | -+++ b/storage/innodb_plugin/trx/trx0sys.c 2011-03-12 06:28:08.000000000 -0800 |
2289 | -@@ -1607,10 +1607,12 @@ |
2290 | - UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
2291 | - } |
2292 | - |
2293 | -+ if (!srv_apply_log_only) { |
2294 | - ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0); |
2295 | - ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0); |
2296 | - ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
2297 | - ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
2298 | -+ } |
2299 | - |
2300 | - mem_free(trx_sys); |
2301 | - |
2302 | ---- a/storage/innodb_plugin/trx/trx0trx.c 2011-03-12 06:27:32.000000000 -0800 |
2303 | -+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-03-12 06:28:08.000000000 -0800 |
2304 | -@@ -461,8 +461,8 @@ |
2305 | - TRX_ID_PREP_PRINTF(trx->id)); |
2306 | - |
2307 | - if (srv_force_recovery == 0) { |
2308 | -- |
2309 | -- trx->conc_state = TRX_PREPARED; |
2310 | -+ /* xtrabackup should rollback it */ |
2311 | -+ trx->conc_state = TRX_ACTIVE; |
2312 | - } else { |
2313 | - fprintf(stderr, |
2314 | - "InnoDB: Since" |
2315 | -@@ -538,9 +538,9 @@ |
2316 | - trx->id)); |
2317 | - |
2318 | - if (srv_force_recovery == 0) { |
2319 | -- |
2320 | -+ /* xtrabackup should rollback it */ |
2321 | - trx->conc_state |
2322 | -- = TRX_PREPARED; |
2323 | -+ = TRX_ACTIVE; |
2324 | - } else { |
2325 | - fprintf(stderr, |
2326 | - "InnoDB: Since" |
2327 | |
2328 | === added directory 'patches' |
2329 | === renamed file 'fix_innodb_for_backup51.patch' => 'patches/innodb51_builtin.patch' |
2330 | === renamed file 'tar4ibd_libtar-1.2.11.patch' => 'patches/tar4ibd_libtar-1.2.11.patch' |
2331 | === renamed file 'fix_innodb_for_backup_percona-server.patch' => 'patches/xtradb51.patch' |
2332 | --- fix_innodb_for_backup_percona-server.patch 2011-03-13 15:52:22 +0000 |
2333 | +++ patches/xtradb51.patch 2011-03-15 21:59:23 +0000 |
2334 | @@ -1,5 +1,5 @@ |
2335 | ---- a/storage/innodb_plugin/btr/btr0btr.c 2011-03-12 12:22:30.000000000 -0800 |
2336 | -+++ b/storage/innodb_plugin/btr/btr0btr.c 2011-03-12 12:23:27.000000000 -0800 |
2337 | +--- a/storage/innodb_plugin/btr/btr0btr.c 2011-03-14 03:24:55.000000000 -0700 |
2338 | ++++ b/storage/innodb_plugin/btr/btr0btr.c 2011-03-14 03:25:16.000000000 -0700 |
2339 | @@ -120,7 +120,7 @@ |
2340 | /**************************************************************//** |
2341 | Gets the root node of a tree and x-latches it. |
2342 | @@ -18,8 +18,8 @@ |
2343 | buf_block_t* |
2344 | btr_node_ptr_get_child( |
2345 | /*===================*/ |
2346 | ---- a/storage/innodb_plugin/buf/buf0buf.c 2011-03-12 12:22:30.000000000 -0800 |
2347 | -+++ b/storage/innodb_plugin/buf/buf0buf.c 2011-03-12 12:23:27.000000000 -0800 |
2348 | +--- a/storage/innodb_plugin/buf/buf0buf.c 2011-03-14 03:24:55.000000000 -0700 |
2349 | ++++ b/storage/innodb_plugin/buf/buf0buf.c 2011-03-14 03:25:16.000000000 -0700 |
2350 | @@ -440,7 +440,7 @@ |
2351 | return(TRUE); |
2352 | } |
2353 | @@ -38,8 +38,8 @@ |
2354 | ibuf_merge_or_delete_for_page( |
2355 | /* Delete possible entries, if bpage is_corrupt */ |
2356 | (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL : |
2357 | ---- a/storage/innodb_plugin/fil/fil0fil.c 2011-03-12 12:22:30.000000000 -0800 |
2358 | -+++ b/storage/innodb_plugin/fil/fil0fil.c 2011-03-12 12:27:51.000000000 -0800 |
2359 | +--- a/storage/innodb_plugin/fil/fil0fil.c 2011-03-14 03:24:55.000000000 -0700 |
2360 | ++++ b/storage/innodb_plugin/fil/fil0fil.c 2011-03-14 03:26:26.000000000 -0700 |
2361 | @@ -294,7 +294,7 @@ |
2362 | |
2363 | /** The tablespace memory cache. This variable is NULL before the module is |
2364 | @@ -412,7 +412,7 @@ |
2365 | } |
2366 | |
2367 | if (node->open == FALSE) { |
2368 | -+ ulint err; |
2369 | ++ ulint err; |
2370 | /* File is closed: open it */ |
2371 | ut_a(node->n_pending == 0); |
2372 | |
2373 | @@ -423,7 +423,16 @@ |
2374 | } |
2375 | |
2376 | if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
2377 | -@@ -4835,6 +5017,16 @@ |
2378 | +@@ -4650,6 +4832,8 @@ |
2379 | + } |
2380 | + |
2381 | + node->n_pending++; |
2382 | ++ |
2383 | ++ return(0); |
2384 | + } |
2385 | + |
2386 | + /********************************************************************//** |
2387 | +@@ -4835,6 +5019,16 @@ |
2388 | |
2389 | ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
2390 | |
2391 | @@ -440,8 +449,8 @@ |
2392 | node = UT_LIST_GET_FIRST(space->chain); |
2393 | |
2394 | for (;;) { |
2395 | ---- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-03-12 12:22:30.000000000 -0800 |
2396 | -+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-03-12 12:23:27.000000000 -0800 |
2397 | +--- a/storage/innodb_plugin/handler/ha_innodb.cc 2011-03-14 03:24:55.000000000 -0700 |
2398 | ++++ b/storage/innodb_plugin/handler/ha_innodb.cc 2011-03-14 03:25:16.000000000 -0700 |
2399 | @@ -343,12 +343,6 @@ |
2400 | "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.", |
2401 | NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0); |
2402 | @@ -481,8 +490,8 @@ |
2403 | MYSQL_SYSVAR(enable_unsafe_group_commit), |
2404 | MYSQL_SYSVAR(expand_import), |
2405 | MYSQL_SYSVAR(extra_rsegments), |
2406 | ---- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-12 12:22:30.000000000 -0800 |
2407 | -+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-12 12:23:27.000000000 -0800 |
2408 | +--- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-14 03:24:55.000000000 -0700 |
2409 | ++++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2011-03-14 03:25:16.000000000 -0700 |
2410 | @@ -1064,6 +1064,9 @@ |
2411 | |
2412 | ut_ad(!recv_no_ibuf_operations); |
2413 | @@ -503,8 +512,8 @@ |
2414 | while (sum_pages < n_pages) { |
2415 | n_bytes = ibuf_contract_ext(&n_pag2, sync); |
2416 | |
2417 | ---- a/storage/innodb_plugin/include/ha_prototypes.h 2011-03-12 12:22:30.000000000 -0800 |
2418 | -+++ b/storage/innodb_plugin/include/ha_prototypes.h 2011-03-12 12:23:27.000000000 -0800 |
2419 | +--- a/storage/innodb_plugin/include/ha_prototypes.h 2011-03-14 03:24:55.000000000 -0700 |
2420 | ++++ b/storage/innodb_plugin/include/ha_prototypes.h 2011-03-14 03:25:16.000000000 -0700 |
2421 | @@ -268,12 +268,4 @@ |
2422 | void* thd); /*!< in: thread handle (THD*), or NULL to query |
2423 | the global innodb_lock_wait_timeout */ |
2424 | @@ -518,8 +527,8 @@ |
2425 | - void* thd); |
2426 | - |
2427 | #endif |
2428 | ---- a/storage/innodb_plugin/include/srv0srv.h 2011-03-12 12:22:31.000000000 -0800 |
2429 | -+++ b/storage/innodb_plugin/include/srv0srv.h 2011-03-12 12:23:27.000000000 -0800 |
2430 | +--- a/storage/innodb_plugin/include/srv0srv.h 2011-03-14 03:24:55.000000000 -0700 |
2431 | ++++ b/storage/innodb_plugin/include/srv0srv.h 2011-03-14 03:25:16.000000000 -0700 |
2432 | @@ -228,6 +228,10 @@ |
2433 | |
2434 | extern ulong srv_replication_delay; |
2435 | @@ -531,8 +540,8 @@ |
2436 | extern long long srv_ibuf_max_size; |
2437 | extern ulint srv_ibuf_active_contract; |
2438 | extern ulint srv_ibuf_accel_rate; |
2439 | ---- a/storage/innodb_plugin/include/srv0start.h 2011-03-12 12:22:30.000000000 -0800 |
2440 | -+++ b/storage/innodb_plugin/include/srv0start.h 2011-03-12 12:23:27.000000000 -0800 |
2441 | +--- a/storage/innodb_plugin/include/srv0start.h 2011-03-14 03:24:55.000000000 -0700 |
2442 | ++++ b/storage/innodb_plugin/include/srv0start.h 2011-03-14 03:25:16.000000000 -0700 |
2443 | @@ -91,6 +91,8 @@ |
2444 | /** Log sequence number immediately after startup */ |
2445 | extern ib_uint64_t srv_start_lsn; |
2446 | @@ -542,8 +551,8 @@ |
2447 | #ifdef __NETWARE__ |
2448 | void set_panic_flag_for_netware(void); |
2449 | #endif |
2450 | ---- a/storage/innodb_plugin/include/trx0trx.h 2011-03-12 12:22:30.000000000 -0800 |
2451 | -+++ b/storage/innodb_plugin/include/trx0trx.h 2011-03-12 12:23:27.000000000 -0800 |
2452 | +--- a/storage/innodb_plugin/include/trx0trx.h 2011-03-14 03:24:55.000000000 -0700 |
2453 | ++++ b/storage/innodb_plugin/include/trx0trx.h 2011-03-14 03:25:16.000000000 -0700 |
2454 | @@ -497,7 +497,6 @@ |
2455 | FALSE, one can save CPU time and about |
2456 | 150 bytes in the undo log size as then |
2457 | @@ -552,8 +561,8 @@ |
2458 | ulint flush_log_later;/* In 2PC, we hold the |
2459 | prepare_commit mutex across |
2460 | both phases. In that case, we |
2461 | ---- a/storage/innodb_plugin/include/ut0byte.ic 2011-01-25 07:04:39.000000000 -0800 |
2462 | -+++ b/storage/innodb_plugin/include/ut0byte.ic 2011-03-12 12:23:27.000000000 -0800 |
2463 | +--- a/storage/innodb_plugin/include/ut0byte.ic 2011-03-14 03:24:55.000000000 -0700 |
2464 | ++++ b/storage/innodb_plugin/include/ut0byte.ic 2011-03-14 03:25:16.000000000 -0700 |
2465 | @@ -168,6 +168,14 @@ |
2466 | dulint a, /*!< in: dulint */ |
2467 | ulint b) /*!< in: ulint */ |
2468 | @@ -595,8 +604,8 @@ |
2469 | return(diff); |
2470 | } |
2471 | |
2472 | ---- a/storage/innodb_plugin/log/log0log.c 2011-03-12 12:22:31.000000000 -0800 |
2473 | -+++ b/storage/innodb_plugin/log/log0log.c 2011-03-12 12:23:27.000000000 -0800 |
2474 | +--- a/storage/innodb_plugin/log/log0log.c 2011-03-14 03:24:55.000000000 -0700 |
2475 | ++++ b/storage/innodb_plugin/log/log0log.c 2011-03-14 03:25:16.000000000 -0700 |
2476 | @@ -1370,7 +1370,7 @@ |
2477 | #endif /* UNIV_DEBUG */ |
2478 | ulint unlock; |
2479 | @@ -622,8 +631,8 @@ |
2480 | |
2481 | if (srv_fast_shutdown == 2) { |
2482 | /* In this fastest shutdown we do not flush the buffer pool: |
2483 | ---- a/storage/innodb_plugin/log/log0recv.c 2011-03-12 12:22:30.000000000 -0800 |
2484 | -+++ b/storage/innodb_plugin/log/log0recv.c 2011-03-12 12:23:27.000000000 -0800 |
2485 | +--- a/storage/innodb_plugin/log/log0recv.c 2011-03-14 03:24:55.000000000 -0700 |
2486 | ++++ b/storage/innodb_plugin/log/log0recv.c 2011-03-14 03:25:16.000000000 -0700 |
2487 | @@ -42,27 +42,27 @@ |
2488 | #include "trx0undo.h" |
2489 | #include "trx0rec.h" |
2490 | @@ -747,8 +756,8 @@ |
2491 | trx_rollback_or_clean_recovered(FALSE); |
2492 | } |
2493 | |
2494 | ---- a/storage/innodb_plugin/os/os0file.c 2011-03-12 12:22:30.000000000 -0800 |
2495 | -+++ b/storage/innodb_plugin/os/os0file.c 2011-03-12 12:23:27.000000000 -0800 |
2496 | +--- a/storage/innodb_plugin/os/os0file.c 2011-03-14 03:24:55.000000000 -0700 |
2497 | ++++ b/storage/innodb_plugin/os/os0file.c 2011-03-14 03:25:16.000000000 -0700 |
2498 | @@ -554,7 +554,7 @@ |
2499 | } |
2500 | |
2501 | @@ -802,8 +811,8 @@ |
2502 | ret = os_file_pwrite(file, buf, n, offset, offset_high); |
2503 | |
2504 | if ((ulint)ret == n) { |
2505 | ---- a/storage/innodb_plugin/os/os0thread.c 2011-01-25 07:04:39.000000000 -0800 |
2506 | -+++ b/storage/innodb_plugin/os/os0thread.c 2011-03-12 12:23:27.000000000 -0800 |
2507 | +--- a/storage/innodb_plugin/os/os0thread.c 2011-03-14 03:24:55.000000000 -0700 |
2508 | ++++ b/storage/innodb_plugin/os/os0thread.c 2011-03-14 03:25:16.000000000 -0700 |
2509 | @@ -287,12 +287,17 @@ |
2510 | #elif defined(__NETWARE__) |
2511 | delay(tm / 1000); |
2512 | @@ -822,8 +831,8 @@ |
2513 | #endif |
2514 | } |
2515 | |
2516 | ---- a/storage/innodb_plugin/row/row0merge.c 2011-03-12 12:22:30.000000000 -0800 |
2517 | -+++ b/storage/innodb_plugin/row/row0merge.c 2011-03-12 12:23:27.000000000 -0800 |
2518 | +--- a/storage/innodb_plugin/row/row0merge.c 2011-03-14 03:24:55.000000000 -0700 |
2519 | ++++ b/storage/innodb_plugin/row/row0merge.c 2011-03-14 03:25:16.000000000 -0700 |
2520 | @@ -453,7 +453,9 @@ |
2521 | rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); |
2522 | offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
2523 | @@ -859,8 +868,8 @@ |
2524 | |
2525 | /* Read clustered index of the table and create files for |
2526 | secondary index entries for merge sort */ |
2527 | ---- a/storage/innodb_plugin/srv/srv0srv.c 2011-03-12 12:22:31.000000000 -0800 |
2528 | -+++ b/storage/innodb_plugin/srv/srv0srv.c 2011-03-12 12:23:27.000000000 -0800 |
2529 | +--- a/storage/innodb_plugin/srv/srv0srv.c 2011-03-14 03:24:55.000000000 -0700 |
2530 | ++++ b/storage/innodb_plugin/srv/srv0srv.c 2011-03-14 03:25:16.000000000 -0700 |
2531 | @@ -402,6 +402,10 @@ |
2532 | |
2533 | UNIV_INTERN ulong srv_replication_delay = 0; |
2534 | @@ -897,8 +906,8 @@ |
2535 | } |
2536 | |
2537 | /*********************************************************************//** |
2538 | ---- a/storage/innodb_plugin/srv/srv0start.c 2011-03-12 12:22:30.000000000 -0800 |
2539 | -+++ b/storage/innodb_plugin/srv/srv0start.c 2011-03-12 12:23:27.000000000 -0800 |
2540 | +--- a/storage/innodb_plugin/srv/srv0start.c 2011-03-14 03:24:55.000000000 -0700 |
2541 | ++++ b/storage/innodb_plugin/srv/srv0start.c 2011-03-14 03:25:16.000000000 -0700 |
2542 | @@ -94,6 +94,8 @@ |
2543 | /** Log sequence number at shutdown */ |
2544 | UNIV_INTERN ib_uint64_t srv_shutdown_lsn; |
2545 | @@ -972,8 +981,8 @@ |
2546 | srv_file_per_table = srv_file_per_table_original_value; |
2547 | |
2548 | srv_was_started = TRUE; |
2549 | ---- a/storage/innodb_plugin/trx/trx0purge.c 2011-03-12 12:22:30.000000000 -0800 |
2550 | -+++ b/storage/innodb_plugin/trx/trx0purge.c 2011-03-12 12:23:27.000000000 -0800 |
2551 | +--- a/storage/innodb_plugin/trx/trx0purge.c 2011-03-14 03:24:55.000000000 -0700 |
2552 | ++++ b/storage/innodb_plugin/trx/trx0purge.c 2011-03-14 03:25:16.000000000 -0700 |
2553 | @@ -1113,6 +1113,9 @@ |
2554 | /* que_thr_t* thr2; */ |
2555 | ulint old_pages_handled; |
2556 | @@ -984,8 +993,8 @@ |
2557 | mutex_enter(&(purge_sys->mutex)); |
2558 | |
2559 | if (purge_sys->trx->n_active_thrs > 0) { |
2560 | ---- a/storage/innodb_plugin/trx/trx0rseg.c 2011-03-12 12:22:30.000000000 -0800 |
2561 | -+++ b/storage/innodb_plugin/trx/trx0rseg.c 2011-03-12 12:23:27.000000000 -0800 |
2562 | +--- a/storage/innodb_plugin/trx/trx0rseg.c 2011-03-14 03:24:55.000000000 -0700 |
2563 | ++++ b/storage/innodb_plugin/trx/trx0rseg.c 2011-03-14 03:25:16.000000000 -0700 |
2564 | @@ -143,9 +143,11 @@ |
2565 | |
2566 | mutex_free(&rseg->mutex); |
2567 | @@ -998,8 +1007,8 @@ |
2568 | |
2569 | undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
2570 | |
2571 | ---- a/storage/innodb_plugin/trx/trx0sys.c 2011-03-12 12:22:30.000000000 -0800 |
2572 | -+++ b/storage/innodb_plugin/trx/trx0sys.c 2011-03-12 12:23:27.000000000 -0800 |
2573 | +--- a/storage/innodb_plugin/trx/trx0sys.c 2011-03-14 03:24:55.000000000 -0700 |
2574 | ++++ b/storage/innodb_plugin/trx/trx0sys.c 2011-03-14 03:25:16.000000000 -0700 |
2575 | @@ -1931,10 +1931,12 @@ |
2576 | UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
2577 | } |
2578 | @@ -1013,8 +1022,8 @@ |
2579 | |
2580 | mem_free(trx_sys); |
2581 | |
2582 | ---- a/storage/innodb_plugin/trx/trx0trx.c 2011-03-12 12:22:30.000000000 -0800 |
2583 | -+++ b/storage/innodb_plugin/trx/trx0trx.c 2011-03-12 12:23:27.000000000 -0800 |
2584 | +--- a/storage/innodb_plugin/trx/trx0trx.c 2011-03-14 03:24:55.000000000 -0700 |
2585 | ++++ b/storage/innodb_plugin/trx/trx0trx.c 2011-03-14 03:25:16.000000000 -0700 |
2586 | @@ -109,8 +109,6 @@ |
2587 | |
2588 | trx->support_xa = TRUE; |
2589 | |
2590 | === added file 'patches/xtradb55.patch' |
2591 | --- patches/xtradb55.patch 1970-01-01 00:00:00 +0000 |
2592 | +++ patches/xtradb55.patch 2011-03-15 21:59:23 +0000 |
2593 | @@ -0,0 +1,1189 @@ |
2594 | +--- a/storage/innobase/btr/btr0btr.c 2011-03-15 07:56:04.000000000 -0700 |
2595 | ++++ b/storage/innobase/btr/btr0btr.c 2011-03-15 07:56:47.000000000 -0700 |
2596 | +@@ -120,7 +120,7 @@ |
2597 | + /**************************************************************//** |
2598 | + Gets the root node of a tree and x-latches it. |
2599 | + @return root page, x-latched */ |
2600 | +-static |
2601 | ++//static |
2602 | + buf_block_t* |
2603 | + btr_root_block_get( |
2604 | + /*===============*/ |
2605 | +@@ -578,7 +578,7 @@ |
2606 | + /************************************************************//** |
2607 | + Returns the child page of a node pointer and x-latches it. |
2608 | + @return child page, x-latched */ |
2609 | +-static |
2610 | ++//static |
2611 | + buf_block_t* |
2612 | + btr_node_ptr_get_child( |
2613 | + /*===================*/ |
2614 | +--- a/storage/innobase/buf/buf0buf.c 2011-03-15 07:56:04.000000000 -0700 |
2615 | ++++ b/storage/innobase/buf/buf0buf.c 2011-03-15 07:56:47.000000000 -0700 |
2616 | +@@ -609,7 +609,7 @@ |
2617 | + return(TRUE); |
2618 | + } |
2619 | + |
2620 | +-#ifndef UNIV_HOTBACKUP |
2621 | ++#ifdef UNDEFINED |
2622 | + if (recv_lsn_checks_on) { |
2623 | + ib_uint64_t current_lsn; |
2624 | + |
2625 | +@@ -4901,7 +4901,7 @@ |
2626 | + recv_recover_page(TRUE, (buf_block_t*) bpage); |
2627 | + } |
2628 | + |
2629 | +- if (uncompressed && !recv_no_ibuf_operations) { |
2630 | ++ if (uncompressed && !recv_no_ibuf_operations && !srv_fake_write) { |
2631 | + ibuf_merge_or_delete_for_page( |
2632 | + /* Delete possible entries, if bpage is_corrupt */ |
2633 | + (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL : |
2634 | +--- a/storage/innobase/fil/fil0fil.c 2011-03-15 07:56:04.000000000 -0700 |
2635 | ++++ b/storage/innobase/fil/fil0fil.c 2011-03-15 07:56:47.000000000 -0700 |
2636 | +@@ -305,7 +305,7 @@ |
2637 | + |
2638 | + /** The tablespace memory cache. This variable is NULL before the module is |
2639 | + initialized. */ |
2640 | +-static fil_system_t* fil_system = NULL; |
2641 | ++fil_system_t* fil_system = NULL; |
2642 | + |
2643 | + #ifdef UNIV_DEBUG |
2644 | + /** Try fil_validate() every this many times */ |
2645 | +@@ -344,7 +344,7 @@ |
2646 | + off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
2647 | + mutex. */ |
2648 | + static |
2649 | +-void |
2650 | ++ulint |
2651 | + fil_node_prepare_for_io( |
2652 | + /*====================*/ |
2653 | + fil_node_t* node, /*!< in: file node */ |
2654 | +@@ -669,7 +669,7 @@ |
2655 | + Opens a the file of a node of a tablespace. The caller must own the fil_system |
2656 | + mutex. */ |
2657 | + static |
2658 | +-void |
2659 | ++ulint |
2660 | + fil_node_open_file( |
2661 | + /*===============*/ |
2662 | + fil_node_t* node, /*!< in: file node */ |
2663 | +@@ -704,7 +704,14 @@ |
2664 | + OS_FILE_READ_ONLY, &success); |
2665 | + if (!success) { |
2666 | + /* The following call prints an error message */ |
2667 | +- os_file_get_last_error(TRUE); |
2668 | ++ if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND) |
2669 | ++ { |
2670 | ++ ut_print_timestamp(stderr); |
2671 | ++ fprintf(stderr, |
2672 | ++ " InnoDB: Warning: cannot open %s\n", |
2673 | ++ node->name); |
2674 | ++ return(OS_FILE_NOT_FOUND); |
2675 | ++ } |
2676 | + |
2677 | + ut_print_timestamp(stderr); |
2678 | + |
2679 | +@@ -794,8 +801,8 @@ |
2680 | + } |
2681 | + |
2682 | + if (size_bytes >= 1024 * 1024) { |
2683 | +- /* Truncate the size to whole megabytes. */ |
2684 | +- size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
2685 | ++ /* The size should be exact for after applying .delta */ |
2686 | ++ //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024); |
2687 | + } |
2688 | + |
2689 | + if (!(flags & DICT_TF_ZSSIZE_MASK)) { |
2690 | +@@ -846,6 +853,8 @@ |
2691 | + /* Put the node to the LRU list */ |
2692 | + UT_LIST_ADD_FIRST(LRU, system->LRU, node); |
2693 | + } |
2694 | ++ |
2695 | ++ return(0); |
2696 | + } |
2697 | + |
2698 | + /**********************************************************************//** |
2699 | +@@ -1474,7 +1483,12 @@ |
2700 | + the file yet; the following calls will open it and update the |
2701 | + size fields */ |
2702 | + |
2703 | +- fil_node_prepare_for_io(node, fil_system, space); |
2704 | ++ if (fil_node_prepare_for_io(node, fil_system, space)) |
2705 | ++ { |
2706 | ++ mutex_exit(&fil_system->mutex); |
2707 | ++ |
2708 | ++ return(0); |
2709 | ++ } |
2710 | + fil_node_complete_io(node, fil_system, OS_FILE_READ); |
2711 | + } |
2712 | + |
2713 | +@@ -1526,7 +1540,12 @@ |
2714 | + the file yet; the following calls will open it and update the |
2715 | + size fields */ |
2716 | + |
2717 | +- fil_node_prepare_for_io(node, fil_system, space); |
2718 | ++ if (fil_node_prepare_for_io(node, fil_system, space)) |
2719 | ++ { |
2720 | ++ mutex_exit(&fil_system->mutex); |
2721 | ++ |
2722 | ++ return(ULINT_UNDEFINED); |
2723 | ++ } |
2724 | + fil_node_complete_io(node, fil_system, OS_FILE_READ); |
2725 | + } |
2726 | + |
2727 | +@@ -2202,7 +2221,7 @@ |
2728 | + if (fil_create_new_single_table_tablespace( |
2729 | + space_id, name, FALSE, flags, |
2730 | + FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
2731 | +- ut_error; |
2732 | ++ //ut_error; |
2733 | + } |
2734 | + } |
2735 | + |
2736 | +@@ -2369,7 +2388,7 @@ |
2737 | + } |
2738 | + |
2739 | + if (success) { |
2740 | +-#ifndef UNIV_HOTBACKUP |
2741 | ++#ifdef UNDEFINED |
2742 | + /* Write a log record about the deletion of the .ibd |
2743 | + file, so that ibbackup can replay it in the |
2744 | + --apply-log phase. We use a dummy mtr and the familiar |
2745 | +@@ -2670,7 +2689,7 @@ |
2746 | + |
2747 | + mutex_exit(&fil_system->mutex); |
2748 | + |
2749 | +-#ifndef UNIV_HOTBACKUP |
2750 | ++#ifdef UNDEFINED |
2751 | + if (success) { |
2752 | + mtr_t mtr; |
2753 | + |
2754 | +@@ -2861,7 +2880,7 @@ |
2755 | + |
2756 | + fil_node_create(path, size, space_id, FALSE); |
2757 | + |
2758 | +-#ifndef UNIV_HOTBACKUP |
2759 | ++#ifdef UNDEFINED |
2760 | + { |
2761 | + mtr_t mtr; |
2762 | + |
2763 | +@@ -3116,19 +3135,97 @@ |
2764 | + "InnoDB: open the tablespace file ", stderr); |
2765 | + ut_print_filename(stderr, filepath); |
2766 | + fputs("!\n" |
2767 | +- "InnoDB: Have you moved InnoDB .ibd files around" |
2768 | +- " without using the\n" |
2769 | +- "InnoDB: commands DISCARD TABLESPACE and" |
2770 | +- " IMPORT TABLESPACE?\n" |
2771 | +- "InnoDB: It is also possible that this is" |
2772 | +- " a temporary table #sql...,\n" |
2773 | +- "InnoDB: and MySQL removed the .ibd file for this.\n" |
2774 | +- "InnoDB: Please refer to\n" |
2775 | +- "InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n" |
2776 | +- "InnoDB: for how to resolve the issue.\n", stderr); |
2777 | ++ "InnoDB: It will be removed from data dictionary.\n" |
2778 | ++ , stderr); |
2779 | + |
2780 | + mem_free(filepath); |
2781 | + |
2782 | ++ /* removing from data dictionary */ |
2783 | ++ { |
2784 | ++ trx_t* trx; |
2785 | ++ pars_info_t* info = NULL; |
2786 | ++ |
2787 | ++ trx = trx_allocate_for_mysql(); |
2788 | ++ |
2789 | ++ trx->op_info = "removing invalid table from data dictionary"; |
2790 | ++ |
2791 | ++ info = pars_info_create(); |
2792 | ++ |
2793 | ++ pars_info_add_str_literal(info, "table_name", name); |
2794 | ++ |
2795 | ++ que_eval_sql(info, |
2796 | ++ "PROCEDURE DROP_TABLE_PROC () IS\n" |
2797 | ++ "sys_foreign_id CHAR;\n" |
2798 | ++ "table_id CHAR;\n" |
2799 | ++ "index_id CHAR;\n" |
2800 | ++ "foreign_id CHAR;\n" |
2801 | ++ "found INT;\n" |
2802 | ++ "BEGIN\n" |
2803 | ++ "SELECT ID INTO table_id\n" |
2804 | ++ "FROM SYS_TABLES\n" |
2805 | ++ "WHERE NAME = :table_name\n" |
2806 | ++ "LOCK IN SHARE MODE;\n" |
2807 | ++ "IF (SQL % NOTFOUND) THEN\n" |
2808 | ++ " RETURN;\n" |
2809 | ++ "END IF;\n" |
2810 | ++ "found := 1;\n" |
2811 | ++ "SELECT ID INTO sys_foreign_id\n" |
2812 | ++ "FROM SYS_TABLES\n" |
2813 | ++ "WHERE NAME = 'SYS_FOREIGN'\n" |
2814 | ++ "LOCK IN SHARE MODE;\n" |
2815 | ++ "IF (SQL % NOTFOUND) THEN\n" |
2816 | ++ " found := 0;\n" |
2817 | ++ "END IF;\n" |
2818 | ++ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
2819 | ++ " found := 0;\n" |
2820 | ++ "END IF;\n" |
2821 | ++ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
2822 | ++ " found := 0;\n" |
2823 | ++ "END IF;\n" |
2824 | ++ "WHILE found = 1 LOOP\n" |
2825 | ++ " SELECT ID INTO foreign_id\n" |
2826 | ++ " FROM SYS_FOREIGN\n" |
2827 | ++ " WHERE FOR_NAME = :table_name\n" |
2828 | ++ " AND TO_BINARY(FOR_NAME)\n" |
2829 | ++ " = TO_BINARY(:table_name)\n" |
2830 | ++ " LOCK IN SHARE MODE;\n" |
2831 | ++ " IF (SQL % NOTFOUND) THEN\n" |
2832 | ++ " found := 0;\n" |
2833 | ++ " ELSE\n" |
2834 | ++ " DELETE FROM SYS_FOREIGN_COLS\n" |
2835 | ++ " WHERE ID = foreign_id;\n" |
2836 | ++ " DELETE FROM SYS_FOREIGN\n" |
2837 | ++ " WHERE ID = foreign_id;\n" |
2838 | ++ " END IF;\n" |
2839 | ++ "END LOOP;\n" |
2840 | ++ "found := 1;\n" |
2841 | ++ "WHILE found = 1 LOOP\n" |
2842 | ++ " SELECT ID INTO index_id\n" |
2843 | ++ " FROM SYS_INDEXES\n" |
2844 | ++ " WHERE TABLE_ID = table_id\n" |
2845 | ++ " LOCK IN SHARE MODE;\n" |
2846 | ++ " IF (SQL % NOTFOUND) THEN\n" |
2847 | ++ " found := 0;\n" |
2848 | ++ " ELSE\n" |
2849 | ++ " DELETE FROM SYS_FIELDS\n" |
2850 | ++ " WHERE INDEX_ID = index_id;\n" |
2851 | ++ " DELETE FROM SYS_INDEXES\n" |
2852 | ++ " WHERE ID = index_id\n" |
2853 | ++ " AND TABLE_ID = table_id;\n" |
2854 | ++ " END IF;\n" |
2855 | ++ "END LOOP;\n" |
2856 | ++ "DELETE FROM SYS_COLUMNS\n" |
2857 | ++ "WHERE TABLE_ID = table_id;\n" |
2858 | ++ "DELETE FROM SYS_TABLES\n" |
2859 | ++ "WHERE ID = table_id;\n" |
2860 | ++ "END;\n" |
2861 | ++ , FALSE, trx); |
2862 | ++ |
2863 | ++ trx_commit_for_mysql(trx); |
2864 | ++ |
2865 | ++ trx_free_for_mysql(trx); |
2866 | ++ } |
2867 | ++ |
2868 | + return(FALSE); |
2869 | + } |
2870 | + |
2871 | +@@ -3836,7 +3933,7 @@ |
2872 | + cannot be ok. */ |
2873 | + |
2874 | + size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low; |
2875 | +-#ifndef UNIV_HOTBACKUP |
2876 | ++#ifdef UNDEFINED |
2877 | + if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { |
2878 | + fprintf(stderr, |
2879 | + "InnoDB: Error: the size of single-table tablespace" |
2880 | +@@ -3977,7 +4074,7 @@ |
2881 | + idea is to read as much good data as we can and jump over bad data. |
2882 | + @return 0 if ok, -1 if error even after the retries, 1 if at the end |
2883 | + of the directory */ |
2884 | +-static |
2885 | ++//static |
2886 | + int |
2887 | + fil_file_readdir_next_file( |
2888 | + /*=======================*/ |
2889 | +@@ -4276,15 +4373,97 @@ |
2890 | + "InnoDB: in InnoDB data dictionary" |
2891 | + " has tablespace id %lu,\n" |
2892 | + "InnoDB: but tablespace with that id" |
2893 | +- " or name does not exist. Have\n" |
2894 | +- "InnoDB: you deleted or moved .ibd files?\n" |
2895 | +- "InnoDB: This may also be a table created with" |
2896 | +- " CREATE TEMPORARY TABLE\n" |
2897 | +- "InnoDB: whose .ibd and .frm files" |
2898 | +- " MySQL automatically removed, but the\n" |
2899 | +- "InnoDB: table still exists in the" |
2900 | +- " InnoDB internal data dictionary.\n", |
2901 | ++ " or name does not exist. It will be removed from data dictionary.\n" |
2902 | ++ , |
2903 | + (ulong) id); |
2904 | ++ mem_free(path); |
2905 | ++ mutex_exit(&fil_system->mutex); |
2906 | ++ /* removing from data dictionary */ |
2907 | ++ { |
2908 | ++ trx_t* trx; |
2909 | ++ pars_info_t* info = NULL; |
2910 | ++ |
2911 | ++ trx = trx_allocate_for_mysql(); |
2912 | ++ |
2913 | ++ trx->op_info = "removing invalid table from data dictionary"; |
2914 | ++ |
2915 | ++ info = pars_info_create(); |
2916 | ++ |
2917 | ++ pars_info_add_str_literal(info, "table_name", name); |
2918 | ++ |
2919 | ++ que_eval_sql(info, |
2920 | ++ "PROCEDURE DROP_TABLE_PROC () IS\n" |
2921 | ++ "sys_foreign_id CHAR;\n" |
2922 | ++ "table_id CHAR;\n" |
2923 | ++ "index_id CHAR;\n" |
2924 | ++ "foreign_id CHAR;\n" |
2925 | ++ "found INT;\n" |
2926 | ++ "BEGIN\n" |
2927 | ++ "SELECT ID INTO table_id\n" |
2928 | ++ "FROM SYS_TABLES\n" |
2929 | ++ "WHERE NAME = :table_name\n" |
2930 | ++ "LOCK IN SHARE MODE;\n" |
2931 | ++ "IF (SQL % NOTFOUND) THEN\n" |
2932 | ++ " RETURN;\n" |
2933 | ++ "END IF;\n" |
2934 | ++ "found := 1;\n" |
2935 | ++ "SELECT ID INTO sys_foreign_id\n" |
2936 | ++ "FROM SYS_TABLES\n" |
2937 | ++ "WHERE NAME = 'SYS_FOREIGN'\n" |
2938 | ++ "LOCK IN SHARE MODE;\n" |
2939 | ++ "IF (SQL % NOTFOUND) THEN\n" |
2940 | ++ " found := 0;\n" |
2941 | ++ "END IF;\n" |
2942 | ++ "IF (:table_name = 'SYS_FOREIGN') THEN\n" |
2943 | ++ " found := 0;\n" |
2944 | ++ "END IF;\n" |
2945 | ++ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" |
2946 | ++ " found := 0;\n" |
2947 | ++ "END IF;\n" |
2948 | ++ "WHILE found = 1 LOOP\n" |
2949 | ++ " SELECT ID INTO foreign_id\n" |
2950 | ++ " FROM SYS_FOREIGN\n" |
2951 | ++ " WHERE FOR_NAME = :table_name\n" |
2952 | ++ " AND TO_BINARY(FOR_NAME)\n" |
2953 | ++ " = TO_BINARY(:table_name)\n" |
2954 | ++ " LOCK IN SHARE MODE;\n" |
2955 | ++ " IF (SQL % NOTFOUND) THEN\n" |
2956 | ++ " found := 0;\n" |
2957 | ++ " ELSE\n" |
2958 | ++ " DELETE FROM SYS_FOREIGN_COLS\n" |
2959 | ++ " WHERE ID = foreign_id;\n" |
2960 | ++ " DELETE FROM SYS_FOREIGN\n" |
2961 | ++ " WHERE ID = foreign_id;\n" |
2962 | ++ " END IF;\n" |
2963 | ++ "END LOOP;\n" |
2964 | ++ "found := 1;\n" |
2965 | ++ "WHILE found = 1 LOOP\n" |
2966 | ++ " SELECT ID INTO index_id\n" |
2967 | ++ " FROM SYS_INDEXES\n" |
2968 | ++ " WHERE TABLE_ID = table_id\n" |
2969 | ++ " LOCK IN SHARE MODE;\n" |
2970 | ++ " IF (SQL % NOTFOUND) THEN\n" |
2971 | ++ " found := 0;\n" |
2972 | ++ " ELSE\n" |
2973 | ++ " DELETE FROM SYS_FIELDS\n" |
2974 | ++ " WHERE INDEX_ID = index_id;\n" |
2975 | ++ " DELETE FROM SYS_INDEXES\n" |
2976 | ++ " WHERE ID = index_id\n" |
2977 | ++ " AND TABLE_ID = table_id;\n" |
2978 | ++ " END IF;\n" |
2979 | ++ "END LOOP;\n" |
2980 | ++ "DELETE FROM SYS_COLUMNS\n" |
2981 | ++ "WHERE TABLE_ID = table_id;\n" |
2982 | ++ "DELETE FROM SYS_TABLES\n" |
2983 | ++ "WHERE ID = table_id;\n" |
2984 | ++ "END;\n" |
2985 | ++ , FALSE, trx); |
2986 | ++ |
2987 | ++ trx_commit_for_mysql(trx); |
2988 | ++ |
2989 | ++ trx_free_for_mysql(trx); |
2990 | ++ } |
2991 | ++ return(FALSE); |
2992 | + } else { |
2993 | + ut_print_timestamp(stderr); |
2994 | + fputs(" InnoDB: Error: table ", stderr); |
2995 | +@@ -4683,7 +4862,7 @@ |
2996 | + off the LRU list if it is in the LRU list. The caller must hold the fil_sys |
2997 | + mutex. */ |
2998 | + static |
2999 | +-void |
3000 | ++ulint |
3001 | + fil_node_prepare_for_io( |
3002 | + /*====================*/ |
3003 | + fil_node_t* node, /*!< in: file node */ |
3004 | +@@ -4703,10 +4882,13 @@ |
3005 | + } |
3006 | + |
3007 | + if (node->open == FALSE) { |
3008 | ++ ulint err; |
3009 | + /* File is closed: open it */ |
3010 | + ut_a(node->n_pending == 0); |
3011 | + |
3012 | +- fil_node_open_file(node, system, space); |
3013 | ++ err = fil_node_open_file(node, system, space); |
3014 | ++ if (err) |
3015 | ++ return(err); |
3016 | + } |
3017 | + |
3018 | + if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE |
3019 | +@@ -4719,6 +4901,8 @@ |
3020 | + } |
3021 | + |
3022 | + node->n_pending++; |
3023 | ++ |
3024 | ++ return(0); |
3025 | + } |
3026 | + |
3027 | + /********************************************************************//** |
3028 | +@@ -4920,6 +5104,16 @@ |
3029 | + |
3030 | + ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE)); |
3031 | + |
3032 | ++ if (space->size <= block_offset) { |
3033 | ++ ulint actual_size; |
3034 | ++ |
3035 | ++ mutex_exit(&fil_system->mutex); |
3036 | ++ fil_extend_space_to_desired_size(&actual_size, space->id, |
3037 | ++ ((block_offset + 1) / 64 + 1) * 64); |
3038 | ++ mutex_enter(&fil_system->mutex); |
3039 | ++ /* should retry? but it may safe for xtrabackup for now. */ |
3040 | ++ } |
3041 | ++ |
3042 | + node = UT_LIST_GET_FIRST(space->chain); |
3043 | + |
3044 | + for (;;) { |
3045 | +--- a/storage/innobase/handler/ha_innodb.cc 2011-03-15 07:53:56.000000000 -0700 |
3046 | ++++ b/storage/innobase/handler/ha_innodb.cc 2011-03-15 07:59:54.000000000 -0700 |
3047 | +@@ -460,13 +460,6 @@ |
3048 | + "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.", |
3049 | + NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0); |
3050 | + |
3051 | +-static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit, PLUGIN_VAR_OPCMDARG, |
3052 | +- "Set to 0 (write and flush once per second)," |
3053 | +- " 1 (write and flush at each commit)" |
3054 | +- " or 2 (write at commit, flush once per second).", |
3055 | +- NULL, NULL, 1, 0, 2, 0); |
3056 | +- |
3057 | +- |
3058 | + static handler *innobase_create_handler(handlerton *hton, |
3059 | + TABLE_SHARE *table, |
3060 | + MEM_ROOT *mem_root) |
3061 | +@@ -958,17 +951,6 @@ |
3062 | + } |
3063 | + } |
3064 | + |
3065 | +-/******************************************************************//** |
3066 | +-*/ |
3067 | +-extern "C" UNIV_INTERN |
3068 | +-ulong |
3069 | +-thd_flush_log_at_trx_commit( |
3070 | +-/*================================*/ |
3071 | +- void* thd) |
3072 | +-{ |
3073 | +- return(THDVAR((THD*) thd, flush_log_at_trx_commit)); |
3074 | +-} |
3075 | +- |
3076 | + /********************************************************************//** |
3077 | + Obtain the InnoDB transaction of a MySQL thread. |
3078 | + @return reference to transaction pointer */ |
3079 | +@@ -11595,18 +11577,12 @@ |
3080 | + innodb_file_format_max_validate, |
3081 | + innodb_file_format_max_update, "Antelope"); |
3082 | + |
3083 | +-/* Changed to the THDVAR */ |
3084 | +-//static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit, |
3085 | +-// PLUGIN_VAR_OPCMDARG, |
3086 | +-// "Set to 0 (write and flush once per second)," |
3087 | +-// " 1 (write and flush at each commit)" |
3088 | +-// " or 2 (write at commit, flush once per second).", |
3089 | +-// NULL, NULL, 1, 0, 2, 0); |
3090 | +- |
3091 | +-static MYSQL_SYSVAR_BOOL(use_global_flush_log_at_trx_commit, srv_use_global_flush_log_at_trx_commit, |
3092 | +- PLUGIN_VAR_NOCMDARG, |
3093 | +- "Use global innodb_flush_log_at_trx_commit value. (default: ON).", |
3094 | +- NULL, NULL, TRUE); |
3095 | ++static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit, |
3096 | ++ PLUGIN_VAR_OPCMDARG, |
3097 | ++ "Set to 0 (write and flush once per second)," |
3098 | ++ " 1 (write and flush at each commit)" |
3099 | ++ " or 2 (write at commit, flush once per second).", |
3100 | ++ NULL, NULL, 1, 0, 2, 0); |
3101 | + |
3102 | + static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method, |
3103 | + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, |
3104 | +@@ -12073,7 +12049,6 @@ |
3105 | + MYSQL_SYSVAR(file_format_check), |
3106 | + MYSQL_SYSVAR(file_format_max), |
3107 | + MYSQL_SYSVAR(flush_log_at_trx_commit), |
3108 | +- MYSQL_SYSVAR(use_global_flush_log_at_trx_commit), |
3109 | + MYSQL_SYSVAR(flush_method), |
3110 | + MYSQL_SYSVAR(force_recovery), |
3111 | + MYSQL_SYSVAR(locks_unsafe_for_binlog), |
3112 | +--- a/storage/innobase/ibuf/ibuf0ibuf.c 2011-03-15 07:56:04.000000000 -0700 |
3113 | ++++ b/storage/innobase/ibuf/ibuf0ibuf.c 2011-03-15 07:56:47.000000000 -0700 |
3114 | +@@ -1202,6 +1202,9 @@ |
3115 | + ut_ad(!recv_no_ibuf_operations); |
3116 | + ut_ad(x_latch || mtr == NULL); |
3117 | + |
3118 | ++ if (srv_fake_write) |
3119 | ++ return(FALSE); |
3120 | ++ |
3121 | + if (ibuf_fixed_addr_page(space, zip_size, page_no)) { |
3122 | + |
3123 | + return(TRUE); |
3124 | +@@ -2733,6 +2736,9 @@ |
3125 | + ulint n_bytes; |
3126 | + ulint n_pag2; |
3127 | + |
3128 | ++ if (srv_fake_write) |
3129 | ++ return(0); |
3130 | ++ |
3131 | + while (sum_pages < n_pages) { |
3132 | + n_bytes = ibuf_contract_ext(&n_pag2, sync); |
3133 | + |
3134 | +--- a/storage/innobase/include/ha_prototypes.h 2011-03-15 07:56:04.000000000 -0700 |
3135 | ++++ b/storage/innobase/include/ha_prototypes.h 2011-03-15 07:56:47.000000000 -0700 |
3136 | +@@ -275,12 +275,5 @@ |
3137 | + /*===================*/ |
3138 | + void* thd, /*!< in: thread handle (THD*) */ |
3139 | + ulint value); /*!< in: time waited for the lock */ |
3140 | +-/******************************************************************//** |
3141 | +-*/ |
3142 | +- |
3143 | +-ulong |
3144 | +-thd_flush_log_at_trx_commit( |
3145 | +-/*================================*/ |
3146 | +- void* thd); |
3147 | + |
3148 | + #endif |
3149 | +--- a/storage/innobase/include/srv0srv.h 2011-03-15 07:56:04.000000000 -0700 |
3150 | ++++ b/storage/innobase/include/srv0srv.h 2011-03-15 07:56:47.000000000 -0700 |
3151 | +@@ -148,8 +148,7 @@ |
3152 | + extern ulint srv_n_log_files; |
3153 | + extern ulint srv_log_file_size; |
3154 | + extern ulint srv_log_buffer_size; |
3155 | +-//extern ulong srv_flush_log_at_trx_commit; |
3156 | +-extern char srv_use_global_flush_log_at_trx_commit; |
3157 | ++extern ulong srv_flush_log_at_trx_commit; |
3158 | + extern char srv_adaptive_flushing; |
3159 | + |
3160 | + |
3161 | +@@ -253,6 +252,10 @@ |
3162 | + extern ulint srv_dict_size_limit; |
3163 | + |
3164 | + extern ulint srv_lazy_drop_table; |
3165 | ++ |
3166 | ++extern ibool srv_read_only; |
3167 | ++extern ibool srv_fake_write; |
3168 | ++extern ibool srv_apply_log_only; |
3169 | + /*-------------------------------------------*/ |
3170 | + |
3171 | + extern ulint srv_n_rows_inserted; |
3172 | +--- a/storage/innobase/include/srv0start.h 2011-03-15 07:56:04.000000000 -0700 |
3173 | ++++ b/storage/innobase/include/srv0start.h 2011-03-15 07:56:47.000000000 -0700 |
3174 | +@@ -91,6 +91,8 @@ |
3175 | + /** Log sequence number immediately after startup */ |
3176 | + extern ib_uint64_t srv_start_lsn; |
3177 | + |
3178 | ++extern ib_uint64_t srv_oldest_lsn; |
3179 | ++ |
3180 | + #ifdef HAVE_DARWIN_THREADS |
3181 | + /** TRUE if the F_FULLFSYNC option is available */ |
3182 | + extern ibool srv_have_fullfsync; |
3183 | +--- a/storage/innobase/log/log0log.c 2011-03-15 07:56:04.000000000 -0700 |
3184 | ++++ b/storage/innobase/log/log0log.c 2011-03-15 07:56:47.000000000 -0700 |
3185 | +@@ -1154,7 +1154,7 @@ |
3186 | + if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC |
3187 | + && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT |
3188 | + && srv_unix_file_flush_method != SRV_UNIX_NOSYNC |
3189 | +- && thd_flush_log_at_trx_commit(NULL) != 2) { |
3190 | ++ && srv_flush_log_at_trx_commit != 2) { |
3191 | + |
3192 | + fil_flush(group->space_id); |
3193 | + } |
3194 | +@@ -1389,7 +1389,7 @@ |
3195 | + #endif /* UNIV_DEBUG */ |
3196 | + ulint unlock; |
3197 | + |
3198 | +- if (recv_no_ibuf_operations) { |
3199 | ++ if (recv_no_ibuf_operations || srv_fake_write) { |
3200 | + /* Recovery is running and no operations on the log files are |
3201 | + allowed yet (the variable name .._no_ibuf_.. is misleading) */ |
3202 | + |
3203 | +@@ -3151,6 +3151,7 @@ |
3204 | + for the 'very fast' shutdown, because the InnoDB layer may have |
3205 | + committed or prepared transactions and we don't want to lose them. */ |
3206 | + |
3207 | ++ if (!srv_apply_log_only) { |
3208 | + if (trx_n_mysql_transactions > 0 |
3209 | + || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) { |
3210 | + |
3211 | +@@ -3158,6 +3159,7 @@ |
3212 | + |
3213 | + goto loop; |
3214 | + } |
3215 | ++ } |
3216 | + |
3217 | + if (srv_fast_shutdown == 2) { |
3218 | + /* In this fastest shutdown we do not flush the buffer pool: |
3219 | +--- a/storage/innobase/log/log0recv.c 2011-03-15 07:56:04.000000000 -0700 |
3220 | ++++ b/storage/innobase/log/log0recv.c 2011-03-15 07:56:47.000000000 -0700 |
3221 | +@@ -42,27 +42,27 @@ |
3222 | + #include "trx0undo.h" |
3223 | + #include "trx0rec.h" |
3224 | + #include "fil0fil.h" |
3225 | +-#ifndef UNIV_HOTBACKUP |
3226 | ++//#ifndef UNIV_HOTBACKUP |
3227 | + # include "buf0rea.h" |
3228 | + # include "srv0srv.h" |
3229 | + # include "srv0start.h" |
3230 | + # include "trx0roll.h" |
3231 | + # include "row0merge.h" |
3232 | + # include "sync0sync.h" |
3233 | +-#else /* !UNIV_HOTBACKUP */ |
3234 | ++//#else /* !UNIV_HOTBACKUP */ |
3235 | + |
3236 | + /** This is set to FALSE if the backup was originally taken with the |
3237 | + ibbackup --include regexp option: then we do not want to create tables in |
3238 | + directories which were not included */ |
3239 | + UNIV_INTERN ibool recv_replay_file_ops = TRUE; |
3240 | +-#endif /* !UNIV_HOTBACKUP */ |
3241 | ++//#endif /* !UNIV_HOTBACKUP */ |
3242 | + |
3243 | + /** Log records are stored in the hash table in chunks at most of this size; |
3244 | + this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ |
3245 | + #define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t)) |
3246 | + |
3247 | + /** Read-ahead area in applying log records to file pages */ |
3248 | +-#define RECV_READ_AHEAD_AREA 32 |
3249 | ++#define RECV_READ_AHEAD_AREA 128 |
3250 | + |
3251 | + /** The recovery system */ |
3252 | + UNIV_INTERN recv_sys_t* recv_sys = NULL; |
3253 | +@@ -631,7 +631,7 @@ |
3254 | + /***********************************************************************//** |
3255 | + Checks the consistency of the checkpoint info |
3256 | + @return TRUE if ok */ |
3257 | +-static |
3258 | ++//static |
3259 | + ibool |
3260 | + recv_check_cp_is_consistent( |
3261 | + /*========================*/ |
3262 | +@@ -661,7 +661,7 @@ |
3263 | + /********************************************************//** |
3264 | + Looks for the maximum consistent checkpoint from the log groups. |
3265 | + @return error code or DB_SUCCESS */ |
3266 | +-static |
3267 | ++//static |
3268 | + ulint |
3269 | + recv_find_max_checkpoint( |
3270 | + /*=====================*/ |
3271 | +@@ -850,7 +850,7 @@ |
3272 | + InnoDB-3.23.52 where the checksum field contains the log block number. |
3273 | + @return TRUE if ok, or if the log block may be in the format of InnoDB |
3274 | + version predating 3.23.52 */ |
3275 | +-static |
3276 | ++//static |
3277 | + ibool |
3278 | + log_block_checksum_is_ok_or_old_format( |
3279 | + /*===================================*/ |
3280 | +@@ -2380,7 +2380,7 @@ |
3281 | + || type == MLOG_FILE_RENAME |
3282 | + || type == MLOG_FILE_DELETE) { |
3283 | + ut_a(space); |
3284 | +-#ifdef UNIV_HOTBACKUP |
3285 | ++//#ifdef UNIV_HOTBACKUP |
3286 | + if (recv_replay_file_ops) { |
3287 | + |
3288 | + /* In ibbackup --apply-log, replay an .ibd file |
3289 | +@@ -2403,7 +2403,7 @@ |
3290 | + ut_error; |
3291 | + } |
3292 | + } |
3293 | +-#endif |
3294 | ++//#endif |
3295 | + /* In normal mysqld crash recovery we do not try to |
3296 | + replay file operations */ |
3297 | + #ifdef UNIV_LOG_LSN_DEBUG |
3298 | +@@ -2820,8 +2820,11 @@ |
3299 | + |
3300 | + fprintf(stderr, |
3301 | + "InnoDB: Doing recovery: scanned up to" |
3302 | +- " log sequence number %llu\n", |
3303 | +- *group_scanned_lsn); |
3304 | ++ " log sequence number %llu (%lu %%)\n", |
3305 | ++ *group_scanned_lsn, |
3306 | ++ (ulong) (*group_scanned_lsn - srv_oldest_lsn) |
3307 | ++ / (8 * log_group_get_capacity(UT_LIST_GET_FIRST(log_sys->log_groups))/900) |
3308 | ++ ); |
3309 | + } |
3310 | + } |
3311 | + |
3312 | +@@ -2936,12 +2939,14 @@ |
3313 | + |
3314 | + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { |
3315 | + |
3316 | ++#ifdef UNDEFINED |
3317 | + fprintf(stderr, |
3318 | + "InnoDB: Restoring possible" |
3319 | + " half-written data pages from" |
3320 | + " the doublewrite\n" |
3321 | + "InnoDB: buffer...\n"); |
3322 | +- trx_sys_doublewrite_init_or_restore_pages(TRUE); |
3323 | ++#endif |
3324 | ++ trx_sys_doublewrite_init_or_restore_pages(FALSE); |
3325 | + } |
3326 | + } |
3327 | + |
3328 | +@@ -3110,6 +3115,7 @@ |
3329 | + recv_sys->recovered_lsn = checkpoint_lsn; |
3330 | + |
3331 | + srv_start_lsn = checkpoint_lsn; |
3332 | ++ srv_oldest_lsn = checkpoint_lsn; |
3333 | + } |
3334 | + |
3335 | + contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn, |
3336 | +@@ -3475,6 +3481,7 @@ |
3337 | + that the data dictionary tables will be free of any locks. |
3338 | + The data dictionary latch should guarantee that there is at |
3339 | + most one data dictionary transaction active at a time. */ |
3340 | ++ if (!srv_apply_log_only) |
3341 | + trx_rollback_or_clean_recovered(FALSE); |
3342 | + } |
3343 | + |
3344 | +--- a/storage/innobase/os/os0file.c 2011-03-15 07:56:04.000000000 -0700 |
3345 | ++++ b/storage/innobase/os/os0file.c 2011-03-15 07:56:47.000000000 -0700 |
3346 | +@@ -660,7 +660,7 @@ |
3347 | + } |
3348 | + |
3349 | + #undef USE_FILE_LOCK |
3350 | +-#define USE_FILE_LOCK |
3351 | ++//#define USE_FILE_LOCK |
3352 | + #if defined(UNIV_HOTBACKUP) || defined(__WIN__) |
3353 | + /* InnoDB Hot Backup does not lock the data files. |
3354 | + * On Windows, mandatory locking is used. |
3355 | +@@ -1428,7 +1428,7 @@ |
3356 | + #endif |
3357 | + #ifdef UNIV_NON_BUFFERED_IO |
3358 | + # ifndef UNIV_HOTBACKUP |
3359 | +- if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) { |
3360 | ++ if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) { |
3361 | + /* Do not use unbuffered i/o to log files because |
3362 | + value 2 denotes that we do not flush the log at every |
3363 | + commit, but only once per second */ |
3364 | +@@ -1444,7 +1444,7 @@ |
3365 | + attributes = 0; |
3366 | + #ifdef UNIV_NON_BUFFERED_IO |
3367 | + # ifndef UNIV_HOTBACKUP |
3368 | +- if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) { |
3369 | ++ if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) { |
3370 | + /* Do not use unbuffered i/o to log files because |
3371 | + value 2 denotes that we do not flush the log at every |
3372 | + commit, but only once per second */ |
3373 | +@@ -1460,8 +1460,9 @@ |
3374 | + attributes = 0; |
3375 | + ut_error; |
3376 | + } |
3377 | +- |
3378 | ++ share_mode |= FILE_SHARE_WRITE; /* Why? */ |
3379 | + file = CreateFile((LPCTSTR) name, |
3380 | ++ (srv_read_only && create_flag == OPEN_EXISTING) ? GENERIC_READ : |
3381 | + GENERIC_READ | GENERIC_WRITE, /* read and write |
3382 | + access */ |
3383 | + share_mode, /* File can be read also by other |
3384 | +@@ -1520,7 +1521,11 @@ |
3385 | + if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW |
3386 | + || create_mode == OS_FILE_OPEN_RETRY) { |
3387 | + mode_str = "OPEN"; |
3388 | +- create_flag = O_RDWR; |
3389 | ++ if (srv_read_only) { |
3390 | ++ create_flag = O_RDONLY; |
3391 | ++ } else { |
3392 | ++ create_flag = O_RDWR; |
3393 | ++ } |
3394 | + } else if (create_mode == OS_FILE_CREATE) { |
3395 | + mode_str = "CREATE"; |
3396 | + create_flag = O_RDWR | O_CREAT | O_EXCL; |
3397 | +@@ -2732,6 +2737,9 @@ |
3398 | + ut_a((offset & 0xFFFFFFFFUL) == offset); |
3399 | + ut_a((n & 0xFFFFFFFFUL) == n); |
3400 | + |
3401 | ++ if (srv_fake_write) |
3402 | ++ return(TRUE); |
3403 | ++ |
3404 | + os_n_file_writes++; |
3405 | + |
3406 | + ut_ad(file); |
3407 | +@@ -2856,6 +2864,9 @@ |
3408 | + #else |
3409 | + ssize_t ret; |
3410 | + |
3411 | ++ if (srv_fake_write) |
3412 | ++ return(TRUE); |
3413 | ++ |
3414 | + ret = os_file_pwrite(file, buf, n, offset, offset_high); |
3415 | + |
3416 | + if ((ulint)ret == n) { |
3417 | +--- a/storage/innobase/os/os0thread.c 2011-03-15 07:56:04.000000000 -0700 |
3418 | ++++ b/storage/innobase/os/os0thread.c 2011-03-15 07:56:47.000000000 -0700 |
3419 | +@@ -266,12 +266,17 @@ |
3420 | + #ifdef __WIN__ |
3421 | + Sleep((DWORD) tm / 1000); |
3422 | + #else |
3423 | ++ /* select() simetimes hang up from xtrabackup */ |
3424 | ++ /* change to use usleep() for now */ |
3425 | ++ usleep(tm); |
3426 | ++/* |
3427 | + struct timeval t; |
3428 | + |
3429 | + t.tv_sec = tm / 1000000; |
3430 | + t.tv_usec = tm % 1000000; |
3431 | + |
3432 | + select(0, NULL, NULL, NULL, &t); |
3433 | ++*/ |
3434 | + #endif |
3435 | + } |
3436 | + |
3437 | +--- a/storage/innobase/row/row0merge.c 2011-03-15 07:56:04.000000000 -0700 |
3438 | ++++ b/storage/innobase/row/row0merge.c 2011-03-15 07:56:47.000000000 -0700 |
3439 | +@@ -459,7 +459,9 @@ |
3440 | + rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); |
3441 | + offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
3442 | + |
3443 | +- innobase_rec_to_mysql(dup->table, rec, index, offsets); |
3444 | ++ //innobase_rec_to_mysql(dup->table, rec, index, offsets); |
3445 | ++ fprintf(stderr, "InnoDB: Error: row_merge_dup_report() is called.\n"); |
3446 | ++ ut_error; |
3447 | + |
3448 | + mem_heap_free(heap); |
3449 | + } |
3450 | +@@ -1485,8 +1487,10 @@ |
3451 | + case 0: |
3452 | + if (UNIV_UNLIKELY |
3453 | + (dict_index_is_unique(index) && !null_eq)) { |
3454 | +- innobase_rec_to_mysql(table, mrec0, |
3455 | +- index, offsets0); |
3456 | ++ //innobase_rec_to_mysql(table, mrec0, |
3457 | ++ // index, offsets0); |
3458 | ++ fprintf(stderr, "InnoDB: Error: row_merge_blocks() is called.\n"); |
3459 | ++ ut_error; |
3460 | + mem_heap_free(heap); |
3461 | + return(DB_DUPLICATE_KEY); |
3462 | + } |
3463 | +@@ -2613,7 +2617,9 @@ |
3464 | + |
3465 | + /* Reset the MySQL row buffer that is used when reporting |
3466 | + duplicate keys. */ |
3467 | +- innobase_rec_reset(table); |
3468 | ++ //innobase_rec_reset(table); |
3469 | ++ fprintf(stderr, "InnoDB: Error: row_merge_build_indexes() is called.\n"); |
3470 | ++ ut_error; |
3471 | + |
3472 | + /* Read clustered index of the table and create files for |
3473 | + secondary index entries for merge sort */ |
3474 | +--- a/storage/innobase/srv/srv0srv.c 2011-03-15 07:56:04.000000000 -0700 |
3475 | ++++ b/storage/innobase/srv/srv0srv.c 2011-03-15 07:56:47.000000000 -0700 |
3476 | +@@ -197,8 +197,7 @@ |
3477 | + UNIV_INTERN ulint srv_log_file_size = ULINT_MAX; |
3478 | + /* size in database pages */ |
3479 | + UNIV_INTERN ulint srv_log_buffer_size = ULINT_MAX; |
3480 | +-//UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1; |
3481 | +-UNIV_INTERN char srv_use_global_flush_log_at_trx_commit = TRUE; |
3482 | ++UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1; |
3483 | + |
3484 | + /* Try to flush dirty pages so as to avoid IO bursts at |
3485 | + the checkpoints. */ |
3486 | +@@ -449,6 +448,10 @@ |
3487 | + UNIV_INTERN ulint srv_dict_size_limit = 0; |
3488 | + |
3489 | + UNIV_INTERN ulint srv_lazy_drop_table = 0; |
3490 | ++ |
3491 | ++UNIV_INTERN ibool srv_read_only = FALSE; |
3492 | ++UNIV_INTERN ibool srv_fake_write = FALSE; |
3493 | ++UNIV_INTERN ibool srv_apply_log_only = FALSE; |
3494 | + /*-------------------------------------------*/ |
3495 | + UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; |
3496 | + UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; |
3497 | +@@ -1148,7 +1151,7 @@ |
3498 | + } |
3499 | + |
3500 | + /* Initialize some INFORMATION SCHEMA internal structures */ |
3501 | +- trx_i_s_cache_init(trx_i_s_cache); |
3502 | ++ //trx_i_s_cache_init(trx_i_s_cache); |
3503 | + } |
3504 | + |
3505 | + /*********************************************************************//** |
3506 | +@@ -1159,6 +1162,7 @@ |
3507 | + /*==========*/ |
3508 | + { |
3509 | + os_fast_mutex_free(&srv_conc_mutex); |
3510 | ++#ifdef UNDEFINED |
3511 | + mem_free(srv_conc_slots); |
3512 | + srv_conc_slots = NULL; |
3513 | + |
3514 | +@@ -1172,6 +1176,7 @@ |
3515 | + srv_mysql_table = NULL; |
3516 | + |
3517 | + trx_i_s_cache_free(trx_i_s_cache); |
3518 | ++#endif |
3519 | + } |
3520 | + |
3521 | + /*********************************************************************//** |
3522 | +@@ -1876,7 +1881,7 @@ |
3523 | + } |
3524 | + |
3525 | + /* Record the lock wait time for this thread */ |
3526 | +- thd_set_lock_wait_time(trx->mysql_thd, diff_time); |
3527 | ++ //thd_set_lock_wait_time(trx->mysql_thd, diff_time); |
3528 | + } |
3529 | + |
3530 | + if (trx->was_chosen_as_deadlock_victim) { |
3531 | +--- a/storage/innobase/srv/srv0start.c 2011-03-15 07:56:04.000000000 -0700 |
3532 | ++++ b/storage/innobase/srv/srv0start.c 2011-03-15 07:56:47.000000000 -0700 |
3533 | +@@ -94,6 +94,8 @@ |
3534 | + /** Log sequence number at shutdown */ |
3535 | + UNIV_INTERN ib_uint64_t srv_shutdown_lsn; |
3536 | + |
3537 | ++UNIV_INTERN ib_uint64_t srv_oldest_lsn; |
3538 | ++ |
3539 | + #ifdef HAVE_DARWIN_THREADS |
3540 | + # include <sys/utsname.h> |
3541 | + /** TRUE if the F_FULLFSYNC option is available */ |
3542 | +@@ -549,7 +551,7 @@ |
3543 | + /*********************************************************************//** |
3544 | + Creates or opens the log files and closes them. |
3545 | + @return DB_SUCCESS or error code */ |
3546 | +-static |
3547 | ++//static |
3548 | + ulint |
3549 | + open_or_create_log_file( |
3550 | + /*====================*/ |
3551 | +@@ -709,7 +711,7 @@ |
3552 | + /*********************************************************************//** |
3553 | + Creates or opens database data files and closes them. |
3554 | + @return DB_SUCCESS or error code */ |
3555 | +-static |
3556 | ++//static |
3557 | + ulint |
3558 | + open_or_create_data_files( |
3559 | + /*======================*/ |
3560 | +@@ -1868,6 +1870,10 @@ |
3561 | + are initialized in trx_sys_init_at_db_start(). */ |
3562 | + |
3563 | + recv_recovery_from_checkpoint_finish(); |
3564 | ++ |
3565 | ++ if (srv_apply_log_only) |
3566 | ++ goto skip_processes; |
3567 | ++ |
3568 | + if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { |
3569 | + /* The following call is necessary for the insert |
3570 | + buffer to work with multiple tablespaces. We must |
3571 | +@@ -2042,6 +2048,17 @@ |
3572 | + if (!srv_auto_extend_last_data_file |
3573 | + && sum_of_data_file_sizes != tablespace_size_in_header) { |
3574 | + |
3575 | ++ /* extend table space size aligning with header */ |
3576 | ++ ulint actual_size; |
3577 | ++ fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header); |
3578 | ++ if (actual_size < tablespace_size_in_header) { |
3579 | ++ fprintf(stderr, |
3580 | ++"InnoDB: Warning: To extend tablespace size aligning with header seems to be failed.\n" |
3581 | ++"InnoDB: The acutual size %lu must be larger than %lu.\n", |
3582 | ++ (ulong) actual_size, |
3583 | ++ (ulong) tablespace_size_in_header); |
3584 | ++ } |
3585 | ++#ifdef UNDEFINED |
3586 | + ut_print_timestamp(stderr); |
3587 | + fprintf(stderr, |
3588 | + " InnoDB: Error: tablespace size" |
3589 | +@@ -2121,6 +2138,7 @@ |
3590 | + |
3591 | + return(DB_ERROR); |
3592 | + } |
3593 | ++#endif |
3594 | + } |
3595 | + |
3596 | + /* Check that os_fast_mutexes work as expected */ |
3597 | +@@ -2240,6 +2258,7 @@ |
3598 | + ibuf_update_max_tablespace_id(); |
3599 | + } |
3600 | + |
3601 | ++skip_processes: |
3602 | + srv_file_per_table = srv_file_per_table_original_value; |
3603 | + |
3604 | + srv_was_started = TRUE; |
3605 | +--- a/storage/innobase/trx/trx0purge.c 2011-03-15 07:56:04.000000000 -0700 |
3606 | ++++ b/storage/innobase/trx/trx0purge.c 2011-03-15 07:56:47.000000000 -0700 |
3607 | +@@ -1100,6 +1100,9 @@ |
3608 | + /* que_thr_t* thr2; */ |
3609 | + ulint old_pages_handled; |
3610 | + |
3611 | ++ if (srv_fake_write) |
3612 | ++ return(0); |
3613 | ++ |
3614 | + mutex_enter(&(purge_sys->mutex)); |
3615 | + |
3616 | + if (purge_sys->trx->n_active_thrs > 0) { |
3617 | +--- a/storage/innobase/trx/trx0rseg.c 2011-03-15 07:56:04.000000000 -0700 |
3618 | ++++ b/storage/innobase/trx/trx0rseg.c 2011-03-15 07:56:47.000000000 -0700 |
3619 | +@@ -140,9 +140,11 @@ |
3620 | + |
3621 | + mutex_free(&rseg->mutex); |
3622 | + |
3623 | ++ if (!srv_apply_log_only) { |
3624 | + /* There can't be any active transactions. */ |
3625 | + ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0); |
3626 | + ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0); |
3627 | ++ } |
3628 | + |
3629 | + undo = UT_LIST_GET_FIRST(rseg->update_undo_cached); |
3630 | + |
3631 | +--- a/storage/innobase/trx/trx0sys.c 2011-03-15 07:56:04.000000000 -0700 |
3632 | ++++ b/storage/innobase/trx/trx0sys.c 2011-03-15 07:56:47.000000000 -0700 |
3633 | +@@ -1938,10 +1938,12 @@ |
3634 | + UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view); |
3635 | + } |
3636 | + |
3637 | ++ if (!srv_apply_log_only) { |
3638 | + ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0); |
3639 | + ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0); |
3640 | + ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0); |
3641 | + ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0); |
3642 | ++ } |
3643 | + |
3644 | + mem_free(trx_sys); |
3645 | + |
3646 | +--- a/storage/innobase/trx/trx0trx.c 2011-03-15 07:56:04.000000000 -0700 |
3647 | ++++ b/storage/innobase/trx/trx0trx.c 2011-03-15 07:56:47.000000000 -0700 |
3648 | +@@ -505,8 +505,8 @@ |
3649 | + (ullint) trx->id); |
3650 | + |
3651 | + if (srv_force_recovery == 0) { |
3652 | +- |
3653 | +- trx->conc_state = TRX_PREPARED; |
3654 | ++ /* xtrabackup should rollback it */ |
3655 | ++ trx->conc_state = TRX_ACTIVE; |
3656 | + } else { |
3657 | + fprintf(stderr, |
3658 | + "InnoDB: Since" |
3659 | +@@ -580,9 +580,9 @@ |
3660 | + (ullint) trx->id); |
3661 | + |
3662 | + if (srv_force_recovery == 0) { |
3663 | +- |
3664 | ++ /* xtrabackup should rollback it */ |
3665 | + trx->conc_state |
3666 | +- = TRX_PREPARED; |
3667 | ++ = TRX_ACTIVE; |
3668 | + } else { |
3669 | + fprintf(stderr, |
3670 | + "InnoDB: Since" |
3671 | +@@ -925,7 +925,6 @@ |
3672 | + trx->read_view = NULL; |
3673 | + |
3674 | + if (lsn) { |
3675 | +- ulint flush_log_at_trx_commit; |
3676 | + |
3677 | + mutex_exit(&kernel_mutex); |
3678 | + |
3679 | +@@ -934,12 +933,6 @@ |
3680 | + trx_undo_insert_cleanup(trx); |
3681 | + } |
3682 | + |
3683 | +- if (srv_use_global_flush_log_at_trx_commit) { |
3684 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL); |
3685 | +- } else { |
3686 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd); |
3687 | +- } |
3688 | +- |
3689 | + /* NOTE that we could possibly make a group commit more |
3690 | + efficient here: call os_thread_yield here to allow also other |
3691 | + trxs to come to commit! */ |
3692 | +@@ -971,9 +964,9 @@ |
3693 | + if (trx->flush_log_later) { |
3694 | + /* Do nothing yet */ |
3695 | + trx->must_flush_log_later = TRUE; |
3696 | +- } else if (flush_log_at_trx_commit == 0) { |
3697 | ++ } else if (srv_flush_log_at_trx_commit == 0) { |
3698 | + /* Do nothing */ |
3699 | +- } else if (flush_log_at_trx_commit == 1) { |
3700 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
3701 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
3702 | + /* Write the log but do not flush it to disk */ |
3703 | + |
3704 | +@@ -985,7 +978,7 @@ |
3705 | + |
3706 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
3707 | + } |
3708 | +- } else if (flush_log_at_trx_commit == 2) { |
3709 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
3710 | + |
3711 | + /* Write the log but do not flush it to disk */ |
3712 | + |
3713 | +@@ -1665,23 +1658,16 @@ |
3714 | + trx_t* trx) /*!< in: trx handle */ |
3715 | + { |
3716 | + ib_uint64_t lsn = trx->commit_lsn; |
3717 | +- ulint flush_log_at_trx_commit; |
3718 | + |
3719 | + ut_a(trx); |
3720 | + |
3721 | + trx->op_info = "flushing log"; |
3722 | + |
3723 | +- if (srv_use_global_flush_log_at_trx_commit) { |
3724 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL); |
3725 | +- } else { |
3726 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd); |
3727 | +- } |
3728 | +- |
3729 | + if (!trx->must_flush_log_later) { |
3730 | + /* Do nothing */ |
3731 | +- } else if (flush_log_at_trx_commit == 0) { |
3732 | ++ } else if (srv_flush_log_at_trx_commit == 0) { |
3733 | + /* Do nothing */ |
3734 | +- } else if (flush_log_at_trx_commit == 1) { |
3735 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
3736 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
3737 | + /* Write the log but do not flush it to disk */ |
3738 | + |
3739 | +@@ -1692,7 +1678,7 @@ |
3740 | + |
3741 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
3742 | + } |
3743 | +- } else if (flush_log_at_trx_commit == 2) { |
3744 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
3745 | + |
3746 | + /* Write the log but do not flush it to disk */ |
3747 | + |
3748 | +@@ -1945,7 +1931,6 @@ |
3749 | + /*--------------------------------------*/ |
3750 | + |
3751 | + if (lsn) { |
3752 | +- ulint flush_log_at_trx_commit; |
3753 | + |
3754 | + /* Depending on the my.cnf options, we may now write the log |
3755 | + buffer to the log files, making the prepared state of the |
3756 | +@@ -1966,15 +1951,9 @@ |
3757 | + |
3758 | + mutex_exit(&kernel_mutex); |
3759 | + |
3760 | +- if (srv_use_global_flush_log_at_trx_commit) { |
3761 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL); |
3762 | +- } else { |
3763 | +- flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd); |
3764 | +- } |
3765 | +- |
3766 | +- if (flush_log_at_trx_commit == 0) { |
3767 | ++ if (srv_flush_log_at_trx_commit == 0) { |
3768 | + /* Do nothing */ |
3769 | +- } else if (flush_log_at_trx_commit == 1) { |
3770 | ++ } else if (srv_flush_log_at_trx_commit == 1) { |
3771 | + if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { |
3772 | + /* Write the log but do not flush it to disk */ |
3773 | + |
3774 | +@@ -1986,7 +1965,7 @@ |
3775 | + |
3776 | + log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE); |
3777 | + } |
3778 | +- } else if (flush_log_at_trx_commit == 2) { |
3779 | ++ } else if (srv_flush_log_at_trx_commit == 2) { |
3780 | + |
3781 | + /* Write the log but do not flush it to disk */ |
3782 | + |
3783 | |
3784 | === modified file 'utils/build.sh' |
3785 | --- utils/build.sh 2011-03-13 15:52:22 +0000 |
3786 | +++ utils/build.sh 2011-03-15 21:59:23 +0000 |
3787 | @@ -17,9 +17,16 @@ |
3788 | fi |
3789 | MAKE_CMD="$MAKE_CMD -j6" |
3790 | |
3791 | -function usage(){ |
3792 | - echo "Usage: `basename $0` 5.1|5.5|plugin|xtradb" |
3793 | - exit -1 |
3794 | +function usage() |
3795 | +{ |
3796 | + echo "Build an xtrabackup binary against the specified InnoDB flavor." |
3797 | + echo |
3798 | + echo "Usage: `basename $0` CODEBASE" |
3799 | + echo "where CODEBASE can be one of the following values or aliases:" |
3800 | + echo " innodb51_builtin | 5.1 build against built-in InnoDB in MySQL 5.1" |
3801 | + echo " xtradb51 | xtradb build against Percona Server with XtraDB 5.1" |
3802 | + echo " xtradb55 | xtradb55 build against Percona Server with XtraDB 5.5" |
3803 | + exit -1 |
3804 | } |
3805 | |
3806 | ################################################################################ |
3807 | @@ -52,7 +59,7 @@ |
3808 | { |
3809 | tar xzf $top_dir/$1 |
3810 | cd `basename "$1" ".tar.gz"` |
3811 | - patch -p1 < $top_dir/$2 |
3812 | + patch -p1 < $top_dir/patches/$2 |
3813 | cd .. |
3814 | } |
3815 | |
3816 | @@ -104,7 +111,7 @@ |
3817 | # Expects the following variables to be set before calling: |
3818 | # mysql_version version string (e.g. "5.1.53") |
3819 | # server_patch name of the patch to apply to server source before |
3820 | -# building (e.g. "fix_innodb_for_backup51.patch") |
3821 | +# building (e.g. "xtradb51.patch") |
3822 | # innodb_name either "innobase" or "innodb_plugin" |
3823 | # configure_cmd server configure command |
3824 | # xtrabackup_target 'make' target to build in the xtrabackup build directory |
3825 | @@ -142,9 +149,9 @@ |
3826 | top_dir=`pwd` |
3827 | |
3828 | case "$type" in |
3829 | -"5.1") |
3830 | +"innodb51_builtin" | "5.1") |
3831 | mysql_version=$MYSQL_51_VERSION |
3832 | - server_patch=fix_innodb_for_backup51.patch |
3833 | + server_patch=innodb51_builtin.patch |
3834 | innodb_name=innobase |
3835 | xtrabackup_target=5.1 |
3836 | configure_cmd="./configure --enable-local-infile \ |
3837 | @@ -156,11 +163,58 @@ |
3838 | |
3839 | build_all |
3840 | ;; |
3841 | -"5.5") |
3842 | - mysql_version=$MYSQL_55_VERSION |
3843 | - server_patch=fix_innodb_for_backup55.patch |
3844 | - innodb_name=innobase |
3845 | - xtrabackup_target=5.5 |
3846 | +"xtradb51" | "xtradb") |
3847 | + server_dir=$top_dir/Percona-Server |
3848 | + branch_dir=percona-server-5.1-xtrabackup |
3849 | + innodb_dir=$server_dir/storage/innodb_plugin |
3850 | + build_dir=$innodb_dir/xtrabackup |
3851 | + xtrabackup_target=xtradb |
3852 | + configure_cmd="./configure --enable-local-infile \ |
3853 | + --enable-thread-safe-client \ |
3854 | + --with-plugins=innodb_plugin \ |
3855 | + --with-zlib-dir=bundled \ |
3856 | + --enable-shared \ |
3857 | + --with-extra-charsets=complex" |
3858 | + if [ "`uname -s`" = "Linux" ] |
3859 | + then |
3860 | + configure_cmd="LIBS=-lrt $configure_cmd" |
3861 | + fi |
3862 | + |
3863 | + |
3864 | + echo "Downloading sources" |
3865 | + |
3866 | + auto_download libtar-1.2.11.tar.gz |
3867 | + |
3868 | + # Get Percona Server |
3869 | + if [ -d $branch_dir ] |
3870 | + then |
3871 | + cd $branch_dir |
3872 | + bzr pull |
3873 | + else |
3874 | + bzr branch lp:~percona-dev/percona-server/$branch_dir $branch_dir |
3875 | + cd $branch_dir |
3876 | + fi |
3877 | + |
3878 | + $MAKE_CMD main |
3879 | + rm -rf $server_dir |
3880 | + mv Percona-Server $top_dir |
3881 | + |
3882 | + # Patch Percona Server |
3883 | + cd $server_dir |
3884 | + patch -p1 < $top_dir/patches/xtradb51.patch |
3885 | + |
3886 | + build_server |
3887 | + |
3888 | + build_xtrabackup |
3889 | + |
3890 | + build_tar4ibd |
3891 | + ;; |
3892 | +"xtradb55") |
3893 | + server_dir=$top_dir/Percona-Server-5.5 |
3894 | + branch_dir=percona-server-5.5-xtrabackup |
3895 | + innodb_dir=$server_dir/storage/innobase |
3896 | + build_dir=$innodb_dir/xtrabackup |
3897 | + xtrabackup_target=xtradb55 |
3898 | # We need to build with partitioning due to MySQL bug #58632 |
3899 | configure_cmd="cmake . \ |
3900 | -DENABLED_LOCAL_INFILE=ON \ |
3901 | @@ -169,34 +223,6 @@ |
3902 | -DWITH_ZLIB=bundled \ |
3903 | -DWITH_EXTRA_CHARSETS=complex \ |
3904 | -DENABLE_DTRACE=OFF" |
3905 | - |
3906 | - build_all |
3907 | - ;; |
3908 | -"plugin") |
3909 | - mysql_version=$MYSQL_51_VERSION |
3910 | - server_patch=fix_innodb_for_backup_5.1_plugin.patch |
3911 | - innodb_name=innodb_plugin |
3912 | - xtrabackup_target=plugin |
3913 | - configure_cmd="./configure --enable-local-infile \ |
3914 | - --enable-thread-safe-client \ |
3915 | - --with-plugins=innodb_plugin \ |
3916 | - --with-zlib-dir=bundled \ |
3917 | - --enable-shared \ |
3918 | - --with-extra-charsets=complex" |
3919 | - |
3920 | - build_all |
3921 | - ;; |
3922 | -"xtradb") |
3923 | - server_dir=$top_dir/Percona-Server |
3924 | - branch_dir=percona-server-5.1-xtrabackup |
3925 | - innodb_dir=$server_dir/storage/innodb_plugin |
3926 | - build_dir=$innodb_dir/xtrabackup |
3927 | - configure_cmd="./configure --enable-local-infile \ |
3928 | - --enable-thread-safe-client \ |
3929 | - --with-plugins=innodb_plugin \ |
3930 | - --with-zlib-dir=bundled \ |
3931 | - --enable-shared \ |
3932 | - --with-extra-charsets=complex" |
3933 | if [ "`uname -s`" = "Linux" ] |
3934 | then |
3935 | configure_cmd="LIBS=-lrt $configure_cmd" |
3936 | @@ -217,14 +243,13 @@ |
3937 | cd $branch_dir |
3938 | fi |
3939 | |
3940 | - $MAKE_CMD main |
3941 | + $MAKE_CMD PERCONA_SERVER=Percona-Server-5.5 main |
3942 | rm -rf $server_dir |
3943 | - mv Percona-Server $top_dir |
3944 | + mv Percona-Server-5.5 $top_dir |
3945 | |
3946 | # Patch Percona Server |
3947 | cd $server_dir |
3948 | - patch -p1 < $top_dir/fix_innodb_for_backup_percona-server.patch |
3949 | - |
3950 | + patch -p1 < $top_dir/patches/xtradb55.patch |
3951 | |
3952 | build_server |
3953 | |
3954 | |
3955 | === removed file 'utils/build51tree.sh' |
3956 | --- utils/build51tree.sh 2009-12-07 07:25:13 +0000 |
3957 | +++ utils/build51tree.sh 1970-01-01 00:00:00 +0000 |
3958 | @@ -1,29 +0,0 @@ |
3959 | -# helper script to prepare MySQL tree for xtrabackup build |
3960 | -# tested with mysql-5.0.75 / .77 |
3961 | -# $1 - path to mysql .tar.gz |
3962 | -set -e |
3963 | -PATHS=$1 |
3964 | -DIRDST=`dirname $PATHS` |
3965 | -DRNAME=`basename $PATHS .tar.gz` |
3966 | - |
3967 | -mkdir -p $DIRDST/xtrabackup-build |
3968 | - |
3969 | -tar xfz $PATHS -C $DIRDST/xtrabackup-build |
3970 | -cp ../fix_innodb_for_backup51.patch $DIRDST/xtrabackup-build/$DRNAME/storage |
3971 | - |
3972 | -mkdir -p $DIRDST/xtrabackup-build/$DRNAME/storage/innobase/xtrabackup |
3973 | -cp -R ../* $DIRDST/xtrabackup-build/$DRNAME/storage/innobase/xtrabackup |
3974 | -pushd $DIRDST/xtrabackup-build/$DRNAME |
3975 | -cd storage |
3976 | -patch -p1 < fix_innodb_for_backup51.patch |
3977 | -cd .. |
3978 | -./configure |
3979 | -if test -f /proc/cpuinfo |
3980 | -then |
3981 | - n_proc=`grep ^processor.: /proc/cpuinfo | wc -l` |
3982 | -else |
3983 | - n_proc=1 |
3984 | -fi |
3985 | -make -j$n_proc |
3986 | -cd storage/innobase/xtrabackup |
3987 | -make |
3988 | |
3989 | === removed file 'utils/buildtree.sh' |
3990 | --- utils/buildtree.sh 2009-12-07 07:25:13 +0000 |
3991 | +++ utils/buildtree.sh 1970-01-01 00:00:00 +0000 |
3992 | @@ -1,27 +0,0 @@ |
3993 | -# helper script to prepare MySQL tree for xtrabackup build |
3994 | -# tested with mysql-5.0.75 / .77 |
3995 | -# $1 - path to mysql .tar.gz |
3996 | -set -e |
3997 | -PATHS=$1 |
3998 | -DIRDST=`dirname $PATHS` |
3999 | -DRNAME=`basename $PATHS .tar.gz` |
4000 | - |
4001 | -mkdir -p $DIRDST/xtrabackup-build |
4002 | - |
4003 | -tar xfz $PATHS -C $DIRDST/xtrabackup-build |
4004 | -cp ../fix_innodb_for_backup.patch $DIRDST/xtrabackup-build/$DRNAME |
4005 | -mkdir -p $DIRDST/xtrabackup-build/$DRNAME/innobase/xtrabackup |
4006 | -cp -R ../* $DIRDST/xtrabackup-build/$DRNAME/innobase/xtrabackup |
4007 | -pushd $DIRDST/xtrabackup-build/$DRNAME |
4008 | -patch -p1 < fix_innodb_for_backup.patch |
4009 | - |
4010 | -./configure --with-extra-charsets=complex |
4011 | -if test -f /proc/cpuinfo |
4012 | -then |
4013 | - n_proc=`grep ^processor.: /proc/cpuinfo | wc -l` |
4014 | -else |
4015 | - n_proc=1 |
4016 | -fi |
4017 | -make -j$n_proc |
4018 | -cd innobase/xtrabackup |
4019 | -make |
4020 | |
4021 | === removed file 'utils/prepare_tree_for_rpm.sh' |
4022 | --- utils/prepare_tree_for_rpm.sh 2009-06-18 06:05:21 +0000 |
4023 | +++ utils/prepare_tree_for_rpm.sh 1970-01-01 00:00:00 +0000 |
4024 | @@ -1,31 +0,0 @@ |
4025 | -# helper script to prepare MySQL tree for xtrabackup build |
4026 | -# tested with mysql-5.0.75 / .77 |
4027 | -# $1 - path to mysql .tar.gz |
4028 | - |
4029 | -BV=0.8 |
4030 | - |
4031 | -PATHS=$1 |
4032 | -DIRDST=`dirname $PATHS` |
4033 | -DRNAME=`basename $PATHS .tar.gz` |
4034 | - |
4035 | -mkdir -p $DIRDST/xtrabackup-build |
4036 | - |
4037 | -rm -fr $DIRDST/xtrabackup-build/$DRNAME |
4038 | - |
4039 | -tar xfz $PATHS -C $DIRDST/xtrabackup-build |
4040 | -cp ../fix_innodb_for_backup.patch $DIRDST/xtrabackup-build/$DRNAME |
4041 | -mkdir -p $DIRDST/xtrabackup-build/$DRNAME/innobase/xtrabackup |
4042 | -cp ../* $DIRDST/xtrabackup-build/$DRNAME/innobase/xtrabackup |
4043 | -pushd $DIRDST/xtrabackup-build/$DRNAME |
4044 | -patch -p1 < fix_innodb_for_backup.patch |
4045 | - |
4046 | -cd .. |
4047 | -mv $DIRDST/xtrabackup-build/$DRNAME/ $DIRDST/xtrabackup-build/xtrabackup-$BV |
4048 | - |
4049 | -tar cfz xtrabackup-$BV.tar.gz xtrabackup-$BV |
4050 | -cp xtrabackup-$BV.tar.gz /usr/src/redhat/SOURCES/ |
4051 | - |
4052 | -#./configure |
4053 | -#make -j8 |
4054 | -#cd innobase/xtrabackup |
4055 | -#make |
4056 | |
4057 | === modified file 'xtrabackup.c' |
4058 | --- xtrabackup.c 2011-03-13 15:52:22 +0000 |
4059 | +++ xtrabackup.c 2011-03-15 21:59:23 +0000 |
4060 | @@ -486,6 +486,9 @@ |
4061 | struct fil_system_struct { |
4062 | #ifndef UNIV_HOTBACKUP |
4063 | mutex_t mutex; /*!< The mutex protecting the cache */ |
4064 | +#ifdef XTRADB55 |
4065 | + mutex_t file_extend_mutex; |
4066 | +#endif |
4067 | #endif /* !UNIV_HOTBACKUP */ |
4068 | hash_table_t* spaces; /*!< The hash table of spaces in the |
4069 | system; they are hashed on the space |
4070 | @@ -1950,9 +1953,10 @@ |
4071 | |
4072 | #ifdef XTRADB_BASED |
4073 | srv_doublewrite_file = innobase_doublewrite_file; |
4074 | - |
4075 | +#ifndef XTRADB55 |
4076 | srv_extra_undoslots = (ibool) innobase_extra_undoslots; |
4077 | #endif |
4078 | +#endif |
4079 | |
4080 | /* -------------- Log files ---------------------------*/ |
4081 |
Alexey,
Why xtrabackup_innodb55 ?
I'd like to have single binary xtrabackup_55 for both Percona Server and MySQL