MDEV-5231: Per query variables from Percona Server (rewritten)
MDEV-7088: Query stats for compression based on TRIM size

Analysis: Status variables were missing from innodb_status_variables
array.

Fix: Add missing status variables to the array.
MDEV-7108: Make long semaphore wait timeout configurable

Merge Facebook commit https://github.com/facebook/mysql-5.6/commit/cd063ab930f05efdba39d504543998512d1bd71f
authored by Peng Tian from https://github.com/facebook/mysql-5.6

Introduced a new configuration variable innodb_fatal_semaphore_wait_threshold,
it makes the fatal semaphore timeout configurable. Modified original commit
so that no MariaDB server files are changed, instead introduced a new
InnoDB/XtraDB configuration variable.

Its default/min/max vlaues are 600/1/2^32-1 in seconds (it was hardcoded
as 600, now its default value is 600, so the default behavior of this diff
should be no change).
MDEV-7133: InnoDB: Assertion failure in dict_tf_is_valid

Problem is that page compressed tables currently require atomic_blobs and
that feature is not availabe currently for row_format=redundant.

Fix: Disallow page compressed create option if table row_format=redundant.
Sharing similar code between Item_func_ifnull and Item_func_if
MDEV-7005 NULLIF does not work as documented
MDEV-7146 NULLIF returns unexpected result with a YEAR field
Deriving Item_bool_func from Item_bool_func2.
Removing some duplicate code: deriving Item_func_opt_neg from Item_bool_func.
cleanup: sql_plugin.cc

* test for opt->name being non-NULL *before* dereferencing it
* remove unused argument in cleanup_variables()
* simplify
cleanup: remove long unused unireg constants
compiler warning when compiling wsrep w/o P_S
parser cleanup: don't store field properties in LEX, use Create_field directly

length/dec/charset are still in LEX, because they're also used
for CAST and dynamic columns.

also
1. fix "MDEV-7041 COLLATION(CAST('a' AS CHAR BINARY)) returns a wrong result"
2. allow BINARY modifier in stored function RETURN clause
3. allow "COLLATION without CHARSET" in SP/SF (parameters, RETURN, DECLARE)
4. print correct variable name in error messages for stored routine parameters
cleanup: sort and reorder %union elements in sql_yacc.yy
cleanup: comments referring to non-extistent Item classes
cleanup: freshen up CREATE SERVER code

* pass LEX_STRING's from the parser, don't ignore the length only to strlen later
* init LEX::server_options only for SERVER commands, not for every statement
* don't put temporary values into a global persistent memroot

but really it's just scratching a surface
MDEV-6311 Add errors on CREATE SERVER

fail CREATE SERVER foreign data wrapper is "mysql"
and neither HOST nor SOCKET are specified.

Also default PORT to 3306 (again, only for foreign
data wrapper "mysql")
cleanup: ptr_cmp

1. don't cast size_t* to int*
2. remove long obsolete register specifier
cleanup: reuse MY_CHECK_AND_SET_COMPILER_FLAG in sphinx/CMakeLists.txt
cleanup: s/const CHARSET_INFO/CHARSET_INFO/

as CHARSET_INFO is already const, using const on it
is redundant and results in compiler warnings (on Windows)