Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql 5.6.11 #3

Closed
wants to merge 148 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
ff9c9e5
Fixed 5.6.11 code/test/distro errors.
steaphangreene Jul 7, 2012
eec604a
Disable binlog.binlog_server_start_options
jtolmer Apr 19, 2013
9dd3834
Added fb.cmake Facebook build config file.
steaphangreene Oct 23, 2012
5aee376
Disable PerfSchema By Default
steaphangreene Mar 28, 2013
e9bfa36
Add -DMY_PTHREAD_FASTMUTEX for 5.6
steaphangreene Feb 28, 2013
057035a
Stop spawning dummy threads on client library initialization (5.6)
Apr 5, 2013
f37b8e8
Share more structures
steaphangreene Mar 31, 2013
6eb74f8
Adding xtrabackup files
steaphangreene Mar 4, 2013
74b6cc6
Integrate xtrabackup into tree
steaphangreene Mar 4, 2013
922d355
Prevent xtrabackup apply-log disk-space bloat
Mar 28, 2013
38d9cb3
Facebook changes to xtrabackup
steaphangreene Mar 27, 2013
c45dad7
Port v5.1 innodb stress tests to 5.6
steaphangreene Apr 2, 2013
bd4a4bc
Add trx pointer to struct mtr_t
steaphangreene Mar 29, 2013
77f5b2b
Port Percona fake changes patch to 5.6
steaphangreene Mar 28, 2013
64c14da
Parse, but ignore, MEMECACHE_DIRTY keyword.
steaphangreene Mar 20, 2012
b6311ac
Use both upstream and our crc algo, migrating to upstream.
steaphangreene Mar 21, 2012
e3e2235
Fix our acl damage in mysql_upgrade
steaphangreene Oct 25, 2012
0a1f919
Allow reading of headerless compressed pages.
steaphangreene Oct 30, 2012
e5c4318
Port v5.1 SQL_NO_FCACHE to 5.6
steaphangreene Mar 28, 2012
a334b43
Fix unsigned arithmetic
Mar 27, 2012
386ab02
Port Control Cross-Table Access to 5.6
emayanke Oct 29, 2012
ef2e91b
Port v5.1 super_read_only
steaphangreene Oct 19, 2012
22a8b8c
Added new fast timer support.
steaphangreene Apr 24, 2012
27e4c3b
Port v5.1 Extra Stats: Basic Stats
steaphangreene Mar 31, 2013
a535b68
Port v5.1 Extra Stats: BinLog BaseDirs
steaphangreene Apr 10, 2012
83c4e4f
Port v5.1 Extra Stats: mutex and rw-lock
steaphangreene Apr 24, 2012
79ee703
Port v5.1 Extra Stats: InnoDB transaction logging
steaphangreene Apr 24, 2012
44bed9b
Port v5.1 Extra Stats: More buffer pool stats.
steaphangreene Apr 24, 2012
a42b065
Port v5.1 Extra Stats: Command Timers
steaphangreene Apr 25, 2012
a334bd1
Port v5.1 Allow innodb_lock_wait_timeout=0
steaphangreene Apr 18, 2012
141168b
Port v5.1 Extra Stats: records_in_range_seconds
steaphangreene Apr 27, 2012
7b50c38
Port v5.1 Extra Stats: callers of os_file_flush
steaphangreene Apr 27, 2012
6fcbe16
Port v5.1 Extra Stats: IO Perf Counters
steaphangreene Apr 30, 2012
a32d118
Port v5.1 Extra Stats: Insert Buffer and Adaptive Hash
steaphangreene May 2, 2012
24b3d11
Port v5.1 Extra Stats: Time Master Thread Tasks
steaphangreene May 1, 2012
dbc3c69
Port v5.1 SysVar: innodb_deadlock_detect
steaphangreene Mar 28, 2013
c54c3d3
Port v5.1 Extra Stats: InnoDB Lock Status
steaphangreene Nov 9, 2012
a90e2a3
Port v5.1 Extra Stats: Remove Transactions
steaphangreene May 2, 2012
90429dc
Port v5.1 Extra Stats: Flushed Neighbor Counters
steaphangreene Nov 9, 2012
0dcb3f1
Port v5.1 Extra Stats: SHOW ENGINE INNODB TRANSACTION STATUS
steaphangreene May 2, 2012
8068673
Port v5.1 SHOW STATUS tests
steaphangreene May 2, 2012
a4a48c3
Port v5.1 Slow Query Log Changes
steaphangreene May 24, 2012
1482a90
Port v5.1 Extra Stats: Pages Evicted
steaphangreene Jun 7, 2012
64a2cef
Port v5.1 InnoDB Commit and Rollback Counters
steaphangreene May 23, 2012
246d2fa
Port v5.1 Extra Stats: Per-Table
steaphangreene Apr 10, 2013
c230745
Port v5.1 os_aio_old/slow changes
steaphangreene Mar 28, 2013
6fc26a7
Port v5.1 Extra Stats: Hide BinLog Threads
steaphangreene Jun 7, 2012
118e571
Port v5.1 IS.User_Stats to 5.6
Apr 12, 2013
cffd602
Log changes to 'read_only' and 'super_read_only'
steaphangreene Dec 11, 2012
e5c8ab5
Adding logging for durability changes
Mar 12, 2013
3db5967
Port binlog_bytes_written status to 5.6
Oct 23, 2012
eb5859e
Porting per session stats from 5.1 to 5.6
Apr 12, 2013
92c3a2a
Port per query stats from 5.1 to 5.6
Sep 25, 2012
e2b9411
Porting more table stats changes from 5.1 to 5.6
Apr 16, 2013
b581af4
port global per page IO stats from 5.1 to 5.6
steaphangreene Oct 12, 2012
84ee91f
Porting secondary index to 5.6
Oct 18, 2012
1c1c30d
Port v5.1 SHOW MASTER LOGS without SUPER privilege
steaphangreene Oct 19, 2012
44bb61a
Port v5.1 process_can_disable_bin_log
steaphangreene Oct 19, 2012
42346f9
Port v5.1 sql_log_bin changes
steaphangreene Oct 19, 2012
08286b9
Port replication counter stats to 5.6
Oct 23, 2012
6483211
Port Stats: binlog slave offset to 5.6
Oct 23, 2012
d456588
Port Stats: slow_log_if_rows_examined to 5.6
Apr 10, 2013
2940cda
Port Per-Tablespace Mutex Contention Fix to 5.6
Apr 12, 2013
dd377be
Port Fuzzy Checkpoint Limits to 5.6
Oct 19, 2012
dad6a4d
Port Stats: Log -vs- Double-Write to 5.6
Oct 26, 2012
91ad928
Port Ignore innodb_thread_concurrency for Replication Thread to 5.6
Mar 28, 2013
3bd6c63
Port Fix Locality of trx_ts to 5.6
Nov 1, 2012
5f9cf36
Port Stats: Slow IOs to 5.6
Apr 12, 2013
5a4c16f
Port Optimizations for os_aio_thread_buffer to 5.6
Oct 31, 2012
48af57e
Port per page type table stats, and fix native_aio data stats
steaphangreene Apr 17, 2013
0cc3917
Replication IO thread retries more frequently
jtolmer Nov 7, 2012
bf47c0a
Port v5.1 Compression Stats
Apr 17, 2013
c1c7d8c
Make replication and client connection compression configurable.
steaphangreene Dec 14, 2012
2dd83ca
Port disable_slave_update_table_stats change to 5.6
Mar 28, 2013
db8eb38
Port unix datagram socket from 5.1 to 5.6
rvsprvsp Dec 14, 2012
f2c05a0
Ported Working Set Size to 5.6
Apr 12, 2013
192f35c
Check how max_binlog_cache_size affects LOAD DATA INFILE
rvsprvsp Nov 17, 2012
adadc00
Fix an inifinite loop while reading compressed pages
rvsprvsp Nov 26, 2012
8bdd21d
Port additional session stats in SHOW PROCESSLIST
steaphangreene Mar 28, 2013
2c08050
Port v5.1 fix for bug #60682 to 5.6
rvsprvsp Nov 28, 2012
36a220d
Make DROP DATABASE replicate safely with FK constraints
rvsprvsp Nov 29, 2012
69645eb
Check for a killed connection while building a previous version.
jtolmer Mar 28, 2013
e3c31a0
Replication Monitoring to 5.6
steaphangreene Dec 14, 2012
c5369e9
Port rpl_read_size to 5.6
rvsprvsp Dec 14, 2012
95dfb4a
Add reset_seconds_behind_master and Relay_log_io_connected
jtolmer Dec 19, 2012
7f9705c
Reduce LOCK_log mutex contention during lock during binlog reads.
steaphangreene Apr 18, 2013
49ecae0
Port Stats: Peak Lag to 5.6
Oct 26, 2012
bc267c3
Fix failure of set relay_log_info_repository = 'file'
rvsprvsp Jan 9, 2013
44051a2
Fix checksum errors in 5.6 slave when 5.6 master is downgraded to 5.1
rvsprvsp Jan 11, 2013
5df7a35
Test autoinc intvar not persisted across relay-log events on slave
rvsprvsp Feb 13, 2013
cf410f6
Port Warn on Purge with Active Slave to 5.6
rvsprvsp Feb 13, 2013
382ea2c
port add rpl_event_buffer_size to 5.6
rvsprvsp Apr 18, 2013
57ecb0a
Set Default metadata_locks_hash_instances=256
steaphangreene Feb 19, 2013
72e95f1
Port Compression: Reduce Calls to btr_cur_optimistic_insert to 5.6
Nov 27, 2012
10f24ce
Change the default value for innodb_log_compressed_pages to false
Feb 27, 2013
64ba92e
Fix changing from gtid-based to position-based replication
rvsprvsp Feb 23, 2013
d830046
create new config option enable_gitd_on_new_slave_with_old_master
rvsprvsp Feb 25, 2013
f172125
Set Default table_open_cache_instances=8
jtolmer Mar 1, 2013
8a133e2
Port v5.1 InnoChecksum: Page Type
steaphangreene Jun 8, 2012
40f3202
Port v5.1 extra page stats for innochecksum
Oct 30, 2012
6bceb58
Port compressed, and fix uncompressed, page support in innochecksum
Apr 16, 2013
ee8dedf
Port v5.1 tests for non-blocking read-only
Mar 12, 2013
107a4b7
Port Add --timeout option for mysqldump to 5.6
Mar 12, 2013
8c30d8f
Port ALL_O_DIRECT to 5.6
Mar 13, 2013
e19fd7c
Allow mysqldump from 5.6 to dump 5.1 tables.
Mar 15, 2013
b763904
Add support for MYSQL_SYSVAR_DOUBLE.
Dec 18, 2012
68a7fe1
Port Fast Index Creation to 5.6
Mar 25, 2013
3cfd01f
Port Compression: Making empty space reserved dynamic to 5.6
Mar 21, 2013
b191c2c
Add innodb_page_cleaner_interval_millis
mdcallag Mar 20, 2013
6130989
Made innodb_max_dirty_pages_pct my.cnf variable a double
Mar 25, 2013
07ee2aa
Merge aio page read requests
Mar 27, 2013
ee024c6
Add logical read-ahead to InnoDB.
Mar 28, 2013
fd05d7d
Add mysqldump support for logical read ahead
steaphangreene Apr 10, 2013
e1ff3c4
Port testing of random compression failures
jtolmer Mar 29, 2013
c23127a
Add support for srv_unzip_LRU_pct and innodb_lru_io_to_unzip_factor.
Mar 30, 2013
a73beda
Implement START TRANSACTION WITH CONSISTENT INNODB SNAPSHOT
jtolmer Mar 18, 2013
86e9ffc
Add the value of padding to table statistics in 5.6.
steaphangreene Apr 12, 2013
9ff3d3f
Make "FACEBOOK" the default crc setting.
steaphangreene Oct 24, 2012
b11c652
Write old FB crcs by default
steaphangreene Oct 26, 2012
b723a0a
Waste less memory on os_event structs
steaphangreene Feb 21, 2013
f8c37c4
Port fix for mysqlbinlog reading big records from stdin
rvsprvsp Apr 25, 2013
9d571cb
port streaming binlogs to 5.6.11
rvsprvsp Apr 25, 2013
09cb719
Make mysqldump not lock all tables with --single-transaction
Apr 26, 2013
71e9e5a
Make default value of binlog_checksum 'NONE'
rvsprvsp Apr 26, 2013
9261f0f
Two fixes for logical read-ahead feature
Apr 23, 2013
39309ee
Add config option gtid_deployment_step useful for deployment
rvsprvsp Mar 20, 2013
eb621d9
Fix disable_deadlock_detect
steaphangreene Apr 30, 2013
a4dad83
Port v5.1 Compression: Reduce Log Records
Apr 19, 2013
1594ae8
Port v5.1 Cache buf_page_t Memory Allocations
Apr 16, 2013
5db55fd
Port v5.1 Cache mem_block_t Memory Allocations
Apr 4, 2013
58e9fbc
Stabalize main.partition_innodb test
steaphangreene May 2, 2013
5ef7807
Move InnoDB message from warning to info
jtolmer May 9, 2013
8af6176
Add error messages for main.slow_log_extra_big
May 7, 2013
0bb21a2
Initialize innodb_sync_pool_size, even without mysql.
steaphangreene May 10, 2013
4596d7d
Initialize error messages for xtrabackup
May 10, 2013
58f3e15
xtrabackup: Do not FLUSH TABLES WITH READ LOCK on master
May 9, 2013
7b2bb76
Add GTID info to START TRANSACTION WITH CONSISTENT INNODB SNAPSHOT
rvsprvsp Apr 26, 2013
df04aae
Oracle's diff for MTS recovery SEGV
jtolmer May 9, 2013
fc14f6c
Back-port Oracle's stop-sleeping patch from 5.6
steaphangreene May 3, 2013
e68ec58
Port v5.1: Skip fsyncs on O_DIRECT
steaphangreene May 9, 2013
4dd11b5
Port v5.1 Prefix Index Queries Optimization
steaphangreene May 8, 2013
e8d01a8
Create xtrabackup_logfile in the supplied target_dir
May 13, 2013
3bbd76e
Xtrabackup: Always use default error messages
May 10, 2013
d0aad62
Change binlog index file format to incude previous gtid set.
rvsprvsp May 2, 2013
911133c
Fix CREATE TABLE ... LIKE to handle KEY_BLOCK_SIZE
jtolmer May 13, 2013
0fd6a6d
Zero-padding trx log write to OS block size
Apr 19, 2013
cc11939
Oracle's fix for flush tables breaking replication
rvsprvsp May 13, 2013
4c478e2
Back-port Oracle's fix for CREATE TABLE IF NOT EXISTS
steaphangreene May 13, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add logical read-ahead to InnoDB.
Summary:
When the session variable innodb_lra_size is set to N, we issue async
read requests for the next M logical pages where the total size of the M
pages on disk is N megabytes. The max allowed value of innodb_lra_size
is is 16384 which corresponds to prefetching 16GB of data. We may choose
to use smaller values in production.

