groonga-query-log 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +11 -0
- data/lib/groonga-query-log/command/check-performance-regression.rb +64 -26
- data/lib/groonga-query-log/version.rb +1 -1
- data/test/command/test-check-performance-regression.rb +27 -5
- data/test/fixtures/check-performance-regression/different_operations1.log +9 -0
- data/test/fixtures/check-performance-regression/different_operations2.log +7 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c4745d088436d712bbc9d1b010c0219008baac00d05f5c5ebb59423912353ab
|
4
|
+
data.tar.gz: 3d663956a09c081278a1f6a06534dfcd08e7a46c5ee270d06469be274817f8d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 705cfcf529854898bd27884a714ac123776f8e560e088ebacc5860049061de29c3454bcfafd45ab3655d812492659ced950d9fa66727d831fb4d7b3961cf779c
|
7
|
+
data.tar.gz: eccf8a59cb0f6faba614bf9e4beae35228c4b3634a04e3d2a1af0fa50d7da60750e53a6ef891a3295c301bb47301c38685ece802b001b5a2e12ef4df1c384916
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
|
4
|
+
## 1.5.2: 2019-09-26
|
5
|
+
|
6
|
+
### Improvements
|
7
|
+
|
8
|
+
* `check-performance-regression`:
|
9
|
+
|
10
|
+
* Added support that the case which different operations exist.
|
11
|
+
|
12
|
+
* Added support for multiple operation sets.
|
13
|
+
|
3
14
|
## 1.5.1: 2019-09-13
|
4
15
|
|
5
16
|
### Improvements
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# Copyright (C) 2019 Kentaro Hayashi <hayashi@clear-code.com>
|
2
2
|
# Copyright (C) 2019 Sutou Kouhei <kou@clear-code.com>
|
3
|
+
# Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
3
4
|
#
|
4
5
|
# This library is free software; you can redistribute it and/or
|
5
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -278,6 +279,15 @@ module GroongaQueryLog
|
|
278
279
|
end
|
279
280
|
end
|
280
281
|
|
282
|
+
class OperationSet
|
283
|
+
attr_reader :names
|
284
|
+
attr_reader :statistics
|
285
|
+
def initialize(names, statistics)
|
286
|
+
@names = names
|
287
|
+
@statistics = statistics
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
281
291
|
class QueryStatistic < Statistic
|
282
292
|
attr_reader :query
|
283
293
|
def initialize(query, old, new, threshold)
|
@@ -289,22 +299,44 @@ module GroongaQueryLog
|
|
289
299
|
@threshold.slow_query?(diff_elapsed_time, ratio)
|
290
300
|
end
|
291
301
|
|
292
|
-
def
|
293
|
-
@old.
|
294
|
-
|
295
|
-
|
302
|
+
def operation_sets
|
303
|
+
old_operation_name_sets = @old.group_by do |statistic|
|
304
|
+
statistic.operations.collect do |operation|
|
305
|
+
operation[:name]
|
306
|
+
end
|
307
|
+
end
|
308
|
+
new_operation_name_sets = @new.group_by do |statistic|
|
309
|
+
statistic.operations.collect do |operation|
|
310
|
+
operation[:name]
|
296
311
|
end
|
297
|
-
|
298
|
-
|
299
|
-
|
312
|
+
end
|
313
|
+
|
314
|
+
operation_sets = []
|
315
|
+
operation_name_sets =
|
316
|
+
(old_operation_name_sets.keys & new_operation_name_sets.keys)
|
317
|
+
operation_name_sets.each do |operation_names|
|
318
|
+
old = old_operation_name_sets[operation_names]
|
319
|
+
next if old.nil?
|
320
|
+
new = new_operation_name_sets[operation_names]
|
321
|
+
next if new.nil?
|
322
|
+
statistics = operation_names.size.times.collect do |i|
|
323
|
+
old_operations = old.collect do |statistic|
|
324
|
+
statistic.operations[i]
|
325
|
+
end
|
326
|
+
new_operations = new.collect do |statistic|
|
327
|
+
statistic.operations[i]
|
328
|
+
end
|
329
|
+
operation = old_operations[0]
|
330
|
+
OperationStatistic.new(operation,
|
331
|
+
i,
|
332
|
+
old_operations,
|
333
|
+
new_operations,
|
334
|
+
@threshold)
|
300
335
|
end
|
301
|
-
|
302
|
-
|
303
|
-
old_operations,
|
304
|
-
new_operations,
|
305
|
-
@threshold)
|
306
|
-
yield(operation_statistic)
|
336
|
+
operation_set = OperationSet.new(operation_names, statistics)
|
337
|
+
operation_sets << operation_set
|
307
338
|
end
|
339
|
+
operation_sets
|
308
340
|
end
|
309
341
|
|
310
342
|
private
|
@@ -355,25 +387,31 @@ Query: #{query_statistic.query}
|
|
355
387
|
Mean (old): #{format_elapsed_time(query_statistic.old_elapsed_time)}
|
356
388
|
Mean (new): #{format_elapsed_time(query_statistic.new_elapsed_time)}
|
357
389
|
Diff: #{format_diff(query_statistic)}
|
358
|
-
Operations:
|
359
390
|
REPORT
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
n_slow_operations += 1
|
365
|
-
index = operation_statistic.index
|
366
|
-
name = operation_statistic.name
|
367
|
-
context = operation_statistic.context
|
368
|
-
label = [name, context].compact.join(" ")
|
369
|
-
old_elapsed_time = operation_statistic.old_elapsed_time
|
370
|
-
new_elapsed_time = operation_statistic.new_elapsed_time
|
391
|
+
|
392
|
+
operation_sets = query_statistic.operation_sets
|
393
|
+
operation_sets.each_with_index do |operation_set, nth_operation_set|
|
371
394
|
@output.puts(<<-REPORT)
|
395
|
+
Operation set[#{nth_operation_set}]:
|
396
|
+
REPORT
|
397
|
+
operation_set.statistics.each do |operation_statistic|
|
398
|
+
n_target_operations += 1
|
399
|
+
next unless operation_statistic.slow?
|
400
|
+
|
401
|
+
n_slow_operations += 1
|
402
|
+
index = operation_statistic.index
|
403
|
+
name = operation_statistic.name
|
404
|
+
context = operation_statistic.context
|
405
|
+
label = [name, context].compact.join(" ")
|
406
|
+
old_elapsed_time = operation_statistic.old_elapsed_time
|
407
|
+
new_elapsed_time = operation_statistic.new_elapsed_time
|
408
|
+
@output.puts(<<-REPORT)
|
372
409
|
Operation[#{index}]: #{label}
|
373
410
|
Mean (old): #{format_elapsed_time(old_elapsed_time)}
|
374
411
|
Mean (new): #{format_elapsed_time(new_elapsed_time)}
|
375
412
|
Diff: #{format_diff(operation_statistic)}
|
376
|
-
|
413
|
+
REPORT
|
414
|
+
end
|
377
415
|
end
|
378
416
|
end
|
379
417
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# Copyright (C) 2019 Kentaro Hayashi <hayashi@clear-code.com>
|
2
|
+
# Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
2
3
|
#
|
3
4
|
# This library is free software; you can redistribute it and/or
|
4
5
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -118,7 +119,7 @@ Query: select --table Site --limit 0
|
|
118
119
|
Mean (old): 12.0msec
|
119
120
|
Mean (new): 14.0msec
|
120
121
|
Diff: +2.0msec/+1.17
|
121
|
-
|
122
|
+
Operation set[0]:
|
122
123
|
Operation[0]: select
|
123
124
|
Mean (old): 5.0msec
|
124
125
|
Mean (new): 6.0msec
|
@@ -146,7 +147,7 @@ Query: select --table Site --filter "_id >= 4 && _id <= 6"
|
|
146
147
|
Mean (old): 70.0msec
|
147
148
|
Mean (new): 90.0msec
|
148
149
|
Diff: +20.0msec/+1.29
|
149
|
-
|
150
|
+
Operation set[0]:
|
150
151
|
Operation[0]: filter #<accessor _id(Site)> greater_equal 4
|
151
152
|
Mean (old): 40.0msec
|
152
153
|
Mean (new): 80.0msec
|
@@ -186,7 +187,7 @@ Query: select --table Site --limit 0
|
|
186
187
|
Mean (old): 12.0msec
|
187
188
|
Mean (new): 14.0msec
|
188
189
|
Diff: +2.0msec/+1.17
|
189
|
-
|
190
|
+
Operation set[0]:
|
190
191
|
Operation[0]: select
|
191
192
|
Mean (old): 5.0msec
|
192
193
|
Mean (new): 6.0msec
|
@@ -233,7 +234,7 @@ Query: select --table Site --limit 0
|
|
233
234
|
Mean (old): 12.0msec
|
234
235
|
Mean (new): 14.0msec
|
235
236
|
Diff: +2.0msec/+1.17
|
236
|
-
|
237
|
+
Operation set[0]:
|
237
238
|
Summary:
|
238
239
|
Slow queries: 1/1(100.00%)
|
239
240
|
Slow operations: 0/2( 0.00%)
|
@@ -276,7 +277,7 @@ Query: select --table Site --limit 0
|
|
276
277
|
Mean (old): 12.0msec
|
277
278
|
Mean (new): 14.0msec
|
278
279
|
Diff: +2.0msec/+1.17
|
279
|
-
|
280
|
+
Operation set[0]:
|
280
281
|
Operation[0]: select
|
281
282
|
Mean (old): 5.0msec
|
282
283
|
Mean (new): 6.0msec
|
@@ -308,4 +309,25 @@ Summary:
|
|
308
309
|
assert_equal(expected, actual)
|
309
310
|
end
|
310
311
|
end
|
312
|
+
|
313
|
+
def test_different_operations
|
314
|
+
actual = run_command("--slow-query-ratio=0.0",
|
315
|
+
"--slow-query-second=0.0",
|
316
|
+
"--slow-operation-ratio=0.0",
|
317
|
+
"--slow-operation-second=0.0",
|
318
|
+
fixture_path("different_operations1.log"),
|
319
|
+
fixture_path("different_operations2.log"))
|
320
|
+
expected = <<-OUTPUT
|
321
|
+
Query: select Memos --output_columns _key,tag --filter 'all_records() && (tag == \"groonga\" || tag == \"mroonga\" || tag == \"droonga\")' --sortby _id
|
322
|
+
Mean (old): 7.1msec
|
323
|
+
Mean (new): 82.8msec
|
324
|
+
Diff: +75.7msec/+11.64
|
325
|
+
Summary:
|
326
|
+
Slow queries: 1/1(100.00%)
|
327
|
+
Slow operations: 0/0( 0.00%)
|
328
|
+
Caches (old): 0/1( 0.00%)
|
329
|
+
Caches (new): 0/1( 0.00%)
|
330
|
+
OUTPUT
|
331
|
+
assert_equal(expected, actual)
|
332
|
+
end
|
311
333
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
2019-09-24 11:26:52.247684|0x7ffd3772d330|>select Memos --output_columns _key,tag --filter 'all_records() && (tag == "groonga" || tag == "mroonga" || tag == "droonga")' --sortby _id
|
2
|
+
2019-09-24 11:26:52.254556|0x7ffd3772d330|:000000006876176 filter(2): Memos.tag equal #<record:pat:Tags id:1 key:"groonga">
|
3
|
+
2019-09-24 11:26:52.254577|0x7ffd3772d330|:000000006896105 filter(3): Memos.tag equal #<record:pat:Tags id:2 key:"mroonga">
|
4
|
+
2019-09-24 11:26:52.254589|0x7ffd3772d330|:000000006907737 filter(4): Memos.tag equal #<record:pat:Tags id:4 key:"droonga">
|
5
|
+
2019-09-24 11:26:52.254601|0x7ffd3772d330|:000000006919999 filter(4): all_records()
|
6
|
+
2019-09-24 11:26:52.254608|0x7ffd3772d330|:000000006926366 select(4)
|
7
|
+
2019-09-24 11:26:52.254649|0x7ffd3772d330|:000000006968407 sort(4): _id
|
8
|
+
2019-09-24 11:26:52.254696|0x7ffd3772d330|:000000007015885 output(4)
|
9
|
+
2019-09-24 11:26:52.254795|0x7ffd3772d330|<000000007115023 rc=0
|
@@ -0,0 +1,7 @@
|
|
1
|
+
2019-09-24 11:28:16.384410|0x7ffcd86f6b40|>select Memos --output_columns _key,tag --filter 'all_records() && (tag == "groonga" || tag == "mroonga" || tag == "droonga")' --sortby _id
|
2
|
+
2019-09-24 11:28:16.467000|0x7ffcd86f6b40|:000000082594372 filter(4): in_values(Memos.tag, #<record:pat:Tags id:1 key:"groonga">, #<record:pat:Tags id:2 key:"mroonga">, #<record:pat:Tags id:4 key:"droonga">)
|
3
|
+
2019-09-24 11:28:16.467016|0x7ffcd86f6b40|:000000082610035 filter(4): all_records()
|
4
|
+
2019-09-24 11:28:16.467038|0x7ffcd86f6b40|:000000082633089 select(4)
|
5
|
+
2019-09-24 11:28:16.467067|0x7ffcd86f6b40|:000000082662096 sort(4): _id
|
6
|
+
2019-09-24 11:28:16.467129|0x7ffcd86f6b40|:000000082723557 output(4)
|
7
|
+
2019-09-24 11:28:16.467194|0x7ffcd86f6b40|<000000082788858 rc=0
|
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.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -239,6 +239,8 @@ files:
|
|
239
239
|
- test/command/test-format-regression-test-logs.rb
|
240
240
|
- test/command/test-run-regression-test.rb
|
241
241
|
- test/fixtures/check-performance-regression/cache.log
|
242
|
+
- test/fixtures/check-performance-regression/different_operations1.log
|
243
|
+
- test/fixtures/check-performance-regression/different_operations2.log
|
242
244
|
- test/fixtures/check-performance-regression/nquery.log
|
243
245
|
- test/fixtures/check-performance-regression/nquery2.log
|
244
246
|
- test/fixtures/check-performance-regression/query1.log
|
@@ -305,9 +307,11 @@ test_files:
|
|
305
307
|
- test/fixtures/n_entries.expected
|
306
308
|
- test/fixtures/check-performance-regression/query1.log
|
307
309
|
- test/fixtures/check-performance-regression/cache.log
|
310
|
+
- test/fixtures/check-performance-regression/different_operations2.log
|
308
311
|
- test/fixtures/check-performance-regression/nquery2.log
|
309
312
|
- test/fixtures/check-performance-regression/nquery.log
|
310
313
|
- test/fixtures/check-performance-regression/query2.log
|
314
|
+
- test/fixtures/check-performance-regression/different_operations1.log
|
311
315
|
- test/fixtures/target-tables.expected
|
312
316
|
- test/fixtures/no-report-summary.expected
|
313
317
|
- test/fixtures/order/-start-time.expected
|