Kouhei Sutou
null+****@clear*****
Mon May 28 16:47:38 JST 2018
Kouhei Sutou 2018-05-28 16:47:38 +0900 (Mon, 28 May 2018) New Revision: 446e6d3e3407f8b9010a39068407baa9b7372075 https://github.com/groonga/groonga/commit/446e6d3e3407f8b9010a39068407baa9b7372075 Message: logical_range_filter: fix a memory leak on error in dynamic column evaluation Modified files: plugins/sharding/logical_range_filter.rb Modified: plugins/sharding/logical_range_filter.rb (+7 -19) =================================================================== --- plugins/sharding/logical_range_filter.rb 2018-05-28 14:44:50 +0900 (2bbec6f0a) +++ plugins/sharding/logical_range_filter.rb 2018-05-28 16:47:38 +0900 (fafb2ecf7) @@ -115,21 +115,12 @@ module Groonga @current_limit = @limit @result_sets = [] - @unsorted_result_sets = [] - @temporary_tables = [] @threshold = compute_threshold end def close - @unsorted_result_sets.each do |result_set| - result_set.close if result_set.temporary? - end - @result_sets.each do |result_set| - result_set.close if result_set.temporary? - end - @temporary_tables.each do |table| table.close end @@ -457,7 +448,7 @@ module Groonga @filter =****@conte***** @post_filter =****@conte*****_filter @result_sets =****@conte*****_sets - @unsorted_result_sets =****@conte*****_result_sets + @temporary_tables =****@conte*****_tables @target_range =****@conte*****_range @@ -502,7 +493,7 @@ module Groonga @cover_type = :all expression_builder.filter = @filter end - @context.temporary_tables << @target_table + @temporary_tables << @target_table end dynamic_column.apply(@target_table) end @@ -850,6 +841,7 @@ module Groonga if****@conte*****_limit > 0 @context.current_limit -= result_set.size end + @temporary_tables << result_set @result_sets << result_set end @@ -906,10 +898,7 @@ module Groonga end def add_result_set(result_set) - @context.temporary_tables.delete(result_set) - if result_set.empty? - result_set.close if result_set.temporary? return end @@ -928,23 +917,21 @@ module Groonga @context.dynamic_columns.each_filtered do |dynamic_column| if result_set ==****@shard***** result_set = result_set.select_all + @temporary_tables << result_set end dynamic_column.apply(result_set) end unless @post_filter.nil? - filtered_table = result_set - result_set = apply_post_filter(filtered_table) - @context.temporary_tables << filtered_table + result_set = apply_post_filter(result_set) + @temporary_tables << result_set end if result_set.size <=****@conte*****_offset @context.current_offset -= result_set.size - result_set.close if result_set.temporary? return end - @unsorted_result_sets << result_set if result_set.temporary? if****@conte*****_keys.empty? sort_keys = [ { @@ -972,6 +959,7 @@ module Groonga sorted_result_set = result_set.sort(sort_keys, :offset => @context.current_offset, :limit => limit) + @temporary_tables << sorted_result_set @result_sets << sorted_result_set if****@conte*****_offset > 0 @context.current_offset = 0 -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180528/223833be/attachment-0001.htm