List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:October 5 2006 4:39pm
Subject:bk commit into 5.1 tree (stewart:1.2300) BUG#23013
View as plain text  
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@stripped, 2006-10-06 00:39:22+10:00, stewart@willster.(none) +3 -0
  BUG#23013 make INFORMATION_SCHEMA.FILES easily usable by other engines

  sql/ha_ndbcluster.cc@stripped, 2006-10-06 00:39:17+10:00, stewart@willster.(none) +97 -191
    update fill_files_table to match new way of doing things

  sql/mysql_priv.h@stripped, 2006-10-06 00:39:18+10:00, stewart@willster.(none) +39 -0
    defines for INFORMATION_SCHEMA.FILES column numbers
    add init_fill_schema_files_row()

  sql/sql_show.cc@stripped, 2006-10-06 00:39:18+10:00, stewart@willster.(none) +10 -0
    add init_fill_schema_files_row(TABLE*) to help engines with filling schema files.

# 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-is_files_refactor

--- 1.437/sql/mysql_priv.h	2006-10-06 00:39:28 +10:00
+++ 1.438/sql/mysql_priv.h	2006-10-06 00:39:28 +10:00
@@ -2033,6 +2033,45 @@
 #endif
 
 /* 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);
 
 #endif /* MYSQL_SERVER */

--- 1.361/sql/sql_show.cc	2006-10-06 00:39:28 +10:00
+++ 1.362/sql/sql_show.cc	2006-10-06 00:39:28 +10:00
@@ -5418,6 +5418,16 @@
   {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[]=
 {
   {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},

--- 1.356/sql/ha_ndbcluster.cc	2006-10-06 00:39:28 +10:00
+++ 1.357/sql/ha_ndbcluster.cc	2006-10-06 00:39:28 +10:00
@@ -10449,7 +10449,7 @@
 
     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);
       ndberr= dict->getNdbError();
       if(ndberr.classification != NdbError::NoError)
@@ -10467,76 +10467,48 @@
         ERR_RETURN(ndberr);
       }
 
-      table->field[c++]->set_null(); // FILE_ID
-      table->field[c]->set_notnull();
-      table->field[c++]->store(elt.name, strlen(elt.name),
-                               system_charset_info);
-      table->field[c]->set_notnull();
-      table->field[c++]->store("DATAFILE",8,system_charset_info);
-      table->field[c]->set_notnull();
-      table->field[c++]->store(df.getTablespace(), strlen(df.getTablespace()),
-                               system_charset_info);
-      table->field[c++]->set_null(); // TABLE_CATALOG
-      table->field[c++]->set_null(); // TABLE_SCHEMA
-      table->field[c++]->set_null(); // TABLE_NAME
-
-      // LOGFILE_GROUP_NAME
-      table->field[c]->set_notnull();
-      table->field[c++]->store(ts.getDefaultLogfileGroup(),
-                               strlen(ts.getDefaultLogfileGroup()),
-                               system_charset_info);
-      table->field[c++]->set_null(); // LOGFILE_GROUP_NUMBER
-      table->field[c]->set_notnull();
-      table->field[c++]->store(ndbcluster_hton_name,
-                               ndbcluster_hton_name_length,
-                               system_charset_info); // ENGINE
-
-      table->field[c++]->set_null(); // FULLTEXT_KEYS
-      table->field[c++]->set_null(); // DELETED_ROWS
-      table->field[c++]->set_null(); // UPDATE_COUNT
-      table->field[c]->set_notnull();
-      table->field[c++]->store(df.getFree() / ts.getExtentSize()); // FREE_EXTENTS
-      table->field[c]->set_notnull();
-      table->field[c++]->store(df.getSize() / ts.getExtentSize()); // TOTAL_EXTENTS
-      table->field[c]->set_notnull();
-      table->field[c++]->store(ts.getExtentSize()); // EXTENT_SIZE
-
-      table->field[c]->set_notnull();
-      table->field[c++]->store(df.getSize()); // INITIAL_SIZE
-      table->field[c]->set_notnull();
-      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[IS_FILES_FILE_NAME]->set_notnull();
+      table->field[IS_FILES_FILE_NAME]->store(elt.name, strlen(elt.name),
+                                              system_charset_info);
+      table->field[IS_FILES_FILE_TYPE]->set_notnull();
+      table->field[IS_FILES_FILE_TYPE]->store("DATAFILE",8,
+                                              system_charset_info);
+      table->field[IS_FILES_TABLESPACE_NAME]->set_notnull();
+      table->field[IS_FILES_TABLESPACE_NAME]->store(df.getTablespace(),
+                                                    strlen(df.getTablespace()),
+                                                    system_charset_info);
+      table->field[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
+      table->field[IS_FILES_LOGFILE_GROUP_NAME]->
+        store(ts.getDefaultLogfileGroup(),
+              strlen(ts.getDefaultLogfileGroup()),
+              system_charset_info);
+      table->field[IS_FILES_ENGINE]->set_notnull();
+      table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
+                                           ndbcluster_hton_name_length,
+                                           system_charset_info);
+
+      table->field[IS_FILES_FREE_EXTENTS]->set_notnull();
+      table->field[IS_FILES_FREE_EXTENTS]->store(df.getFree()
+                                                 / ts.getExtentSize());
+      table->field[IS_FILES_TOTAL_EXTENTS]->set_notnull();
+      table->field[IS_FILES_TOTAL_EXTENTS]->store(df.getSize()
+                                                  / ts.getExtentSize());
+      table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
+      table->field[IS_FILES_EXTENT_SIZE]->store(ts.getExtentSize());
+      table->field[IS_FILES_INITIAL_SIZE]->set_notnull();
+      table->field[IS_FILES_INITIAL_SIZE]->store(df.getSize());
+      table->field[IS_FILES_MAXIMUM_SIZE]->set_notnull();
+      table->field[IS_FILES_MAXIMUM_SIZE]->store(df.getSize());
+      table->field[IS_FILES_VERSION]->set_notnull();
+      table->field[IS_FILES_VERSION]->store(df.getObjectVersion());
 
