grntest 1.8.5 → 1.8.6
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 +29 -0
- data/doc/text/news.md +7 -0
- data/lib/grntest/execution-context.rb +3 -1
- data/lib/grntest/executors/base-executor.rb +35 -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: e58246b338b34f388628f0a2762c405d01a2ec9e715d572a45402a09825717fe
|
|
4
|
+
data.tar.gz: 9d2dcfb7b76374143d26bca3981614b5e242afe5bd04119ce2e8a12a5461efa3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcfd998dab94f51aaf683f5c9a5089bde2c9c91ad4f39fd3fe0a6803d77faa1bc9617034033d755bef21e191f90a310cb127456f80157e95d3b6e12096702ee1
|
|
7
|
+
data.tar.gz: bd7b3cc3eb63003ce7bdc1ed93df6caa98c0d5432e6bf9139c7d6a7c595e87ac1389e1e9bcbf657cdec9df0570501b909c59d57b169b91666e7d6cdea18a625d
|
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,34 @@ 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 [none|shard]
|
|
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
|
+
`none` is the default. Operations are printed in the executed order.
|
|
571
|
+
|
|
572
|
+
`shard` sorts sharded operations such as `select[...]` and
|
|
573
|
+
`filter[...]` by their names. Sharded operations may be executed in
|
|
574
|
+
parallel. So their order isn't stable. `shard` makes the order stable.
|
|
575
|
+
Non sharded operations keep the executed order.
|
|
576
|
+
|
|
577
|
+
Example:
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
#@collect-query-log true
|
|
581
|
+
#@sort-query-log-operations shard
|
|
582
|
+
logical_select Logs --shard_key timestamp --query message:hello
|
|
583
|
+
#@sort-query-log-operations none
|
|
584
|
+
#@collect-query-log false
|
|
585
|
+
```
|
|
586
|
+
|
|
558
587
|
## Options
|
|
559
588
|
|
|
560
589
|
Grntest has many options. You don't need to specify many of them
|
data/doc/text/news.md
CHANGED
|
@@ -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 = "none"
|
|
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,10 @@ 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
|
+
@context.sort_query_log_operations = options[0]
|
|
313
|
+
end
|
|
314
|
+
|
|
311
315
|
def each_generated_series_chunk(template, start, stop)
|
|
312
316
|
evaluator = TemplateEvaluator.new(template, :i)
|
|
313
317
|
max_chunk_size = 1 * 1024 * 1024 # 1MiB
|
|
@@ -631,6 +635,8 @@ module Grntest
|
|
|
631
635
|
execute_directive_sleep(line, content, options)
|
|
632
636
|
when "collect-query-log"
|
|
633
637
|
execute_directive_collect_query_log(line, content, options)
|
|
638
|
+
when "sort-query-log-operations"
|
|
639
|
+
execute_directive_sort_query_log_operations(line, content, options)
|
|
634
640
|
when "generate-series"
|
|
635
641
|
execute_directive_generate_series(parser, line, content, options)
|
|
636
642
|
when "eval"
|
|
@@ -950,7 +956,8 @@ module Grntest
|
|
|
950
956
|
command[:output_type] = nil if command.output_type == :json
|
|
951
957
|
log_query("\#>#{command.to_command_format}")
|
|
952
958
|
end
|
|
953
|
-
|
|
959
|
+
sorted_operations = sort_operations(statistic)
|
|
960
|
+
sorted_operations.each do |operation|
|
|
954
961
|
message = operation[:raw_message]
|
|
955
962
|
case operation[:name]
|
|
956
963
|
when "cache"
|
|
@@ -964,6 +971,32 @@ module Grntest
|
|
|
964
971
|
end
|
|
965
972
|
end
|
|
966
973
|
|
|
974
|
+
def sort_operations(statistic)
|
|
975
|
+
sort_key = @context.sort_query_log_operations
|
|
976
|
+
case sort_key
|
|
977
|
+
when "shard"
|
|
978
|
+
first_shard_select_index = nil
|
|
979
|
+
first_shard_filter_index = nil
|
|
980
|
+
statistic.each_operation.sort_by do |operation|
|
|
981
|
+
i = operation[:i]
|
|
982
|
+
name = operation[:name]
|
|
983
|
+
if name.start_with?("select[")
|
|
984
|
+
first_shard_select_index ||= i
|
|
985
|
+
[first_shard_select_index, name]
|
|
986
|
+
elsif name.start_with?("filter[")
|
|
987
|
+
first_shard_filter_index ||= i
|
|
988
|
+
[first_shard_filter_index, name]
|
|
989
|
+
else
|
|
990
|
+
[i]
|
|
991
|
+
end
|
|
992
|
+
end
|
|
993
|
+
when "none"
|
|
994
|
+
statistic.each_operation
|
|
995
|
+
else
|
|
996
|
+
raise Error.nw("unsupported sort-query-log-operations: #{sort_key}")
|
|
997
|
+
end
|
|
998
|
+
end
|
|
999
|
+
|
|
967
1000
|
def debug_input(input)
|
|
968
1001
|
return unless @context.debug?
|
|
969
1002
|
$stderr.puts("> #{input}")
|
data/lib/grntest/version.rb
CHANGED