[Groonga-mysql-commit] mroonga/mroonga [master] fix for storage_mode alter_table_disable_enable_keys. refs #1310

Back to archive index

null+****@clear***** null+****@clear*****
2012年 5月 8日 (火) 04:38:20 JST


Kentoku	2012-05-08 04:38:20 +0900 (Tue, 08 May 2012)

  New Revision: 6cbac6278758873fe6c55447f11e406b9e10c65b

  Log:
    fix for storage_mode alter_table_disable_enable_keys. refs #1310

  Modified files:
    ha_mroonga.cpp
    mrn_table.cpp

  Modified: ha_mroonga.cpp (+17 -15)
===================================================================
--- ha_mroonga.cpp    2012-05-07 19:17:40 +0900 (6ab7b7f)
+++ ha_mroonga.cpp    2012-05-08 04:38:20 +0900 (90c7261)
@@ -930,6 +930,7 @@ static int mrn_close_connection(handlerton *hton, THD *thd)
   MRN_DBUG_ENTER_FUNCTION();
   void *p = *thd_ha_data(thd, mrn_hton_ptr);
   if (p) {
+    mrn_clear_alter_share(thd);
     free(p);
     *thd_ha_data(thd, mrn_hton_ptr) = (void *) NULL;
     pthread_mutex_lock(&mrn_allocated_thds_mutex);
@@ -11186,8 +11187,8 @@ int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info,
   if (!error && have_multiple_column_index)
   {
     error = storage_add_index_multiple_columns(key_info, num_of_keys,
-                                               index_tables,
-                                               index_columns, FALSE);
+                                               index_tables + n_keys,
+                                               index_columns + n_keys, FALSE);
   }
   bitmap_set_all(table->read_set);
   if (error)
@@ -11219,7 +11220,6 @@ int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info,
   MRN_DBUG_ENTER_METHOD();
 
   int error = 0;
-  uint n_keys = table->s->keys;
 
   if (!(error = storage_rnd_init(true)))
   {
@@ -11236,7 +11236,7 @@ int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info,
         if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) {
           continue;
         }
-        if (!index_columns[i + n_keys]) {
+        if (!index_columns[i]) {
           continue;
         }
 
@@ -11251,23 +11251,25 @@ int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info,
               current_key_info->key_part[j].field->null_bit;
           }
         }
-        grn_id key_id;
-        if ((error = storage_write_row_unique_index(table->record[0],
-                                                    record_id,
-                                                    current_key_info,
-                                                    index_tables[i + n_keys],
-                                                    &key_id)))
-        {
-          if (error == HA_ERR_FOUND_DUPP_KEY)
+        if (key_info[i].flags & HA_NOSAME) {
+          grn_id key_id;
+          if ((error = storage_write_row_unique_index(table->record[0],
+                                                      record_id,
+                                                      current_key_info,
+                                                      index_tables[i],
+                                                      &key_id)))
           {
-            error = HA_ERR_FOUND_DUPP_UNIQUE;
+            if (error == HA_ERR_FOUND_DUPP_KEY)
+            {
+              error = HA_ERR_FOUND_DUPP_UNIQUE;
+            }
+            break;
           }
-          break;
         }
         if ((error = storage_write_row_multiple_column_index(table->record[0],
                                                              record_id,
                                                              current_key_info,
-                                                             index_columns[i + n_keys])))
+                                                             index_columns[i])))
         {
           break;
         }

  Modified: mrn_table.cpp (+3 -0)
===================================================================
--- mrn_table.cpp    2012-05-07 19:17:40 +0900 (33302ac)
+++ mrn_table.cpp    2012-05-08 04:38:20 +0900 (0983363)
@@ -496,6 +496,9 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
 #if MYSQL_VERSION_ID >= 50500
   if (key_info->comment.length == 0)
   {
+    if (share->key_parser[i]) {
+      my_free(share->key_parser[i], MYF(0));
+    }
     if (
       !(share->key_parser[i] = mrn_create_string(
         mrn_default_parser,




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