Fix trivial output typo.

Summary:
An extra comma slipped into an output line.  Remove it.

Test Plan: Jenkins

Reviewers: santoshb

Reviewed By: santoshb
Remove stats histograms

Summary:
Revert stat histogram diffs - these need to be redone.

Test Plan: arc unit

Reviewers: steaphan

Reviewed By: steaphan
Fix innodb_doublewrite test.

Summary:
innodb_doublewrite tests the functionality of the doublewrite
buffer in full-durability and reduced-durability mode. In order
to do this, it invokes the innodb_corrupt_doublewrite_pages.py
script which corrupts pages that were on the doublewrite buffer
on disk. The problem is that innodb accesses the files using
O_DIRECT but the python script accesses them through FS cache.
This meant that sometimes the corruption (or un-corruption)
performed by the python script was not seen by innodb. In order
to fix this problem we enforce flushing of the file by calling
flush() and fsync().

Test Plan:
Run the test repeatedly using the following command:

  ../srpm/mysqltest.sh --release --repeat=16 --parallel=4 innodb.innodb_doublewrite innodb.innodb_doublewrite_odirect innodb.innodb_doublewrite innodb.innodb_doublewrite_odirect

Reviewers: steaphan, rongrong

Reviewed By: rongrong
Fix warnings detected by gcc-4.8.1

Summary:
These errors are all from upstream 5.6.12, not our changes.

Test Plan: Built (with -Wall -Werror), works now.

Reviewers: rudradevbasak

Reviewed By: rudradevbasak
Fix errors detected by ASan at compile time.

Summary: Compiles cleanly with ASan now.

Test Plan: Built it with ASan, no warnings/errors.

Reviewers: rudradevbasak

Reviewed By: rudradevbasak
Fix errors detected by ASan at runtime

Summary:
Half of these are from upstream.  Good news is most of them corresponded
to changes between 5.6.12 and 5.6.14, so it seems Oracle already ran
some of this.  I've back-ported those same fixes to resolve those.
In the case of sql/sql_error.*, I just copied the entire files, as
they had no irrelevant changes.

I fixed one other upstream one as well, with the minimum (good) change
I could see.

Four errors are ours (two from Table Stats, one from Semi-Sync, and one
from the Reduced Double-Write mode).  I fixed these too.

Test Plan:
Ran a special ASan-Enabled 'arc unit', all passed in Release and Debug,
except the expected failures.  Also running 'arc unit --everything' now.

Expected failures under ASan:

1) Valgrind and ASan don't get along, at least not yet, so it is
   expected that all the Valgrind+ASan test runs will fail.

2) The XtraBackup build setup does't support ASan yet.  So, all of
   those builds will fail, well before the tests even run.

3) JEMalloc doesn't work with ASan yet, so that test will (quite
   correctly) fail to confirm the presense of jemalloc.

Reviewers: rudradevbasak

Reviewed By: rudradevbasak
Fix asan failure in log padding

Summary:
There is a possibility that data + padding exceeds the boundry of
log_sys->buf.

Make the buffer larger so padding always land in valid memory.

Test Plan: asan tests.

Reviewers: steaphan

Reviewed By: steaphan
Add -DWITH_ASAN cmake option, to enable ASan checking

Summary: Passing -DWITH_ASAN will add the "-fsanitize=address" compiler option.

Test Plan:
Built with -DWITH_ASAN, with intentional ASan failures, works.
Built without -DWITH_ASAN, confirmed it is not enabled.

Reviewers: rudradevbasak, santoshb

Reviewed By: rudradevbasak
Add -Wall -Werror to xtrabackup's mysql build too

Summary:
We also want to build this in maintainer mode.

This build system will hopefully, one day, be unified.

But, for now, it is not.

Test Plan: Build xtrabackup, ran the xtrabackup tests, works.

Reviewers: rudradevbasak

Reviewed By: rudradevbasak
Stop valgrind from complaining about uninitilialized variables.

