Kouhei Sutou
null+****@clear*****
Thu Jan 5 23:18:27 JST 2017
Kouhei Sutou 2017-01-05 23:18:27 +0900 (Thu, 05 Jan 2017) New Revision: 9e788f74af3de3870ac74d3e3e1c1347a857637f https://github.com/pgroonga/pgroonga/commit/9e788f74af3de3870ac74d3e3e1c1347a857637f Message: Apply WAL when INSERT Modified files: src/pgroonga.c test/test-pgroonga-check.rb Modified: src/pgroonga.c (+2 -0) =================================================================== --- src/pgroonga.c 2017-01-05 23:17:54 +0900 (3064256) +++ src/pgroonga.c 2017-01-05 23:18:27 +0900 (f513e46) @@ -2187,6 +2187,8 @@ pgroonga_insert_raw(Relation index, grn_obj *sourcesCtidColumn; uint32_t recordSize; + PGrnWALApply(index); + sourcesTable = PGrnLookupSourcesTable(index, ERROR); sourcesCtidColumn = PGrnLookupSourcesCtidColumn(index, ERROR); recordSize = PGrnInsert(index, Modified: test/test-pgroonga-check.rb (+32 -0) =================================================================== --- test/test-pgroonga-check.rb 2017-01-05 23:17:54 +0900 (99ef32b) +++ test/test-pgroonga-check.rb 2017-01-05 23:18:27 +0900 (3bb5b95) @@ -60,5 +60,37 @@ SELECT * FROM memos WHERE content %% 'PGroonga'; "SELECT * FROM memos WHERE content %% 'PGroonga';")) end end + + sub_test_case "table" do + test "locked" do + run_sql("CREATE TABLE memos (content text);") + run_sql("CREATE INDEX memos_content ON memos USING pgroonga (content);") + run_sql("INSERT INTO memos VALUES ('PGroonga is good!');") + stop_postgres + lexicon = nil + groonga("table_list")[1][2..-1].each do |_, name,| + if name.start_with?("Lexicon") + lexicon = name + break + end + end + groonga("lock_acquire", lexicon) + start_postgres + run_sql("INSERT INTO memos VALUES ('PGroonga is good!');") + output = <<-OUTPUT +SET enable_seqscan = no; +SELECT * FROM memos WHERE content %% 'PGroonga'; + content +------------------- + PGroonga is good! + PGroonga is good! +(2 rows) + + OUTPUT + assert_equal([output, ""], + run_sql("SET enable_seqscan = no;\n" + + "SELECT * FROM memos WHERE content %% 'PGroonga';")) + end + end end end -------------- next part -------------- HTML����������������������������...Download