WL#2511: Add a new table to the Information Schema for TABLESPACE's

Affects: Server-5.5   —   Status: Complete   —   Priority: Medium

Implement a new Information Schema Table TABLESPACES which includes
tablespaces from all storage engines using tablespaces (currently NDB
and Falcon). LOGFILE GROUP's in NDB is a type of tablespace, thus a
tablespace table requires a field TYPE distinguishing the type of
tablespace.


Old description
---------------
Apparently work for this happen in WL#4240.
Email about cancellation is here:
https://intranet.mysql.com/secure/mailarchive/mail.php?folder=4&mail=24634


To be able to view the current standing of a tablespace a new   
table in the information schema is proposed or actually two of them  
1) TABLESPACE (defining extent size, name, nodegroup and engine and whether  
   tablespace or logfile group  
2) File of a TABLESPACE  
   providing initial size, current size, name of file, tablespace name,  
   and maximum size and autoextend size  
   [ Peter Gulutzan believes the appropriate 'files' task is WL#1359 ]  
  

If there must be an INFORMATION_SCHEMA.TABLESPACES,
the "primary key" columns (well, not actually primary key
columns but the columns that are guaranteed to be unique)
are: name + storage engine.

References
----------

dev-private thread "Meeeting re WL#4300 Tablespace privilege
+ Meeting re information_schema.tablespaces"
https://intranet.mysql.com/secure/mailarchive/mail.php?folder=214&mail=792

WL#4240 "Online Backup: save/restore table space information"
There will be a new table INFORMATION_SCHEMA.TABLESPACES:

CREATE TEMPORARY TABLE `TABLESPACES` (
  `TABLESPACE_NAME` varchar(64) NOT NULL DEFAULT '',
  `ENGINE` varchar(64) NOT NULL DEFAULT '',
  `TABLESPACE_TYPE` varchar(64) DEFAULT NULL,
  `LOGFILE_GROUP_NAME` varchar(64) DEFAULT NULL,
  `EXTENT_SIZE` biging(21) unsigned DEFAULT NULL,
  `AUTOEXTEND_SIZE` bigint(21) unsigned DEFAULT NULL,
  `MAXIMUM_SIZE` bigint(21) unsigned DEFAULT NULL,
  `NODEGROUP_ID` bigint(21) unsigned DEFAULT NULL,
  `TABLESPACE_COMMENT` varchar(2048) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8

`TABLESPACE_NAME` is the name of a tablespace. Maximum length is 64 charaters,
which is NAME_CHAR_LEN. This field is mandatory and must be filled by
storage engine.

`ENGINE` is the storage engine which uses this tablespace. Maximum length is
64, which is NAME_CHAR_LEN. This field is mandatory and must be filled by
storage engine.

`TABLESPACE_TYPE` is the internal type of this tablespace. Maximum length is 64,
which is NAME_CHAR_LEN. An engine should optionally provide internal tablespace
type. For NDB valid types are "UNDO LOG" and "DATAFILE". For Falcon valid types
are "DEFAULT", "TEMPORARY", "MASTER CATALOG" and "USER DEFINED".

`LOGFILE_GROUP_NAME` is the log file group of the tablespace. Maximum length is
64, which is NAME_CHAR_LEN. This field is optional. Storage engine may set it
to NULL.

`EXTENT_SIZE` extent size used by any files belonging to the tablespace. This
field is optional. Storage engine may set it to NULL.

`AUTOEXTEND_SIZE`, `MAXIMUM_SIZE`, `NODEGROUP_ID` and `TABLESPACE_COMMENT` are
currently unused per documentation. It is up to an engine whether to fill them
or set to NULL.

References:
- CREATE TABLESPACE Syntax
  http://dev.mysql.com/doc/refman/6.0/en/create-tablespace.html
- WL#4448 - Generalize the handlerton::fill_files_table call with
            handlerton::fill_is_table
- WL#4240 - Online Backup: save/restore table space information
This is written with assumption that WL#4448 is ready.

INFORMATION_SCHEMA.TABLESPACES will be filled by a storage engine via
handlerton::fill_is_table() method. This will be done if schema_table_idx
parameter is set to SCH_TABLESPACES.

sql/mysql_priv.h:
- add human readable definitions for field identifiers, e.g.:
  #define IS_TABLESPACES_TABLESPACE_NAME 0

sql/handler.h
- add SCH_TABLESPACES to the enum_schema_tables

sql/sql_show.cc:
- implement tablespaces_fields_info
- probably implement init_fill_schema_tablespaces_row()
- add TABLESPACES table to the schema_tables array. Reuse
INFORMATION_SCHEMA.FILES related functions.