[Groonga-commit] groonga/groonga at 4c465c7 [master] logical_table_remove: support broken referenced table case

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Aug 29 17:47:51 JST 2016


Kouhei Sutou	2016-08-29 17:47:51 +0900 (Mon, 29 Aug 2016)

  New Revision: 4c465c77fe2450dbb63479affe4c4c82e9e3def7
  https://github.com/groonga/groonga/commit/4c465c77fe2450dbb63479affe4c4c82e9e3def7

  Message:
    logical_table_remove: support broken referenced table case

  Added files:
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.test
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.test
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.test
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.test
  Copied files:
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.expected
      (from test/command/suite/sharding/logical_table_remove/broken/column/default.expected)
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.expected
      (from test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected)
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.expected
      (from test/command/suite/sharding/logical_table_remove/broken/column/default.expected)
    test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.expected
      (from test/command/suite/sharding/logical_table_remove/broken/column/default.expected)
  Modified files:
    plugins/sharding/logical_table_remove.rb
    test/command/suite/sharding/logical_table_remove/broken/column/default.expected
    test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected

  Modified: plugins/sharding/logical_table_remove.rb (+31 -11)
===================================================================
--- plugins/sharding/logical_table_remove.rb    2016-08-29 16:31:54 +0900 (a7c46bc)
+++ plugins/sharding/logical_table_remove.rb    2016-08-29 17:47:51 +0900 (20170d8)
@@ -68,7 +68,7 @@ module Groonga
 
       def remove_table(shard, table)
         if table.nil? and @force
-          Context.instance.clear_error
+          context.clear_error
         end
 
         referenced_table_ids = []
@@ -87,7 +87,10 @@ module Groonga
           columns.each do |column|
             next if column.nil?
             range = column.range
-            if range.is_a?(Table)
+            case range
+            when nil
+              context.clear_error
+            when Table
               referenced_table_ids << range.id
               range.indexes.each do |index_info|
                 referenced_table_ids << index_info.index.domain.id
@@ -101,7 +104,7 @@ module Groonga
 
         if table.nil?
           if @force
-            remove_table_force(shard)
+            remove_table_force(shard.table_name)
           else
             message = "[logical_table_remove] table is broken: " +
                       "<#{shard.table_name}>"
@@ -113,9 +116,8 @@ module Groonga
             begin
               table.remove(options)
             rescue
-              Context.instance.clear_error
               table.close
-              remove_table_force(shard)
+              remove_table_force(shard.table_name)
             end
           else
             table.remove(options)
@@ -127,17 +129,35 @@ module Groonga
         shard_suffix = shard.range_data.to_suffix
         referenced_table_ids.each do |referenced_table_id|
           referenced_table = context[referenced_table_id]
-          next if referenced_table.nil?
-          if referenced_table.name.end_with?(shard_suffix)
+          if referenced_table.nil?
+            context.clear_error
+            if @force
+              Object.remove_force(referenced_table_id)
+            end
+            next
+          end
+
+          referenced_table_name = referenced_table.name
+          next unless referenced_table_name.end_with?(shard_suffix)
+
+          if @force
+            begin
+              referenced_table.remove(:dependent => @dependent)
+            rescue
+              Context.instance.clear_error
+              referenced_table.close
+              remove_table_force(referenced_table_name)
+            end
+          else
             referenced_table.remove(:dependent => @dependent)
           end
         end
       end
 
-      def remove_table_force(shard)
+      def remove_table_force(table_name)
         database = context.database
 
-        prefix = "#{shard.table_name}."
+        prefix = "#{table_name}."
         database.each_raw(:prefix => prefix) do |id, cursor|
           column = context[id]
           if column.nil?
@@ -149,7 +169,7 @@ module Groonga
           end
         end
 
-        table_id = database[shard.table_name]
+        table_id = database[table_name]
         return if table_id.nil?
 
         database.each_raw do |id, cursor|
@@ -169,7 +189,7 @@ module Groonga
           end
         end
 
-        Object.remove_force(shard.table_name)
+        Object.remove_force(table_name)
       end
 
       def remove_records(table)

  Modified: test/command/suite/sharding/logical_table_remove/broken/column/default.expected (+61 -0)
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/default.expected    2016-08-29 16:31:54 +0900 (e9256b9)
+++ test/command/suite/sharding/logical_table_remove/broken/column/default.expected    2016-08-29 17:47:51 +0900 (24a9c29)
@@ -63,6 +63,67 @@ logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border
 #|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
 #|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
 dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+table_create Times_20150204 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
 
