[Tritonn-commit 132] [svn] [146] prototype development

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 6月 12日 (木) 17:26:50 JST


Revision: 146
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=146
Author:   mir
Date:     2008-06-12 17:26:50 +0900 (Thu, 12 Jun 2008)

Log Message:
-----------
prototype development

Modified Paths:
--------------
    trunk/src/ha_tritonn.cc
    trunk/src/ha_tritonn.h


-------------- next part --------------
Modified: trunk/src/ha_tritonn.cc
===================================================================
--- trunk/src/ha_tritonn.cc	2008-06-12 06:53:26 UTC (rev 145)
+++ trunk/src/ha_tritonn.cc	2008-06-12 08:26:50 UTC (rev 146)
@@ -61,6 +61,7 @@
 static int tritonn_init_hton(void *p)
 {
   DBUG_ENTER("tritonn_init_hton");
+  DBTN;
 
   handlerton *hton;
 
@@ -82,6 +83,7 @@
 {
   int error= 0;
   DBUG_ENTER("tritonn_deinit_hton");
+  DBTN;
 
   if (tritonn_open_tables.records)
     error= 1;
@@ -102,6 +104,8 @@
   uint length;
   char *tmp_name;
 
+  DBTN;
+
   pthread_mutex_lock(&tritonn_mutex);
   length=(uint) strlen(table_name);
 
@@ -147,6 +151,7 @@
 */
 static int free_share(TRITONN_SHARE *share)
 {
+  DBTN;
   pthread_mutex_lock(&tritonn_mutex);
   if (!--share->use_count)
   {
@@ -165,16 +170,20 @@
 				       TABLE_SHARE *table,
 				       MEM_ROOT *mem_root)
 {
+  DBTN;
   return new (mem_root) ha_tritonn(hton, table);
 }
 
 /* delete database files */
 static void tritonn_drop_database(handlerton *hton, char* path)
-{}
+{
+  DBTN;
+}
 
 /* flush logfile */
 static bool tritonn_flush_logs(handlerton *hton)
 {
+  DBTN;
   return true;
 }
 
@@ -182,25 +191,79 @@
 static bool tritonn_show_status(handlerton *hton, THD *thd, stat_print_fn *print,
 				enum ha_stat_type stat)
 {
+  DBTN;
   return true;
 }
 
 ha_tritonn::ha_tritonn(handlerton *hton, TABLE_SHARE *table_arg)
   :handler(hton, table_arg)
-{}
+{
+  DBTN;
+}
 
+ha_tritonn::~ha_tritonn()
+{
+  DBTN;
+}
+
+const char *ha_tritonn::table_type() const
+{
+  DBTN;
+  return "TRITONN";
+}
+
+const char *ha_tritonn::index_type(uint inx) const
+{
+  DBTN;
+  return "SENNA";
+}
+
 static const char *ha_tritonn_exts[] = {
   NullS
 };
 
 const char **ha_tritonn::bas_ext() const
 {
+  DBTN;
   return ha_tritonn_exts;
 }
 
+// see $MYSQL_SRC/sql/handler.h "bits in table_flags"
+ulonglong ha_tritonn::table_flags() const {
+  DBTN;
+  return (HA_NO_TRANSACTIONS | HA_NO_BLOBS | HA_REQUIRE_PRIMARY_KEY |
+            HA_STATS_RECORDS_IS_EXACT | HA_NO_PREFIX_CHAR_KEYS | HA_CAN_FULLTEXT |
+	  HA_NO_AUTO_INCREMENT);
+}
+
+// see $MYSQL_SRC/sql/handler.h, "bits in index_flags"
+ulong ha_tritonn::index_flags(uint inx, uint part, bool all_parts) const {
+  DBTN;
+  return (HA_ONLY_WHOLE_INDEX);
+}
+
+int ha_tritonn::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
+  DBTN;
+  return HA_ERR_WRONG_COMMAND;
+}
+
+int ha_tritonn::prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys)
+{
+  DBTN;
+  return HA_ERR_WRONG_COMMAND;
+}
+
+int ha_tritonn::final_drop_index(TABLE *table_arg)
+{
+  DBTN;
+  return HA_ERR_WRONG_COMMAND;
+}
+
+
 int ha_tritonn::open(const char *name, int mode, uint test_if_locked)
 {
   DBUG_ENTER("ha_tritonn::open");
+  DBTN;
 
   if (!(share = get_share(name, table)))
     DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -212,36 +275,42 @@
 int ha_tritonn::close(void)
 {
   DBUG_ENTER("ha_tritonn::close");
+  DBTN;
   DBUG_RETURN(free_share(share));
 }
 
 int ha_tritonn::rnd_init(bool scan)
 {
   DBUG_ENTER("ha_tritonn::rnd_init");
+  DBTN;
   DBUG_RETURN(HA_ERR_WRONG_COMMAND);
 }
 
 int ha_tritonn::rnd_next(uchar *buf)
 {
   DBUG_ENTER("ha_tritonn::rnd_next");
+  DBTN;
   DBUG_RETURN(HA_ERR_END_OF_FILE);
 }
 
 void ha_tritonn::position(const uchar *record)
 {
   DBUG_ENTER("ha_tritonn::position");
+  DBTN;
   DBUG_VOID_RETURN;
 }
 
 int ha_tritonn::rnd_pos(uchar * buf, uchar *pos)
 {
   DBUG_ENTER("ha_tritonn::rnd_pos");
+  DBTN;
   DBUG_RETURN(HA_ERR_WRONG_COMMAND);
 }
 
 int ha_tritonn::info(uint flag)
 {
   DBUG_ENTER("ha_tritonn::info");
+  DBTN;
   DBUG_RETURN(0);
 }
 
@@ -249,6 +318,7 @@
                                        THR_LOCK_DATA **to,
                                        enum thr_lock_type lock_type)
 {
+  DBTN;
   if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
     lock.type=lock_type;
   *to++= &lock;
@@ -259,12 +329,29 @@
                        HA_CREATE_INFO *create_info)
 {
   DBUG_ENTER("ha_tritonn::create");
+  DBTN;
+  DBUG_RETURN(0);
+}
 
-  
+uint ha_tritonn::max_supported_keys() const
+{
+  DBTN;
+  return 1024;
+}
 
-  DBUG_RETURN(0);
+uint ha_tritonn::max_supported_key_length() const
+{
+  DBTN;
+  return 1024;
 }
 
+uint ha_tritonn::max_supported_key_part_length() const
+{
+  DBTN;
+  return 1024;
+}
+
+
 struct st_mysql_storage_engine storage_engine_structure=
 { MYSQL_HANDLERTON_INTERFACE_VERSION };
 

Modified: trunk/src/ha_tritonn.h
===================================================================
--- trunk/src/ha_tritonn.h	2008-06-12 06:53:26 UTC (rev 145)
+++ trunk/src/ha_tritonn.h	2008-06-12 08:26:50 UTC (rev 146)
@@ -19,34 +19,35 @@
   TRITONN_SHARE *share;   // Shared lock info
 
 public:
+  /* constructor */
   ha_tritonn(handlerton *hton, TABLE_SHARE *table_arg);
-  ~ha_tritonn()
-  {
-  }
-
-  const char *table_type() const { return "TRITONN"; }
-  const char *index_type(uint inx) { return "NONE"; }
+  /* destructor */
+  ~ha_tritonn();
+  /* engine name */
+  const char *table_type() const;
+  /* index type in string for specified number */
+  const char *index_type(uint inx) const;
+  /* file extantion for storage */
   const char **bas_ext() const;
 
   // see $MYSQL_SRC/sql/handler.h "bits in table_flags"
-  ulonglong table_flags() const {
-    return (HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
-	    HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
-	    HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
-	    HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS |
-	    HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS |
-	    HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
-  }
+  ulonglong table_flags() const;
 
   // see $MYSQL_SRC/sql/handler.h, "bits in index_flags"
-  ulong index_flags(uint inx, uint part, bool all_parts) const {
-    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
-            0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
-            HA_READ_ORDER | HA_KEYREAD_ONLY);
-  }
+  ulong index_flags(uint inx, uint part, bool all_parts) const;
 
-  int open(const char *name, int mode, uint test_if_locked);    // required
-  int close(void);                                              // required
+  /* add index */
+  int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
+
+  /* drop index */
+  int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
+  int final_drop_index(TABLE *table_arg);
+
+  /* open table */
+  int open(const char *name, int mode, uint test_if_locked);
+  /* close table */
+  int close(void);
+
   int rnd_init(bool scan);                                      // required
   int rnd_next(uchar *buf);                                     // required
   int rnd_pos(uchar *buf, uchar *pos);                          // required
@@ -57,7 +58,15 @@
   const COND *cond_push(const COND *cond);                      // condition pushdown
   THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
                              enum thr_lock_type lock_type);     // required
-  uint max_supported_keys()          const { return 1024; }
-  uint max_supported_key_length()    const { return 1024; }
-  uint max_supported_key_part_length() const { return 1024; }
+  uint max_supported_keys() const;
+  uint max_supported_key_length() const;
+  uint max_supported_key_part_length() const;
 };
+
+#ifdef DEBUG_TRITONN
+#define DBTN printf("[DBTN] %s#%s:%d\n",__FUNCTION__,__FILE__,__LINE__)
+#define DBTN2(x) printf("[DBTN2] %s#%s:%d msg=%s\n",__FUNCTION__,__FILE__,__LINE__,x)
+#else
+#define DBTN
+#define DBTN2(x)
+#endif


Tritonn-commit メーリングリストの案内
Back to archive index