List:Internals« Previous MessageNext Message »
From:pekka Date:April 27 2005 6:16pm
Subject:bk commit into 5.1-ndb tree (pekka:1.1876)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1-ndb repository of pekka. When pekka 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

  ndb/test/src/NDBT_Test.cpp
    1.24 05/04/27 20:29:26 pekka@stripped +36 -1
    add disk option to test programs

  ndb/test/src/NDBT_Tables.cpp
    1.17 05/04/27 20:29:25 pekka@stripped +4 -4
    add disk option to test programs

  ndb/test/ndbapi/testPartitioning.cpp
    1.8 05/04/27 20:29:25 pekka@stripped +1 -1
    add disk option to test programs

  ndb/test/ndbapi/create_tab.cpp
    1.8 05/04/27 20:29:24 pekka@stripped +33 -8
    add disk option to test programs

  ndb/test/include/NDBT_Test.hpp
    1.12 05/04/27 20:29:24 pekka@stripped +5 -1
    add disk option to test programs

  ndb/test/include/NDBT_Tables.hpp
    1.4 05/04/27 20:29:24 pekka@stripped +4 -2
    add disk option to test programs

ChangeSet
  1.1876 05/04/27 20:16:35 pekka@stripped +6 -0
  ndb - wl#1870 test

# 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:	pekka
# Host:	tuna.ndb.mysql.com
# Root:	/orca/space/pekka/ndb/version/my51-dd

--- 1.7/ndb/test/ndbapi/testPartitioning.cpp	2005-04-08 11:47:41 +02:00
+++ 1.8/ndb/test/ndbapi/testPartitioning.cpp	2005-04-27 20:29:25 +02:00
@@ -35,7 +35,7 @@
 
 static
 int