+load --table Paths_20150203
+[
+["_key"],
+["/tmp/log"],
+["/var/"]
+]
+
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
+]
+
+load --table Paths_20150204
+[
+["_key"],
+["/tmp/log"],
+["/root/"],
+["/etc/aliases"]
+]
+
+load --table Logs_20150204
+[
+["_id","timestamp"],
+[1,1422975600.0],
+[2,1423025340.0],
+[3,1423025400.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
 #|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)

  Modified: test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected (+61 -0)
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected    2016-08-29 16:31:54 +0900 (92b093b)
+++ test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected    2016-08-29 17:47:51 +0900 (9e8203f)
@@ -63,6 +63,67 @@ logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border
 #|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
 #|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
 dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+table_create Times_20150204 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
 
+load --table Paths_20150203
+[
+["_key"],
+["/tmp/log"],
+["/var/"]
+]
+
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
+]
+
+load --table Paths_20150204
+[
+["_key"],
+["/tmp/log"],
+["/root/"],
+["/etc/aliases"]
+]
+
+load --table Logs_20150204
+[
+["_id","timestamp"],
+[1,1422975600.0],
+[2,1423025340.0],
+[3,1423025400.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
 #|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
 #|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)

  Copied: test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.expected (+51 -15) 53%
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/default.expected    2016-08-29 16:31:54 +0900 (e9256b9)
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.expected    2016-08-29 17:47:51 +0900 (f39b4ba)
@@ -48,21 +48,57 @@ load --table Logs_20150204
 ]
 [[0,0.0,0.0],3]
 logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"
+[[0,0.0,0.0],true]
+#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.000010F>
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+table_create Times_20150204 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+
+load --table Paths_20150203
 [
-  [
-    [
-      -65,
-      0.0,
-      0.0
-    ],
-    "incompatible file format: <[object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(requ"
-  ]
+["_key"],
+["/tmp/log"],
+["/var/"]
+]
+
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
 ]
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
-dump
 
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+load --table Times_20150204
+[
+["_key"],
+[1422975600.0],
+[1423025340.0],
+[1423025400.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)

  Added: test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.test (+59 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/default.test    2016-08-29 17:47:51 +0900 (b427204)
@@ -0,0 +1,59 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150203 _key
+
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150204 _key
+
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-03 23:59:59", "path": "/var/"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-04 13:49:00", "path": "/root/"},
+{"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
+]
+
+#@disable-logging
+thread_limit 1
+database_unmap
+#@enable-logging
+
+#@copy-path fixture/sharding/logical_table_remove/broken #{db_path}.000010F
+
+logical_table_remove Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include"
+
+dump

  Copied: test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.expected (+43 -15) 53%
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/dependent.expected    2016-08-29 16:31:54 +0900 (92b093b)
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.expected    2016-08-29 17:47:51 +0900 (bf639df)
@@ -48,21 +48,49 @@ load --table Logs_20150204
 ]
 [[0,0.0,0.0],3]
 logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"   --dependent yes
+[[0,0.0,0.0],true]
+#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.000010F>
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+
+load --table Paths_20150203
 [
-  [
-    [
-      -65,
-      0.0,
-      0.0
-    ],
-    "incompatible file format: <[object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(requ"
-  ]
+["_key"],
+["/tmp/log"],
+["/var/"]
 ]
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
-dump
 
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)

  Added: test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.test (+60 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent.test    2016-08-29 17:47:51 +0900 (996d52a)
@@ -0,0 +1,60 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150203 _key
+
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150204 _key
+
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-03 23:59:59", "path": "/var/"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-04 13:49:00", "path": "/root/"},
+{"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
+]
+
+#@disable-logging
+thread_limit 1
+database_unmap
+#@enable-logging
+
+#@copy-path fixture/sharding/logical_table_remove/broken #{db_path}.000010F
+
+logical_table_remove Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include" \
+  --dependent yes
+
+dump

  Copied: test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.expected (+44 -16) 52%
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/default.expected    2016-08-29 16:31:54 +0900 (e9256b9)
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.expected    2016-08-29 17:47:51 +0900 (12e1839)
@@ -47,22 +47,50 @@ load --table Logs_20150204
 {"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
 ]
 [[0,0.0,0.0],3]
-logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"
+logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"   --dependent yes   --force yes
+[[0,0.0,0.0],true]
+#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.000010F>
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+
+load --table Paths_20150203
 [
-  [
-    [
-      -65,
-      0.0,
-      0.0
-    ],
-    "incompatible file format: <[object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(requ"
-  ]
+["_key"],
+["/tmp/log"],
+["/var/"]
 ]
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
-dump
 
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)

  Added: test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.test (+61 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/dependent_force.test    2016-08-29 17:47:51 +0900 (a9506af)
@@ -0,0 +1,61 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150203 _key
+
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150204 _key
+
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-03 23:59:59", "path": "/var/"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-04 13:49:00", "path": "/root/"},
+{"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
+]
+
+#@disable-logging
+thread_limit 1
+database_unmap
+#@enable-logging
+
+#@copy-path fixture/sharding/logical_table_remove/broken #{db_path}.000010F
+
+logical_table_remove Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include" \
+  --dependent yes \
+  --force yes
+
+dump

  Copied: test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.expected (+52 -16) 52%
===================================================================
--- test/command/suite/sharding/logical_table_remove/broken/column/default.expected    2016-08-29 16:31:54 +0900 (e9256b9)
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.expected    2016-08-29 17:47:51 +0900 (a25afe7)
@@ -47,22 +47,58 @@ load --table Logs_20150204
 {"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
 ]
 [[0,0.0,0.0],3]
-logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"
+logical_table_remove Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "include"   --force yes
+[[0,0.0,0.0],true]
+#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.000010F>
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+dump
+plugin_register sharding
+
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+
+table_create Times_20150203 TABLE_PAT_KEY Time
+
+table_create Times_20150204 TABLE_PAT_KEY Time
+
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+
+load --table Paths_20150203
 [
-  [
-    [
-      -65,
-      0.0,
-      0.0
-    ],
-    "incompatible file format: <[object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(requ"
-  ]
+["_key"],
+["/tmp/log"],
+["/var/"]
+]
+
+load --table Logs_20150203
+[
+["_id","path","timestamp"],
+[1,"/tmp/log",1422935340.0],
+[2,"/var/",1422975599.0]
 ]
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
-#|e| [object][remove] column is broken: <Logs_20150204.path>: [object][remove] column is broken: <Logs_20150204.path>: [io][open] file size is too small: <8>(required: >= 64): <db/db.000011
-dump
 
-#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000112>
-#|e| grn_ctx_at: failed to open object: <274>(<Logs_20150204.path>):<64>(<column:fix_size>)
+load --table Times_20150204
+[
+["_key"],
+[1422975600.0],
+[1423025340.0],
+[1423025400.0]
+]
+
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)
+#|e| grn_ctx_at: failed to open object: <271>(<Paths_20150204>):<48>(<table:hash_key>)

  Added: test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.test (+60 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_table_remove/broken/referenced_table/force.test    2016-08-29 17:47:51 +0900 (530568b)
@@ -0,0 +1,60 @@
+#@on-error omit
+plugin_register sharding
+#@on-error default
+
+table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150203 TABLE_NO_KEY
+column_create Logs_20150203 timestamp COLUMN_SCALAR Time
+column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203
+table_create Times_20150203 TABLE_PAT_KEY Time
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
+
+table_create PathTerms_20150203 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150203 _key
+
+
+table_create NotRelated_20150204 TABLE_NO_KEY
+
+table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText
+table_create Logs_20150204 TABLE_NO_KEY
+column_create Logs_20150204 timestamp COLUMN_SCALAR Time
+column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204
+table_create Times_20150204 TABLE_PAT_KEY Time
+column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp
+
+table_create PathTerms_20150204 TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION \
+  Paths_20150204 _key
+
+
+load --table Logs_20150203
+[
+{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-03 23:59:59", "path": "/var/"}
+]
+
+load --table Logs_20150204
+[
+{"timestamp": "2015-02-04 00:00:00", "path": "/tmp/log"},
+{"timestamp": "2015-02-04 13:49:00", "path": "/root/"},
+{"timestamp": "2015-02-04 13:50:00", "path": "/etc/aliases"}
+]
+
+#@disable-logging
+thread_limit 1
+database_unmap
+#@enable-logging
+
+#@copy-path fixture/sharding/logical_table_remove/broken #{db_path}.000010F
+
+logical_table_remove Logs timestamp \
+  --min "2015-02-04 00:00:00" \
+  --min_border "include" \
+  --force yes
+
+dump
-------------- next part --------------
HTML����������������������������...
Download 



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