Merge lp:~sergei.glushchenko/percona-xtrabackup/ST-25967-2.1 into lp:percona-xtrabackup/2.1

Proposed by Sergei Glushchenko on 2012-11-16
Status: Merged
Approved by: Alexey Kopytov on 2012-11-16
Approved revision: 443
Merged at revision: 455
Proposed branch: lp:~sergei.glushchenko/percona-xtrabackup/ST-25967-2.1
Merge into: lp:percona-xtrabackup/2.1
Prerequisite: lp:~sergei.glushchenko/percona-xtrabackup/BT-26901-2.1
Diff against target: 235 lines (+147/-37)
4 files modified
src/innodb_int.c (+39/-0)
src/innodb_int.h (+7/-0)
src/xtrabackup.c (+4/-37)
test/t/bug1062684.sh (+97/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-xtrabackup/ST-25967-2.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2012-11-16 Approve on 2012-11-16
Review via email: mp+134638@code.launchpad.net

This proposal supersedes a proposal from 2012-10-22.

Description of the change

Same as for 2.0

To post a comment you must log in.
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

#25967

Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Same comment as in the 2.0 MP.

review: Needs Information
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/innodb_int.c'
2--- src/innodb_int.c 2012-09-13 12:24:01 +0000
3+++ src/innodb_int.c 2012-11-16 11:26:25 +0000
4@@ -294,6 +294,45 @@
5 return TRUE;
6 }
7
8+/*********************************************************************//**
9+Normalizes init parameter values to use units we use inside InnoDB.
10+@return DB_SUCCESS or error code */
11+void
12+xb_normalize_init_values(void)
13+/*==========================*/
14+{
15+ ulint i;
16+
17+ for (i = 0; i < srv_n_data_files; i++) {
18+ srv_data_file_sizes[i] = srv_data_file_sizes[i]
19+ * ((1024 * 1024) / UNIV_PAGE_SIZE);
20+ }
21+
22+ srv_last_file_size_max = srv_last_file_size_max
23+ * ((1024 * 1024) / UNIV_PAGE_SIZE);
24+
25+ srv_log_file_size = srv_log_file_size / UNIV_PAGE_SIZE;
26+
27+ srv_log_buffer_size = srv_log_buffer_size / UNIV_PAGE_SIZE;
28+
29+#ifndef INNODB_VERSION_SHORT
30+ srv_pool_size = srv_pool_size / (UNIV_PAGE_SIZE / 1024);
31+
32+ srv_awe_window_size = srv_awe_window_size / UNIV_PAGE_SIZE;
33+
34+ if (srv_use_awe) {
35+ /* If we are using AWE we must save memory in the 32-bit
36+ address space of the process, and cannot bind the lock
37+ table size to the real buffer pool size. */
38+
39+ srv_lock_table_size = 20 * srv_awe_window_size;
40+ } else {
41+ srv_lock_table_size = 5 * srv_pool_size;
42+ }
43+#else
44+ srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
45+#endif
46+}
47
48 #ifndef INNODB_VERSION_SHORT
49
50
51=== modified file 'src/innodb_int.h'
52--- src/innodb_int.h 2012-09-13 12:24:01 +0000
53+++ src/innodb_int.h 2012-11-16 11:26:25 +0000
54@@ -625,6 +625,13 @@
55 flags */
56 os_file_t* file); /*!<out: file handle */
57
58+/*********************************************************************//**
59+Normalizes init parameter values to use units we use inside InnoDB.
60+@return DB_SUCCESS or error code */
61+void
62+xb_normalize_init_values(void);
63+/*==========================*/
64+
65 #ifndef INNODB_VERSION_SHORT
66
67 /********************************************************************//**
68
69=== modified file 'src/xtrabackup.c'
70--- src/xtrabackup.c 2012-11-16 11:26:25 +0000
71+++ src/xtrabackup.c 2012-11-16 11:26:25 +0000
72@@ -2493,6 +2493,8 @@
73 if(innodb_init_param())
74 exit(EXIT_FAILURE);
75
76+ xb_normalize_init_values();
77+
78 #ifndef __WIN__
79 if (srv_file_flush_method_str == NULL) {
80 /* These are the default options */
81@@ -2570,43 +2572,6 @@
82 computers */
83 }
84
85- {
86- ulint nr;
87- ulint i;
88-
89- nr = srv_n_data_files;
90-
91- for (i = 0; i < nr; i++) {
92- srv_data_file_sizes[i] = srv_data_file_sizes[i]
93- * ((1024 * 1024) / UNIV_PAGE_SIZE);
94- }
95-
96- srv_last_file_size_max = srv_last_file_size_max
97- * ((1024 * 1024) / UNIV_PAGE_SIZE);
98-
99- srv_log_file_size = srv_log_file_size / UNIV_PAGE_SIZE;
100-
101- srv_log_buffer_size = srv_log_buffer_size / UNIV_PAGE_SIZE;
102-
103-#ifndef INNODB_VERSION_SHORT
104- srv_pool_size = srv_pool_size / (UNIV_PAGE_SIZE / 1024);
105-
106- srv_awe_window_size = srv_awe_window_size / UNIV_PAGE_SIZE;
107-
108- if (srv_use_awe) {
109- /* If we are using AWE we must save memory in the 32-bit
110- address space of the process, and cannot bind the lock
111- table size to the real buffer pool size. */
112-
113- srv_lock_table_size = 20 * srv_awe_window_size;
114- } else {
115- srv_lock_table_size = 5 * srv_pool_size;
116- }
117-#else
118- srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
119-#endif
120- }
121-
122 os_sync_mutex = NULL;
123 srv_general_init();
124
125@@ -4497,6 +4462,8 @@
126 if(innodb_init_param())
127 goto error;
128
129+ xb_normalize_init_values();
130+
131 mem_init(srv_mem_pool_size);
132 if (xtrabackup_incremental) {
133 err = xb_data_files_init();
134
135=== added file 'test/t/bug1062684.sh'
136--- test/t/bug1062684.sh 1970-01-01 00:00:00 +0000
137+++ test/t/bug1062684.sh 2012-11-16 11:26:25 +0000
138@@ -0,0 +1,97 @@
139+. inc/common.sh
140+
141+start_server --innodb-data-file-path="ibdata1:10M;ibdata2:5M:autoextend"
142+load_dbase_schema incremental_sample
143+
144+echo "innodb-data-file-path=ibdata1:10M;ibdata2:5M:autoextend" >>$topdir/my.cnf
145+
146+# Adding initial rows
147+vlog "Adding initial rows to database..."
148+${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
149+
150+# Full backup
151+# backup root directory
152+mkdir -p $topdir/backup
153+
154+vlog "Starting backup"
155+innobackupex $topdir/backup
156+full_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | awk -F\' '{print $2}'`
157+vlog "Full backup done to directory $full_backup_dir"
158+
159+# Changing data
160+
161+vlog "Making changes to database"
162+${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int(11) default null, number int(11) default null) engine=innodb" incremental_sample
163+${MYSQL} ${MYSQL_ARGS} -e "insert into test values (10, 1);" incremental_sample
164+${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values (10, 1);" incremental_sample
165+vlog "Changes done"
166+
167+# Saving the checksum of original table
168+checksum_test_a=`checksum_table incremental_sample test`
169+checksum_t2_a=`checksum_table incremental_sample t2`
170+vlog "Table 'test' checksum is $checksum_test_a"
171+vlog "Table 't2' checksum is $checksum_t2_a"
172+
173+vlog "Making incremental backup"
174+
175+vlog "###############"
176+vlog "# INCREMENTAL #"
177+vlog "###############"
178+
179+# Incremental backup
180+innobackupex --incremental --incremental-basedir=$full_backup_dir \
181+ $topdir/backup
182+inc_backup_dir=`grep "innobackupex: Backup created in directory" $OUTFILE | tail -n 1 | awk -F\' '{print $2}'`
183+vlog "Incremental backup done to directory $inc_backup_dir"
184+
185+vlog "Preparing backup"
186+# Prepare backup
187+vlog "##############"
188+vlog "# PREPARE #1 #"
189+vlog "##############"
190+innobackupex --apply-log --redo-only $full_backup_dir
191+vlog "Log applied to full backup"
192+vlog "##############"
193+vlog "# PREPARE #2 #"
194+vlog "##############"
195+innobackupex --apply-log --redo-only --incremental-dir=$inc_backup_dir \
196+ $full_backup_dir
197+vlog "Delta applied to full backup"
198+vlog "##############"
199+vlog "# PREPARE #3 #"
200+vlog "##############"
201+innobackupex --apply-log $full_backup_dir
202+vlog "Data prepared for restore"
203+
204+# Destroying mysql data
205+stop_server
206+rm -rf $mysql_datadir/*
207+vlog "Data destroyed"
208+
209+# Restore backup
210+vlog "Copying files"
211+vlog "###########"
212+vlog "# RESTORE #"
213+vlog "###########"
214+innobackupex --copy-back $full_backup_dir
215+vlog "Data restored"
216+
217+start_server --innodb-data-file-path="ibdata1:10M;ibdata2:5M:autoextend"
218+
219+vlog "Checking checksums"
220+checksum_test_b=`checksum_table incremental_sample test`
221+checksum_t2_b=`checksum_table incremental_sample t2`
222+
223+if [ "$checksum_test_a" != "$checksum_test_b" ]
224+then
225+ vlog "Checksums for table 'test' are not equal"
226+ exit -1
227+fi
228+
229+if [ "$checksum_t2_a" != "$checksum_t2_b" ]
230+then
231+ vlog "Checksums for table 't2' are not equal"
232+ exit -1
233+fi
234+
235+vlog "Checksums are OK"

Subscribers

People subscribed via source and target branches