groonga-query-log 1.7.0 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 137657847fe22ae9bd436e1a2a99467c93cc7134cde90f710451f1d6c205c083
4
- data.tar.gz: 68455fe3c51c12a8b1ee1a5106d99ff86a52b14eebbd2077b2284523fe560498
3
+ metadata.gz: ddc6abfd57bfd9684c695179c7cac74c76ea66fffb0b87b9a0d44726a16128b6
4
+ data.tar.gz: 52dfaf4698c92587f155e3d4e0fd70fcc7c94b7c6ae58fdab43e72695a3e7722
5
5
  SHA512:
6
- metadata.gz: baa54b40acddcb3c6b2fe46a4a7566eb402dc4f1be8327200832614ee3274e6de49116b644bf149c7d87dcc58f920e61ddb81a5c0486c4648164bc6a3503d4f9
7
- data.tar.gz: 747d1d1fc84cbeabf2445882e7d70274c6b94994787ea056150c9a18f661992436a29acded2d19cb0a152a2159ef0d7c29dca9e0b8690f82564873f31f99ef35
6
+ metadata.gz: 0747f843b5cce48e3540cace8c2be2ab4200c7d6c406917a56b7eb05dbd047437249400f25178045d29b1aef8c84253e6c3a70ef806db9f581ae47392a34c2a5
7
+ data.tar.gz: 47391f44a1d86c8aa37ae8893f87381e49fddf15100762938cacb73b742b0a909c2b32e574564d32415c82e8ca2c5b618f0c86b0028c288b0570685a4b3f0d60
@@ -1,5 +1,50 @@
1
1
  # News
2
2
 
3
+ ## 1.7.5: 2020-11-18
4
+
5
+ ### Improvements
6
+
7
+ * `analyze`: Ignored static file access.
8
+
9
+ ## 1.7.4: 2020-11-12
10
+
11
+ ### Fixes
12
+
13
+ * `server-verifier`: Fixed a bug that `--max-limit` doesn't work.
14
+
15
+ * `run-regression-test`: Fixed a bug that `--max-limit` doesn't work.
16
+
17
+ ## 1.7.3: 2020-11-12
18
+
19
+ ### Improvements
20
+
21
+ * `check-crash`: Added support for showing Groonga version.
22
+
23
+ * `server-verifier`: Added `--max-limit` option.
24
+
25
+ * `run-regression-test`: Added `--max-limit` option.
26
+
27
+ ### Fixes
28
+
29
+ * `GroongaQueryLog::Parser`: Fixed a bug that target command filter
30
+ may not work.
31
+
32
+ ## 1.7.2: 2020-06-02
33
+
34
+ ### Fixes
35
+
36
+ * `server-verifier`: Fixed a bug that performance verification
37
+ doesn't try 5 times.
38
+
39
+ ## 1.7.1: 2020-06-01
40
+
41
+ ### Fixes
42
+
43
+ * `server-verifier`: Fixed a bug that performance verification with
44
+ `--stop-onlfailre` doesn't work.
45
+
46
+ * `run-regression-test`: Fixed a bug that failure is ignored.
47
+
3
48
  ## 1.7.0: 2020-05-31
4
49
 
5
50
  ### Fixes
@@ -71,6 +71,7 @@ module GroongaQueryLog
71
71
  end
72
72
 
73
73
  class GroongaProcess
74
+ attr_reader :version
74
75
  attr_reader :pid
75
76
  attr_reader :start_time
76
77
  attr_reader :start_log_path
@@ -80,7 +81,8 @@ module GroongaQueryLog
80
81
  attr_writer :crashed
81
82
  attr_writer :finished
82
83
  attr_reader :important_entries
83
- def initialize(pid, start_time, start_log_path)
84
+ def initialize(version, pid, start_time, start_log_path)
85
+ @version = version
84
86
  @pid = pid
85
87
  @start_time = start_time
86
88
  @end_time = @start_time
@@ -121,6 +123,7 @@ module GroongaQueryLog
121
123
  need_query_log_parsing = false
