[Groonga-commit] groonga/groonga at d34fe66 [master] Fix a bug that removing DB that uses DAT key may remain garbage

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 5 20:42:00 JST 2013


Kouhei Sutou	2013-10-13 15:52:15 +0900 (Sun, 13 Oct 2013)

  New Revision: d34fe6647156a6bd9ad04be393b6893617b5df93
  https://github.com/groonga/groonga/commit/d34fe6647156a6bd9ad04be393b6893617b5df93

  Message:
    Fix a bug that removing DB that uses DAT key may remain garbage
    
    Note: This is not a comment for this commit. I forget to write a
    comment in the previous commit (723a77f). So I write a comment for the
    previous commit in the commit.
    
    The problem fixed in the previous is reported by Eito Katagiri at
    https://github.com/ranguba/rroonga/issues/13 . Thanks!!!

  Modified files:
    lib/db.c

  Modified: lib/db.c (+13 -1)
===================================================================
--- lib/db.c    2013-10-13 15:41:03 +0900 (6c8d6b8)
+++ lib/db.c    2013-10-13 15:52:15 +0900 (c469ebf)
@@ -6840,6 +6840,7 @@ _grn_obj_remove_db(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   const char *io_spath;
   char *spath;
   grn_db *s = (grn_db *)db;
+  unsigned char key_type;
 
   if (s->specs &&
       (io_spath = grn_obj_path(ctx, (grn_obj *)s->specs)) && *io_spath != '\0') {
@@ -6851,6 +6852,8 @@ _grn_obj_remove_db(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
     spath = NULL;
   }
 
+  key_type = s->keys->header.type;
+
   _grn_obj_remove_db_index_columns(ctx, db);
   _grn_obj_remove_db_reference_columns(ctx, db);
   _grn_obj_remove_db_reference_tables(ctx, db);
@@ -6863,7 +6866,16 @@ _grn_obj_remove_db(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
     GRN_FREE(spath);
   }
 
-  if (path) { grn_pat_remove(ctx, path); }
+  if (path) {
+    switch (key_type) {
+    case GRN_TABLE_PAT_KEY :
+      grn_pat_remove(ctx, path);
+      break;
+    case GRN_TABLE_DAT_KEY :
+      grn_dat_remove(ctx, path);
+      break;
+    }
+  }
 }
 
 static grn_bool
-------------- next part --------------
HTML����������������������������...
Download 



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