-add_distribution_key(Ndb*, NdbDictionary::Table& tab, int when)
+add_distribution_key(Ndb*, NdbDictionary::Table& tab, int when, void* arg)
 {
   switch(when){
   case 0: // Before

--- 1.3/ndb/test/include/NDBT_Tables.hpp	2004-11-07 19:36:35 +01:00
+++ 1.4/ndb/test/include/NDBT_Tables.hpp	2005-04-27 20:29:24 +02:00
@@ -23,13 +23,15 @@
 #include <NdbDictionary.hpp>
 #include <NDBT_Table.hpp>
 
-typedef int (* NDBT_CreateTableHook)(Ndb*, NdbDictionary::Table&, int when);
+typedef int (* NDBT_CreateTableHook)(Ndb*, NdbDictionary::Table&, int when,
+                                    void* arg);
 
 class NDBT_Tables {
 public:
 
   static int createTable(Ndb* pNdb, const char* _name, bool _temp = false, 
-			 bool existsOK = false, NDBT_CreateTableHook = 0);
+			 bool existsOK = false, NDBT_CreateTableHook = 0,
+                         void* arg = 0);
   static int createAllTables(Ndb* pNdb, bool _temp, bool existsOK = false);
   static int createAllTables(Ndb* pNdb);
 

--- 1.11/ndb/test/include/NDBT_Test.hpp	2005-02-03 16:53:55 +01:00
+++ 1.12/ndb/test/include/NDBT_Test.hpp	2005-04-27 20:29:24 +02:00
@@ -349,8 +349,10 @@
   // Returns true if timing info should be printed
   bool timerIsOn();
 
-
   int addTest(NDBT_TestCase* pTest);
+
+  // Table create tweaks
+  int createHook(Ndb*, NdbDictionary::Table&, int when);
 private:
   int executeOne(Ndb_cluster_connection&,
 		 const char* _tabname, const char* testname = NULL);
@@ -373,6 +375,8 @@
   int timer;
   NdbTimer testSuiteTimer;
   bool createTable;
+  bool diskbased;
+  const char* tsname;
 };
 
 

--- 1.7/ndb/test/ndbapi/create_tab.cpp	2004-12-29 16:01:40 +01:00
+++ 1.8/ndb/test/ndbapi/create_tab.cpp	2005-04-27 20:29:24 +02:00
@@ -22,7 +22,27 @@
 
 #include <getarg.h>
 
+static int g_diskbased = 0;
+static const char* g_tsname = 0;
 
+static int
+g_create_hook(Ndb* ndb, NdbDictionary::Table& tab, int when, void* arg)
+{
+  if (when == 0) {
+    if (g_diskbased) {
+      for (int i = 0; i < tab.getNoOfColumns(); i++) {
+        NdbDictionary::Column* col = tab.getColumn(i);
+        if (! col->getPrimaryKey()) {
+          col->setStorageType(NdbDictionary::Column::StorageTypeDisk);
+        }
+      }
+    }
+    if (g_tsname != NULL) {
+      tab.setTablespace(g_tsname);
+    }
+  }
+  return 0;
+}
 
 int main(int argc, const char** argv){
   ndb_init();
@@ -32,13 +52,16 @@
   int _all = 0;
   int _print = 0;
   const char* _connectstr = NULL;
+  int _diskbased = 0;
+  const char* _tsname = NULL;
 
   struct getargs args[] = {
-    { "all", 'a', arg_flag, &_all, "Create/print all tables" },
-    { "print", 'p', arg_flag, &_print, "Print table(s) instead of creating it"},
-    { "temp", 't', arg_flag, &_temp, "Temporary table", "temp" },
-    { "connstr", 'c', arg_string, &_connectstr, "connect string", 
-      "How to connect to NDB"}, 
+    { "all", 'a', arg_flag, &_all, "Create/print all tables", 0 },
+    { "print", 'p', arg_flag, &_print, "Print table(s) instead of creating it", 0},
+    { "temp", 't', arg_flag, &_temp, "Temporary table", 0 },
+    { "connstr", 'c', arg_string, &_connectstr, "Connect string", "cs" }, 
+    { "diskbased", 0, arg_flag, &_diskbased, "Store attrs on disk if possible", 0 },
+    { "tsname", 0, arg_string, &_tsname, "Tablespace name", "ts" },
     { "usage", '?', arg_flag, &_help, "Print help", "" }
   };
   int num_args = sizeof(args) / sizeof(args[0]);
@@ -59,6 +82,9 @@
     return NDBT_ProgramExit(NDBT_WRONGARGS);
   }
 
+  g_diskbased = _diskbased;
+  g_tsname = _tsname;
+
   int res = 0;
   if(_print){
     /**
@@ -98,7 +124,8 @@
       int tmp;
       for(int i = optind; i<argc; i++){
 	ndbout << "Trying to create " <<  argv[i] << endl;
-	if((tmp = NDBT_Tables::createTable(&MyNdb, argv[i], _temp)) != 0)
+	if((tmp = NDBT_Tables::createTable(&MyNdb, argv[i], _temp, false,
+                                           g_create_hook)) != 0)
 	  res = tmp;
       }
     } 
@@ -109,5 +136,3 @@
   else
     return NDBT_ProgramExit(NDBT_OK);
 }
-
-

--- 1.16/ndb/test/src/NDBT_Tables.cpp	2005-04-15 14:50:13 +02:00
+++ 1.17/ndb/test/src/NDBT_Tables.cpp	2005-04-27 20:29:25 +02:00
@@ -820,8 +820,8 @@
 
 int
 NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp, 
-			 bool existsOk, NDBT_CreateTableHook f){
-  
+			 bool existsOk, NDBT_CreateTableHook f, void* arg)
+{
   const NdbDictionary::Table* tab = NDBT_Tables::getTable(_name);
   if (tab == NULL){
     ndbout << "Could not create table " << _name 
@@ -834,7 +834,7 @@
   do {
     NdbDictionary::Table tmpTab(* tab);
     tmpTab.setStoredTable(_temp ? 0 : 1);
-    if(f != 0 && f(pNdb, tmpTab, 0))
+    if(f != 0 && f(pNdb, tmpTab, 0, arg))
     {
       ndbout << "Failed to create table" << endl;
       return NDBT_FAILED;
@@ -887,7 +887,7 @@
 	}
       }
     }
-    if(f != 0 && f(pNdb, tmpTab, 1))
+    if(f != 0 && f(pNdb, tmpTab, 1, arg))
     {
       ndbout << "Failed to create table" << endl;
       return NDBT_FAILED;

--- 1.23/ndb/test/src/NDBT_Test.cpp	2005-02-06 10:43:21 +01:00
+++ 1.24/ndb/test/src/NDBT_Test.cpp	2005-04-27 20:29:26 +02:00
@@ -726,6 +726,8 @@
    records = 0;
    loops = 0;
    createTable = true;
+   diskbased = false;
+   tsname = NULL;
 }
 
 
@@ -809,6 +811,32 @@
   }
 }
 
+static int
+g_create_hook(Ndb* ndb, NdbDictionary::Table& tab, int when, void* arg)
+{
+  NDBT_TestSuite* ts = (NDBT_TestSuite*)arg;
+  return ts->createHook(ndb, tab, when);
+}
+
+int
+NDBT_TestSuite::createHook(Ndb* ndb, NdbDictionary::Table& tab, int when)
+{
+  if (when == 0) {
+    if (diskbased) {
+      for (int i = 0; i < tab.getNoOfColumns(); i++) {
+        NdbDictionary::Column* col = tab.getColumn(i);
+        if (! col->getPrimaryKey()) {
+          col->setStorageType(NdbDictionary::Column::StorageTypeDisk);
+        }
+      }
+    }
+    if (tsname != NULL) {
+      tab.setTablespace(tsname);
+    }
+  }
+  return 0;
+}
+
 void NDBT_TestSuite::execute(Ndb_cluster_connection& con,
 			     Ndb* ndb, const NdbDictionary::Table* pTab, 
 			     const char* _testname){
@@ -839,7 +867,8 @@
 	continue;
       }
       
-      if(NDBT_Tables::createTable(ndb, pTab->getName()) != 0){
+      if (NDBT_Tables::createTable(ndb, pTab->getName(), false, false,
+                                   g_create_hook, this) != 0) {
 	numTestsFail++;
 	numTestsExecuted++;
 	g_err << "ERROR1: Failed to create table " << pTab->getName()
@@ -972,6 +1001,8 @@
 #ifndef DBUG_OFF
   const char *debug_option= 0;
 #endif
+  int _diskbased = 0;
+  const char* _tsname = NULL;
 
   struct getargs args[] = {
     { "print", '\0', arg_flag, &_print, "Print execution tree", "" },
@@ -987,6 +1018,8 @@
     { "debug", 0, arg_string, &debug_option,
       "Specify debug options e.g. d:t:i:o,out.trace", "options" },
 #endif
+    { "diskbased", 0, arg_flag, &_diskbased, "Store attrs on disk if possible", 0 },
+    { "tsname", 0, arg_string, &_tsname, "Tablespace name", "ts" },
     { "verbose", 'v', arg_flag, &_verbose, "Print verbose status", "verbose" }
   };
   int num_args = sizeof(args) / sizeof(args[0]);
@@ -1030,6 +1063,8 @@
   records = _records;
   loops = _loops;
   timer = _timer;
+  diskbased = _diskbased;
+  tsname = _tsname;
 
   Ndb_cluster_connection con;
   if(con.connect(12, 5, 1))
Thread
bk commit into 5.1-ndb tree (pekka:1.1876)pekka27 Apr