groonga-query-log 1.7.6 → 1.7.7

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: 5c1dd6a2bc5f431a4003c5468aa573a55563107a7eb875ef6af59b2150bb0ab9
4
- data.tar.gz: 503abaf07344e2453e74bf34fd053560ce2bb3acce212527ea0559520167e81b
3
+ metadata.gz: af3ac522ec27ea395b44209b8ab56521de14b828d67bf4b8d4dad52bb0df2d1c
4
+ data.tar.gz: c570a4a49aad267b71047d992e0593afac1290135711a7f45b8114ded4232dbd
5
5
  SHA512:
6
- metadata.gz: ff08e69d1c1197d42fc763a685e2780e24c4e6432c3b04035b5076b1cd0fe126411fc36a8965da55abbde8cf94ac59a5032bc0028f52ceea6143abb5084c9f30
7
- data.tar.gz: f4d689ada13d114ffce2f7d4d6d50ca6d38dbce1974a6df7fba5e9d677234d451de0da939aef0720f5876715d6d3848741cb8abbfeb12c005f6b0fa0983eb3b7
6
+ metadata.gz: 7f0dc1247dc380bd50f8b249fcc7976a800bb67de75f10e4cd600741508f4236d89aa750277043336dc4abd561641804cf53056373338ef9ae2dd2b0f9cc5c0e
7
+ data.tar.gz: ddcce99bb10e8b8876fbbce95d9c0c49f5d1b8ca7e6ce8beb4a9178624ab169475ce49173c33f1e1a5796909ae20c1fa1976126033c944757859f18e9a05689f
data/doc/text/news.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # News
2
2
 
3
+ ## 1.7.7: 2024-04-08
4
+
5
+ ### Improvements
6
+
7
+ * `run-regression-test`: Added a test to verify that the `request_cancel` command can be successfully cancelled.
8
+
9
+ * `analyze-load`: Added support for reporting throughput.
10
+
3
11
  ## 1.7.6: 2021-02-24
4
12
 
5
13
  ### Improvements
@@ -54,6 +54,7 @@ Gem::Specification.new do |spec|
54
54
 
55
55
  spec.add_runtime_dependency("charty")
56
56
  spec.add_runtime_dependency("diff-lcs")
57
+ spec.add_runtime_dependency("net-smtp")
57
58
  spec.add_runtime_dependency("groonga-client", ">= 0.6.2")
58
59
  spec.add_runtime_dependency("groonga-log", ">= 0.1.2")
59
60
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017-2018 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2017-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -147,9 +147,15 @@ module GroongaQueryLog
147
147
  n_column_errors = nil
148
148
  total = nil
149
149
  end
150
+ if n_loaded_records and n_loaded_records > 0
151
+ throughput = statistic.elapsed_in_seconds / n_loaded_records
152
+ else
153
+ throughput = nil
154
+ end
150
155
  entry = [
151
156
  statistic.start_time.iso8601,
152
157
  statistic.elapsed_in_seconds,
158
+ throughput,
153
159
  load_command.table,
154
160
  n_loaded_records,
155
161
  n_record_errors,
@@ -171,6 +177,7 @@ module GroongaQueryLog
171
177
  header = [
172
178
  "start_time",
173
179
  "elapsed",
180
+ "throughput",
174
181
  "table",
175
182
  "n_loaded_records",
176
183
  "n_record_errors",
@@ -67,6 +67,8 @@ module GroongaQueryLog
67
67
  @debug_rewrite = false
68
68
  @omit_rate = 0.0
69
69
  @max_limit = -1
70
+ @verify_cancel = false
71
+ @cancel_max_wait = 5.0
70
72
 
71
73
  @care_order = true
72
74
  @ignored_drilldown_keys = []
@@ -426,6 +428,20 @@ module GroongaQueryLog
426
428
  "(#{@notifier_options[:mail_only_on_failure]})") do |boolean|
427
429
  @notifier_options[:mail_only_on_failure] = boolean
428
430
  end
431
+ parser.on("--[no-]verify-cancel",
432
+ "Verify cancellation",
433
+ "(#{@verify_cancel})") do |boolean|
434
+ @verify_cancel = boolean
435
+ end
436
+ parser.on("--cancel-max-wait=SECONDS", Float,
437
+ "Used with --verify_cancel. " +
438
+ "You can specify the maximum number of seconds to wait " +
439
+ "before sending request_cancel command. " +
440
+ "For example, if you specify 5.0 in this option, " +
441
+ "wait randomly between 0~5.0 seconds before sending request_cancel command.",
442
+ "(#{@cancel_max_wait})") do |seconds|
443
+ @cancel_max_wait = seconds
444
+ end
429
445
  parser
430
446
  end
431
447
 
@@ -478,6 +494,8 @@ module GroongaQueryLog
478
494
  :verify_performance => @verify_performance,
479
495
  :performance_verfifier_options => @performance_verfifier_options,
480
496
  :read_timeout => @read_timeout,
497
+ :verify_cancel => @verify_cancel,
498
+ :cancel_max_wait => @cancel_max_wait,
481
499
  }
