MDEV-6247: Merge 10.0-galera to 10.1.

Merged lp:maria/maria-10.0-galera up to revision 3867.
Minor cleanups, fix compiler warnings
Change MySQL -> MariaDB inc scripts
Changes for using build scripts

Removed -DSECURITY_HARDENED=OFF for debug build scripts
ignore configure
Made sql_log_slow a session variable

mysqldump:
- Added --log-queries to allow one to disable logging for the dump

sql/log_event.cc:
- Removed setting of enable_slow_log as it's not required anymore.

sql/sql_parse.cc:
- Set enable_slow_log to value of thd->variables.sql_log_slow as this will speed up tests if slow log is disabled.
- opt_log_slow_admin_statements can now only disable slow log, not enable it.

sql/sql_explain.cc:
- Minor cleanup

Other things:
- Added sql_log_slow to system variables.
- Changed opt_slow_log to global_system_variables.sql_log_slow in all files
- Updated tests to reflect changes
MDEV-6567: Raw debug output in the error log.

Removed raw debug output when no error on OS operation has not happened.
Basic test of slave_run_triggers_for_rbr variable added.
MDEV-6575: main.view --ps-protocol fails in ANALYZE code

- After PREPARE is done, save the value of thd->select_number
  (this is what will be assigned to next select_lex object)
- Restore the value at each execution of the prepared statement.
Merge branch '10.1' of github.com:MariaDB/server into 10.1
MDEV-6172: Monitor progress of ALTER TABLE ... ADD INDEX,
ALGORITHM=INPLACE for InnoDB

Added thd_progress calls to row_merge_sort to give
some hint how merge sort progresses.
Merge branch '10.1' of github.com:MariaDB/server into 10.1
MDEV-4262 - P_S discovery

Discover P_S tables automatically.

Most of this patch is code clean-up:
- removed tests and code responsible for P_S tables correctness verification
- always return error from ha_perfschema::create()
- install/upgrade scripts won't create P_S tables anymore
Review fixes.
Fix Windows compiler errors.
Fix merge error.
Fix merge errors.
MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate

IS [NOT] NULL predicate is sargable within an outer join. Range
analysis only uses predicates from ON expressions, which have
regular semantics (without null-complemented rows, etc).
There is no reason not use IS [NOT] NULL predicates.
Merge lp:maria/maria-10.0-galera revisions 3867..3869 and
3871..3879.
MDEV-6305 - UNINIT_VAR emits code in non-debug builds

Reverted workaround for gcc bug, which was fixed 3 years ago:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772
Add missing test files for new configuration variables.

Added a new functions to handler API to forcefully abort_transaction,
producing fake_trx_id, get_checkpoint and set_checkpoint for XA. These
were added for future possiblity to add more storage engines that
could use galera replication.