Add new InnoDB status variables for InnoDB B-tree node operations

This change introduces new counters for InnoDB b-tree page operations
such as page split, merge and reorganization. Innodb_page_merges
counts the number of page merge operations, Innodb_page_splits the
number of page split operations and Innodb_page_reorganizes the number
of page reorganization operations. These counters also represent the
number of pages that have been split, merged or reorganized.
Use int instead of bool when interfacing between C and C++.
Cleanup check for timer object allocation and fix a typo.
Destroy the mutex object before its containing object is released.
Gracefully handle errors when disarming a statement timer.

If the timer cannot be properly disarmed, assume that the timer might
be pending. Also, use a separate field to indicate whether the timer
object should be destroyed by the callback.
Merge additional changes from branch 'statement-timeout' into t8-dev
Bug#67476: Innodb_buffer_pool_read_ahead_evicted is inaccurate

If a page being read into the buffer pool is made "young" (moved
to the head of the LRU), its time of first access it not properly
recorded (that is, it remains with a value of zero). When the page
eventually gets evicted, the page is counted as a read-ahead page
that was evicted without having been accessed by queries.

The solution is to ensure that the first access time is recorded
even if the page is moved to the head of the LRU.
A non-blocking mode for ALTER TABLE.

While an ALTER TABLE is executing, the table whose definition is being
changed can usually be read, but not updated, by other sessions. Such
writes are blocked until the ALTER TABLE operation completes or a lock
wait timeout occurs.

In a sharded system, it would be better if conflicting operations were
aborted rather than blocked, thereby eliminating delays due to lock
waits and allowing them to be redirect to another shard.

In order to allow for this behavior, a new ALTER TABLE option named
NO_WAIT is introduced. When NO_WAIT is set, conflicting locks requests
that would normally block are aborted instead.
ALTER TABLE in exclusive mode.

In certain cases, it is desirable to control the lock mode to be used
for an ALTER TABLE operation, especially in a scenario where it is
appropriate to restrict access to the table while the operation is in
progress. For example, an exclusive lock mode could be used in
conjunction with NO_WAIT to abort any attempts to use a table while
its structure is being changed.

In order to support such scenarios, this changes adds a LOCK clause
for ALTER TABLE. Inspired by the LOCK clause introduced in MySQL 5.6,
this clause can be used to enforce a specific lock mode for an alter
table operation. The only supported lock mode parameter is EXCLUSIVE,
which will block any attempts to read or write to the table while the
operation is in progress.
Fix spurious failures of the log_state test case.

Enable the slow query log only after cleaning up the existing slow_log
table. Truncating the slow_log table might take some time and cause
itself to be logged as slow, thus defeating its purpose.
Expose the level of each B-tree page in the buffer pool

Although the INNODB_BUFFER_PAGE table shows the number of records
within a page, it is not clear whether these records are row data or
internal b-tree pointers. For this reason, a new LEVEL column is
introduced which shows the level of a page in the B-tree.

Additionally, the direction of insertion encoded in InnoDB data
pages is now available in the DIRECTION column, and the number of
consecutive inserts in that direction is available in the N_DIRECTION
column. These columns are useful to determine whether records are
being inserted in an ascending or descending sequence.
Expose the segment fill factor as a configurable setting.

When allocating a page from a segment, InnoDB has an internal fill
factor setting that is used to decide whether to allocate a new extent
or to use an unused page. In short, the segment fill factor is used to
determine how full to make the segment before extending it. The fill
factor resembles a ratio of the number of unused pages to the total
number of pages (1:8), meaning that some unused pages are left behind
for future (contiguous) expansion of the index. If taking a page would
cause the ratio to decrease, a new extent is allocated instead.

A problem with this default fill factor is that it may lead to a lot of
wasted space if the segment becomes fragmented. The larger the table,
the more wasted space there might be. Depending on the performance
characteristics of the hard disk, it might make more sense to increase
the fill factor if, for example, seek time is not a concern.

This change introduces a new variable named innodb_segment_fill_factor
that can be used to control the fill factor. Its value specifies the
percentage of space on a segment to be used, reserving the remainder as
free space for future growth. The default value is set to 88%.
Expose the index fill factor as a configurable setting.

When extending a clustered index to the left or right, InnoDB attempts
to fill leaf pages only up to a certain percentage, at which point the
page is split. The remaining space is reserved for updating rows
belonging to the page, attempting to make it likely that an updated row
will be stored on the same page. This percentage is also know as the
index fill factor and is used to determine how much to fill leaf pages
and how much space to reserve for future expansion, with the aim of
reducing the need to split pages as the data grows. Currently, InnoDB
reserves 1/16 (6.25%) of the page for future updates of records.

A problem with this imposed fill factor is that for tables whose entries
are never updated, or whose records are of fixed size (meaning that the
record can be update in place), the reserved space might lead to
premature page splits and also cause a lot of space to be wasted. In any
case, if the pattern of insertion/modification can be determined, it
might be worthwhile to tweak the fill factor to reduce or increase the
amount of space that is reserved.

This change introduces a new variable name innodb_index_fill_factor that
can be used to control the fill factor for clustered indexes. Its value
specifies the percentage of space on a leaf page to be used, reserving
the remainder as free space. The default value is set to 94%.