Kouhei Sutou
null+****@clear*****
Tue Aug 30 20:21:42 JST 2016
Kouhei Sutou 2016-08-30 20:21:42 +0900 (Tue, 30 Aug 2016) New Revision: eb4ba820faad87b96979ecedfbbd4d6bb86d2ab2 https://github.com/groonga/groonga/commit/eb4ba820faad87b96979ecedfbbd4d6bb86d2ab2 Message: logical_table_remove: support removing shard key Added files: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.expected test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.test test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.expected test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.test test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.expected test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.test test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.expected test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.test Modified files: lib/db.c plugins/sharding/logical_table_remove.rb Modified: lib/db.c (+21 -16) =================================================================== --- lib/db.c 2016-08-30 20:16:09 +0900 (3ec141e) +++ lib/db.c 2016-08-30 20:21:42 +0900 (401fa19) @@ -8187,22 +8187,27 @@ delete_source_hook(grn_ctx *ctx, grn_obj *obj) GRN_TEXT_SET_REF(&data, &hook_data, sizeof(hook_data)); for (i = 1; i <= n; i++, s++) { hook_data.section = i; - if ((source = grn_ctx_at(ctx, *s))) { - switch (source->header.type) { - case GRN_TABLE_HASH_KEY : - case GRN_TABLE_PAT_KEY : - case GRN_TABLE_DAT_KEY : - del_hook(ctx, source, GRN_HOOK_INSERT, &data); - del_hook(ctx, source, GRN_HOOK_DELETE, &data); - break; - case GRN_COLUMN_FIX_SIZE : - case GRN_COLUMN_VAR_SIZE : - del_hook(ctx, source, GRN_HOOK_SET, &data); - break; - default : - /* invalid target */ - break; - } + + source = grn_ctx_at(ctx, *s); + if (!source) { + ERRCLR(ctx); + continue; + } + + switch (source->header.type) { + case GRN_TABLE_HASH_KEY : + case GRN_TABLE_PAT_KEY : + case GRN_TABLE_DAT_KEY : + del_hook(ctx, source, GRN_HOOK_INSERT, &data); + del_hook(ctx, source, GRN_HOOK_DELETE, &data); + break; + case GRN_COLUMN_FIX_SIZE : + case GRN_COLUMN_VAR_SIZE : + del_hook(ctx, source, GRN_HOOK_SET, &data); + break; + default : + /* invalid target */ + break; } } grn_obj_close(ctx, &data); Modified: plugins/sharding/logical_table_remove.rb (+10 -4) =================================================================== --- plugins/sharding/logical_table_remove.rb 2016-08-30 20:16:09 +0900 (e1fc341) +++ plugins/sharding/logical_table_remove.rb 2016-08-30 20:21:42 +0900 (81a4e92) @@ -32,14 +32,14 @@ module Groonga return if cover_type == :none shard_key = shard.key - if shard_key.nil? + if shard_key.nil? and !@force message = "[logical_table_remove] shard_key doesn't exist: " + "<#{shard.key_name}>" raise InvalidArgument, message end table = shard.table - if cover_type == :all or (table.nil? and @force) + if cover_type == :all or ((table.nil? or shard_key.nil?) and @force) remove_table(shard, table) return end @@ -69,9 +69,15 @@ module Groonga def collect_referenced_table_ids(shard, table) return [] unless @dependent + columns = nil if table - columns = table.columns - else + begin + columns = table.columns + rescue + context.clear_error + end + end + if columns.nil? prefix = "#{shard.table_name}." columns = [] context.database.each_name(:prefix => prefix) do |column_name| Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.expected (+120 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.expected 2016-08-30 20:21:42 +0900 (4997c2c) @@ -0,0 +1,120 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150203 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150203 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203 +[[0,0.0,0.0],true] +table_create Times_20150203 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key +[[0,0.0,0.0],true] +table_create NotRelated_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150204 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 +[[0,0.0,0.0],true] +table_create Times_20150204 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key +[[0,0.0,0.0],true] +load --table Logs_20150203 +[ +{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"}, +{"timestamp": "2015-02-03 23:59:59", "path": "/var/"} +] +[[0,0.0,0.0],2] +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"} +] +[[0,0.0,0.0],3] +logical_table_remove Logs timestamp --min "2015-02-04 00:00:00" --min_border "include" +[[[-22,0.0,0.0],"[logical_table_remove] shard_key doesn't exist: <timestamp>"]] +#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +object_exist Times_20150204.timestamp_index +[[0,0.0,0.0],true] +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 + +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 +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 + +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","path"], +[1,"/tmp/log"], +[2,"/root/"], +[3,"/etc/aliases"] +] + +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 +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.test (+61 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/default.test 2016-08-30 20:21:42 +0900 (e9bd5bb) @@ -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}.0000111 + +logical_table_remove Logs timestamp \ + --min "2015-02-04 00:00:00" \ + --min_border "include" + +object_exist Times_20150204.timestamp_index + +dump Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.expected (+120 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.expected 2016-08-30 20:21:42 +0900 (baaa41d) @@ -0,0 +1,120 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150203 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150203 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203 +[[0,0.0,0.0],true] +table_create Times_20150203 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key +[[0,0.0,0.0],true] +table_create NotRelated_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150204 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 +[[0,0.0,0.0],true] +table_create Times_20150204 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key +[[0,0.0,0.0],true] +load --table Logs_20150203 +[ +{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"}, +{"timestamp": "2015-02-03 23:59:59", "path": "/var/"} +] +[[0,0.0,0.0],2] +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"} +] +[[0,0.0,0.0],3] +logical_table_remove Logs timestamp --min "2015-02-04 00:00:00" --min_border "include" --dependent yes +[[[-22,0.0,0.0],"[logical_table_remove] shard_key doesn't exist: <timestamp>"]] +#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +object_exist Times_20150204.timestamp_index +[[0,0.0,0.0],true] +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 + +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 +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 + +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","path"], +[1,"/tmp/log"], +[2,"/root/"], +[3,"/etc/aliases"] +] + +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 +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.test (+62 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent.test 2016-08-30 20:21:42 +0900 (252e3f5) @@ -0,0 +1,62 @@ +#@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}.0000111 + +logical_table_remove Logs timestamp \ + --min "2015-02-04 00:00:00" \ + --min_border "include" \ + --dependent yes + +object_exist Times_20150204.timestamp_index + +dump Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.expected (+105 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.expected 2016-08-30 20:21:42 +0900 (b7ca949) @@ -0,0 +1,105 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150203 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150203 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203 +[[0,0.0,0.0],true] +table_create Times_20150203 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key +[[0,0.0,0.0],true] +table_create NotRelated_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150204 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 +[[0,0.0,0.0],true] +table_create Times_20150204 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key +[[0,0.0,0.0],true] +load --table Logs_20150203 +[ +{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"}, +{"timestamp": "2015-02-03 23:59:59", "path": "/var/"} +] +[[0,0.0,0.0],2] +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"} +] +[[0,0.0,0.0],3] +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.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| [object][remove] column is broken: <Logs_20150204.timestamp>: [object][remove] column is broken: <Logs_20150204.timestamp>: [io][open] file size is too small: <8>(required: >= 64): <db/db.0 +#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| system call error: No such file or directory: failed to open path: <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<>):<64>(<column:fix_size>) +object_exist Times_20150204.timestamp_index +[[0,0.0,0.0],false] +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 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 +[ +["_key"], +["/tmp/log"], +["/var/"] +] + +load --table Logs_20150203 +[ +["_id","path","timestamp"], +[1,"/tmp/log",1422935340.0], +[2,"/var/",1422975599.0] +] + +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 Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.test (+63 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/dependent_force.test 2016-08-30 20:21:42 +0900 (8618e23) @@ -0,0 +1,63 @@ +#@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}.0000111 + +logical_table_remove Logs timestamp \ + --min "2015-02-04 00:00:00" \ + --min_border "include" \ + --dependent yes \ + --force yes + +object_exist Times_20150204.timestamp_index + +dump Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.expected (+116 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.expected 2016-08-30 20:21:42 +0900 (383f352) @@ -0,0 +1,116 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Paths_20150203 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150203 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150203 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150203 path COLUMN_SCALAR Paths_20150203 +[[0,0.0,0.0],true] +table_create Times_20150203 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150203 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key +[[0,0.0,0.0],true] +table_create NotRelated_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Paths_20150204 TABLE_HASH_KEY|KEY_LARGE ShortText +[[0,0.0,0.0],true] +table_create Logs_20150204 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150204 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150204 path COLUMN_SCALAR Paths_20150204 +[[0,0.0,0.0],true] +table_create Times_20150204 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times_20150204 timestamp_index COLUMN_INDEX Logs_20150204 timestamp +[[0,0.0,0.0],true] +table_create PathTerms_20150204 TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key +[[0,0.0,0.0],true] +load --table Logs_20150203 +[ +{"timestamp": "2015-02-03 12:49:00", "path": "/tmp/log"}, +{"timestamp": "2015-02-03 23:59:59", "path": "/var/"} +] +[[0,0.0,0.0],2] +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"} +] +[[0,0.0,0.0],3] +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.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| [object][remove] column is broken: <Logs_20150204.timestamp>: [object][remove] column is broken: <Logs_20150204.timestamp>: [io][open] file size is too small: <8>(required: >= 64): <db/db.0 +#|e| [io][open] file size is too small: <8>(required: >= 64): <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<Logs_20150204.timestamp>):<64>(<column:fix_size>) +#|e| system call error: No such file or directory: failed to open path: <db/db.0000111> +#|e| grn_ctx_at: failed to open object: <273>(<(null)>):<64>(<column:fix_size>) +object_exist Times_20150204.timestamp_index +[[0,0.0,0.0],false] +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 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 Times_20150204 +[ +["_key"], +[1422975600.0], +[1423025340.0], +[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 Added: test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.test (+62 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_table_remove/broken/shard_key_column/force.test 2016-08-30 20:21:42 +0900 (e9128e6) @@ -0,0 +1,62 @@ +#@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}.0000111 + +logical_table_remove Logs timestamp \ + --min "2015-02-04 00:00:00" \ + --min_border "include" \ + --force yes + +object_exist Times_20150204.timestamp_index + +dump -------------- next part -------------- HTML����������������������������...Download