[Groonga-mysql-commit] mroonga/mroonga [master] [wrapper] can't insert between tables are locked. refs #1154

Back to archive index

null+****@clear***** null+****@clear*****
2011年 11月 4日 (金) 00:38:32 JST


Kentoku	2011-11-03 15:38:32 +0000 (Thu, 03 Nov 2011)

  New Revision: c85da6dcbc64ac86d72b4aed51592957f1c7d085

  Log:
    [wrapper] can't insert between tables are locked. refs #1154

  Modified files:
    ha_mroonga.cc
    ha_mroonga.h

  Modified: ha_mroonga.cc (+62 -10)
===================================================================
--- ha_mroonga.cc    2011-11-03 05:53:03 +0000 (87b6c44)
+++ ha_mroonga.cc    2011-11-03 15:38:32 +0000 (ac2221a)
@@ -5662,19 +5662,38 @@ int ha_mroonga::wrapper_get_next_record(uchar *buf)
 
     MRN_SET_WRAP_SHARE_KEY(share, table->s);
     MRN_SET_WRAP_TABLE_KEY(this, table);
+    if (wrap_handler->inited == NONE)
+    {
 #ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP
-    error = wrap_handler->ha_index_read_idx_map(buf,
-                                                share->wrap_primary_key,
-                                                (uchar *)GRN_TEXT_VALUE(&key_buffer),
-                                                pk_keypart_map,
-                                                HA_READ_KEY_EXACT);
+      error = wrap_handler->ha_index_read_idx_map(buf,
+                                                  share->wrap_primary_key,
+                                                  (uchar *)GRN_TEXT_VALUE(
+                                                    &key_buffer),
+                                                  pk_keypart_map,
+                                                  HA_READ_KEY_EXACT);
+#else
+      error = wrap_handler->index_read_idx_map(buf,
+                                               share->wrap_primary_key,
+                                               (uchar *)GRN_TEXT_VALUE(
+                                                 &key_buffer),
+                                               pk_keypart_map,
+                                               HA_READ_KEY_EXACT);
+#endif
+    } else {
+#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP
+      error = wrap_handler->ha_index_read_map(buf,
+                                              (uchar *)GRN_TEXT_VALUE(
+                                                &key_buffer),
+                                              pk_keypart_map,
+                                              HA_READ_KEY_EXACT);
 #else
-    error = wrap_handler->index_read_idx_map(buf,
-                                             share->wrap_primary_key,
-                                             (uchar *)GRN_TEXT_VALUE(&key_buffer),
-                                             pk_keypart_map,
-                                             HA_READ_KEY_EXACT);
+      error = wrap_handler->index_read_map(buf,
+                                           (uchar *)GRN_TEXT_VALUE(
+                                             &key_buffer),
+                                           pk_keypart_map,
+                                           HA_READ_KEY_EXACT);
 #endif
+    }
     MRN_SET_BASE_SHARE_KEY(share, table->s);
     MRN_SET_BASE_TABLE_KEY(this, table);
   } while (error == HA_ERR_END_OF_FILE);
@@ -7846,6 +7865,39 @@ void ha_mroonga::set_pk_bitmap()
   DBUG_VOID_RETURN;
 }
 
+int ha_mroonga::wrapper_start_stmt(THD *thd, thr_lock_type lock_type)
+{
+  int res;
+  MRN_DBUG_ENTER_METHOD();
+  MRN_SET_WRAP_SHARE_KEY(share, table->s);
+  MRN_SET_WRAP_TABLE_KEY(this, table);
+  res = wrap_handler->start_stmt(thd, lock_type);
+  MRN_SET_BASE_SHARE_KEY(share, table->s);
+  MRN_SET_BASE_TABLE_KEY(this, table);
+  DBUG_RETURN(res);
+}
+
+int ha_mroonga::storage_start_stmt(THD *thd, thr_lock_type lock_type)
+{
+  int res;
+  MRN_DBUG_ENTER_METHOD();
+  res = handler::start_stmt(thd, lock_type);
+  DBUG_RETURN(res);
+}
+
+int ha_mroonga::start_stmt(THD *thd, thr_lock_type lock_type)
+{
+  int res;
+  MRN_DBUG_ENTER_METHOD();
+  if (share->wrapper_mode)
+  {
+    res = wrapper_start_stmt(thd, lock_type);
+  } else {
+    res = storage_start_stmt(thd, lock_type);
+  }
+  DBUG_RETURN(res);
+}
+
 #ifdef __cplusplus
 }
 #endif

  Modified: ha_mroonga.h (+3 -0)
===================================================================
--- ha_mroonga.h    2011-11-03 05:53:03 +0000 (4a66d83)
+++ ha_mroonga.h    2011-11-03 15:38:32 +0000 (a5fa3a3)
@@ -336,6 +336,7 @@ public:
   void restore_auto_increment(ulonglong prev_insert_id);
   void release_auto_increment();
   int reset_auto_increment(ulonglong value);
+  int start_stmt(THD *thd, thr_lock_type lock_type);
 
 protected:
 #ifdef MRN_HANDLER_HAVE_HA_RND_NEXT
@@ -674,6 +675,8 @@ private:
   void storage_release_auto_increment();
   int wrapper_reset_auto_increment(ulonglong value);
   int storage_reset_auto_increment(ulonglong value);
+  int wrapper_start_stmt(THD *thd, thr_lock_type lock_type);
+  int storage_start_stmt(THD *thd, thr_lock_type lock_type);
 };
 
 #ifdef __cplusplus




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