482
500
  directory_options.merge(options)
483
501
  end
@@ -517,7 +535,7 @@ module GroongaQueryLog
517
535
  end
518
536
  formatted << "\n"
519
537
  unless n_leaked_objects.zero?
520
- formatted << "\nLeaked: #{n_leaked_objects}"
538
+ formatted << "\nLeaked: #{n_leaked_objects}\n"
521
539
  end
522
540
  unless success
523
541
  output = StringIO.new
@@ -945,6 +963,11 @@ module GroongaQueryLog
945
963
  command_line << "--read-timeout"
946
964
  command_line << @options[:read_timeout].to_s
947
965
  end
966
+ if @options[:verify_cancel]
967
+ command_line << "--verify_cancel"
968
+ command_line << "--cancel-max-wait"
969
+ command_line << @options[:cancel_max_wait].to_s
970
+ end
948
971
  verify_server = VerifyServer.new
949
972
  same = verify_server.run(command_line, &callback)
950
973
  @n_executed_commands = verify_server.n_executed_commands
@@ -287,6 +287,22 @@ module GroongaQueryLog
287
287
  @options.max_limit = limit
288
288
  end
289
289
 
290
+ parser.on("--[no-]verify-cancel",
291
+ "Verify cancellation",
292
+ "(#{@options.verify_cancel?})") do |boolean|
293
+ @options.verify_cancel = boolean
294
+ end
295
+
296
+ parser.on("--cancel-max-wait=SECONDS", Float,
297
+ "Used with --verify_cancel. " +
298
+ "You can specify the maximum number of seconds to wait " +
299
+ "before sending request_cancel command. " +
300
+ "For example, if you specify 5.0 in this option, " +
301
+ "wait randomly between 0~5.0 seconds before sending request_cancel command.",
302
+ "(#{@options.cancel_max_wait})") do |seconds|
303
+ @options.cancel_max_wait = seconds
304
+ end
305
+
290
306
  create_parser_performance(parser)
291
307
 
292
308
  parser.separator("")
@@ -27,12 +27,15 @@ require "groonga-query-log/response-comparer"
27
27
 
28
28
  module GroongaQueryLog
29
29
  class ServerVerifier
30
+ GRN_CANCEL = -77
31
+
30
32
  attr_reader :n_executed_commands
31
33
  def initialize(options)
32
34
  @options = options
33
35
  @queue = SizedQueue.new(@options.request_queue_size)
34
36
  @events = Queue.new
35
37
  @n_executed_commands = 0
38
+ @request_id_counter = 0
36
39
  end
37
40
 
38
41
  def verify(input, &callback)
