grntest 1.8.5 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +47 -0
- data/doc/text/news.md +14 -0
- data/lib/grntest/execution-context.rb +3 -1
- data/lib/grntest/executors/base-executor.rb +67 -2
- data/lib/grntest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c59c4eb36a3ebc1ac542ffc9bbc5f87d2756ec899c58a105976958f01821a3d
|
|
4
|
+
data.tar.gz: 17a66afc2d549cbf0234f03cca393bed5dd8c86dd6841ec26492625f4fdfe3d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b4468d6a5513043ac62d1d5b1596d093a46bfaf9709f492500bacffa2de6c384fb564c00bacfaa2de659d805c092d6bffadb53991a46d3e2aa8bf54d388972b
|
|
7
|
+
data.tar.gz: b265cd5cd7cdca7eb31477feff524fc111b2d334a2e5f19495882dc2df83e2bb3a31c0ff9a1b7ba346a39622d181314545be251cd1fabba058712fb50db9710f
|
data/README.md
CHANGED
|
@@ -221,6 +221,7 @@ Here are available `NAME` s:
|
|
|
221
221
|
* `remove-important-log-levels`
|
|
222
222
|
* `sleep`
|
|
223
223
|
* `collect-query-log`
|
|
224
|
+
* `sort-query-log-operations`
|
|
224
225
|
|
|
225
226
|
`ARGUMENTS...` are depends on directive. A directive doesn't require
|
|
226
227
|
any arguments but a directive requires arguments.
|
|
@@ -555,6 +556,52 @@ select Users --query _key:User1
|
|
|
555
556
|
#@collect-query-log false
|
|
556
557
|
```
|
|
557
558
|
|
|
559
|
+
#### `sort-query-log-operations`
|
|
560
|
+
|
|
561
|
+
Usage:
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
#@sort-query-log-operations [SORT_KEY_1 SORT_KEY_2 ...]
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
It changes the order of operations in the collected query log. It
|
|
568
|
+
is useful with `collect-query-log` directive.
|
|
569
|
+
|
|
570
|
+
If no `SORT_KEY_N` is specified, no operation is sorted. This is the
|
|
571
|
+
default. Operations are printed in the executed order.
|
|
572
|
+
|
|
573
|
+
Here are available `SORT_KEY_N` s:
|
|
574
|
+
|
|
575
|
+
* `shard`: Sorts sharded operations such as `select[...]` and
|
|
576
|
+
`filter[...]` by their names. Sharded operations may be executed in
|
|
577
|
+
parallel. So their order isn't stable. `shard` makes the order
|
|
578
|
+
stable.
|
|
579
|
+
* `drilldown`: Sorts drilldown operations. Labeled drilldown
|
|
580
|
+
operations such as `drilldowns[...]` are sorted by their
|
|
581
|
+
names. Plain drilldown operations such as `drilldown(...): KEY` are
|
|
582
|
+
sorted by their keys. Drilldown operations may be executed in
|
|
583
|
+
parallel. So their order isn't stable. `drilldown` makes the order
|
|
584
|
+
stable. `drilldowns[...].sort` and `drilldown.sort` operations
|
|
585
|
+
aren't sorted because they are executed after all drilldown
|
|
586
|
+
operations are finished.
|
|
587
|
+
|
|
588
|
+
Operations that aren't matched with any `SORT_KEY_N` keep the executed
|
|
589
|
+
order. You can specify multiple `SORT_KEY_N` s at once.
|
|
590
|
+
|
|
591
|
+
Example:
|
|
592
|
+
|
|
593
|
+
```
|
|
594
|
+
#@collect-query-log true
|
|
595
|
+
#@sort-query-log-operations shard drilldown
|
|
596
|
+
logical_select Logs \
|
|
597
|
+
--shard_key timestamp \
|
|
598
|
+
--query message:hello \
|
|
599
|
+
--drilldowns[host].keys host \
|
|
600
|
+
--drilldowns[path].keys path
|
|
601
|
+
#@sort-query-log-operations
|
|
602
|
+
#@collect-query-log false
|
|
603
|
+
```
|
|
604
|
+
|
|
558
605
|
## Options
|
|
559
606
|
|
|
560
607
|
Grntest has many options. You don't need to specify many of them
|
data/doc/text/news.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# News
|
|
2
2
|
|
|
3
|
+
## 1.8.7: 2026-09-06
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
* `#@sort-query-log-operations`: Added `drilldown` sort key. `none`
|
|
8
|
+
sort key is removed. Use empty sort keys instead.
|
|
9
|
+
|
|
10
|
+
## 1.8.6: 2026-09-05
|
|
11
|
+
|
|
12
|
+
### Improvements
|
|
13
|
+
|
|
14
|
+
* `#@sort-query-log-operations`: Added for `logical_select`'s
|
|
15
|
+
`--n_workers` support.
|
|
16
|
+
|
|
3
17
|
## 1.8.5: 2026-09-04
|
|
4
18
|
|
|
5
19
|
### Improvements
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2012-
|
|
1
|
+
# Copyright (C) 2012-2026 Sutou Kouhei <kou@clear-code.com>
|
|
2
2
|
#
|
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -37,6 +37,7 @@ module Grntest
|
|
|
37
37
|
attr_accessor :shutdown_wait_timeout
|
|
38
38
|
attr_writer :suppress_backtrace
|
|
39
39
|
attr_writer :collect_query_log
|
|
40
|
+
attr_accessor :sort_query_log_operations
|
|
40
41
|
attr_writer :debug
|
|
41
42
|
attr_accessor :platform
|
|
42
43
|
attr_accessor :benchmarks
|
|
@@ -69,6 +70,7 @@ module Grntest
|
|
|
69
70
|
@omitted = false
|
|
70
71
|
@suppress_backtrace = true
|
|
71
72
|
@collect_query_log = false
|
|
73
|
+
@sort_query_log_operations = []
|
|
72
74
|
@debug = false
|
|
73
75
|
@platform = guess_platform
|
|
74
76
|
@benchmarks = []
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2012-
|
|
1
|
+
# Copyright (C) 2012-2026 Sutou Kouhei <kou@clear-code.com>
|
|
2
2
|
#
|
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
|
@@ -308,6 +308,21 @@ module Grntest
|
|
|
308
308
|
@context.collect_query_log = (options[0] == "true")
|
|
309
309
|
end
|
|
310
310
|
|
|
311
|
+
def execute_directive_sort_query_log_operations(line, content, options)
|
|
312
|
+
sort_keys = options
|
|
313
|
+
valid_sort_keys = ["shard", "drilldown"]
|
|
314
|
+
unsupported_sort_keys = sort_keys - valid_sort_keys
|
|
315
|
+
if unsupported_sort_keys.empty?
|
|
316
|
+
@context.sort_query_log_operations = sort_keys
|
|
317
|
+
else
|
|
318
|
+
valid_sort_keys_label = "[#{valid_sort_keys.join(', ')}]"
|
|
319
|
+
message = "must be one of #{valid_sort_keys_label}"
|
|
320
|
+
log_error("#|e| [sort-query-log-operations] " +
|
|
321
|
+
"#{message}: unsupported values: " +
|
|
322
|
+
unsupported_sort_keys.collect {|key| "<#{key}>"}.join(", "))
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
311
326
|
def each_generated_series_chunk(template, start, stop)
|
|
312
327
|
evaluator = TemplateEvaluator.new(template, :i)
|
|
313
328
|
max_chunk_size = 1 * 1024 * 1024 # 1MiB
|
|
@@ -631,6 +646,8 @@ module Grntest
|
|
|
631
646
|
execute_directive_sleep(line, content, options)
|
|
632
647
|
when "collect-query-log"
|
|
633
648
|
execute_directive_collect_query_log(line, content, options)
|
|
649
|
+
when "sort-query-log-operations"
|
|
650
|
+
execute_directive_sort_query_log_operations(line, content, options)
|
|
634
651
|
when "generate-series"
|
|
635
652
|
execute_directive_generate_series(parser, line, content, options)
|
|
636
653
|
when "eval"
|
|
@@ -950,7 +967,8 @@ module Grntest
|
|
|
950
967
|
command[:output_type] = nil if command.output_type == :json
|
|
951
968
|
log_query("\#>#{command.to_command_format}")
|
|
952
969
|
end
|
|
953
|
-
|
|
970
|
+
sorted_operations = sort_operations(statistic)
|
|
971
|
+
sorted_operations.each do |operation|
|
|
954
972
|
message = operation[:raw_message]
|
|
955
973
|
case operation[:name]
|
|
956
974
|
when "cache"
|
|
@@ -964,6 +982,53 @@ module Grntest
|
|
|
964
982
|
end
|
|
965
983
|
end
|
|
966
984
|
|
|
985
|
+
def sort_operations(statistic)
|
|
986
|
+
sort_keys = @context.sort_query_log_operations
|
|
987
|
+
return statistic.each_operation if sort_keys.empty?
|
|
988
|
+
|
|
989
|
+
sort_shard = sort_keys.include?("shard")
|
|
990
|
+
sort_drilldown = sort_keys.include?("drilldown")
|
|
991
|
+
first_shard_select_index = nil
|
|
992
|
+
first_shard_filter_index = nil
|
|
993
|
+
first_drilldowns_index = nil
|
|
994
|
+
first_drilldown_index = nil
|
|
995
|
+
statistic.each_operation.sort_by do |operation|
|
|
996
|
+
i = operation[:i]
|
|
997
|
+
name = operation[:name]
|
|
998
|
+
if name.start_with?("select[")
|
|
999
|
+
if sort_shard
|
|
1000
|
+
first_shard_select_index ||= i
|
|
1001
|
+
[first_shard_select_index, name]
|
|
1002
|
+
else
|
|
1003
|
+
[i]
|
|
1004
|
+
end
|
|
1005
|
+
elsif name.start_with?("filter[")
|
|
1006
|
+
if sort_shard
|
|
1007
|
+
first_shard_filter_index ||= i
|
|
1008
|
+
[first_shard_filter_index, name]
|
|
1009
|
+
else
|
|
1010
|
+
[i]
|
|
1011
|
+
end
|
|
1012
|
+
elsif name.start_with?("drilldowns[")
|
|
1013
|
+
if sort_drilldown and not name.end_with?(".sort")
|
|
1014
|
+
first_drilldowns_index ||= i
|
|
1015
|
+
[first_drilldowns_index, name]
|
|
1016
|
+
else
|
|
1017
|
+
[i]
|
|
1018
|
+
end
|
|
1019
|
+
elsif name.start_with?("drilldown")
|
|
1020
|
+
if sort_drilldown and not name.end_with?(".sort")
|
|
1021
|
+
first_drilldown_index ||= i
|
|
1022
|
+
[first_drilldown_index, name, operation[:extra]]
|
|
1023
|
+
else
|
|
1024
|
+
[i]
|
|
1025
|
+
end
|
|
1026
|
+
else
|
|
1027
|
+
[i]
|
|
1028
|
+
end
|
|
1029
|
+
end
|
|
1030
|
+
end
|
|
1031
|
+
|
|
967
1032
|
def debug_input(input)
|
|
968
1033
|
return unless @context.debug?
|
|
969
1034
|
$stderr.puts("> #{input}")
|
data/lib/grntest/version.rb
CHANGED