[Groonga-commit] groonga/groonga at 8fd6c2e [master] table_remove: disable removing referenced table

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 3 20:36:22 JST 2013


Kouhei Sutou	2013-08-03 20:36:22 +0900 (Sat, 03 Aug 2013)

  New Revision: 8fd6c2eb2847fc58da73634e8e5d6002f3926c0c
  https://github.com/groonga/groonga/commit/8fd6c2eb2847fc58da73634e8e5d6002f3926c0c

  Message:
    table_remove: disable removing referenced table
    
    Patricia trie table referenced by other hash table should not be
    removed.

  Added files:
    test/command/suite/table_remove/patricia_trie/referenced/table_hash.expected
    test/command/suite/table_remove/patricia_trie/referenced/table_hash.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+1 -0)
===================================================================
--- lib/db.c    2013-08-03 20:35:02 +0900 (f0a8fbf)
+++ lib/db.c    2013-08-03 20:36:22 +0900 (6c12ba4)
@@ -6663,6 +6663,7 @@ is_removable_table(grn_ctx *ctx, grn_obj *table, grn_obj *db)
       }
 
       switch (object->header.type) {
+      case GRN_TABLE_HASH_KEY :
       case GRN_TABLE_PAT_KEY :
       case GRN_TABLE_DAT_KEY :
         if (DB_OBJ(object)->id == table_id) {

  Added: test/command/suite/table_remove/patricia_trie/referenced/table_hash.expected (+21 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/patricia_trie/referenced/table_hash.expected    2013-08-03 20:36:22 +0900 (f5ef134)
@@ -0,0 +1,21 @@
+table_create Names TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Users TABLE_HASH_KEY Names
+[[0,0.0,0.0],true]
+table_remove Names
+[
+  [
+    [
+      -2,
+      0.0,
+      0.0
+    ],
+    "[table][remove] a table that references the table exists: <Users._key> -> <Names>"
+  ],
+  false
+]
+#|e| [table][remove] a table that references the table exists: <Users._key> -> <Names>
+dump
+table_create Names TABLE_PAT_KEY ShortText
+table_create Users TABLE_HASH_KEY Names
+

  Added: test/command/suite/table_remove/patricia_trie/referenced/table_hash.test (+6 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/patricia_trie/referenced/table_hash.test    2013-08-03 20:36:22 +0900 (8884b4d)
@@ -0,0 +1,6 @@
+table_create Names TABLE_PAT_KEY ShortText
+table_create Users TABLE_HASH_KEY Names
+
+table_remove Names
+
+dump
-------------- next part --------------
HTML����������������������������...
下載 



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