WL#4305: storage-engine private data area per physical table

Affects: Server-5.6   —   Status: Complete

Most, if not all, storage engines need to store some data related to a physical
table, that is once per table, not per table instance (one physical table may be
opened many times yielding many handler instances of the same table). The
handler class provides storage area for engine private data per table instance,
but to store data common to all instances on the same physical table storage
engine needed until recently to maintain a hash by table name. Examples of this
approach are (in 5.1): ARCHIVE_SHARE, st_blackhole_share, EXAMPLE_SHARE,
TINA_SHARE, FEDERATED_SHARE, INNOBASE_SHARE, NDB_SHARE. Partitioning engine
doesn't use PARTITION_SHARE structure, but has it fields added directly to
TABLE_SHARE.

This is code duplication (copied from one storage engine to another, ha_berkeley
started using this approach). And functionality duplication as SQL level already
has a shared structure like this - TABLE_SHARE. Storage engines should be able
to benefit from it.

THD structure has a dedicated pointer to storage engine private data - ha_data.
TABLE_SHARE should have it too, so that storage could use it.

Recently, as a bugfix for BUG#33479, TABLE_SHARE::ha_data was implemented.

The goal of this WorkLog task is to make use of it - partitioning data should be
moved from TABLE_SHARE to  PARTITION_SHARE. Archive, blackhole, example, tina,
innodb, and ndb should drop the code that maintains the hash by name and
store the structure in TABLE_SHARE::ha_data instead.

Scope of this worklog has been decreased to: Archive, Example and the general
partitioning storage engine, ha_partition, after the InnoDB implementation was
reverted (see bug#13838761).

Perhaps MyISAM, HEAP and MERGE could do the same (although these three
maintain the shared data differently - not copy-pasted from BDB engine - so
changing them would be not trivial).

NOTE: Currently the ha_data introduced in BUG#33479 is used by
ha_partitioning.cc, but this use must probably move to a specific auto_increment
area or a specific partitioning area, since it would not otherwise allow
partitioned tables handlers to use it.

Also BUG#49177 could be fixed by attaching the MYISAM_SHARE on the TABLE_SHARE
instead of using a linear search in test_if_reopen. The same problem seems to
also affect Heap in hp_find_named_heap.

This also solves BUG#55878 / bug#11763195

NOTE: this worklog was pushed to trunk (5.6.5) but later disabled for InnoDB
because of bug#13838761. The remaining work is now WL#6324.