groonga-query-log 1.6.8 → 1.7.3

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: eae04a296ec14c5c76495fed6305cbf2bd483ae3d1f75927c876d788deaa61ed
4
- data.tar.gz: ae995f3d7b5bb5b93fdc380aa3cba02b6de0b5a5a356879c811190c3054fcd27
3
+ metadata.gz: fca209c185dcd27bb15bdf7444261a754f33d40f73ffe1f1141fc8fe5a2c61ac
4
+ data.tar.gz: 4efd951340f55639e8d83fbd69d13ef411ca6c62bc0f4bfae59afd982c9d2571
5
5
  SHA512:
6
- metadata.gz: '02049e8d2e93ad2f0c5564c7492e2b999e54feca6df4beadb1cc7555c25b31980a8b80c223c81873c63b6827f37a06ae340b7bb42ef943c24757632e1e9a115b'
7
- data.tar.gz: db3778e5ebe80afc1b789cf8484d3ad65651d907388bd69e1c41fa5531fbe1fec4253af8bd5eee5e02d1ac6d53f108d43587cbd2aad2230bd7e493f8df304f64
6
+ metadata.gz: fd72aaaf751c2acee54c88eeb9e8b04d528d5d9debc29405afbba617341b89e59012cb8e34fe2e5088b8e945aa8bf8f2610f4329a16b848c51c51ebdf4b75d3e
7
+ data.tar.gz: b366ad6ce14ffd22da56c7f4432cf59856a6896bdf1a13ebad9d9689043934ab3a13722fb76bb7b5a22a7cdcecc00da62e29940bf191a98b0483bc63af4e17f1
@@ -1,5 +1,50 @@
1
1
  # News
2
2
 
3
+ ## 1.7.3: 2020-11-12
4
+
5
+ ### Improvements
6
+
7
+ * `check-crash`: Added support for showing Groonga version.
8
+
9
+ * `server-verifier`: Added `--max-limit` option.
10
+
11
+ * `run-regression-test`: Added `--max-limit` option.
12
+
13
+ ### Fixes
14
+
15
+ * `GroongaQueryLog::Parser`: Fixed a bug that target command filter
16
+ may not work.
17
+
18
+ ## 1.7.2: 2020-06-02
19
+
20
+ ### Fixes
21
+
22
+ * `server-verifier`: Fixed a bug that performance verification
23
+ doesn't try 5 times.
24
+
25
+ ## 1.7.1: 2020-06-01
26
+
27
+ ### Fixes
28
+
29
+ * `server-verifier`: Fixed a bug that performance verification with
30
+ `--stop-onlfailre` doesn't work.
31
+
32
+ * `run-regression-test`: Fixed a bug that failure is ignored.
33
+
34
+ ## 1.7.0: 2020-05-31
35
+
36
+ ### Fixes
37
+
38
+ * `server-verifier`: Fixed a bug that performance verification
39
+ doesn't work.
40
+
41
+ ## 1.6.9: 2020-05-30
42
+
43
+ ### Fixes
44
+
45
+ * `server-verifier`: Fixed a bug that performance verification
46
+ doesn't work.
47
+
3
48
  ## 1.6.8: 2020-05-30
4
49
 
5
50
  ### Improvements
@@ -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",
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",
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")
@@ -188,11 +196,19 @@ module GroongaQueryLog
188
196
  end
189
197
 
190
198
  if @options.verify_performance?
191
- verify_performance(command, response1, response2)
199
+ verify_performance(command,
200
+ groonga1_client,
201
+ groonga2_client,
202
+ response1,
203
+ response2)
192
204
  end
193
205
  end
194
206
 
195
- def verify_performance(command, response1, response2)
207
+ def verify_performance(command,
208
+ groonga1_client,
209
+ groonga2_client,
210
+ response1,
211
+ response2)
196
212
  responses1 = [response1]
197
213
  responses2 = [response2]
198
214
  verifier = PerformanceVerifier.new(command,
@@ -203,23 +219,24 @@ module GroongaQueryLog
203
219
 
204
220
  n_tries = 4
205
221
  n_tries.times do
222
+ return if stop?
223
+
206
224
  responses1 << groonga1_client.execute(command)
207
225
  responses2 << groonga2_client.execute(command)
208
226
  verifier = PerformanceVerifier.new(command,
209
227
  responses1,
210
228
  responses2,
211
229
  @options.performance_verifier_options)
212
- if verifier.slow?
213
- @slow = true
214
- @events.push([:slow,
215
- command,
216
- verifier.old_elapsed_time,
217
- verifier.new_elapsed_time,
218
- verifier.old_elapsed_time,
219
- verifier.new_elapsed_time])
220
- return
221
- end
230
+ return unless verifier.slow?
222
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])
223
240
  end
224
241
 
225
242
  def rewrite_filter(command, name)
@@ -308,6 +325,7 @@ module GroongaQueryLog
308
325
  attr_reader :performance_verifier_options
309
326
  attr_writer :debug_rewrite
310
327
  attr_writer :omit_rate
328
+ attr_accessor :max_limit
311
329
  def initialize
312
330
  @groonga1 = GroongaOptions.new
313
331
  @groonga2 = GroongaOptions.new
@@ -342,6 +360,7 @@ module GroongaQueryLog
342
360
  @performance_verifier_options = PerformanceVerifier::Options.new
343
361
  @debug_rewrite = false
344
362
  @omit_rate = 0.0
363
+ @max_limit = -1
345
364
  end
346
365
 
347
366
  def request_queue_size
@@ -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.6.8"
18
+ VERSION = "1.7.3"
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.6.8
4
+ version: 1.7.3
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-12 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