List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:June 15 2009 2:01pm
Subject:bzr commit into mysql-5.1-telco-7.1 branch (magnus.blaudd:2910)
View as plain text  
#At file:///home/msvensson/mysql/7.1-ndbinfo/ based on revid:magnus.blaudd@stripped7-edma6n8v30fuwsg1

 2910 Magnus Blåudd	2009-06-15
      ndbinfo
       - Add ha_ndbinfo skeleton code.
       - Add ha_ndbinfo storage engine to same plugin as ha_ndbcluster

    added:
      sql/ha_ndbinfo.cc
      sql/ha_ndbinfo.h
    modified:
      libmysqld/Makefile.am
      sql/Makefile.am
      sql/ha_ndbcluster.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2009-05-26 18:53:34 +0000
+++ b/libmysqld/Makefile.am	2009-06-15 14:01:01 +0000
@@ -48,7 +48,7 @@ noinst_HEADERS =	embedded_priv.h emb_qca
 
 sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
 	     ha_ndbcluster.cc ha_ndbcluster_cond.cc \
-	ha_ndbcluster_connection.cc \
+	ha_ndbcluster_connection.cc ha_ndbinfo.cc \
 	ha_ndbcluster_binlog.cc ha_partition.cc \
 	handler.cc sql_handler.cc \
 	hostname.cc init.cc password.c \
@@ -120,6 +120,9 @@ ha_ndbcluster_binlog.o: ha_ndbcluster_bi
 ha_ndbcluster_connection.o: ha_ndbcluster_connection.cc
 		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
 
+ha_ndbinfo.o: ha_ndbinfo.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
 # Until we can remove dependency on ha_ndbcluster.h
 handler.o:	handler.cc
 		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<

=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2009-05-27 12:11:46 +0000
+++ b/sql/Makefile.am	2009-06-15 14:01:01 +0000
@@ -61,7 +61,7 @@ noinst_HEADERS =	item.h item_func.h item
 			ha_ndbcluster.h ha_ndbcluster_cond.h \
 			ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
 			ha_ndbcluster_connection.h ha_ndbcluster_connection.h \
-			ha_ndbcluster_lock_ext.h \
+			ha_ndbcluster_lock_ext.h ha_ndbinfo.h \
 			ha_partition.h rpl_constants.h \
 			opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
 			rpl_reporting.h \
@@ -133,7 +133,8 @@ libndb_la_CPPFLAGS=	@ndbcluster_includes
 libndb_la_SOURCES=	ha_ndbcluster.cc \
 			ha_ndbcluster_binlog.cc \
 			ha_ndbcluster_connection.cc \
-			ha_ndbcluster_cond.cc
+			ha_ndbcluster_cond.cc \
+			ha_ndbinfo.cc
 
 gen_lex_hash_SOURCES =	gen_lex_hash.cc
 gen_lex_hash_LDFLAGS =  @NOINST_LDFLAGS@

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-06-10 14:30:06 +0000
+++ b/sql/ha_ndbcluster.cc	2009-06-15 14:01:01 +0000
@@ -1,6 +1,6 @@
 /*
-   Copyright (C) 2000-2003 MySQL AB
-    All rights reserved. Use is subject to license terms.
+   Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems Inc.
+   All rights reserved. Use is subject to license terms.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13979,10 +13979,15 @@ static struct st_mysql_sys_var* system_v
   NULL
 };
 
-
 struct st_mysql_storage_engine ndbcluster_storage_engine=
 { MYSQL_HANDLERTON_INTERFACE_VERSION };
 
+
+#include "ha_ndbinfo.h"
+
+struct st_mysql_storage_engine ndbinfo_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
 mysql_declare_plugin(ndbcluster)
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -13991,12 +13996,26 @@ mysql_declare_plugin(ndbcluster)
   "MySQL AB",
   "Clustered, fault-tolerant tables",
   PLUGIN_LICENSE_GPL,
-  ndbcluster_init, /* Plugin Init */
-  NULL, /* Plugin Deinit */
-  0x0100 /* 1.0 */,
+  ndbcluster_init,            /* plugin init */
+  NULL,                       /* plugin deinit */
+  0x0100,                     /* plugin version */
   ndb_status_variables_export,/* status variables                */
   system_variables,           /* system variables                */
   NULL                        /* config options                  */
+},
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &ndbinfo_storage_engine,
+  "ndbinfo",
+  "Sun Microsystems Inc.",
+  "Ndb system information storage engine",
+  PLUGIN_LICENSE_GPL,
+  ndbinfo_init,               /* plugin init */
+  ndbinfo_deinit,             /* plugin deinit */
+  0x0001,                     /* plugin version */
+  NULL,                       /* status variables */
+  NULL,                       /* system variables */
+  NULL                        /* config options */
 }
 mysql_declare_plugin_end;
 

