null+****@clear*****
null+****@clear*****
2011年 9月 25日 (日) 16:28:09 JST
Kentoku 2011-09-25 07:28:09 +0000 (Sun, 25 Sep 2011)
New Revision: b84574b370473801fe047f2a0b5367215ac1f830
Log:
fix assertion fail for auto_increment assertion at inserting
Modified files:
ha_mroonga.cc
ha_mroonga.h
Modified: ha_mroonga.cc (+197 -0)
===================================================================
--- ha_mroonga.cc 2011-09-25 06:27:59 +0000 (5c10f47)
+++ ha_mroonga.cc 2011-09-25 07:28:09 +0000 (4941ebe)
@@ -6998,6 +6998,203 @@ int ha_mroonga::final_drop_index(TABLE *table_arg)
}
#endif
+int ha_mroonga::wrapper_update_auto_increment()
+{
+ int res;
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ res = wrap_handler->update_auto_increment();
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_RETURN(res);
+}
+
+int ha_mroonga::storage_update_auto_increment()
+{
+ MRN_DBUG_ENTER_METHOD();
+ int res = handler::update_auto_increment();
+ DBUG_RETURN(res);
+}
+
+int ha_mroonga::update_auto_increment()
+{
+ MRN_DBUG_ENTER_METHOD();
+ int res;
+ if (share->wrapper_mode)
+ {
+ res = wrapper_update_auto_increment();
+ } else {
+ res = storage_update_auto_increment();
+ }
+ DBUG_RETURN(res);
+}
+
+void ha_mroonga::wrapper_set_next_insert_id(ulonglong id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ wrap_handler->set_next_insert_id(id);
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::storage_set_next_insert_id(ulonglong id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ handler::set_next_insert_id(id);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::set_next_insert_id(ulonglong id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ if (share->wrapper_mode)
+ {
+ wrapper_set_next_insert_id(id);
+ } else {
+ storage_set_next_insert_id(id);
+ }
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::wrapper_get_auto_increment(ulonglong offset,
+ ulonglong increment,
+ ulonglong nb_desired_values,
+ ulonglong *first_value,
+ ulonglong *nb_reserved_values)
+{
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ wrap_handler->get_auto_increment(offset, increment, nb_desired_values,
+ first_value, nb_reserved_values);
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::storage_get_auto_increment(ulonglong offset,
+ ulonglong increment,
+ ulonglong nb_desired_values,
+ ulonglong *first_value,
+ ulonglong *nb_reserved_values)
+{
+ MRN_DBUG_ENTER_METHOD();
+ handler::get_auto_increment(offset, increment, nb_desired_values,
+ first_value, nb_reserved_values);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::get_auto_increment(ulonglong offset, ulonglong increment,
+ ulonglong nb_desired_values,
+ ulonglong *first_value,
+ ulonglong *nb_reserved_values)
+{
+ MRN_DBUG_ENTER_METHOD();
+ if (share->wrapper_mode)
+ {
+ wrapper_get_auto_increment(offset, increment, nb_desired_values,
+ first_value, nb_reserved_values);
+ } else {
+ storage_get_auto_increment(offset, increment, nb_desired_values,
+ first_value, nb_reserved_values);
+ }
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::wrapper_restore_auto_increment(ulonglong prev_insert_id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ wrap_handler->restore_auto_increment(prev_insert_id);
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::storage_restore_auto_increment(ulonglong prev_insert_id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ handler::restore_auto_increment(prev_insert_id);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::restore_auto_increment(ulonglong prev_insert_id)
+{
+ MRN_DBUG_ENTER_METHOD();
+ if (share->wrapper_mode)
+ {
+ wrapper_restore_auto_increment(prev_insert_id);
+ } else {
+ storage_restore_auto_increment(prev_insert_id);
+ }
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::wrapper_release_auto_increment()
+{
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ wrap_handler->ha_release_auto_increment();
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::storage_release_auto_increment()
+{
+ MRN_DBUG_ENTER_METHOD();
+ DBUG_VOID_RETURN;
+}
+
+void ha_mroonga::release_auto_increment()
+{
+ MRN_DBUG_ENTER_METHOD();
+ if (share->wrapper_mode)
+ {
+ wrapper_release_auto_increment();
+ } else {
+ storage_release_auto_increment();
+ }
+ DBUG_VOID_RETURN;
+}
+
+int ha_mroonga::wrapper_reset_auto_increment(ulonglong value)
+{
+ int res;
+ MRN_DBUG_ENTER_METHOD();
+ MRN_SET_WRAP_SHARE_KEY(share, table->s);
+ MRN_SET_WRAP_TABLE_KEY(this, table);
+ res = wrap_handler->ha_reset_auto_increment(value);
+ MRN_SET_BASE_SHARE_KEY(share, table->s);
+ MRN_SET_BASE_TABLE_KEY(this, table);
+ DBUG_RETURN(res);
+}
+
+int ha_mroonga::storage_reset_auto_increment(ulonglong value)
+{
+ MRN_DBUG_ENTER_METHOD();
+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+}
+
+int ha_mroonga::reset_auto_increment(ulonglong value)
+{
+ MRN_DBUG_ENTER_METHOD();
+ int res;
+ if (share->wrapper_mode)
+ {
+ res = wrapper_reset_auto_increment(value);
+ } else {
+ res = storage_reset_auto_increment(value);
+ }
+ DBUG_RETURN(res);
+}
+
void ha_mroonga::set_pk_bitmap()
{
KEY key_info = table->key_info[table_share->primary_key];
Modified: ha_mroonga.h (+25 -0)
===================================================================
--- ha_mroonga.h 2011-09-25 06:27:59 +0000 (cef0959)
+++ ha_mroonga.h 2011-09-25 07:28:09 +0000 (3c1d906)
@@ -300,6 +300,13 @@ public:
int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
int final_drop_index(TABLE *table_arg);
#endif
+ int update_auto_increment();
+ void set_next_insert_id(ulonglong id);
+ void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values,
+ ulonglong *first_value, ulonglong *nb_reserved_values);
+ void restore_auto_increment(ulonglong prev_insert_id);
+ void release_auto_increment();
+ int reset_auto_increment(ulonglong value);
protected:
#ifdef MRN_HANDLER_HAVE_HA_RND_NEXT
@@ -587,6 +594,24 @@ private:
int wrapper_final_drop_index(TABLE *table_arg);
int storage_final_drop_index(TABLE *table_arg);
#endif
+ int wrapper_update_auto_increment();
+ int storage_update_auto_increment();
+ void wrapper_set_next_insert_id(ulonglong id);
+ void storage_set_next_insert_id(ulonglong id);
+ void wrapper_get_auto_increment(ulonglong offset, ulonglong increment,
+ ulonglong nb_desired_values,
+ ulonglong *first_value,
+ ulonglong *nb_reserved_values);
+ void storage_get_auto_increment(ulonglong offset, ulonglong increment,
+ ulonglong nb_desired_values,
+ ulonglong *first_value,
+ ulonglong *nb_reserved_values);
+ void wrapper_restore_auto_increment(ulonglong prev_insert_id);
+ void storage_restore_auto_increment(ulonglong prev_insert_id);
+ void wrapper_release_auto_increment();
+ void storage_release_auto_increment();
+ int wrapper_reset_auto_increment(ulonglong value);
+ int storage_reset_auto_increment(ulonglong value);
};
#ifdef __cplusplus