Kouhei Sutou
null+****@clear*****
Fri Mar 25 13:19:35 JST 2016
Kouhei Sutou 2016-03-25 13:19:35 +0900 (Fri, 25 Mar 2016) New Revision: 96ad770882e96fb32b3d7bc40974d1c5ced495aa https://github.com/groonga/groonga/commit/96ad770882e96fb32b3d7bc40974d1c5ced495aa Message: grndb: fix a bug that cycle reference causes stack over flow 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 (+2 -0) =================================================================== --- lib/mrb/scripts/command_line/grndb.rb 2016-03-23 23:57:52 +0900 (abb7d84) +++ lib/mrb/scripts/command_line/grndb.rb 2016-03-25 13:19:35 +0900 (6dee132) @@ -208,6 +208,8 @@ module Groonga end def check_object_recursive(target) + return if****@check*****?(target.id) + check_object(target) case target when Table Modified: test/command_line/suite/grndb/test_check.rb (+25 -0) =================================================================== --- test/command_line/suite/grndb/test_check.rb 2016-03-23 23:57:52 +0900 (cfc2926) +++ test/command_line/suite/grndb/test_check.rb 2016-03-25 13:19:35 +0900 (73b4624) @@ -260,5 +260,30 @@ Database is locked. It may be broken. Re-create the database. [Names] Table is locked. It may be broken. (1) Truncate the table (truncate Names) or clear lock of the table (lock_clear Names) and (2) load data again. MESSAGE end + + def test_cycle_reference + groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText") + + groonga("table_create", "Logs", "TABLE_PAT_KEY", "ShortText") + groonga("column_create", "Logs", "user", "COLUMN_SCALAR", "Users") + + groonga("column_create", "Users", "logs_user", "COLUMN_INDEX", + "Logs", "user") + + groonga("lock_acquire", "Logs") + groonga("lock_acquire", "Logs.user") + groonga("lock_acquire", "Users") + groonga("lock_acquire", "Users.logs_user") + + error = assert_raise(CommandRunner::Error) do + grndb("check", "--target", "Users") + end + assert_equal(<<-MESSAGE, error.error_output) +[Users] Table is locked. It may be broken. (1) Truncate the table (truncate Users) or clear lock of the table (lock_clear Users) and (2) load data again. +[Users.logs_user] Index column is locked. It may be broken. Re-create index by '#{grndb_path} recover #{@database_path}'. +[Logs] Table is locked. It may be broken. (1) Truncate the table (truncate Logs) or clear lock of the table (lock_clear Logs) and (2) load data again. +[Logs.user] Data column is locked. It may be broken. (1) Truncate the column (truncate Logs.user) or clear lock of the column (lock_clear Logs.user) and (2) load data again. + MESSAGE + end end end -------------- next part -------------- HTML����������������������������... Télécharger