Kouhei Sutou
null+****@clear*****
Mon Apr 2 15:22:19 JST 2018
Kouhei Sutou 2018-04-02 15:22:19 +0900 (Mon, 02 Apr 2018) New Revision: 0c362a4b741d8efb2c3943db0c6c6261974c8342 https://github.com/groonga/groonga/commit/0c362a4b741d8efb2c3943db0c6c6261974c8342 Message: grndb recover: add more tests for --force-truncate with remained paths Modified files: lib/mrb/scripts/command_line/grndb.rb test/command_line/suite/grndb/test_recover.rb Modified: lib/mrb/scripts/command_line/grndb.rb (+5 -4) =================================================================== --- lib/mrb/scripts/command_line/grndb.rb 2018-04-02 15:13:20 +0900 (f5557c8f4) +++ lib/mrb/scripts/command_line/grndb.rb 2018-04-02 15:22:19 +0900 (c33ff21c3) @@ -496,16 +496,17 @@ module Groonga Dir.foreach(object_dirname) do |path| if path.start_with?("#{object_basename}.") + full_path = "#{object_dirname}/#{path}" begin - File.unlink("#{object_dirname}/#{path}") + File.unlink(full_path) message = - "[#{name}] Removed broken object related file: <#{path}>" - $stdout.puts(message) + "[#{name}] Removed broken object related file: <#{full_path}>" + $stderr.puts(message) logger.log(:info, message) rescue Error => error message = "[#{name}] Failed to remove broken object related file: " + - "<#{path}>: #{error.class}: #{error.message}" + "<#{full_path}>: #{error.class}: #{error.message}" $stderr.puts(message) logger.log_error(message) end Modified: test/command_line/suite/grndb/test_recover.rb (+6 -0) =================================================================== --- test/command_line/suite/grndb/test_recover.rb 2018-04-02 15:13:20 +0900 (0329b4be2) +++ test/command_line/suite/grndb/test_recover.rb 2018-04-02 15:22:19 +0900 (b404a67ea) @@ -43,9 +43,12 @@ object corrupt: <[db][recover] table may be broken: <Users>: please truncate the end def test_force_truncate + additional_path = "#{@table_path}.002" + FileUtils.touch(additional_path) result = grndb("recover", "--force-truncate") assert_equal(<<-MESSAGE, result.error_output) [Users] Truncated broken object: <#{@table_path}> +[Users] Removed broken object related file: <#{additional_path}> MESSAGE end end @@ -72,9 +75,12 @@ object corrupt: <[db][recover] column may be broken: <Users.age>: please truncat end def test_force_truncate + additional_path = "#{@column_path}.002" + FileUtils.touch(additional_path) result = grndb("recover", "--force-truncate") assert_equal(<<-MESSAGE, result.error_output) [Users.age] Truncated broken object: <#{@column_path}> +[Users.age] Removed broken object related file: <#{additional_path}> MESSAGE end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180402/9ad3e4ed/attachment-0001.htm