When the flashcache is available, the logical-read-ahead tells
flashcache to not cache the pages it reads.

We always sort the page numbers before issuing read requests for them
because sorting is cheap and this way we don't have to rely on the block
layer of linux kernel to sort our read requests. Another advantage is
that if the read array is small then block layer doesn't get a chance to
coalesce reads.

I added status variables for the number of pages prefetched by
logical-read-ahead, the number of pages that are missed (a page is
missed if we notice that it was not prefetched while doing the scan.
this can happen if the b-tree was modified since the last time we
prefetched pages.), and the number of pages that were already in buffer
pool. These are

  innodb_logical_read_ahead_prefetched
  innodb_logical_read_ahead_missed
  innodb_logical_read_ahead_in_buf_pool.

There are two more session variables that control the behaviour of
logical read ahead:

  innodb_lra_n_node_recs_before_sleep: this variable determines how many
node pointer records should be traversed by logical read ahead before
going to sleep.

  innodb_lra_sleep: this is the amount of time (in milliseconds) that
logical read ahead sleeps in order to give other transactions a chance
to x-latch the index lock.

I had to make the following modifications:

* Persistent cursor can not be restored on a level other than the leaf
level. I provided a way to do this but it only works for PAGE_CUR_LE mode.

* Make btr_pcur_restore_position_func() always re-traverse the B-tree in
debug build. This is to test the above functionality in debug build.

