[Groonga-commit] groonga/groonga at 809af9c [master] grndb: add a missing file existent check

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 27 11:17:40 JST 2016


Kouhei Sutou	2016-10-27 11:17:40 +0900 (Thu, 27 Oct 2016)

  New Revision: 809af9c228592b6f4365aae5b82d737e85f2ce02
  https://github.com/groonga/groonga/commit/809af9c228592b6f4365aae5b82d737e85f2ce02

  Message:
    grndb: add a missing file existent check

  Modified files:
    lib/mrb/scripts/command_line/grndb.rb
    test/command_line/suite/grndb/test_check.rb

  Modified: lib/mrb/scripts/command_line/grndb.rb (+1 -0)
===================================================================
--- lib/mrb/scripts/command_line/grndb.rb    2016-10-27 11:14:37 +0900 (212b02e)
+++ lib/mrb/scripts/command_line/grndb.rb    2016-10-27 11:17:40 +0900 (2498375)
@@ -193,6 +193,7 @@ module Groonga
             cursor.each do |id|
               next if ID.builtin?(id)
               path = "%s.%07x" % [@database.path, id]
+              next unless File.exist?(path)
               return if File.stat(path).mtime > last_modified
             end
           end

  Modified: test/command_line/suite/grndb/test_check.rb (+22 -0)
===================================================================
--- test/command_line/suite/grndb/test_check.rb    2016-10-27 11:14:37 +0900 (607856d)
+++ test/command_line/suite/grndb/test_check.rb    2016-10-27 11:17:40 +0900 (3e522b4)
@@ -31,6 +31,28 @@ load --table Users
 Database wasn't closed successfully. It may be broken. Re-create the database.
       MESSAGE
     end
+
+    def test_have_plugin
+      groonga("plugin_register", "sharding")
+      groonga("io_flush")
+
+      groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText")
+      groonga do |process|
+        process.run_command(<<-COMMAND)
+load --table Users
+[
+{"_key": "Alice"}
+]
+        COMMAND
+        Process.kill(:KILL, process.pid)
+      end
+      error = assert_raise(CommandRunner::Error) do
+        grndb("check")
+      end
+      assert_equal(<<-MESSAGE, error.error_output)
+Database wasn't closed successfully. It may be broken. Re-create the database.
+      MESSAGE
+    end
   end
 
   def test_cleaned_database
-------------- next part --------------
HTML����������������������������...
Download 



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