Fix bug 1247021 (Assertion failure in file buf0buf.cc line 3687,
buf_page_init_for_read() w/ multiple purge threads and compressed
tables).

The issue is buf_page_init_for_read() adjusted for the buffer pool
mutex split incorrectly, visible in a combination of compressed
tables and multiple active purge threads, in 5.6 only.

In upstream, decrement of watch page fix count in
buf_pool_watch_unset() is protected by a combination of the relevant
page_hash X latch, buffer pool mutex, and possibly block mutex. In
XtraDB, buf_pool_watch_unset() locks page_hash X latch and then
either a block mutex or the zip mutex.

In upstream, the code path leading to the failing assert temporarily
releases page_hash latch around buf_buddy_alloc() call, which in turn
may release the buffer pool mutex too. If that happens, the watch
page is re-read from the page hash.

In the same code path in XtraDB, the buffer pool mutex was substituted
by the LRU list mutex and the logic was kept the same. Which is
incorrect, because page_hash unlock in itself is enough to necessitate
the page_hash recheck regardless of the LRU list mutex, because of
buf_pool_watch_unset() differences.

Fix by reducing the uses of local variable lru in
buf_page_init_for_read() to absolute minimum, i.e. arg to
buf_buddy_alloc(), and performing the watch_page re-check
unconditionally.
Fix bug 1263087 (Percona Server 5.5 / 5.6 do not handle partial /
interrupted AIO calls) by backporting the os_aio_linux_handle() bits
of lp:mysql-server revision 4334.

The backport is straightforward with mechanical os_mutex/mutex_t
bool/ibool changes.
Trivially merge bug 1263087 fix from 5.5
Fix bug 1264952 (Adjust perfschema autosizing for Percona Server
mutexes).

Testcase sizing_growth checks the performance schema autosizing
heuristics by performing some actions on the server and counting the
resulting PFS records.  One of such tests, count of mutexes per
connection, behaves differently on Percona Server, because a
connection hits one extra mutex.  This failed the sizing_growth
checks, which were then recorded as expected result on the initial PS
5.6 port.

Fix by expecting four mutexes per connection in sizing_growth,
tweaking heuristics constant mutex_per_connection in pfs_autosize.cc
to match, and re-recording sizing_default, sizing_high, sizing_low,
and sizing_med testcases.
Automerge lp:~laurynas-biveinis/percona-server/bug1263087-5.6
Automerge lp:~laurynas-biveinis/percona-server/bug1247021
Fix bug 1204871 (abort in ha_partition::end_bulk_insert |
sql/ha_partition.cc:4438: virtual int ha_partition::end_bulk_insert():
Assertion `0' failed. (sig6)) /
http://bugs.mysql.com/bug.php?id=71270.

A debug server build will crash if, while performing a bulk insert to
a partitioned table, one of the partitions will return a failure for
end_bulk_insert handler call.

The crash happens because the failing ha_partition::end_bulk_insert()
call will clear the m_bulk_insert_started bitmap before returning the
failure to the caller.  The caller will handle the failure, and at one
point it will call select_insert::abort_result_set(), which will
attempt end_bulk_insert again, which will hit DBUG_ASSERT(0) because
m_bulk_insert_started is cleared.

Fix by resetting THD::bulk_insert_started_flag on end bulk insert
handler calls.  Add a error-injecting testcase
parts/partition_bug71270 testcase.
fix for bug 1268246, added back PAM plugin building instruction
Automerge lp:~laurynas-biveinis/percona-server/bug1204871
Automerge lp:~abychko/percona-server/5.6-bug1268246
Automerge lp:~laurynas-biveinis/percona-server/bug1264952
Fix for bug #1266980 crash in group_concat ported from MySQL 5.5.
Test case.
Add testcase for bug #1266980.
Add testcase for bug #1266980.
Automerge lp:~sergei.glushchenko/percona-server/5.6-ps-bug1266980