@@ -167,9 +170,15 @@ module GroongaQueryLog
167
170
  @options.stop_on_failure? and failed?
168
171
  end
169
172
 
173
+ def generate_request_id
174
+ (@request_id_counter += 1).to_s
175
+ end
176
+
170
177
  def verify_command(groonga1_client, groonga2_client, command)
171
178
  command["cache"] = "no" if @options.disable_cache?
172
179
  command["cache"] = "no" if @options.verify_performance?
180
+ command["request_id"] = generate_request_id if @options.verify_cancel?
181
+
173
182
  if @options.max_limit >= 0 and command["limit"]
174
183
  limit = command["limit"].to_i
175
184
  if limit >= 0
@@ -181,8 +190,26 @@ module GroongaQueryLog
181
190
  command["output_type"] = "json"
182
191
  rewrite_filter(command, "filter")
183
192
  rewrite_filter(command, "scorer")
193
+
184
194
  response1 = groonga1_client.execute(command)
185
- response2 = groonga2_client.execute(command)
195
+ # groonga2 is new Groonga.
196
+ response2 = nil
197
+ if @options.verify_cancel?
198
+ request = groonga2_client.execute(command) do |response|
199
+ response2 = response
200
+ end
201
+ # Randomize timing of sending request_cancel command
202
+ sleep(rand(0..@options.cancel_max_wait))
203
+ @options.groonga2.create_client do |cancel_client|
204
+ cancel_client.execute("request_cancel", id: command.request_id)
205
+ end
206
+ request.wait
207
+
208
+ return if response2.return_code == GRN_CANCEL
209
+ else
210
+ response2 = groonga2_client.execute(command)
211
+ end
212
+
186
213
  compare_options = {
187
214
  :care_order => @options.care_order,
188
215
  :ignored_drilldown_keys => @options.ignored_drilldown_keys,
@@ -326,6 +353,8 @@ module GroongaQueryLog
326
353
  attr_writer :debug_rewrite
327
354
  attr_writer :omit_rate
328
355
  attr_accessor :max_limit
356
+ attr_writer :verify_cancel
357
+ attr_writer :cancel_max_wait
329
358
  def initialize
330
359
  @groonga1 = GroongaOptions.new
331
360
  @groonga2 = GroongaOptions.new
@@ -361,6 +390,8 @@ module GroongaQueryLog
361
390
  @debug_rewrite = false
362
391
  @omit_rate = 0.0
363
392
  @max_limit = -1
393
+ @verify_cancel = false
394
+ @cancel_max_wait = 5.0
364
395
  end
365
396
 
366
397
  def request_queue_size
@@ -460,6 +491,14 @@ module GroongaQueryLog
460
491
  def omit_rate
461
492
  @omit_rate
462
493
  end
494
+
495
+ def verify_cancel?
496
+ @verify_cancel
497
+ end
498
+
499
+ def cancel_max_wait
500
+ @cancel_max_wait
501
+ end
463
502
  end
464
503
 
465
504
  class GroongaOptions
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -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.6"
18
+ VERSION = "1.7.7"
19
19
  end
@@ -51,7 +51,7 @@ class ReplayerTest < Test::Unit::TestCase
51
51
  :read_timeout => 60,
52
52
  }
53
53
  expected_open_options = default_options.merge(expected_options)
54
- mock(Groonga::Client).open(expected_open_options).yields(client) do
54
+ mock(Groonga::Client).open(**expected_open_options).yields(client) do
55
55
  client
56
56
  end
57
57
  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.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charty
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-smtp
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: groonga-client
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -315,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
329
  - !ruby/object:Gem::Version
316
330
  version: '0'
317
331
  requirements: []
318
- rubygems_version: 3.3.0.dev
332
+ rubygems_version: 3.3.5
319
333
  signing_key:
320
334
  specification_version: 4
321
335
  summary: Groonga-query-log is a collection of library and tools to process [Groonga](http://groonga.org/)'s