-      table->field[c]->set_notnull();
-      table->field[c++]->store("NORMAL", 6, system_charset_info);
+      table->field[IS_FILES_ROW_FORMAT]->set_notnull();
+      table->field[IS_FILES_ROW_FORMAT]->store("FIXED", 5, system_charset_info);
 
       char extra[30];
       int len= my_snprintf(extra, sizeof(extra), "CLUSTER_NODE=%u", id);
-      table->field[c]->store(extra, len, system_charset_info);
-      table->field[c]->set_notnull();
+      table->field[IS_FILES_EXTRA]->set_notnull();
+      table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
       schema_table_store_record(thd, table);
     }
   }
@@ -10575,76 +10547,43 @@
         ERR_RETURN(ndberr);
       }
 
-      int c= 0;
-      table->field[c++]->set_null(); // FILE_ID
-      table->field[c]->set_notnull();
-      table->field[c++]->store(elt.name, strlen(elt.name),
-                               system_charset_info);
-      table->field[c]->set_notnull();
-      table->field[c++]->store("UNDO LOG", 8, 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
+      init_fill_schema_files_row(table);
+      table->field[IS_FILES_FILE_NAME]->set_notnull();
+      table->field[IS_FILES_FILE_NAME]->store(elt.name, strlen(elt.name),
+                                              system_charset_info);
+      table->field[IS_FILES_FILE_TYPE]->set_notnull();
+      table->field[IS_FILES_FILE_TYPE]->store("UNDO LOG", 8,
+                                              system_charset_info);
       NdbDictionary::ObjectId objid;
       uf.getLogfileGroupId(&objid);
-      table->field[c]->set_notnull();
-      table->field[c++]->store(uf.getLogfileGroup(),
-                               strlen(uf.getLogfileGroup()),
-                               system_charset_info);
-      table->field[c]->set_notnull();
-      table->field[c++]->store(objid.getObjectId()); // LOGFILE_GROUP_NUMBER
-      table->field[c]->set_notnull();
-      table->field[c++]->store(ndbcluster_hton_name,
-                               ndbcluster_hton_name_length,
-                               system_charset_info); // ENGINE
-
-      table->field[c++]->set_null(); // FULLTEXT_KEYS
-      table->field[c++]->set_null(); // DELETED_ROWS
-      table->field[c++]->set_null(); // UPDATE_COUNT
-      table->field[c++]->set_null(); // FREE_EXTENTS
-      table->field[c]->set_notnull();
-      table->field[c++]->store(uf.getSize()/4); // TOTAL_EXTENTS
-      table->field[c]->set_notnull();
-      table->field[c++]->store(4); // EXTENT_SIZE
-
-      table->field[c]->set_notnull();
-      table->field[c++]->store(uf.getSize()); // INITIAL_SIZE
-      table->field[c]->set_notnull();
-      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[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
+      table->field[IS_FILES_LOGFILE_GROUP_NAME]->store(uf.getLogfileGroup(),
+                                                  strlen(uf.getLogfileGroup()),
+                                                       system_charset_info);
+      table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->set_notnull();
+      table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->store(objid.getObjectId());
+      table->field[IS_FILES_ENGINE]->set_notnull();
+      table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
+                                           ndbcluster_hton_name_length,
+                                           system_charset_info);
+
+      table->field[IS_FILES_TOTAL_EXTENTS]->set_notnull();
+      table->field[IS_FILES_TOTAL_EXTENTS]->store(uf.getSize()/4);
+      table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
+      table->field[IS_FILES_EXTENT_SIZE]->store(4);
+
+      table->field[IS_FILES_INITIAL_SIZE]->set_notnull();
+      table->field[IS_FILES_INITIAL_SIZE]->store(uf.getSize());
+      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("NORMAL", 6, system_charset_info);
+      table->field[IS_FILES_VERSION]->set_notnull();
+      table->field[IS_FILES_VERSION]->store(uf.getObjectVersion());
 
       char extra[100];
       int len=
my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
-      table->field[c]->set_notnull();
-      table->field[c]->store(extra, len, system_charset_info);
+      table->field[IS_FILES_EXTRA]->set_notnull();
+      table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
       schema_table_store_record(thd, table);
     }
   }
@@ -10670,69 +10609,36 @@
       ERR_RETURN(ndberr);
     }
 
-    int c= 0;
-    table->field[c++]->set_null(); // FILE_ID
-    table->field[c++]->set_null(); // name
-    table->field[c]->set_notnull();
-    table->field[c++]->store("UNDO LOG", 8, 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
-    table->field[c]->set_notnull();
-    table->field[c++]->store(elt.name, strlen(elt.name),
-                             system_charset_info);
-    table->field[c]->set_notnull();
-    table->field[c++]->store(lfg.getObjectId()); // LOGFILE_GROUP_NUMBER
-    table->field[c]->set_notnull();
-    table->field[c++]->store(ndbcluster_hton_name,
-                             ndbcluster_hton_name_length,
-                             system_charset_info); // ENGINE
-
-    table->field[c++]->set_null(); // FULLTEXT_KEYS
-    table->field[c++]->set_null(); // DELETED_ROWS
-    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
+    init_fill_schema_files_row(table);
+    table->field[IS_FILES_FILE_TYPE]->set_notnull();
+    table->field[IS_FILES_FILE_TYPE]->store("UNDO LOG", 8,
+                                            system_charset_info);
+
+    table->field[IS_FILES_LOGFILE_GROUP_NAME]->set_notnull();
+    table->field[IS_FILES_LOGFILE_GROUP_NAME]->store(elt.name,
+                                                     strlen(elt.name),
+                                                     system_charset_info);
+    table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->set_notnull();
+    table->field[IS_FILES_LOGFILE_GROUP_NUMBER]->store(lfg.getObjectId());
+    table->field[IS_FILES_ENGINE]->set_notnull();
+    table->field[IS_FILES_ENGINE]->store(ndbcluster_hton_name,
+                                         ndbcluster_hton_name_length,
+                                         system_charset_info);
+
+    table->field[IS_FILES_FREE_EXTENTS]->set_notnull();
+    table->field[IS_FILES_FREE_EXTENTS]->store(lfg.getUndoFreeWords());
+    table->field[IS_FILES_EXTENT_SIZE]->set_notnull();
+    table->field[IS_FILES_EXTENT_SIZE]->store(4);
 
-    table->field[c]->set_notnull();
-    table->field[c++]->store("NORMAL", 6, system_charset_info);
+    table->field[IS_FILES_VERSION]->set_notnull();
+    table->field[IS_FILES_VERSION]->store(lfg.getObjectVersion());
 
     char extra[100];
-    int len=
my_snprintf(extra,sizeof(extra),"UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize());
-    table->field[c]->set_notnull();
-    table->field[c]->store(extra, len, system_charset_info);
+    int len= my_snprintf(extra,sizeof(extra),
+                         "UNDO_BUFFER_SIZE=%lu",
+                         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);
   }
   DBUG_RETURN(0);
Thread
bk commit into 5.1 tree (stewart:1.2300) BUG#23013Stewart Smith5 Oct