groonga-query-log 1.7.2 → 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: b9d218a019817b6222c63db7cb6dcde54452d56dba3ad1026e678e0d64a8ca1c
4
- data.tar.gz: 4755e11de2ab221a1db0a1d6c2fa86c3bf05e18c3cd30e451096160bf870e169
3
+ metadata.gz: fca209c185dcd27bb15bdf7444261a754f33d40f73ffe1f1141fc8fe5a2c61ac
4
+ data.tar.gz: 4efd951340f55639e8d83fbd69d13ef411ca6c62bc0f4bfae59afd982c9d2571
5
5
  SHA512:
6
- metadata.gz: 1380025523bbb3debb587da39f774f7e2cb7aab6301e2d6f66ebf9c7fed3baccbfa5e4fc57202db3e1d00c53a37686196d1165df560ba9c824cce68efd21af03
7
- data.tar.gz: ed36cd1e75dc79eb701238bad818ee0a42531d1ff47ebaba255bdfeb68574f173f49e44f0e38e786d45d41981d720c6ac2e5d32f6a84fa8abebdcde0adebe8bb
6
+ metadata.gz: fd72aaaf751c2acee54c88eeb9e8b04d528d5d9debc29405afbba617341b89e59012cb8e34fe2e5088b8e945aa8bf8f2610f4329a16b848c51c51ebdf4b75d3e
7
+ data.tar.gz: b366ad6ce14ffd22da56c7f4432cf59856a6896bdf1a13ebad9d9689043934ab3a13722fb76bb7b5a22a7cdcecc00da62e29940bf191a98b0483bc63af4e17f1
@@ -1,5 +1,20 @@
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
+
3
18
  ## 1.7.2: 2020-06-02
4
19
 
5
20
  ### 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",
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,
@@ -919,6 +927,10 @@ module GroongaQueryLog
919
927
  command_line << "--omit-rate"
920
928
  command_line << @options[:omit_rate].to_s
921
929
  end
930
+ if @options[:max_limit] >= 0
931
+ command_line << "--max-limit"
932
+ command_line << @options[:max_limit].to_s
933
+ end
922
934
  if @options[:target_command_names]
923
935
  command_line << "--target-command-names"
924
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")
@@ -317,6 +325,7 @@ module GroongaQueryLog
317
325
  attr_reader :performance_verifier_options
318
326
  attr_writer :debug_rewrite
319
327
  attr_writer :omit_rate
328
+ attr_accessor :max_limit
320
329
  def initialize
321
330
  @groonga1 = GroongaOptions.new
322
331
  @groonga2 = GroongaOptions.new
@@ -351,6 +360,7 @@ module GroongaQueryLog
351
360
  @performance_verifier_options = PerformanceVerifier::Options.new
352
361
  @debug_rewrite = false
353
362
  @omit_rate = 0.0
363
+ @max_limit = -1
354
364
  end
355
365
 
356
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.7.2"
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.7.2
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-06-01 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