122
124
  p [:process,
123
125
  :success,
126
+ process.version,
124
127
  process.start_time.iso8601,
125
128
  process.end_time.iso8601,
126
129
  process.pid,
@@ -129,6 +132,7 @@ module GroongaQueryLog
129
132
  elsif process.crashed?
130
133
  p [:process,
131
134
  :crashed,
135
+ process.version,
132
136
  process.start_time.iso8601,
133
137
  process.end_time.iso8601,
134
138
  process.pid,
@@ -137,6 +141,7 @@ module GroongaQueryLog
137
141
  else
138
142
  p [:process,
139
143
  :unfinished,
144
+ process.version,
140
145
  process.start_time.iso8601,
141
146
  process.pid,
142
147
  process.start_log_path]
@@ -144,6 +149,7 @@ module GroongaQueryLog
144
149
 
145
150
  unless process.n_leaks.zero?
146
151
  p [:leak,
152
+ process.version,
147
153
  process.n_leaks,
148
154
  process.end_time.iso8601,
149
155
  process.pid,
@@ -184,7 +190,8 @@ module GroongaQueryLog
184
190
  end
185
191
  end
186
192
  unless @unflushed_statistics.empty?
187
- puts("Unflushed commands in #{start.iso8601}/#{last.iso8601}")
193
+ puts("Unflushed commands in " +
194
+ "#{start_time.iso8601}/#{end_time.iso8601}")
188
195
  @unflushed_statistics.each do |statistic|
189
196
  puts("#{statistic.start_time.iso8601}: #{statistic.raw_command}")
190
197
  end
@@ -320,7 +327,8 @@ module GroongaQueryLog
320
327
  end
321
328
 
322
329
  case entry.message
323
- when /\Agrn_init:/, /\Amroonga \d+\.\d+ started\.\z/
330
+ when /\Agrn_init: <(.+?)>/, /\Amroonga (\d+\.\d+) started\.\z/
331
+ version = $1
324
332
  process = @running_processes[entry.pid]
325
333
  if process
326
334
  process.finished = true
@@ -328,12 +336,15 @@ module GroongaQueryLog
328
336
  yield(process)
329
337
  @running_processes.delete(entry.pid)
330
338
  end
331
- process = GroongaProcess.new(entry.pid, entry.timestamp, path)
339
+ process = GroongaProcess.new(version,
340
+ entry.pid,
341
+ entry.timestamp,
342
+ path)
332
343
  @running_processes[entry.pid] = process
333
344
  when /\Agrn_fin \((\d+)\)\z/
334
345
  n_leaks = $1.to_i
335
346
  @running_processes[entry.pid] ||=
336
- GroongaProcess.new(entry.pid, Time.at(0), path)
347
+ GroongaProcess.new(nil, entry.pid, Time.at(0), path)
337
348
  process = @running_processes[entry.pid]
338
349
  process.n_leaks = n_leaks
339
350
  process.end_time = entry.timestamp
@@ -343,7 +354,7 @@ module GroongaQueryLog
343
354
  @running_processes.delete(entry.pid)
344
355
  else
345
356
  @running_processes[entry.pid] ||=
346
- GroongaProcess.new(entry.pid, Time.at(0), path)
357
+ GroongaProcess.new(nil, entry.pid, Time.at(0), path)
347
358
  process = @running_processes[entry.pid]
348
359
  case entry.log_level
349
360
  when :notice
@@ -66,6 +66,7 @@ module GroongaQueryLog
66
66
  @rewrite_and_not_operator = false
67
67
  @debug_rewrite = false
68
68
  @omit_rate = 0.0
69
+ @max_limit = -1
69
70
 
70
71
  @care_order = true
71
72
  @ignored_drilldown_keys = []
@@ -313,6 +314,12 @@ module GroongaQueryLog
313
314
  "(#{@omit_rate})") do |rate|
314
315
  @omit_rate = rate
315
316
  end
317
+ parser.on("--max-limit=LIMIT", Integer,
318
+ "Use LIMIT as the max limit value",
319
+ "Negative value doesn't rewrite the limit parameter",
320
+ "(#{@max_limit})") do |limit|
321
+ @max_limit = limit
322
+ end
316
323
 
317
324
  parser.separator("")
318
325
  parser.separator("Comparisons:")
@@ -466,6 +473,7 @@ module GroongaQueryLog
466
473
  @rewrite_and_not_operator,
467
474
  :debug_rewrite => @debug_rewrite,
468
475
  :omit_rate => @omit_rate,
476
+ :max_limit => @max_limit,
469
477
  :target_command_names => @target_command_names,
470
478
  :verify_performance => @verify_performance,
471
479
  :performance_verfifier_options => @performance_verfifier_options,
@@ -790,6 +798,7 @@ module GroongaQueryLog
790
798
  begin
791
799
  ready_queue.push(true)
792
800
  wait_queue.pop
801
+ true
793
802
  ensure
794
803
  @old.shutdown
795
804
  end
@@ -799,6 +808,7 @@ module GroongaQueryLog
799
808
  begin
800
809
  ready_queue.push(true)
801
810
  wait_queue.pop
811
+ true
802
812
  ensure
803
813
  @new.shutdown
804
814
  end
@@ -806,9 +816,10 @@ module GroongaQueryLog
806
816
  test_thread = Thread.new do
807
817
  ready_queue.pop
808
818
  ready_queue.pop
809
- run_test
819
+ success = run_test
810
820
  wait_queue.push(true)
811
821
  wait_queue.push(true)
822
+ success
812
823
  end
813
824
 
814
825
  old_thread_success = old_thread.value
@@ -824,7 +835,7 @@ module GroongaQueryLog
824
835
 
825
836
  private
826
837
  def run_test
827
- same = true
838
+ success = true
828
839
  query_log_paths.each do |query_log_path|
829
840
  log_path = test_log_path(query_log_path)
830
841
  if @options[:skip_finished_queries] and log_path.exist?
@@ -849,14 +860,14 @@ module GroongaQueryLog
849
860
  callback = nil
850
861
  end
851
862
  unless verify_server(log_path, query_log_path, &callback)
852
- same = false
863
+ success = false
853
864
  break if @stop_on_failure
854
865
  end
855
866
  rescue Interrupt
856
867
  puts("Interrupt: #{query_log_path}")
857
868
  end
858
869
  end
859
- same
870
+ success
860
871
  end
861
872
 
862
873
  def verify_server(test_log_path, query_log_path, &callback)
@@ -916,6 +927,10 @@ module GroongaQueryLog
916
927
  command_line << "--omit-rate"
917
928
  command_line << @options[:omit_rate].to_s
918
929
  end
930
+ if @options[:max_limit] >= 0
931
+ command_line << "--max-limit"
932
+ command_line << @options[:max_limit].to_s
933
+ end
919
934
  if @options[:target_command_names]
920
935
  command_line << "--target-command-names"
921
936
  command_line << @options[:target_command_names].join(",")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2020 Horimoto Yasuhiro <horimoto@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -280,6 +280,13 @@ module GroongaQueryLog
280
280
  @options.nullable_reference_number_accessors << accessor
281
281
  end
282
282
 
283
+ parser.on("--max-limit=LIMIT", Integer,
284
+ "Use LIMIT as the max limit value",
285
+ "Negative value doesn't rewrite the limit parameter",
286
+ "(#{@options.max_limit})") do |limit|
287
+ @options.max_limit = limit
288
+ end
289
+
283
290
  create_parser_performance(parser)
284
291
 
285
292
  parser.separator("")
@@ -160,7 +160,7 @@ module GroongaQueryLog
160
160
 
161
161
  def target_statistic?(statistic)
162
162
  if @target_commands
163
- unless @target_commands.include?(statistic.command.name)
163
+ unless @target_commands.include?(statistic.command.command_name)
164
164
  return false
165
165
  end
166
166
  end
@@ -83,19 +83,15 @@ module GroongaQueryLog
83
83
  end
84
84
  begin
85
85
  replay_command(client, id, statistic.command)
86
- rescue Groonga::Client::Error
86
+ rescue => error
87
87
  # TODO: add error log mechanism
88
88
  $stderr.puts(Time.now.iso8601(6))
89
89
  $stderr.puts(statistic.command.original_source)
90
- $stderr.puts($!.raw_error.message)
91
- $stderr.puts($!.raw_error.backtrace)
92
- return false
93
- rescue
94
- # TODO: add error log mechanism
95
- $stderr.puts(Time.now.iso8601(6))
96
- $stderr.puts(statistic.command.original_source)
97
- $stderr.puts($!.message)
98
- $stderr.puts($!.backtrace)
90
+ if error.respond_to?(:raw_error)
91
+ error = raw_error
92
+ end
93
+ $stderr.puts(error.message)
94
+ $stderr.puts(error.backtrace)
99
95
  return false
100
96
  end
101
97
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2020 Sutou Kouhei <kou@clear-code.com>
2
2
  # Copyright (C) 2020 Horimoto Yasuhiro <horimoto@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -170,6 +170,14 @@ module GroongaQueryLog
170
170
  def verify_command(groonga1_client, groonga2_client, command)
171
171
  command["cache"] = "no" if @options.disable_cache?
172
172
  command["cache"] = "no" if @options.verify_performance?
173
+ if @options.max_limit >= 0 and command["limit"]
174
+ limit = command["limit"].to_i
175
+ if limit >= 0
176
+ command["limit"] = [limit, @options.max_limit].min.to_s
177
+ else
178
+ command["limit"] = @options.max_limit.to_s
179
+ end
180
+ end
173
181
  command["output_type"] = "json"
174
182
  rewrite_filter(command, "filter")
175
183
  rewrite_filter(command, "scorer")
@@ -211,23 +219,24 @@ module GroongaQueryLog
211
219
 
212
220
  n_tries = 4
213
221
  n_tries.times do
222
+ return if stop?
223
+
214
224
  responses1 << groonga1_client.execute(command)
215
225
  responses2 << groonga2_client.execute(command)
216
226
  verifier = PerformanceVerifier.new(command,
217
227
  responses1,
218
228
  responses2,
219
229
  @options.performance_verifier_options)
220
- if verifier.slow?
221
- @slow = true
222
- @events.push([:slow,
223
- command,
224
- verifier.old_elapsed_time,
225
- verifier.new_elapsed_time,
226
- verifier.old_elapsed_times,
227
- verifier.new_elapsed_times])
228
- return
229
- end
230
+ return unless verifier.slow?
230
231
  end
232
+
233
+ @slow = true
234
+ @events.push([:slow,
235
+ command,
236
+ verifier.old_elapsed_time,
237
+ verifier.new_elapsed_time,
238
+ verifier.old_elapsed_times,
239
+ verifier.new_elapsed_times])
231
240
  end
232
241
 
233
242
  def rewrite_filter(command, name)
@@ -316,6 +325,7 @@ module GroongaQueryLog
316
325
  attr_reader :performance_verifier_options
317
326
  attr_writer :debug_rewrite
318
327
  attr_writer :omit_rate
328
+ attr_accessor :max_limit
319
329
  def initialize
320
330
  @groonga1 = GroongaOptions.new
321
331
  @groonga2 = GroongaOptions.new
@@ -350,6 +360,7 @@ module GroongaQueryLog
350
360
  @performance_verifier_options = PerformanceVerifier::Options.new
351
361
  @debug_rewrite = false
352
362
  @omit_rate = 0.0
363
+ @max_limit = -1
353
364
  end
354
365
 
355
366
  def request_queue_size
@@ -115,6 +115,7 @@ module GroongaQueryLog
115
115
  end
116
116
 
117
117
  def select_family_command?
118
+ return false if command.nil?
118
119
  case command.command_name
119
120
  when "select", "range_filter"
120
121
  true
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module GroongaQueryLog
18
- VERSION = "1.7.0"
18
+ VERSION = "1.7.5"
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-30 00:00:00.000000000 Z
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charty
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubygems_version: 3.2.0.pre1
318
+ rubygems_version: 3.2.0.rc.2
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: Groonga-query-log is a collection of library and tools to process [Groonga](http://groonga.org/)'s