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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '023904fd821f10549843a393066606dc362b18cf37a0fdf367dad9fa2112510b'
4
- data.tar.gz: 13c88359ceff1ac99c0a56c9c53deac527c1fd2158c62ebaef70ade2a623b149
3
+ metadata.gz: 7420f29c336d80bf892fa8c8a5a8368ee6344f2e6d02846f7da1172daca83d7b
4
+ data.tar.gz: 0a6833bd88e699ea7e102a0466b4db7944d273a84adb6ccc7e9262795cf1e5c0
5
5
  SHA512:
6
- metadata.gz: 981cb090997ecb1644b4e891e60bae06a985b0a84abb4c186ca69f053c3c024ea16cc7333a95b9f57d50392ad2fb00aca6633447a9e4b296ea6c6a1b02046792
7
- data.tar.gz: 94c88472305982b6f1be3833d2dbc7a79223def680cfb7f424ce197edab06dc2360cc087c4221b038b3cbb2697d93bdfa97883d77db6c8fee22b4d4f61f94d20
6
+ metadata.gz: e4e4fbae0c9fb4b9fe3d6b474b2a77fb250f4a48c7a1775fd9aaed07a527a35c40e543fb21a250a4ef47ebadd75ef7626da17630462b52eef9395b9149ddef0a
7
+ data.tar.gz: 06fcd20a1e52b0edcd1697a4712ac8781b624a915fef57963518054fb501b1ec93c0b3d7195fbd3c898c5e6231139c5f1fd4781bf65fdb98c4a939057e620974
@@ -1,5 +1,13 @@
1
1
  # News
2
2
 
3
+ ## 1.6.1: 2020-04-28
4
+
5
+ ### Improvements
6
+
7
+ * `run-regression-test`: Ensured using UTF-8 for `groonga.log`.
8
+
9
+ * `run-regression-test`: Added support for loading `.grn.zst`.
10
+
3
11
  ## 1.6.0: 2020-04-15
4
12
 
5
13
  ### Improvements
@@ -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
- system(@groonga, "-n", @database_path.to_s, "quit")
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
- if load_file.extname == ".rb"
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
- pid = spawn(env, *command)
585
- begin
586
- pid, status = Process.waitpid2(pid)
587
- rescue Interrupt
588
- Process.kill(:TERM, pid)
589
- pid, status = Process.waitpid2(pid)
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
 
@@ -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.6.0"
18
+ VERSION = "1.6.1"
19
19
  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.6.0
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-15 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charty