Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2030 05/09/29 16:08:23 stewart@stripped +12 -0
WL#2076 Add extra statistics for ndb processes
add and implement INFORMATION_SCHEMA.TABLESPACES
currently lists tablespaces in NDB.
Need to check if there's any existing standard on the content of a table like this.
sql/sql_show.cc
1.271 05/09/29 16:08:19 stewart@stripped +48 -2
Add fill_schema_tablespaces and datafiles.
schema_table_store_record is now public so that the fill_schema_tablespaces
handlerton function can call it to write each record.
Add preliminary tables for INFORMATION_SCHEMA.TABLESPACES and .DATAFILES.
These probably aren't following any standard. They are a translation of what
we output from ndb_desc about ndb tablespaces and datafiles.
I need to find a standard and implement it properly. This will do for the
meantime however.
sql/mysql_priv.h
1.303 05/09/29 16:08:19 stewart@stripped +3 -0
Add fill_schema_tablespaces and datafiles.
schema_table_store_record is now public so that the fill_schema_tablespaces
handlerton function can call it to write each record.
sql/handler.h
1.146 05/09/29 16:08:18 stewart@stripped +1 -0
Add fill_schema_tablespaces to handlerton.
Since any handler could support tablespaces in any variety of ways (local files,
over a network), we let the handler discover these and report back.
sql/ha_partition.cc
1.5 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_ndbcluster.cc
1.152 05/09/29 16:08:18 stewart@stripped +27 -0
Implement ndbcluster_fill_schema_tablespaces.
Reports tablespaces for inclusion in INFORMATION_SCHEMA.
sql/ha_myisammrg.cc
1.68 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_myisam.cc
1.154 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_innodb.cc
1.218 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_heap.cc
1.73 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_federated.cc
1.32 05/09/29 16:08:18 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_blackhole.cc
1.19 05/09/29 16:08:17 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
sql/ha_berkeley.cc
1.157 05/09/29 16:08:17 stewart@stripped +1 -0
add NULL for handlerton fill_schema_tablespaces
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.1/ndb-dd
--- 1.156/sql/ha_berkeley.cc 2005-08-26 02:49:39 +10:00
+++ 1.157/sql/ha_berkeley.cc 2005-09-29 16:08:17 +10:00
@@ -124,6 +124,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
HTON_CLOSE_CURSORS_AT_COMMIT
};
--- 1.72/sql/ha_heap.cc 2005-07-23 06:47:34 +10:00
+++ 1.73/sql/ha_heap.cc 2005-09-29 16:08:18 +10:00
@@ -40,6 +40,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};
--- 1.153/sql/ha_myisam.cc 2005-07-25 18:30:25 +10:00
+++ 1.154/sql/ha_myisam.cc 2005-09-29 16:08:18 +10:00
@@ -63,6 +63,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
/*
MyISAM doesn't support transactions and doesn't have
transaction-dependent context: cursors can survive a commit.
--- 1.67/sql/ha_myisammrg.cc 2005-07-25 18:30:25 +10:00
+++ 1.68/sql/ha_myisammrg.cc 2005-09-29 16:08:18 +10:00
@@ -51,6 +51,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};
--- 1.145/sql/handler.h 2005-09-17 01:44:30 +10:00
+++ 1.146/sql/handler.h 2005-09-29 16:08:18 +10:00
@@ -373,6 +373,7 @@
void *(*create_cursor_read_view)();
void (*set_cursor_read_view)(void *);
void (*close_cursor_read_view)(void *);
+ int (*fill_schema_tablespaces)(THD *thd, struct st_table_list *tables, class Item
*cond);
uint32 flags; /* global handler flags */
} handlerton;
--- 1.302/sql/mysql_priv.h 2005-09-17 01:06:43 +10:00
+++ 1.303/sql/mysql_priv.h 2005-09-29 16:08:19 +10:00
@@ -877,10 +877,13 @@
int make_schema_select(THD *thd, SELECT_LEX *sel,
enum enum_schema_tables schema_table_idx);
int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
+bool schema_table_store_record(THD *thd, TABLE *table);
int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
+int fill_schema_tablespaces(THD *thd, TABLE_LIST *tables, COND *cond);
+int fill_schema_datafiles(THD *thd, TABLE_LIST *tables, COND *cond);
bool get_schema_tables_result(JOIN *join);
#define is_schema_db(X) \
!my_strcasecmp(system_charset_info, information_schema_name.str, (X))
--- 1.270/sql/sql_show.cc 2005-09-16 14:52:32 +10:00
+++ 1.271/sql/sql_show.cc 2005-09-29 16:08:19 +10:00
@@ -43,7 +43,6 @@
store_create_info(THD *thd, TABLE_LIST *table_list, String *packet);
static int
view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
-static bool schema_table_store_record(THD *thd, TABLE *table);
/***************************************************************************
@@ -1737,7 +1736,7 @@
1 error
*/
-static bool schema_table_store_record(THD *thd, TABLE *table)
+bool schema_table_store_record(THD *thd, TABLE *table)
{
int error;
if ((error= table->file->write_row(table->record[0])))
@@ -3797,6 +3796,29 @@
DBUG_RETURN(result);
}
+extern handlerton *handlertons[];
+extern ulong total_ha;
+
+int fill_schema_tablespaces(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ int i;
+ TABLE *table= tables->table;
+ DBUG_ENTER("fill_schema_tablespaces");
+
+ for(i=0;i<total_ha;i++)
+ if(handlertons[i]->fill_schema_tablespaces)
+ handlertons[i]->fill_schema_tablespaces(thd,tables,cond);
+
+ DBUG_RETURN(0);
+}
+
+int fill_schema_datafiles(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ DBUG_ENTER("fill_schema_datafiles");
+
+ DBUG_RETURN(0);
+}
+
ST_FIELD_INFO schema_fields_info[]=
{
@@ -4079,6 +4101,26 @@
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
+ST_FIELD_INFO tablespaces_fields_info[]=
+{
+ {"NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"VERSION", 1, MYSQL_TYPE_LONG, 0, 0, 0},
+ {"EXTENT_SIZE", 1, MYSQL_TYPE_LONG, 0, 0, 0},
+ {"DEFAULT_LOGFILE_GROUP", 1, MYSQL_TYPE_LONG, 0, 0, 0},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+ST_FIELD_INFO datafiles_fields_info[]=
+{
+ {"NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"SIZE", 1, MYSQL_TYPE_LONG, 0, 0, 0},
+ {"FREE", 1, MYSQL_TYPE_LONG, 0, 0, 0},
+ {"TABLESPACE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
/*
Description of ST_FIELD_INFO in table.h
@@ -4126,6 +4168,10 @@
get_all_tables, 0, get_schema_views_record, 1, 2, 0},
{"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table,
fill_schema_user_privileges, 0, 0, -1, -1, 0},
+ {"TABLESPACES", tablespaces_fields_info, create_schema_table,
+ fill_schema_tablespaces, 0, 0, -1, -1, 0},
+ {"DATAFILES", datafiles_fields_info, create_schema_table,
+ fill_schema_datafiles, 0, 0, -1, -1, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0}
};
--- 1.18/sql/ha_blackhole.cc 2005-08-31 15:23:03 +10:00
+++ 1.19/sql/ha_blackhole.cc 2005-09-29 16:08:17 +10:00
@@ -43,6 +43,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};
--- 1.151/sql/ha_ndbcluster.cc 2005-09-17 01:44:30 +10:00
+++ 1.152/sql/ha_ndbcluster.cc 2005-09-29 16:08:18 +10:00
@@ -51,6 +51,7 @@
static int ndbcluster_close_connection(THD *thd);
static int ndbcluster_commit(THD *thd, bool all);
static int ndbcluster_rollback(THD *thd, bool all);
+static int ndbcluster_fill_schema_tablespaces(THD *thd, TABLE_LIST *tables, COND *cond);
static handlerton ndbcluster_hton = {
"ndbcluster",
@@ -69,6 +70,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ ndbcluster_fill_schema_tablespaces,
HTON_NO_FLAGS
};
@@ -7886,4 +7888,29 @@
return COMPATIBLE_DATA_YES;
}
+
+static int ndbcluster_fill_schema_tablespaces(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ TABLE* table= tables->table;
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ Ndb *ndb= thd_ndb->ndb;
+ NdbDictionary::Dictionary* dict= ndb->getDictionary();
+ NdbDictionary::Dictionary::List tslist;
+
+ dict->listObjects(tslist,NdbDictionary::Object::Tablespace);
+
+ for(unsigned i= 0;i < tslist.count;i++)
+ {
+ NdbDictionary::Dictionary::List::Element& elt = tslist.elements[i];
+ NdbDictionary::Tablespace ts= dict->getTablespace(elt.name);
+
+ table->field[0]->store(elt.name,strlen(elt.name),system_charset_info);
+ table->field[1]->store("NDB",3,system_charset_info);
+ table->field[2]->store(ts.getObjectVersion());
+ table->field[3]->store(ts.getExtentSize());
+ table->field[4]->store(0);
+
+ schema_table_store_record(thd, table);
+ }
+}
#endif /* HAVE_NDBCLUSTER_DB */
--- 1.217/sql/ha_innodb.cc 2005-09-09 21:45:39 +10:00
+++ 1.218/sql/ha_innodb.cc 2005-09-29 16:08:18 +10:00
@@ -223,6 +223,7 @@
innobase_create_cursor_view,
innobase_set_cursor_view,
innobase_close_cursor_view,
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};
--- 1.4/sql/ha_partition.cc 2005-09-20 13:32:03 +10:00
+++ 1.5/sql/ha_partition.cc 2005-09-29 16:08:18 +10:00
@@ -84,6 +84,7 @@
NULL,
NULL,
NULL,
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};
--- 1.31/sql/ha_federated.cc 2005-09-17 01:06:43 +10:00
+++ 1.32/sql/ha_federated.cc 2005-09-29 16:08:18 +10:00
@@ -710,6 +710,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
+ NULL, /* fill_schema_tablespaces */
HTON_NO_FLAGS
};