[Groonga-mysql-commit] mroonga/mroonga at 4506b46 [master] Fix a regression bug that wrong primary key is used for new record

Back to archive index

Kouhei Sutou null+****@clear*****
Sat May 23 14:06:39 JST 2015


Kouhei Sutou	2015-05-23 14:06:39 +0900 (Sat, 23 May 2015)

  New Revision: 4506b46970149c894de5c8400464a94386decf8a
  https://github.com/mroonga/mroonga/commit/4506b46970149c894de5c8400464a94386decf8a

  Message:
    Fix a regression bug that wrong primary key is used for new record

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+11 -11)
===================================================================
--- ha_mroonga.cpp    2015-05-23 12:09:21 +0900 (fdaa4c7)
+++ ha_mroonga.cpp    2015-05-23 14:06:39 +0900 (96d5291)
@@ -5494,10 +5494,19 @@ int ha_mroonga::storage_write_row(uchar *buf)
     }
   }
 
+  uint pkey_nr = table->s->primary_key;
+
+  int added = 0;
+  {
+    mrn::Lock lock(&(share->record_mutex));
+    if ((error = storage_write_row_unique_indexes(buf)))
+    {
+      DBUG_RETURN(error);
+    }
+    unique_indexes_are_processed = true;
+
   char *pkey;
   int pkey_size;
-  uint pkey_nr;
-  pkey_nr = table->s->primary_key;
   GRN_BULK_REWIND(&key_buffer);
   if (pkey_nr == MAX_INDEXES) {
     pkey = NULL;
@@ -5530,15 +5539,6 @@ int ha_mroonga::storage_write_row(uchar *buf)
     DBUG_RETURN(ER_ERROR_ON_WRITE);
   }
 
-  int added;
-  {
-    mrn::Lock lock(&(share->record_mutex));
-    if ((error = storage_write_row_unique_indexes(buf)))
-    {
-      DBUG_RETURN(error);
-    }
-    unique_indexes_are_processed = true;
-
     record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added);
     if (ctx->rc) {
       my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0));
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index