Test Plan:
* innodb_logical_read_ahead.test tests that logical read ahead fetches
all pages necessary when the read ahead size is large enough. It also
tests whether the asynchronous io requests made for the table was the
same as the number of prefetches done by the logical read ahead.

* Add a unit test where one thread creates a lot of splits and merges on
the B-tree while the other scans the table. This is to stress test the
correctness of the changes.

* innodb_logical_read_ahead_correctness.test: This test tests for the
base cases (empty table, table with one row, table with many rows) and a
case where pages are merged while the scan is being performed. If the
code was not careful in restoring the cursor in row_read_ahead_logical()
or if row_search_for_mysql() did not check the return value of this
function, then we could skip a record. If the return value of
row_read_ahead_logical() in row_search_for_mysql() is ignored, this test
fails.

* Add stress test for logical read ahead: checksum of the table is
computed in a separate thread while the table is modified by bunch of
threads. This makes sure that innodb_lra_size works under concurrency.

* Run on a production table without traffic.

* Run on a production shadow with read/write traffic.

Reviewers: rongrong, mcallaghan, steaphan, yoshinori

Reviewed By: steaphan
  • Loading branch information
Nizameddin Ordulu authored and steaphangreene committed Apr 19, 2013
commit ee024c6a790ec790d0f4c59442b534507d690157
50 changes: 50 additions & 0 deletions mysql-test/suite/innodb/r/innodb_logical_read_ahead.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
DROP TABLE if exists t1;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;
INSERT INTO t1 VALUES (0, REPEAT('a',256));
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
show global status like "innodb_buffered_aio_submitted";
Variable_name Value
Innodb_buffered_aio_submitted 0
show global status like "innodb_logical_read_ahead_misses";
Variable_name Value
Innodb_logical_read_ahead_misses 0
show global status like "innodb_logical_read_ahead_prefetched";
Variable_name Value
Innodb_logical_read_ahead_prefetched 0
show global status like "innodb_logical_read_ahead_in_buf_pool";
Variable_name Value
Innodb_logical_read_ahead_in_buf_pool 0
SET SESSION innodb_lra_size=1024;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
checksum table t1;
Table Checksum
test.t1 2920207201
select t1.variable_value=t2.variable_value prefetched_equals_submitted from information_schema.global_status t1, information_schema.global_status t2 where t1.variable_name = 'innodb_logical_read_ahead_prefetched' and t2.variable_name='innodb_buffered_aio_submitted';
prefetched_equals_submitted
1
show global status like "innodb_logical_read_ahead_misses";
Variable_name Value
Innodb_logical_read_ahead_misses 0
select variable_value > 1000 from information_schema.global_status where variable_name="innodb_logical_read_ahead_prefetched";
variable_value > 1000
1
select variable_value < 100 from information_schema.global_status where variable_name="innodb_logical_read_ahead_in_buf_pool";
variable_value < 100
1
DROP TABLE t1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
DROP TABLE IF EXISTS t1_small;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1_lra;
DROP TABLE IF EXISTS t2_small;
DROP TABLE IF EXISTS t3_small;
CREATE TABLE t1_small(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;
SET SESSION innodb_lra_size=1;
SELECT * FROM t1_small;
a b
SET SESSION innodb_lra_size=0;
INSERT INTO t1_small(b) VALUES(REPEAT('a',256));
SET SESSION innodb_lra_size=1;
SELECT a, LENGTH(b) FROM t1_small;
a LENGTH(b)
1 256
SET SESSION innodb_lra_size=0;
DROP TABLE t1_small;
CREATE TABLE `t2_small` (
`id1` bigint(20) unsigned NOT NULL DEFAULT '0',
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
`id2` bigint(20) unsigned NOT NULL DEFAULT '0',
`id2_type` int(10) unsigned DEFAULT NULL,
`data` text,
`status` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id1`,`time`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET SESSION innodb_lra_size=1;
SELECT * FROM t2_small;
id1 time id2 id2_type data status
DROP TABLE t2_small;
CREATE TABLE `t3_small` (
`id` bigint(20) NOT NULL,
`a` text,
`b` text,
`c` text,
`d` text,
`e` text,
`f` text,
`g` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET SESSION innodb_lra_size=1;
SELECT * FROM t3_small;
id a b c d e f g
DROP TABLE t3_small;
CREATE TABLE t1(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;
CREATE TABLE t1_lra(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;
INSERT INTO t1 VALUES (0, REPEAT('a',256));
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1_lra SELECT * FROM t1;
CHECKSUM TABLE t1;
Table Checksum
test.t1 2793042655
SET SESSION innodb_lra_size=1;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
CHECKSUM TABLE t1_lra;
Table Checksum
test.t1_lra 2793042655
DELETE FROM t1 WHERE a >= 5480 AND a < 5520;
DELETE FROM t1 WHERE a >= 5520 AND a < 5550;
CHECKSUM TABLE t1;
Table Checksum
test.t1 1005864202
SET GLOBAL innodb_lra_test=1;
DELETE FROM t1_lra WHERE a >= 5480 AND a < 5520;
DELETE FROM t1_lra WHERE a >= 5520 AND a < 5550;
SET SESSION innodb_lra_size=1;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
CHECKSUM TABLE t1_lra;
Table Checksum
test.t1_lra 1005864202
DROP TABLE t1;
DROP TABLE t1_lra;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--innodb_use_native_aio=1
--force-restart
59 changes: 59 additions & 0 deletions mysql-test/suite/innodb/t/innodb_logical_read_ahead.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--source include/have_innodb.inc
--source include/have_native_aio.inc

--disable_warnings
DROP TABLE if exists t1;
--enable_warnings

# Create table.
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;

# Populate table.
INSERT INTO t1 VALUES (0, REPEAT('a',256));
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;
INSERT INTO t1 SELECT 0, b FROM t1;

--source include/restart_mysqld.inc

show global status like "innodb_buffered_aio_submitted";
show global status like "innodb_logical_read_ahead_misses";
show global status like "innodb_logical_read_ahead_prefetched";
show global status like "innodb_logical_read_ahead_in_buf_pool";

# set the logical read ahead large enough to prefetch
# the entire table.
SET SESSION innodb_lra_size=1024;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
checksum table t1;

# the asynchronous io submits must be nonzero and equal
# to the innodb_logical_read_ahead_prefetched.
select t1.variable_value=t2.variable_value prefetched_equals_submitted from information_schema.global_status t1, information_schema.global_status t2 where t1.variable_name = 'innodb_logical_read_ahead_prefetched' and t2.variable_name='innodb_buffered_aio_submitted';

# there should be no misses, all pages must have been
# prefetched by the logical read ahead.
show global status like "innodb_logical_read_ahead_misses";
# the total number of pages prefetched must be close to the number
# of leaf pages of the table.
select variable_value > 1000 from information_schema.global_status where variable_name="innodb_logical_read_ahead_prefetched";
# innodb_logical_read_ahead_in_buf_pool is the number of pages
# of the table that were already in the buffer pool while doing the scan.
# This should be small.
select variable_value < 100 from information_schema.global_status where variable_name="innodb_logical_read_ahead_in_buf_pool";

DROP TABLE t1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--innodb_use_native_aio=1
--force-restart
107 changes: 107 additions & 0 deletions mysql-test/suite/innodb/t/innodb_logical_read_ahead_correctness.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_native_aio.inc

--disable_warnings
DROP TABLE IF EXISTS t1_small;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1_lra;
DROP TABLE IF EXISTS t2_small;
DROP TABLE IF EXISTS t3_small;
--enable_warnings

# The small table is for checking against a bug where the table's only page is the
# root page. In such a case the function called for getting the parent page caused
# the server to crash.
CREATE TABLE t1_small(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;

SET SESSION innodb_lra_size=1;
SELECT * FROM t1_small;

SET SESSION innodb_lra_size=0;
INSERT INTO t1_small(b) VALUES(REPEAT('a',256));
SET SESSION innodb_lra_size=1;
SELECT a, LENGTH(b) FROM t1_small;
SET SESSION innodb_lra_size=0;

DROP TABLE t1_small;

CREATE TABLE `t2_small` (
`id1` bigint(20) unsigned NOT NULL DEFAULT '0',
`time` bigint(20) unsigned NOT NULL DEFAULT '0',
`id2` bigint(20) unsigned NOT NULL DEFAULT '0',
`id2_type` int(10) unsigned DEFAULT NULL,
`data` text,
`status` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id1`,`time`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

SET SESSION innodb_lra_size=1;
SELECT * FROM t2_small;
DROP TABLE t2_small;

CREATE TABLE `t3_small` (
`id` bigint(20) NOT NULL,
`a` text,
`b` text,
`c` text,
`d` text,
`e` text,
`f` text,
`g` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

SET SESSION innodb_lra_size=1;
SELECT * FROM t3_small;
DROP TABLE t3_small;

CREATE TABLE t1(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;
CREATE TABLE t1_lra(a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256)) ENGINE=INNODB;

# Populate tables.
INSERT INTO t1 VALUES (0, REPEAT('a',256));
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t1;

INSERT INTO t1_lra SELECT * FROM t1;

--source include/restart_mysqld.inc

CHECKSUM TABLE t1;

SET SESSION innodb_lra_size=1;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
CHECKSUM TABLE t1_lra;

--source include/restart_mysqld.inc

DELETE FROM t1 WHERE a >= 5480 AND a < 5520;
DELETE FROM t1 WHERE a >= 5520 AND a < 5550;

CHECKSUM TABLE t1;

SET GLOBAL innodb_lra_test=1;
DELETE FROM t1_lra WHERE a >= 5480 AND a < 5520;
DELETE FROM t1_lra WHERE a >= 5520 AND a < 5550;

SET SESSION innodb_lra_size=1;
SET SESSION innodb_lra_n_node_recs_before_sleep=128;
SET SESSION innodb_lra_sleep=100;
CHECKSUM TABLE t1_lra;

DROP TABLE t1;
DROP TABLE t1_lra;
27 changes: 27 additions & 0 deletions mysql-test/suite/innodb_stress/r/innodb_stress_lra.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg VARCHAR(255),
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB;
call mtr.add_suppression(".*");
include/rpl_restart_server.inc [server_number=2]
Checksum master
stop slave;
Warnings:
Note 1255 Slave already has been stopped
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
9 changes: 9 additions & 0 deletions mysql-test/suite/innodb_stress/t/innodb_stress_lra-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--binlog-do-db=test
--innodb-file-per-table
--innodb_file_format='Barracuda'
--sync_binlog=10
--innodb_flush_log_at_trx_commit=2
--force-restart
--innodb_buffer_pool_size=128M
--innodb_use_native_aio=1
--innodb_flush_method=O_DIRECT
35 changes: 35 additions & 0 deletions mysql-test/suite/innodb_stress/t/innodb_stress_lra.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Don't test this under valgrind, memory leaks will occur
--source include/not_valgrind.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/big_test.inc
--source include/have_native_aio.inc


--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

# create the actual table
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg VARCHAR(255),
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB;


let $use_blob=0;
let $do_crash=0;
let $do_compress=1;

--let $num_crashes = 1
--let $num_workers = 10
--let $num_transactions = 1000
--let $kill_db_after = 0
--let $num_records = 1000000
--let $max_rows = 1100000
--let $do_checksum = 1

--source suite/innodb_stress/include/innodb_stress.inc
Loading