Summary:
innodb.innodb_alter_table_defragment fails in valgrind runs. The report sort of suggesting a
corrupted page but it's not clear. For example, one of the conditional jump based on uninitalized
variables report points to page_type, which is a ulint initialized from the page. Adding debug output
will make the error disappear so it's hard to do any further analysis. Changing the word "SECOND" in
defragment statement "alter table t1 defragment index SECOND" to "second" seem to avoid the error.
It's not clear as of why this happens. Actually, in the original form, the first valgrind error happens
before the statement is executed. So this diff is only to make valgrind stop complaining, not really
solving the problem.

Test Plan: mysqltest.sh --valgrind innodb.innodb_alter_table_defragment

Reviewers: steaphan

Reviewed By: steaphan
Free transaction pool at shutdown

Summary:
Fix memory leak reported by Valgrind by freeing the transaction pool
at shutdown.

Test Plan: Jenkins Valgrind run, once leak checking works.

Reviewers: steaphan

Reviewed By: steaphan
Fix leaked memory, os_support

Summary:
We introduce a new allocation, os_support, but we do not free it.
Valgrind complains. Fix that.

Test Plan: Jenkins

Reviewers: steaphan

Reviewed By: steaphan
Fix leak of os_aio_thread_buffer under Valgrind

Summary:
Valgrind complains that we're not freeing the os_aio_thread_buffers.
Fix valgrind builds so that we do.

Test Plan: Jenkins

Reviewers: rongrong, santoshb

Reviewed By: santoshb
Update valgrind suppression for current tools / libraries

Summary:
Existing valgrind suppression isn't getting triggered because
the call stack is slightly different now.

Test Plan: Jenkins

Reviewers: santoshb

Reviewed By: santoshb
fix leak in read_gtids_from_binlog

Summary:
The last event allocatted is not freed if the condition
ev->log_pos <= max_pos is false and the while loop exits.
Fixed it

Test Plan:
mysqltest.sh --valgrind xtrabackup.xb_gtid.
Failed before this patch but passed after this patch

Reviewers: jtolmer, rudradevbasak, steaphan

Reviewed By: steaphan
Fix memory leak in logical read ahead

Summary:
Valgrind is complaining of leaked memory from innodb.innodb_logical_read_ahead.
Fix it.

Test Plan:
mysqltest.sh --valgrind --jenkins innodb.innodb_logical_read_ahead
Jenkins

Reviewers: nizamordulu, steaphan

Reviewed By: steaphan
Fix writing uninitialized bytes to InnoDB's doublewrite buffer.

Summary:
innodb.innodb_doublewrite_odirect is failing under valgrind with:
  Syscall param pwrite64(buf) points to uninitialised byte(s)
Fix that. The problem is that buf_dblwr_reset is doing a memcpy
of the full contents of buf_dblwr->header, but buf_dblwr_init
only initializes 2 fields of the header, leaving the rest
uninitialized.

Test Plan: mysqltest.sh --valgrind innodb.innodb_doublewrite_odirect

Reviewers: nizamordulu, steaphan

Reviewed By: nizamordulu
First innodb_fake_changes update from Percona [1/7]

Summary:
Port Percona implementation of avoiding binlogging of fake changes
transactions.

- Handle fake changes in InnoDB XA 2PC prepare step by rolling back
  the transaction.
- In ha_check_and_coleasce_trx_read_only(), bump rw_ha_count for each
  fake changes handlerton, which will force the 2PC protocol for fake
  changes transactions as if they were non-fake-changes.
- In ha_prepare_low(), treat fake changes transactions as RW ones.
- Remove the loop from ha_commit_trans() that explicitly rolled back
  the fake changes transaction as the same effect is achieved by the
  above changes.

Test Plan: Jenkins

Reviewers: jtolmer

Reviewed By: jtolmer
First innodb_fake_changes update from Percona [2/7]

Summary:
Add branch prediction annotations for the fake changes.  Always assume
that a non-fake change branch is likely to be taken.

Test Plan: Jenkins

Reviewers: jtolmer

Reviewed By: jtolmer
First innodb_fake_changes update from Percona [3/7]

Summary: Remove redundant tree_height check from btr_cur_pessimistic_update().

Test Plan: Jenkins

Reviewers: jtolmer

Reviewed By: jtolmer