groonga-query-log 1.6.0 → 1.6.1
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 +8 -0
- data/lib/groonga-query-log/command/run-regression-test.rb +55 -13
- data/lib/groonga-query-log/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7420f29c336d80bf892fa8c8a5a8368ee6344f2e6d02846f7da1172daca83d7b
|
4
|
+
data.tar.gz: 0a6833bd88e699ea7e102a0466b4db7944d273a84adb6ccc7e9262795cf1e5c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e4fbae0c9fb4b9fe3d6b474b2a77fb250f4a48c7a1775fd9aaed07a527a35c40e543fb21a250a4ef47ebadd75ef7626da17630462b52eef9395b9149ddef0a
|
7
|
+
data.tar.gz: 06fcd20a1e52b0edcd1697a4712ac8781b624a915fef57963518054fb501b1ec93c0b3d7195fbd3c898c5e6231139c5f1fd4781bf65fdb98c4a939057e620974
|
data/doc/text/news.md
CHANGED
@@ -556,12 +556,19 @@ module GroongaQueryLog
|
|
556
556
|
if @options[:recreate_database]
|
557
557
|
FileUtils.rm_rf(@database_path.dirname.to_s)
|
558
558
|
end
|
559
|
-
|
560
559
|
return if @database_path.exist?
|
560
|
+
|
561
561
|
FileUtils.mkdir_p(@database_path.dirname.to_s)
|
562
|
-
|
562
|
+
create_db_command = [@groonga, "-n", @database_path.to_s, "quit"]
|
563
|
+
unless system(*create_db_command)
|
564
|
+
create_db_command_line = create_db_command.join(" ")
|
565
|
+
raise "Failed to run: #{create_db_command_line}"
|
566
|
+
end
|
567
|
+
|
563
568
|
load_files.each do |load_file|
|
564
|
-
|
569
|
+
filter_command = nil
|
570
|
+
case load_file.extname
|
571
|
+
when ".rb"
|
565
572
|
env = {
|
566
573
|
"GROONGA_LOG_PATH" => log_path.to_s,
|
567
574
|
}
|
@@ -570,6 +577,17 @@ module GroongaQueryLog
|
|
570
577
|
load_file.to_s,
|
571
578
|
@database_path.to_s,
|
572
579
|
]
|
580
|
+
when ".zst"
|
581
|
+
env = {}
|
582
|
+
command = [
|
583
|
+
@groonga,
|
584
|
+
"--log-path", log_path.to_s,
|
585
|
+
@database_path.to_s,
|
586
|
+
]
|
587
|
+
filter_command = [
|
588
|
+
"zstdcat",
|
589
|
+
load_file.to_s,
|
590
|
+
]
|
573
591
|
else
|
574
592
|
env = {}
|
575
593
|
command = [
|
@@ -580,13 +598,36 @@ module GroongaQueryLog
|
|
580
598
|
]
|
581
599
|
end
|
582
600
|
command_line = command.join(" ")
|
601
|
+
if filter_command
|
602
|
+
filter_command_line = filter_command.join(" ")
|
603
|
+
command_line = "#{filter_command_line} | #{command_line}"
|
604
|
+
end
|
583
605
|
puts("Running...: #{command_line}")
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
606
|
+
status = nil
|
607
|
+
if filter_command
|
608
|
+
IO.pipe do |input, output|
|
609
|
+
filter_pid = spawn(*filter_command, out: output)
|
610
|
+
output.close
|
611
|
+
pid = spawn(env, *command, in: input)
|
612
|
+
input.close
|
613
|
+
begin
|
614
|
+
pid, status = Process.waitpid2(pid)
|
615
|
+
filter_pid, filter_status = Process.waitpid2(filter_pid)
|
616
|
+
rescue Interrupt
|
617
|
+
Process.kill(:TERM, pid)
|
618
|
+
Process.kill(:TERM, filter_pid)
|
619
|
+
pid, status = Process.waitpid2(pid)
|
620
|
+
filter_pid, filter_status = Process.waitpid2(filter_pid)
|
621
|
+
end
|
622
|
+
end
|
623
|
+
else
|
624
|
+
pid = spawn(env, *command)
|
625
|
+
begin
|
626
|
+
pid, status = Process.waitpid2(pid)
|
627
|
+
rescue Interrupt
|
628
|
+
Process.kill(:TERM, pid)
|
629
|
+
pid, status = Process.waitpid2(pid)
|
630
|
+
end
|
590
631
|
end
|
591
632
|
unless status.success?
|
592
633
|
raise "Failed to run: #{command_line}"
|
@@ -608,8 +649,9 @@ module GroongaQueryLog
|
|
608
649
|
|
609
650
|
def n_leaked_objects
|
610
651
|
n = 0
|
611
|
-
File.open(log_path) do |log|
|
652
|
+
File.open(log_path, encoding: "UTF-8") do |log|
|
612
653
|
log.each_line do |line|
|
654
|
+
next unless line.valid_encoding?
|
613
655
|
case line
|
614
656
|
when /grn_fin \((\d+)\)/
|
615
657
|
n += Integer($1, 10)
|
@@ -652,15 +694,15 @@ module GroongaQueryLog
|
|
652
694
|
end
|
653
695
|
|
654
696
|
def schema_files
|
655
|
-
Pathname.glob("#{@input_directory}/schema/**/*.{grn,rb}").sort
|
697
|
+
Pathname.glob("#{@input_directory}/schema/**/*.{grn,grn.zst,rb}").sort
|
656
698
|
end
|
657
699
|
|
658
700
|
def index_files
|
659
|
-
Pathname.glob("#{@input_directory}/indexes/**/*.{grn,rb}").sort
|
701
|
+
Pathname.glob("#{@input_directory}/indexes/**/*.{grn,grn.zst,rb}").sort
|
660
702
|
end
|
661
703
|
|
662
704
|
def data_files
|
663
|
-
Pathname.glob("#{@input_directory}/data/**/*.{grn,rb}").sort
|
705
|
+
Pathname.glob("#{@input_directory}/data/**/*.{grn,grn.zst,rb}").sort
|
664
706
|
end
|
665
707
|
end
|
666
708
|
|
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.6.
|
4
|
+
version: 1.6.1
|
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-04-
|
11
|
+
date: 2020-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charty
|