Commit 4de3c4bf authored by stewart@willster.(none)'s avatar stewart@willster.(none)

Merge willster.(none):/home/stewart/Documents/MySQL/5.1/ndb

into  willster.(none):/home/stewart/Documents/MySQL/5.1/ndb-is_files_refactor
parents 8353d3e6 163f272d
...@@ -10491,7 +10491,7 @@ static int ndbcluster_fill_files_table(handlerton *hton, ...@@ -10491,7 +10491,7 @@ static int ndbcluster_fill_files_table(handlerton *hton,
while ((id= g_ndb_cluster_connection->get_next_node(iter))) while ((id= g_ndb_cluster_connection->get_next_node(iter)))
{ {
uint c= 0; init_fill_schema_files_row(table);
NdbDictionary::Datafile df= dict->getDatafile(id, elt.name); NdbDictionary::Datafile df= dict->getDatafile(id, elt.name);
ndberr= dict->getNdbError(); ndberr= dict->getNdbError();
if(ndberr.classification != NdbError::NoError) if(ndberr.classification != NdbError::NoError)
...@@ -10509,76 +10509,48 @@ static int ndbcluster_fill_files_table(handlerton *hton, ...@@ -10509,76 +10509,48 @@ static int ndbcluster_fill_files_table(handlerton *hton,
ERR_RETURN(ndberr); ERR_RETURN(ndberr);
} }
table->field[c++]->set_null(); // FILE_ID table->field[IS_FILES_FILE_NAME]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_FILE_NAME]->store(elt.name, strlen(elt.name),
table->field[c++]->store(elt.name, strlen(elt.name), system_charset_info);
system_charset_info); table->field[IS_FILES_FILE_TYPE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_FILE_TYPE]->store("DATAFILE",8,
table->field[c++]->store("DATAFILE",8,system_charset_info); system_charset_info);
table->field[c]->set_notnull(); table->field[IS_FILES_TABLESPACE_NAME]->set_notnull();
table->field[c++]->store(df.getTablespace(), strlen(df.getTablespace()), table->field[IS_FILES_TABLESPACE_NAME]->store(df.getTablespace(),
system_charset_info); strlen(df.getTablespace()),
table->field[c++]->set_null(); // TABLE_CATALOG system_charset_info);
table->field[c++]->set_null(); // TABLE_SCHEMA table->field[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
table->field[c++]->set_null(); // TABLE_NAME table->field[IS_FILES_LOGFILE_GROUP_NAME]->
store(ts.getDefaultLogfileGroup(),
// LOGFILE_GROUP_NAME strlen(ts.getDefaultLogfileGroup()),
table->field[c]->set_notnull(); system_charset_info);
table->field[c++]->store(ts.getDefaultLogfileGroup(), table->field[IS_FILES_ENGINE]->set_notnull();
strlen(ts.getDefaultLogfileGroup()), table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
system_charset_info); ndbcluster_hton_name_length,
table->field[c++]->set_null(); // LOGFILE_GROUP_NUMBER system_charset_info);
table->field[c]->set_notnull();
table->field[c++]->store(ndbcluster_hton_name, table->field[IS_FILES_FREE_EXTENTS]->set_notnull();
ndbcluster_hton_name_length, table->field[IS_FILES_FREE_EXTENTS]->store(df.getFree()
system_charset_info); // ENGINE / ts.getExtentSize());
table->field[IS_FILES_TOTAL_EXTENTS]->set_notnull();
table->field[c++]->set_null(); // FULLTEXT_KEYS table->field[IS_FILES_TOTAL_EXTENTS]->store(df.getSize()
table->field[c++]->set_null(); // DELETED_ROWS / ts.getExtentSize());
table->field[c++]->set_null(); // UPDATE_COUNT table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_EXTENT_SIZE]->store(ts.getExtentSize());
table->field[c++]->store(df.getFree() / ts.getExtentSize()); // FREE_EXTENTS table->field[IS_FILES_INITIAL_SIZE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_INITIAL_SIZE]->store(df.getSize());
table->field[c++]->store(df.getSize() / ts.getExtentSize()); // TOTAL_EXTENTS table->field[IS_FILES_MAXIMUM_SIZE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_MAXIMUM_SIZE]->store(df.getSize());
table->field[c++]->store(ts.getExtentSize()); // EXTENT_SIZE table->field[IS_FILES_VERSION]->set_notnull();
table->field[IS_FILES_VERSION]->store(df.getObjectVersion());
table->field[c]->set_notnull();
table->field[c++]->store(df.getSize()); // INITIAL_SIZE table->field[IS_FILES_ROW_FORMAT]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_ROW_FORMAT]->store("FIXED", 5, system_charset_info);
table->field[c++]->store(df.getSize()); // MAXIMUM_SIZE
table->field[c++]->set_null(); // AUTOEXTEND_SIZE
table->field[c++]->set_null(); // CREATION_TIME
table->field[c++]->set_null(); // LAST_UPDATE_TIME
table->field[c++]->set_null(); // LAST_ACCESS_TIME
table->field[c++]->set_null(); // RECOVER_TIME
table->field[c++]->set_null(); // TRANSACTION_COUNTER
table->field[c]->set_notnull();
table->field[c++]->store(df.getObjectVersion()); // VERSION
table->field[c]->set_notnull();
table->field[c++]->store("FIXED", 5, system_charset_info); // ROW_FORMAT
table->field[c++]->set_null(); // TABLE_ROWS
table->field[c++]->set_null(); // AVG_ROW_LENGTH
table->field[c++]->set_null(); // DATA_LENGTH
table->field[c++]->set_null(); // MAX_DATA_LENGTH
table->field[c++]->set_null(); // INDEX_LENGTH
table->field[c++]->set_null(); // DATA_FREE
table->field[c++]->set_null(); // CREATE_TIME
table->field[c++]->set_null(); // UPDATE_TIME
table->field[c++]->set_null(); // CHECK_TIME
table->field[c++]->set_null(); // CHECKSUM
table->field[c]->set_notnull();
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[30]; char extra[30];
int len= my_snprintf(extra, sizeof(extra), "CLUSTER_NODE=%u", id); int len= my_snprintf(extra, sizeof(extra), "CLUSTER_NODE=%u", id);
table->field[c]->store(extra, len, system_charset_info); table->field[IS_FILES_EXTRA]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table); schema_table_store_record(thd, table);
} }
} }
...@@ -10617,76 +10589,43 @@ static int ndbcluster_fill_files_table(handlerton *hton, ...@@ -10617,76 +10589,43 @@ static int ndbcluster_fill_files_table(handlerton *hton,
ERR_RETURN(ndberr); ERR_RETURN(ndberr);
} }
int c= 0; init_fill_schema_files_row(table);
table->field[c++]->set_null(); // FILE_ID table->field[IS_FILES_FILE_NAME]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_FILE_NAME]->store(elt.name, strlen(elt.name),
table->field[c++]->store(elt.name, strlen(elt.name), system_charset_info);
system_charset_info); table->field[IS_FILES_FILE_TYPE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_FILE_TYPE]->store("UNDO LOG", 8,
table->field[c++]->store("UNDO LOG", 8, system_charset_info); system_charset_info);
table->field[c++]->set_null(); // TABLESPACE NAME
table->field[c++]->set_null(); // TABLE_CATALOG
table->field[c++]->set_null(); // TABLE_SCHEMA
table->field[c++]->set_null(); // TABLE_NAME
// LOGFILE_GROUP_NAME
NdbDictionary::ObjectId objid; NdbDictionary::ObjectId objid;
uf.getLogfileGroupId(&objid); uf.getLogfileGroupId(&objid);
table->field[c]->set_notnull(); table->field[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
table->field[c++]->store(uf.getLogfileGroup(), table->field[IS_FILES_LOGFILE_GROUP_NAME]->store(uf.getLogfileGroup(),
strlen(uf.getLogfileGroup()), strlen(uf.getLogfileGroup()),
system_charset_info); system_charset_info);
table->field[c]->set_notnull(); table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->set_notnull();
table->field[c++]->store(objid.getObjectId()); // LOGFILE_GROUP_NUMBER table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->store(objid.getObjectId());
table->field[c]->set_notnull(); table->field[IS_FILES_ENGINE]->set_notnull();
table->field[c++]->store(ndbcluster_hton_name, table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
ndbcluster_hton_name_length, ndbcluster_hton_name_length,
system_charset_info); // ENGINE system_charset_info);
table->field[c++]->set_null(); // FULLTEXT_KEYS table->field[IS_FILES_TOTAL_EXTENTS]->set_notnull();
table->field[c++]->set_null(); // DELETED_ROWS table->field[IS_FILES_TOTAL_EXTENTS]->store(uf.getSize()/4);
table->field[c++]->set_null(); // UPDATE_COUNT table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
table->field[c++]->set_null(); // FREE_EXTENTS table->field[IS_FILES_EXTENT_SIZE]->store(4);
table->field[c]->set_notnull();
table->field[c++]->store(uf.getSize()/4); // TOTAL_EXTENTS table->field[IS_FILES_INITIAL_SIZE]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_INITIAL_SIZE]->store(uf.getSize());
table->field[c++]->store(4); // EXTENT_SIZE table->field[IS_FILES_MAXIMUM_SIZE]->set_notnull();
table->field[IS_FILES_MAXIMUM_SIZE]->store(uf.getSize());
table->field[c]->set_notnull();
table->field[c++]->store(uf.getSize()); // INITIAL_SIZE table->field[IS_FILES_VERSION]->set_notnull();
table->field[c]->set_notnull(); table->field[IS_FILES_VERSION]->store(uf.getObjectVersion());
table->field[c++]->store(uf.getSize()); // MAXIMUM_SIZE
table->field[c++]->set_null(); // AUTOEXTEND_SIZE
table->field[c++]->set_null(); // CREATION_TIME
table->field[c++]->set_null(); // LAST_UPDATE_TIME
table->field[c++]->set_null(); // LAST_ACCESS_TIME
table->field[c++]->set_null(); // RECOVER_TIME
table->field[c++]->set_null(); // TRANSACTION_COUNTER
table->field[c]->set_notnull();
table->field[c++]->store(uf.getObjectVersion()); // VERSION
table->field[c++]->set_null(); // ROW FORMAT
table->field[c++]->set_null(); // TABLE_ROWS
table->field[c++]->set_null(); // AVG_ROW_LENGTH
table->field[c++]->set_null(); // DATA_LENGTH
table->field[c++]->set_null(); // MAX_DATA_LENGTH
table->field[c++]->set_null(); // INDEX_LENGTH
table->field[c++]->set_null(); // DATA_FREE
table->field[c++]->set_null(); // CREATE_TIME
table->field[c++]->set_null(); // UPDATE_TIME
table->field[c++]->set_null(); // CHECK_TIME
table->field[c++]->set_null(); // CHECKSUM
table->field[c]->set_notnull();
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[100]; char extra[100];
int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize()); int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
table->field[c]->set_notnull(); table->field[IS_FILES_EXTRA]->set_notnull();
table->field[c]->store(extra, len, system_charset_info); table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table); schema_table_store_record(thd, table);
} }
} }
...@@ -10712,69 +10651,36 @@ static int ndbcluster_fill_files_table(handlerton *hton, ...@@ -10712,69 +10651,36 @@ static int ndbcluster_fill_files_table(handlerton *hton,
ERR_RETURN(ndberr); ERR_RETURN(ndberr);
} }
int c= 0; init_fill_schema_files_row(table);
table->field[c++]->set_null(); // FILE_ID table->field[IS_FILES_FILE_TYPE]->set_notnull();
table->field[c++]->set_null(); // name table->field[IS_FILES_FILE_TYPE]->store("UNDO LOG", 8,
table->field[c]->set_notnull(); system_charset_info);
table->field[c++]->store("UNDO LOG", 8, system_charset_info);
table->field[c++]->set_null(); // TABLESPACE NAME table->field[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
table->field[c++]->set_null(); // TABLE_CATALOG table->field[IS_FILES_LOGFILE_GROUP_NAME]->store(elt.name,
table->field[c++]->set_null(); // TABLE_SCHEMA strlen(elt.name),
table->field[c++]->set_null(); // TABLE_NAME system_charset_info);
table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->set_notnull();
// LOGFILE_GROUP_NAME table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->store(lfg.getObjectId());
table->field[c]->set_notnull(); table->field[IS_FILES_ENGINE]->set_notnull();
table->field[c++]->store(elt.name, strlen(elt.name), table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
system_charset_info); ndbcluster_hton_name_length,
table->field[c]->set_notnull(); system_charset_info);
table->field[c++]->store(lfg.getObjectId()); // LOGFILE_GROUP_NUMBER
table->field[c]->set_notnull(); table->field[IS_FILES_FREE_EXTENTS]->set_notnull();
table->field[c++]->store(ndbcluster_hton_name, table->field[IS_FILES_FREE_EXTENTS]->store(lfg.getUndoFreeWords());
ndbcluster_hton_name_length, table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
system_charset_info); // ENGINE table->field[IS_FILES_EXTENT_SIZE]->store(4);
table->field[c++]->set_null(); // FULLTEXT_KEYS table->field[IS_FILES_VERSION]->set_notnull();
table->field[c++]->set_null(); // DELETED_ROWS table->field[IS_FILES_VERSION]->store(lfg.getObjectVersion());
table->field[c++]->set_null(); // UPDATE_COUNT
table->field[c]->set_notnull();
table->field[c++]->store(lfg.getUndoFreeWords()); // FREE_EXTENTS
table->field[c++]->set_null(); //store(uf.getSize()/4); // TOTAL_EXTENTS
table->field[c]->set_notnull();
table->field[c++]->store(4); // EXTENT_SIZE
table->field[c++]->set_null();//store(uf.getSize()); // INITIAL_SIZE
table->field[c++]->set_null(); //store(uf.getSize()); // MAXIMUM_SIZE
table->field[c++]->set_null(); // AUTOEXTEND_SIZE
table->field[c++]->set_null(); // CREATION_TIME
table->field[c++]->set_null(); // LAST_UPDATE_TIME
table->field[c++]->set_null(); // LAST_ACCESS_TIME
table->field[c++]->set_null(); // RECOVER_TIME
table->field[c++]->set_null(); // TRANSACTION_COUNTER
table->field[c]->set_notnull();
table->field[c++]->store(lfg.getObjectVersion()); // VERSION
table->field[c++]->set_null(); // ROW FORMAT
table->field[c++]->set_null(); // TABLE_ROWS
table->field[c++]->set_null(); // AVG_ROW_LENGTH
table->field[c++]->set_null(); // DATA_LENGTH
table->field[c++]->set_null(); // MAX_DATA_LENGTH
table->field[c++]->set_null(); // INDEX_LENGTH
table->field[c++]->set_null(); // DATA_FREE
table->field[c++]->set_null(); // CREATE_TIME
table->field[c++]->set_null(); // UPDATE_TIME
table->field[c++]->set_null(); // CHECK_TIME
table->field[c++]->set_null(); // CHECKSUM
table->field[c]->set_notnull();
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[100]; char extra[100];
int len= my_snprintf(extra,sizeof(extra),"UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize()); int len= my_snprintf(extra,sizeof(extra),
table->field[c]->set_notnull(); "UNDO_BUFFER_SIZE=%lu",
table->field[c]->store(extra, len, system_charset_info); lfg.getUndoBufferSize());
table->field[IS_FILES_EXTRA]->set_notnull();
table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table); schema_table_store_record(thd, table);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -2007,6 +2007,45 @@ inline void kill_delayed_threads(void) {} ...@@ -2007,6 +2007,45 @@ inline void kill_delayed_threads(void) {}
#endif #endif
/* Used by handlers to store things in schema tables */ /* Used by handlers to store things in schema tables */
#define IS_FILES_FILE_ID 0
#define IS_FILES_FILE_NAME 1
#define IS_FILES_FILE_TYPE 2
#define IS_FILES_TABLESPACE_NAME 3
#define IS_FILES_TABLE_CATALOG 4
#define IS_FILES_TABLE_SCHEMA 5
#define IS_FILES_TABLE_NAME 6
#define IS_FILES_LOGFILE_GROUP_NAME 7
#define IS_FILES_LOGFILE_GROUP_NUMBER 8
#define IS_FILES_ENGINE 9
#define IS_FILES_FULLTEXT_KEYS 10
#define IS_FILES_DELETED_ROWS 11
#define IS_FILES_UPDATE_COUNT 12
#define IS_FILES_FREE_EXTENTS 13
#define IS_FILES_TOTAL_EXTENTS 14
#define IS_FILES_EXTENT_SIZE 15
#define IS_FILES_INITIAL_SIZE 16
#define IS_FILES_MAXIMUM_SIZE 17
#define IS_FILES_AUTOEXTEND_SIZE 18
#define IS_FILES_CREATION_TIME 19
#define IS_FILES_LAST_UPDATE_TIME 20
#define IS_FILES_LAST_ACCESS_TIME 21
#define IS_FILES_RECOVER_TIME 22
#define IS_FILES_TRANSACTION_COUNTER 23
#define IS_FILES_VERSION 24
#define IS_FILES_ROW_FORMAT 25
#define IS_FILES_TABLE_ROWS 26
#define IS_FILES_AVG_ROW_LENGTH 27
#define IS_FILES_DATA_LENGTH 28
#define IS_FILES_MAX_DATA_LENGTH 29
#define IS_FILES_INDEX_LENGTH 30
#define IS_FILES_DATA_FREE 31
#define IS_FILES_CREATE_TIME 32
#define IS_FILES_UPDATE_TIME 33
#define IS_FILES_CHECK_TIME 34
#define IS_FILES_CHECKSUM 35
#define IS_FILES_STATUS 36
#define IS_FILES_EXTRA 37
void init_fill_schema_files_row(TABLE* table);
bool schema_table_store_record(THD *thd, TABLE *table); bool schema_table_store_record(THD *thd, TABLE *table);
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
......
...@@ -5642,6 +5642,16 @@ ST_FIELD_INFO files_fields_info[]= ...@@ -5642,6 +5642,16 @@ ST_FIELD_INFO files_fields_info[]=
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
}; };
void init_fill_schema_files_row(TABLE* table)
{
int i;
for(i=0; files_fields_info[i].field_name!=NULL; i++)
table->field[i]->set_null();
table->field[IS_FILES_STATUS]->set_notnull();
table->field[IS_FILES_STATUS]->store("NORMAL", 6, system_charset_info);
}
ST_FIELD_INFO referential_constraints_fields_info[]= ST_FIELD_INFO referential_constraints_fields_info[]=
{ {
{"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0}, {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment