MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:February 7 2010 4:45pm
Subject:bzr commit into mysql-5.1-telco-6.2 branch (pekka:3074) Bug#31782
View as plain text  
#At file:///export/space/pekka/ms/ms-bug49709-62/ based on revid:pekka@stripped

 3074 Pekka Nousiainen	2010-02-07
      bug#31782 02_bug31782.diff
      In information_schema.files return extra row for tablespace itself.
      It has file_type TABLESPACE (not DATAFILE) to avoid breaking mysqldump
      and old user scripts.  Uses old patch attached to the bug#.

    modified:
      mysql-test/suite/ndb/r/ndb_dd_basic.result
      mysql-test/suite/ndb/t/ndb_dd_basic.test
      sql/ha_ndbcluster.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_dd_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_dd_basic.result	2010-02-07 16:35:44 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_basic.result	2010-02-07 16:45:15 +0000
@@ -578,3 +578,35 @@ drop tablespace ts1
 engine ndb;
 drop logfile group lg1
 engine ndb;
+=== bug#31782 ===
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 2M
+undo_buffer_size 1M
+engine ndb;
+create tablespace ts1
+add datafile 'datafile.dat'
+use logfile group lg1
+initial_size 2M
+extent_size 2M
+engine ndb;
+select distinct tablespace_name, file_type, file_name
+from information_schema.files
+where tablespace_name is not null
+order by file_type, file_name;
+tablespace_name	file_type	file_name
+ts1	DATAFILE	datafile.dat
+ts1	TABLESPACE	NULL
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine ndb;
+select distinct tablespace_name, file_type, file_name
+from information_schema.files
+where tablespace_name is not null
+order by file_type, file_name;
+tablespace_name	file_type	file_name
+ts1	TABLESPACE	NULL
+drop tablespace ts1
+engine ndb;
+drop logfile group lg1
+engine ndb;

=== modified file 'mysql-test/suite/ndb/t/ndb_dd_basic.test'
--- a/mysql-test/suite/ndb/t/ndb_dd_basic.test	2010-02-07 16:35:44 +0000
+++ b/mysql-test/suite/ndb/t/ndb_dd_basic.test	2010-02-07 16:45:15 +0000
@@ -532,4 +532,40 @@ engine ndb;
 drop logfile group lg1
 engine ndb;
 
+# bug#31782 - tablespace with no files
+--echo === bug#31782 ===
+
+create logfile group lg1
+add undofile 'undofile.dat'
+initial_size 2M
+undo_buffer_size 1M
+engine ndb;
+
+create tablespace ts1
+add datafile 'datafile.dat'
+use logfile group lg1
+initial_size 2M
+extent_size 2M
+engine ndb;
+
+select distinct tablespace_name, file_type, file_name
+from information_schema.files
+where tablespace_name is not null
+order by file_type, file_name;
+
+alter tablespace ts1
+drop datafile 'datafile.dat'
+engine ndb;
+
+select distinct tablespace_name, file_type, file_name
+from information_schema.files
+where tablespace_name is not null
+order by file_type, file_name;
+
+drop tablespace ts1
+engine ndb;
+
+drop logfile group lg1
+engine ndb;
+
 #End 5.1 test case

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-12-18 14:08:49 +0000
+++ b/sql/ha_ndbcluster.cc	2010-02-07 16:45:15 +0000
@@ -11509,6 +11509,54 @@ static int ndbcluster_fill_files_table(h
     }
   }
 
+  NdbDictionary::Dictionary::List tslist;
+  dict->listObjects(tslist, NdbDictionary::Object::Tablespace);
+  ndberr= dict->getNdbError();
+  if (ndberr.classification != NdbError::NoError)
+    ERR_RETURN(ndberr);
+
+  for (i= 0; i < tslist.count; i++)
+  {
+    NdbDictionary::Dictionary::List::Element&elt= tslist.elements[i];
+
+    NdbDictionary::Tablespace ts= dict->getTablespace(elt.name);
+    ndberr= dict->getNdbError();
+    if (ndberr.classification != NdbError::NoError)
+    {
+      if (ndberr.classification == NdbError::SchemaError)
+        continue;
+      ERR_RETURN(ndberr);
+    }
+
+    init_fill_schema_files_row(table);
+    table->field[IS_FILES_FILE_TYPE]->set_notnull();
+    table->field[IS_FILES_FILE_TYPE]->store("TABLESPACE", 10,
+                                            system_charset_info);
+
+    table->field[IS_FILES_TABLESPACE_NAME]->set_notnull();
+    table->field[IS_FILES_TABLESPACE_NAME]->store(elt.name,
+                                                     strlen(elt.name),
+                                                     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_EXTENT_SIZE]->set_notnull();
+    table->field[IS_FILES_EXTENT_SIZE]->store(ts.getExtentSize());
+
+    table->field[IS_FILES_VERSION]->set_notnull();
+    table->field[IS_FILES_VERSION]->store(ts.getObjectVersion());
+
+    schema_table_store_record(thd, table);
+  }
+
   NdbDictionary::Dictionary::List uflist;
   dict->listObjects(uflist, NdbDictionary::Object::Undofile);
   ndberr= dict->getNdbError();


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20100207164515-zujrnbyc0s65ji1b.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (pekka:3074) Bug#31782Pekka Nousiainen7 Feb