=== added file 'sql/ha_ndbinfo.cc'
--- a/sql/ha_ndbinfo.cc	1970-01-01 00:00:00 +0000
+++ b/sql/ha_ndbinfo.cc	2009-06-15 14:01:01 +0000
@@ -0,0 +1,138 @@
+/*
+   Copyright (C) 2009 Sun Microsystems Inc.
+   All rights reserved. Use is subject to license terms.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "mysql_priv.h"
+#include "ha_ndbinfo.h"
+
+
+static handler*
+create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root)
+{
+  return new (mem_root) ha_ndbinfo(hton, table);
+}
+
+
+ha_ndbinfo::ha_ndbinfo(handlerton *hton, TABLE_SHARE *table_arg)
+  : handler(hton, table_arg)
+{
+}
+
+
+ha_ndbinfo::~ha_ndbinfo()
+{
+}
+
+
+int ha_ndbinfo::create(const char *name, TABLE *form,
+                       HA_CREATE_INFO *create_info)
+{
+  DBUG_ENTER("ha_ndbinfo::create");
+  DBUG_PRINT("enter", ("name: %s", name));
+
+  DBUG_RETURN(0);
+}
+
+int ha_ndbinfo::open(const char *name, int mode, uint test_if_locked)
+{
+  DBUG_ENTER("ha_ndbinfo::open");
+  DBUG_PRINT("enter", ("name: %s, mode: %d", name, mode));
+
+  DBUG_RETURN(0);
+}
+
+
+int ha_ndbinfo::close(void)
+{
+  DBUG_ENTER("ha_ndbinfo::close");
+
+  DBUG_RETURN(0);
+}
+
+
+int ha_ndbinfo::rnd_init(bool scan)
+{
+  DBUG_ENTER("ha_ndbinfo::rnd_init");
+  DBUG_PRINT("info", ("scan: %d", scan));
+
+  DBUG_RETURN(0);
+}
+
+
+int ha_ndbinfo::rnd_end()
+{
+  DBUG_ENTER("ha_ndbinfo::rnd_end");
+
+  DBUG_RETURN(0);
+}
+
+
+int ha_ndbinfo::rnd_next(uchar *buf)
+{
+  DBUG_ENTER("ha_ndbinfo::rnd_next");
+
+  DBUG_RETURN(HA_ERR_END_OF_FILE);
+}
+
+
+int ha_ndbinfo::rnd_pos(uchar *buf, uchar *pos)
+{
+  DBUG_ENTER("ha_ndbinfo::rnd_pos");
+  // Should never be called if table flags are set correct
+  DBUG_ASSERT(false);
+  DBUG_RETURN(0);
+}
+
+
+void ha_ndbinfo::position(const uchar *record)
+{
+  DBUG_ENTER("ha_ndbinfo::posistion");
+  // Should never be called if table flags are set correct
+  DBUG_ASSERT(false);
+  DBUG_VOID_RETURN;
+}
+
+
+int ha_ndbinfo::info(uint flag)
+{
+  DBUG_ENTER("ha_ndbinfo::info");
+  DBUG_PRINT("enter", ("flag: %d", flag));
+
+  DBUG_RETURN(0);
+}
+
+handlerton* ndbinfo_hton;
+
+int ndbinfo_init(void *plugin)
+{
+  DBUG_ENTER("ndbinfo_init");
+
+  handlerton *hton = (handlerton *)plugin;
+  hton->create= create_handler;
+  hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
+
+  ndbinfo_hton = hton;
+
+  DBUG_RETURN(0);
+}
+
+int ndbinfo_deinit(void *plugin)
+{
+  DBUG_ENTER("ndbinfo_deinit");
+
+  DBUG_RETURN(0);
+}

=== added file 'sql/ha_ndbinfo.h'
--- a/sql/ha_ndbinfo.h	1970-01-01 00:00:00 +0000
+++ b/sql/ha_ndbinfo.h	2009-06-15 14:01:01 +0000
@@ -0,0 +1,64 @@
+/*
+   Copyright (C) 2009 Sun Microsystems Inc.
+   All rights reserved. Use is subject to license terms.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef HA_NDBINFO_H
+#define HA_NDBINFO_H
+
+#include <mysql/plugin.h>
+
+int ndbinfo_init(void *plugin);
+int ndbinfo_deinit(void *plugin);
+
+class ha_ndbinfo: public handler
+{
+public:
+  ha_ndbinfo(handlerton *hton, TABLE_SHARE *table_arg);
+  ~ha_ndbinfo();
+
+  const char *table_type() const { return "NDBINFO"; }
+  const char **bas_ext() const {
+    static const char *null[] = { NullS };
+    return null;
+  }
+  ulonglong table_flags() const {
+    return HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS;
+  }
+  ulong index_flags(uint inx, uint part, bool all_parts) const {
+    return 0;
+  }
+
+  int create(const char *name, TABLE *form,
+             HA_CREATE_INFO *create_info);
+
+  int open(const char *name, int mode, uint test_if_locked);
+  int close(void);
+
+  int rnd_init(bool scan);
+  int rnd_end();
+  int rnd_next(uchar *buf);
+  int rnd_pos(uchar *buf, uchar *pos);
+  void position(const uchar *record);
+  int info(uint);
+
+  THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
+                             enum thr_lock_type lock_type) {
+    return to;
+  }
+};
+
+#endif

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20090615140101-auq16erqncmgo1z8.bundle
Thread
bzr commit into mysql-5.1-telco-7.1 branch (magnus.blaudd:2910)Magnus Blåudd15 Jun