Merge lp:~vlad-lesin/percona-server/i_s-innodb-log-tracking-status into lp:percona-server/5.1

Proposed by Vlad Lesin on 2012-08-02
Status: Work in progress
Proposed branch: lp:~vlad-lesin/percona-server/i_s-innodb-log-tracking-status
Merge into: lp:percona-server/5.1
Diff against target: 609 lines (+328/-26) (has conflicts)
17 files modified
Percona-Server/mysql-test/r/information_schema.result (+16/-3)
Percona-Server/mysql-test/r/information_schema_db.result (+5/-1)
Percona-Server/mysql-test/r/mysqlshow.result (+10/-2)
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status.result (+9/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status_empty.result (+2/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result (+1/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status.test (+50/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty.test (+8/-0)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+5/-0)
Percona-Server/storage/innodb_plugin/handler/i_s.cc (+87/-0)
Percona-Server/storage/innodb_plugin/handler/i_s.h (+4/-0)
Percona-Server/storage/innodb_plugin/include/log0log.h (+12/-0)
Percona-Server/storage/innodb_plugin/include/log0log.ic (+81/-0)
Percona-Server/storage/innodb_plugin/log/log0log.c (+1/-20)
Percona-Server/storage/innodb_plugin/log/log0online.c (+35/-0)
Text conflict in Percona-Server/mysql-test/r/information_schema.result
Text conflict in Percona-Server/mysql-test/r/information_schema_db.result
Text conflict in Percona-Server/mysql-test/r/mysqlshow.result
Text conflict in Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc
Text conflict in Percona-Server/storage/innodb_plugin/handler/i_s.cc
Text conflict in Percona-Server/storage/innodb_plugin/handler/i_s.h
Text conflict in Percona-Server/storage/innodb_plugin/log/log0online.c
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/i_s-innodb-log-tracking-status
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) 2012-08-02 Needs Fixing on 2012-08-10
Review via email: mp+117871@code.launchpad.net

Description of the change

I_S.INNODB_LOG_TRACKING_STATUS - the table for showing current status of log tracking.

Here is the more detailed description of the table:
https://blueprints.launchpad.net/percona-server/+spec/innodb-log-tracking-status

This code was tested locally and all tests passed except "main.partition_rename_longfilename" which fails in the both with and without patch causes.

Here is unfinished jenkins tests:
http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/358/

To post a comment you must log in.

     I think that this table should have an additional field, see the
     whiteboard of the blueprint for more info. I don't know if it
     should be implemented in this MP or as a follow-up, we can discuss.

     Diff lines 191--203 have a verbose way to restart server for
     MTR. What doe the additional variables buy us? And server id is
     guaranteed to be 1 for a non-replication test case.

review: Needs Information

Re. server restart, another option is to have a separate test case for the empty I_S table with its own -master.opt file.

Vlad Lesin (vlad-lesin) wrote :

> Re. server restart, another option is to have a separate test case for the
> empty I_S table with its own -master.opt file.

Done.

     Please update the blueprint (and maybe create a new one) to
     reflect what we decided on the start LSN of the last continuous
     tracked range (what's in the whiteboard currently).

     The "--innodb" option in
     percona_log_tracking_status_empty-master.opt is redundant.

     The log_get_tracked_lsn() function should be kept inlinable, thus
     please move its implementation to log0log.ic.

review: Needs Fixing
458. By Vlad Lesin on 2012-11-01

I_S.INNODB_LOG_TRACKING_STATUS - the table for showing
current status of log tracking.

Here is the more detailed description of the table:
https://blueprints.launchpad.net/percona-server/+spec/innodb-log-tracking-status

459. By Vlad Lesin on 2012-11-08

Holes detection is added.

Bug 1108613 implements parts of this MP.

Unmerged revisions

459. By Vlad Lesin on 2012-11-08

Holes detection is added.

458. By Vlad Lesin on 2012-11-01

I_S.INNODB_LOG_TRACKING_STATUS - the table for showing
current status of log tracking.

Here is the more detailed description of the table:
https://blueprints.launchpad.net/percona-server/+spec/innodb-log-tracking-status

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/mysql-test/r/information_schema.result'
2--- Percona-Server/mysql-test/r/information_schema.result 2012-08-15 14:05:13 +0000
3+++ Percona-Server/mysql-test/r/information_schema.result 2012-11-08 15:35:48 +0000
4@@ -93,10 +93,14 @@
5 INNODB_CMP_RESET
6 INNODB_CMPMEM
7 INNODB_INDEX_STATS
8-INNODB_SYS_INDEXES
9+INNODB_LOG_TRACKING_STATUS
10 INNODB_BUFFER_POOL_PAGES_BLOB
11 INNODB_CMPMEM_RESET
12+<<<<<<< TREE
13 INNODB_LOCKS
14+=======
15+INNODB_SYS_INDEXES
16+>>>>>>> MERGE-SOURCE
17 columns_priv
18 db
19 event
20@@ -1345,10 +1349,14 @@
21 INNODB_CMP_RESET page_size
22 INNODB_CMPMEM page_size
23 INNODB_INDEX_STATS table_schema
24-INNODB_SYS_INDEXES TABLE_ID
25+INNODB_LOG_TRACKING_STATUS log_tracking_lsn
26 INNODB_BUFFER_POOL_PAGES_BLOB space_id
27 INNODB_CMPMEM_RESET page_size
28+<<<<<<< TREE
29 INNODB_LOCKS lock_id
30+=======
31+INNODB_SYS_INDEXES TABLE_ID
32+>>>>>>> MERGE-SOURCE
33 SELECT t.table_name, c1.column_name
34 FROM information_schema.tables t
35 INNER JOIN
36@@ -1414,10 +1422,14 @@
37 INNODB_CMP_RESET page_size
38 INNODB_CMPMEM page_size
39 INNODB_INDEX_STATS table_schema
40-INNODB_SYS_INDEXES TABLE_ID
41+INNODB_LOG_TRACKING_STATUS log_tracking_lsn
42 INNODB_BUFFER_POOL_PAGES_BLOB space_id
43 INNODB_CMPMEM_RESET page_size
44+<<<<<<< TREE
45 INNODB_LOCKS lock_id
46+=======
47+INNODB_SYS_INDEXES TABLE_ID
48+>>>>>>> MERGE-SOURCE
49 SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
50 MAX(table_name)
51 XTRADB_ADMIN_COMMAND
52@@ -1508,6 +1520,7 @@
53 INNODB_INDEX_STATS information_schema.INNODB_INDEX_STATS 1
54 INNODB_LOCKS information_schema.INNODB_LOCKS 1
55 INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
56+INNODB_LOG_TRACKING_STATUS information_schema.INNODB_LOG_TRACKING_STATUS 1
57 INNODB_RSEG information_schema.INNODB_RSEG 1
58 INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
59 INNODB_SYS_STATS information_schema.INNODB_SYS_STATS 1
60
61=== modified file 'Percona-Server/mysql-test/r/information_schema_db.result'
62--- Percona-Server/mysql-test/r/information_schema_db.result 2012-08-15 14:05:13 +0000
63+++ Percona-Server/mysql-test/r/information_schema_db.result 2012-11-08 15:35:48 +0000
64@@ -55,10 +55,14 @@
65 INNODB_CMP_RESET
66 INNODB_CMPMEM
67 INNODB_INDEX_STATS
68-INNODB_SYS_INDEXES
69+INNODB_LOG_TRACKING_STATUS
70 INNODB_BUFFER_POOL_PAGES_BLOB
71 INNODB_CMPMEM_RESET
72+<<<<<<< TREE
73 INNODB_LOCKS
74+=======
75+INNODB_SYS_INDEXES
76+>>>>>>> MERGE-SOURCE
77 show tables from INFORMATION_SCHEMA like 'T%';
78 Tables_in_information_schema (T%)
79 TABLES
80
81=== modified file 'Percona-Server/mysql-test/r/mysqlshow.result'
82--- Percona-Server/mysql-test/r/mysqlshow.result 2012-08-15 14:05:13 +0000
83+++ Percona-Server/mysql-test/r/mysqlshow.result 2012-11-08 15:35:48 +0000
84@@ -129,10 +129,14 @@
85 | INNODB_CMP_RESET |
86 | INNODB_CMPMEM |
87 | INNODB_INDEX_STATS |
88-| INNODB_SYS_INDEXES |
89+| INNODB_LOG_TRACKING_STATUS |
90 | INNODB_BUFFER_POOL_PAGES_BLOB |
91 | INNODB_CMPMEM_RESET |
92+<<<<<<< TREE
93 | INNODB_LOCKS |
94+=======
95+| INNODB_SYS_INDEXES |
96+>>>>>>> MERGE-SOURCE
97 +---------------------------------------+
98 Database: INFORMATION_SCHEMA
99 +---------------------------------------+
100@@ -188,10 +192,14 @@
101 | INNODB_CMP_RESET |
102 | INNODB_CMPMEM |
103 | INNODB_INDEX_STATS |
104-| INNODB_SYS_INDEXES |
105+| INNODB_LOG_TRACKING_STATUS |
106 | INNODB_BUFFER_POOL_PAGES_BLOB |
107 | INNODB_CMPMEM_RESET |
108+<<<<<<< TREE
109 | INNODB_LOCKS |
110+=======
111+| INNODB_SYS_INDEXES |
112+>>>>>>> MERGE-SOURCE
113 +---------------------------------------+
114 Wildcard: inf_rmation_schema
115 +--------------------+
116
117=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status.result'
118--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status.result 1970-01-01 00:00:00 +0000
119+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status.result 2012-11-08 15:35:48 +0000
120@@ -0,0 +1,9 @@
121+set @last_tracked_lsn=
122+(SELECT log_tracking_lsn
123+FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS);
124+CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB;
125+SELECT log_tracking_lsn > @last_tracked_lsn
126+FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS;
127+log_tracking_lsn > @last_tracked_lsn
128+1
129+DROP TABLE T1;
130
131=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status_empty.result'
132--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status_empty.result 1970-01-01 00:00:00 +0000
133+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_log_tracking_status_empty.result 2012-11-08 15:35:48 +0000
134@@ -0,0 +1,2 @@
135+SELECT * FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS;
136+log_tracking_lsn log_tracking_max_lsn_age
137
138=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result'
139--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result 2012-08-15 14:05:13 +0000
140+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result 2012-11-08 15:35:48 +0000
141@@ -11,6 +11,7 @@
142 INNODB_INDEX_STATS
143 INNODB_LOCKS
144 INNODB_LOCK_WAITS
145+INNODB_LOG_TRACKING_STATUS
146 INNODB_RSEG
147 INNODB_SYS_INDEXES
148 INNODB_SYS_STATS
149
150=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status-master.opt'
151--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status-master.opt 1970-01-01 00:00:00 +0000
152+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status-master.opt 2012-11-08 15:35:48 +0000
153@@ -0,0 +1,1 @@
154+--innodb_track_changed_pages=TRUE --innodb_log_file_size=1M
155
156=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status.test'
157--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status.test 1970-01-01 00:00:00 +0000
158+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status.test 2012-11-08 15:35:48 +0000
159@@ -0,0 +1,50 @@
160+#################################################
161+# Test for I_S.INNODB_LOG_TRACKING_STATUS table #
162+#################################################
163+
164+--source include/have_innodb_plugin.inc
165+
166+set @last_tracked_lsn=
167+ (SELECT log_tracking_lsn
168+ FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS);
169+
170+CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB;
171+
172+--disable_query_log
173+--disable_result_log
174+
175+#########################################################################
176+# The maximum log size is 1MB. Each row occupies at least 256 bytes. #
177+# Each iteration inserts 100 rows. They occupies at least 25KB. To be #
178+# sure that tracking log thread wrote at least 1M/16K pages we need to #
179+# exceed maximum log size twice. That means we should do at least #
180+# 2M/25K = 80 iterations. #
181+#########################################################################
182+--let $i=80
183+
184+while ($i)
185+{
186+--dec $i
187+INSERT INTO T1 (F1) VALUES
188+("1"), ("2"), ("3"), ("4"), ("5"), ("6"), ("7"), ("8"), ("9"), ("10"),
189+("11"), ("12"), ("13"), ("14"), ("15"), ("16"), ("17"), ("18"), ("19"), ("20"),
190+("21"), ("22"), ("23"), ("24"), ("25"), ("26"), ("27"), ("28"), ("29"), ("30"),
191+("31"), ("32"), ("33"), ("34"), ("35"), ("36"), ("37"), ("38"), ("39"), ("40"),
192+("41"), ("42"), ("43"), ("44"), ("45"), ("46"), ("47"), ("48"), ("49"), ("50"),
193+("51"), ("52"), ("53"), ("54"), ("55"), ("56"), ("57"), ("58"), ("59"), ("60"),
194+("61"), ("62"), ("63"), ("64"), ("65"), ("66"), ("67"), ("68"), ("69"), ("70"),
195+("71"), ("72"), ("73"), ("74"), ("75"), ("76"), ("77"), ("78"), ("79"), ("80"),
196+("81"), ("82"), ("83"), ("84"), ("85"), ("86"), ("87"), ("88"), ("89"), ("90"),
197+("91"), ("92"), ("93"), ("94"), ("95"), ("96"), ("97"), ("98"), ("99"), ("100");
198+}
199+
200+--enable_query_log
201+--enable_result_log
202+
203+########################################
204+# Check if last tracked lsn is changed #
205+########################################
206+SELECT log_tracking_lsn > @last_tracked_lsn
207+ FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS;
208+
209+DROP TABLE T1;
210
211=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty-master.opt'
212--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty-master.opt 1970-01-01 00:00:00 +0000
213+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty-master.opt 2012-11-08 15:35:48 +0000
214@@ -0,0 +1,1 @@
215+--innodb_track_changed_pages=false
216
217=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty.test'
218--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty.test 1970-01-01 00:00:00 +0000
219+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_log_tracking_status_empty.test 2012-11-08 15:35:48 +0000
220@@ -0,0 +1,8 @@
221+###############################################################################
222+# Test for I_S.INNODB_LOG_TRACKING_STATUS empty table. The table must be empty#
223+# if innodb_track_changed_pages is false. #
224+###############################################################################
225+
226+--source include/have_innodb_plugin.inc
227+
228+SELECT * FROM INFORMATION_SCHEMA.INNODB_LOG_TRACKING_STATUS;
229
230=== modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc'
231--- Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-09-14 12:19:29 +0000
232+++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-11-08 15:35:48 +0000
233@@ -12276,8 +12276,13 @@
234 i_s_innodb_admin_command,
235 i_s_innodb_sys_tables,
236 i_s_innodb_sys_indexes,
237+<<<<<<< TREE
238 i_s_innodb_sys_stats,
239 i_s_innodb_changed_pages
240+=======
241+i_s_innodb_sys_stats,
242+i_s_innodb_log_tracking_status
243+>>>>>>> MERGE-SOURCE
244 mysql_declare_plugin_end;
245
246 /** @brief Initialize the default value of innodb_commit_concurrency.
247
248=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.cc'
249--- Percona-Server/storage/innodb_plugin/handler/i_s.cc 2012-08-23 08:19:20 +0000
250+++ Percona-Server/storage/innodb_plugin/handler/i_s.cc 2012-11-08 15:35:48 +0000
251@@ -55,7 +55,11 @@
252 #include "dict0dict.h" /* for dict_sys */
253 #include "btr0pcur.h"
254 #include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */
255+<<<<<<< TREE
256 #include "log0online.h"
257+=======
258+#include "log0log.h" /* for innodb_log_tracking_status */
259+>>>>>>> MERGE-SOURCE
260 }
261
262 static const char plugin_author[] = "Innobase Oy";
263@@ -3648,6 +3652,7 @@
264 STRUCT_FLD(system_vars, NULL),
265 STRUCT_FLD(__reserved1, NULL)
266 };
267+<<<<<<< TREE
268
269 static ST_FIELD_INFO i_s_innodb_changed_pages_info[] =
270 {
271@@ -3933,3 +3938,85 @@
272 STRUCT_FLD(system_vars, NULL),
273 STRUCT_FLD(__reserved1, NULL)
274 };
275+=======
276+
277+static ST_FIELD_INFO i_s_innodb_log_tracking_status_info[] =
278+{
279+ {STRUCT_FLD(field_name, "log_tracking_lsn"),
280+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
281+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
282+ STRUCT_FLD(value, 0),
283+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
284+ STRUCT_FLD(old_name, ""),
285+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
286+
287+ {STRUCT_FLD(field_name, "log_tracking_max_lsn_age"),
288+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
289+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
290+ STRUCT_FLD(value, 0),
291+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
292+ STRUCT_FLD(old_name, ""),
293+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
294+
295+ END_OF_ST_FIELD_INFO
296+};
297+
298+/***********************************************************************
299+Fill the dynamic table information_schema.innodb_changed_pages. */
300+static
301+int
302+i_s_innodb_log_tracking_status_fill(
303+/*================================*/
304+ /*!<out: 0 on success, 1 on failure */
305+ THD* thd, /*!<in: thread */
306+ TABLE_LIST* tables, /*!<in/out: tables to fill */
307+ COND* cond) /*!<in: condition */
308+{
309+ TABLE* table = (TABLE *) tables->table;
310+
311+ if (!srv_track_changed_pages)
312+ return 0;
313+
314+ /* log_tracking_lsn */
315+ table->field[0]->store(log_get_tracked_lsn());
316+ /* log_tracking_max_lsn_age */
317+ table->field[1]->store(log_sys->max_checkpoint_age);
318+
319+ if (schema_table_store_record(thd, table))
320+ return 1;
321+
322+ return 0;
323+}
324+
325+static
326+int
327+i_s_innodb_log_tracking_status_init(
328+/*================================*/
329+ void* p)
330+{
331+ DBUG_ENTER("i_s_innodb_log_trackig_status_init");
332+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
333+
334+ schema->fields_info = i_s_innodb_log_tracking_status_info;
335+ schema->fill_table = i_s_innodb_log_tracking_status_fill;
336+
337+ DBUG_RETURN(0);
338+}
339+
340+UNIV_INTERN struct st_mysql_plugin i_s_innodb_log_tracking_status =
341+{
342+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
343+ STRUCT_FLD(info, &i_s_info),
344+ STRUCT_FLD(name, "INNODB_LOG_TRACKING_STATUS"),
345+ STRUCT_FLD(author, "Percona"),
346+ STRUCT_FLD(descr, "InnoDB LOG TRACKING STATUS table"),
347+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
348+ STRUCT_FLD(init, i_s_innodb_log_tracking_status_init),
349+ STRUCT_FLD(deinit, i_s_common_deinit),
350+ STRUCT_FLD(version, 0x0100 /* 1.0 */),
351+ STRUCT_FLD(status_vars, NULL),
352+ STRUCT_FLD(system_vars, NULL),
353+ STRUCT_FLD(__reserved1, NULL)
354+};
355+
356+>>>>>>> MERGE-SOURCE
357
358=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.h'
359--- Percona-Server/storage/innodb_plugin/handler/i_s.h 2012-08-15 14:05:13 +0000
360+++ Percona-Server/storage/innodb_plugin/handler/i_s.h 2012-11-08 15:35:48 +0000
361@@ -43,6 +43,10 @@
362 extern struct st_mysql_plugin i_s_innodb_sys_tables;
363 extern struct st_mysql_plugin i_s_innodb_sys_indexes;
364 extern struct st_mysql_plugin i_s_innodb_sys_stats;
365+<<<<<<< TREE
366 extern struct st_mysql_plugin i_s_innodb_changed_pages;
367+=======
368+extern struct st_mysql_plugin i_s_innodb_log_tracking_status;
369+>>>>>>> MERGE-SOURCE
370
371 #endif /* i_s_h */
372
373=== modified file 'Percona-Server/storage/innodb_plugin/include/log0log.h'
374--- Percona-Server/storage/innodb_plugin/include/log0log.h 2012-06-14 09:16:03 +0000
375+++ Percona-Server/storage/innodb_plugin/include/log0log.h 2012-11-08 15:35:48 +0000
376@@ -75,6 +75,7 @@
377 /*==========================================*/
378 ulint limit); /*!< in: limit to set */
379 #endif /* !UNIV_HOTBACKUP */
380+
381 /*******************************************************************//**
382 Calculates where in log files we find a specified lsn.
383 @return log file number */
384@@ -958,6 +959,17 @@
385 64-bit atomic ops are supported,
386 protected by the log sys mutex
387 otherwise. */
388+ ib_uint64_t tracked_start_lsn; /*!< Start LSN of the last
389+ uninterrupted tracked range.
390+ This field is set when
391+ tracking is started or resumed
392+ after maximum tracked age
393+ violation. */
394+ ib_uint64_t tracked_end_lsn; /*!< End LSN of the last
395+ uninterrupted tracked range.
396+ This field is set when
397+ maximum tracked age violation
398+ happens and 0 otherwise. */
399 };
400
401 #ifdef UNIV_LOG_ARCHIVE
402
403=== modified file 'Percona-Server/storage/innodb_plugin/include/log0log.ic'
404--- Percona-Server/storage/innodb_plugin/include/log0log.ic 2010-06-10 14:31:28 +0000
405+++ Percona-Server/storage/innodb_plugin/include/log0log.ic 2012-11-08 15:35:48 +0000
406@@ -444,3 +444,84 @@
407 }
408 }
409 #endif /* !UNIV_HOTBACKUP */
410+
411+UNIV_INLINE
412+void
413+log_set_thread_safe_uint64(
414+/*==============*/
415+ ib_uint64_t* dst,
416+ ib_uint64_t src,
417+ mutex_t* mutex)
418+{
419+#ifdef HAVE_ATOMIC_BUILTINS_64
420+ ib_uint64_t old_value;
421+#endif
422+ ut_ad(dst);
423+ ut_ad(mutex);
424+
425+#ifdef HAVE_ATOMIC_BUILTINS_64
426+ /* Single writer, no data race here */
427+ (void)mutex;
428+ old_value
429+ = os_atomic_increment_uint64(dst, 0);
430+ os_atomic_increment_uint64(dst,
431+ src - old_value);
432+#else
433+ mutex_enter(mutex);
434+ *dst = src;
435+ mutex_exit(mutex);
436+#endif
437+}
438+
439+
440+UNIV_INLINE
441+ib_uint64_t
442+log_get_thread_safe_uint64(
443+ ib_uint64_t* value,
444+ mutex_t* mutex)
445+{
446+#ifdef HAVE_ATOMIC_BUILTINS_64
447+ (void)mutex;
448+ return os_atomic_increment_uint64(value, 0);
449+#else
450+ ut_ad(mutex_own(mutex));
451+ return *value;
452+#endif
453+}
454+
455+
456+/****************************************************************//**
457+Safely reads the log_sys->tracked_lsn value. Uses atomic operations
458+if available, otherwise this field is protected with the log system
459+mutex. The writer counterpart function is log_set_tracked_lsn() in
460+log0online.c.
461+
462+@return log_sys->tracked_lsn value. */
463+UNIV_INLINE
464+ib_uint64_t
465+log_get_tracked_lsn()
466+{
467+ return log_get_thread_safe_uint64(&log_sys->tracked_lsn,
468+ &log_sys->mutex);
469+}
470+
471+
472+UNIV_INLINE
473+ib_uint64_t
474+log_get_tracked_end_lsn()
475+{
476+ return log_get_thread_safe_uint64(&log_sys->tracked_end_lsn,
477+ &log_sys->mutex);
478+}
479+
480+
481+UNIV_INLINE
482+void
483+log_set_tracked_end_lsn(
484+/*================*/
485+ ib_uint64_t tracked_end_lsn) /*!<in: new value */
486+{
487+ log_set_thread_safe_uint64(&log_sys->tracked_end_lsn,
488+ tracked_end_lsn,
489+ &log_sys->mutex);
490+}
491
492=== modified file 'Percona-Server/storage/innodb_plugin/log/log0log.c'
493--- Percona-Server/storage/innodb_plugin/log/log0log.c 2012-06-14 09:16:03 +0000
494+++ Percona-Server/storage/innodb_plugin/log/log0log.c 2012-11-08 15:35:48 +0000
495@@ -202,25 +202,6 @@
496 }
497
498 /****************************************************************//**
499-Safely reads the log_sys->tracked_lsn value. Uses atomic operations
500-if available, otherwise this field is protected with the log system
501-mutex. The writer counterpart function is log_set_tracked_lsn() in
502-log0online.c.
503-
504-@return log_sys->tracked_lsn value. */
505-UNIV_INLINE
506-ib_uint64_t
507-log_get_tracked_lsn()
508-{
509-#ifdef HAVE_ATOMIC_BUILTINS_64
510- return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
511-#else
512- ut_ad(mutex_own(&(log_sys->mutex)));
513- return log_sys->tracked_lsn;
514-#endif
515-}
516-
517-/****************************************************************//**
518 Checks if the log groups have a big enough margin of free space in
519 so that a new log entry can be written without overwriting log data
520 that is not read by the changed page bitmap thread.
521@@ -478,7 +459,7 @@
522 tracked_lsn_age = lsn - tracked_lsn;
523
524 if (tracked_lsn_age >= log->log_group_capacity) {
525-
526+ log_set_tracked_end_lsn(tracked_lsn);
527 fprintf(stderr, " InnoDB: Error: the age of the "
528 "oldest untracked record exceeds the log "
529 "group capacity!\n");
530
531=== modified file 'Percona-Server/storage/innodb_plugin/log/log0online.c'
532--- Percona-Server/storage/innodb_plugin/log/log0online.c 2012-08-17 06:13:44 +0000
533+++ Percona-Server/storage/innodb_plugin/log/log0online.c 2012-11-08 15:35:48 +0000
534@@ -326,6 +326,7 @@
535 return result;
536 }
537
538+
539 /****************************************************************//**
540 Safely write the log_sys->tracked_lsn value. Uses atomic operations
541 if available, otherwise this field is protected with the log system
542@@ -337,6 +338,7 @@
543 /*================*/
544 ib_uint64_t tracked_lsn) /*!<in: new value */
545 {
546+<<<<<<< TREE
547 #ifdef HAVE_ATOMIC_BUILTINS_64
548 /* Single writer, no data race here */
549 ib_uint64_t old_value
550@@ -349,6 +351,25 @@
551 mutex_exit(&log_sys->mutex);
552 #endif
553 }
554+=======
555+ log_set_thread_safe_uint64(&log_sys->tracked_lsn,
556+ tracked_lsn,
557+ &log_sys->mutex);
558+}
559+
560+
561+UNIV_INLINE
562+void
563+log_set_tracked_start_lsn(
564+/*================*/
565+ ib_uint64_t tracked_start_lsn) /*!<in: new value */
566+{
567+ log_set_thread_safe_uint64(&log_sys->tracked_start_lsn,
568+ tracked_start_lsn,
569+ &log_sys->mutex);
570+}
571+
572+>>>>>>> MERGE-SOURCE
573
574 /****************************************************************//**
575 Diagnose a gap in tracked LSN range on server startup due to crash or
576@@ -508,6 +529,8 @@
577 "LSN %llu\n", tracking_start_lsn);
578 log_bmp_sys->start_lsn = tracking_start_lsn;
579 log_set_tracked_lsn(tracking_start_lsn);
580+ log_set_tracked_start_lsn(tracking_start_lsn);
581+ log_set_tracked_end_lsn(0);
582 }
583
584 /*********************************************************************//**
585@@ -898,6 +921,7 @@
586 /*========================*/
587 {
588 ib_uint64_t contiguous_start_lsn;
589+ ib_uint64_t tracking_end_lsn;
590 log_group_t* group;
591
592 /* Grab the LSN of the last checkpoint, we will parse up to it */
593@@ -909,6 +933,17 @@
594 return;
595 }
596
597+ tracking_end_lsn = log_get_tracked_end_lsn();
598+ if (tracking_end_lsn) {
599+ ut_print_timestamp(stderr);
600+ fprintf(stderr,
601+ " InnoDB: Error: possible log tracking hole"
602+ " from %llu to %llu LSN range.",
603+ tracking_end_lsn, log_bmp_sys->start_lsn);
604+ log_set_tracked_end_lsn(0);
605+ log_set_tracked_start_lsn(log_bmp_sys->start_lsn);
606+ }
607+
608 group = UT_LIST_GET_FIRST(log_sys->log_groups);
609 ut_a(group);
610

Subscribers

People subscribed via source and target branches