groonga-query-log 1.6.7 → 1.6.8

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: 5fc818af1a75fea77eee79dc2b7852598ef14796e67a14d043449eebd31b3a15
4
- data.tar.gz: 6c101e1c990a46aabc47208b1625db3db90152cbba9c7163fc5ee0e201b7f7a1
3
+ metadata.gz: eae04a296ec14c5c76495fed6305cbf2bd483ae3d1f75927c876d788deaa61ed
4
+ data.tar.gz: ae995f3d7b5bb5b93fdc380aa3cba02b6de0b5a5a356879c811190c3054fcd27
5
5
  SHA512:
6
- metadata.gz: 942d6b83901dcc4b2bccf8c8639da85cfac8472db3bd59738a8f386b9811c7bb141a7718a3140043b68cef0c71e3434cafabd9686e18a685ca49e0918da24321
7
- data.tar.gz: 23c25f00387e3755908222434477d487c7f5f1a707c54f4a86d2969a17c3bb2fcfffbfe88bee7e157651665956b42aa3d27b1d54f2ac9d5246361886be235028
6
+ metadata.gz: '02049e8d2e93ad2f0c5564c7492e2b999e54feca6df4beadb1cc7555c25b31980a8b80c223c81873c63b6827f37a06ae340b7bb42ef943c24757632e1e9a115b'
7
+ data.tar.gz: db3778e5ebe80afc1b789cf8484d3ad65651d907388bd69e1c41fa5531fbe1fec4253af8bd5eee5e02d1ac6d53f108d43587cbd2aad2230bd7e493f8df304f64
@@ -1,8 +1,17 @@
1
1
  # News
2
2
 
3
+ ## 1.6.8: 2020-05-30
4
+
5
+ ### Improvements
6
+
7
+ * `server-verifier`: Stopped sorting elapsed times.
8
+
9
+ * `run-regression-test`: Ensured killing Groonga server on start up
10
+ error.
11
+
3
12
  ## 1.6.7: 2020-05-30
4
13
 
5
- ### Improves
14
+ ### Improvements
6
15
 
7
16
  * `extract`: Added support for no command request case such as `/`.
8
17
 
@@ -559,6 +559,7 @@ module GroongaQueryLog
559
559
  @host = "127.0.0.1"
560
560
  @port = find_unused_port
561
561
  @options = options
562
+ @pid = nil
562
563
  end
563
564
 
564
565
  def run
@@ -579,25 +580,28 @@ module GroongaQueryLog
579
580
  spawn_args << @database_path.to_s
580
581
  @pid = spawn(*spawn_args)
581
582
 
582
- n_retries = 10
583
583
  begin
584
- send_command("status")
585
- rescue SystemCallError
586
- sleep(1)
587
- n_retries -= 1
588
- raise if n_retries.zero?
589
- retry
590
- end
584
+ n_retries = 60
585
+ begin
586
+ send_command("status")
587
+ rescue SystemCallError
588
+ sleep(1)
589
+ n_retries -= 1
590
+ raise if n_retries.zero?
591
+ retry
592
+ end
591
593
 
592
- if @options[:warm_up]
593
- send_command("dump?dump_records=no")
594
- warm_up_commands = @options[:warm_up_commands] || []
595
- warm_up_commands.each do |command|
596
- send_command(command)
594
+ if @options[:warm_up]
595
+ send_command("dump?dump_records=no")
596
+ warm_up_commands = @options[:warm_up_commands] || []
597
+ warm_up_commands.each do |command|
598
+ send_command(command)
599
+ end
597
600
  end
601
+ rescue
602
+ shutdown
603
+ raise
598
604
  end
599
-
600
- yield if block_given?
601
605
  end
602
606
 
603
607
  def ensure_database
@@ -688,11 +692,14 @@ module GroongaQueryLog
688
692
  end
689
693
 
690
694
  def shutdown
695
+ return if @pid.nil?
691
696
  begin
692
697
  send_command("shutdown")
693
698
  rescue SystemCallError
699
+ Process.kill(:KILL, @pid)
694
700
  end
695
701
  Process.waitpid(@pid)
702
+ @pid = nil
696
703
  end
697
704
 
698
705
  def n_leaked_objects
@@ -769,7 +776,6 @@ module GroongaQueryLog
769
776
  @n_clients = options[:n_clients] || 1
770
777
  @stop_on_failure = options[:stop_on_failure]
771
778
  @options = options
772
- @n_ready_waits = 2
773
779
  @n_executed_commands = 0
774
780
  end
775
781
 
@@ -777,21 +783,39 @@ module GroongaQueryLog
777
783
  @old.ensure_database
778
784
  @new.ensure_database
779
785
 
786
+ ready_queue = Thread::Queue.new
787
+ wait_queue = Thread::Queue.new
780
788
  old_thread = Thread.new do
781
- @old.run do
782
- run_test
789
+ @old.run
790
+ begin
791
+ ready_queue.push(true)
792
+ wait_queue.pop
793
+ ensure
794
+ @old.shutdown
783
795
  end
784
796
  end
785
797
  new_thread = Thread.new do
786
- @new.run do
787
- run_test
798
+ @new.run
799
+ begin
800
+ ready_queue.push(true)
801
+ wait_queue.pop
802
+ ensure
803
+ @new.shutdown
788
804
  end
789
805
  end
806
+ test_thread = Thread.new do
807
+ ready_queue.pop
808
+ ready_queue.pop
809
+ run_test
810
+ wait_queue.push(true)
811
+ wait_queue.push(true)
812
+ end
790
813
 
791
814
  old_thread_success = old_thread.value
792
815
  new_thread_success = new_thread.value
816
+ test_thread_success = test_thread.value
793
817
 
794
- old_thread_success and new_thread_success
818
+ old_thread_success and new_thread_success and test_thread_success
795
819
  end
796
820
 
797
821
  def n_executed_commands
@@ -800,9 +824,6 @@ module GroongaQueryLog
800
824
 
801
825
  private
802
826
  def run_test
803
- @n_ready_waits -= 1
804
- return true unless @n_ready_waits.zero?
805
-
806
827
  same = true
807
828
  query_log_paths.each do |query_log_path|
808
829
  log_path = test_log_path(query_log_path)
@@ -835,16 +856,6 @@ module GroongaQueryLog
835
856
  puts("Interrupt: #{query_log_path}")
836
857
  end
837
858
  end
838
-
839
- old_thread = Thread.new do
840
- @old.shutdown
841
- end
842
- new_thread = Thread.new do
843
- @new.shutdown
844
- end
845
- old_thread.join
846
- new_thread.join
847
-
848
859
  same
849
860
  end
850
861
 
@@ -47,16 +47,16 @@ module GroongaQueryLog
47
47
  diff_ratio > @threshold_ratio
48
48
  end
49
49
 
50
- def old_sorted_elapsed_times
51
- collect_sorted_elapsed_times(@old_responses)
50
+ def old_elapsed_times
51
+ collect_elapsed_times(@old_responses)
52
52
  end
53
53
 
54
54
  def old_elapsed_time
55
55
  choose_target_elapsed_time(@old_responses)
56
56
  end
57
57
 
58
- def new_sorted_elapsed_times
59
- collect_sorted_elapsed_times(@new_responses)
58
+ def new_elapsed_times
59
+ collect_elapsed_times(@new_responses)
60
60
  end
61
61
 
62
62
  def new_elapsed_time
@@ -74,15 +74,14 @@ module GroongaQueryLog
74
74
  end
75
75
  end
76
76
 
77
- def collect_sorted_elapsed_times(responses)
78
- elapsed_times = responses.collect do |response|
77
+ def collect_elapsed_times(responses)
78
+ responses.collect do |response|
79
79
  response.elapsed_time
80
80
  end
81
- elapsed_times.sort
82
81
  end
83
82
 
84
83
  def choose_target_elapsed_time(responses)
85
- sorted_elapsed_times = collect_sorted_elapsed_times(responses)
84
+ sorted_elapsed_times = collect_elapsed_times(responses).sort
86
85
 
87
86
  strategy = @options.choose_strategy
88
87
  case strategy
@@ -215,8 +215,8 @@ module GroongaQueryLog
215
215
  command,
216
216
  verifier.old_elapsed_time,
217
217
  verifier.new_elapsed_time,
218
- verifier.old_sorted_elapsed_time,
219
- verifier.new_sorted_elapsed_time])
218
+ verifier.old_elapsed_time,
219
+ verifier.new_elapsed_time])
220
220
  return
221
221
  end
222
222
  end
@@ -251,14 +251,14 @@ module GroongaQueryLog
251
251
  command,
252
252
  old_elapsed_time,
253
253
  new_elapsed_time,
254
- old_sorted_elapsed_times,
255
- new_sorted_elapsed_times)
254
+ old_elapsed_times,
255
+ new_elapsed_times)
256
256
  command_source = command.original_source || command.to_uri_format
257
257
  output.puts("command: #{command_source}")
258
258
  output.puts("elapsed_time_old: #{old_elapsed_time}")
259
259
  output.puts("elapsed_time_new: #{new_elapsed_time}")
260
- output.puts("elapsed_times_old: #{old_sorted_elapsed_times.join(' ')}")
261
- output.puts("elapsed_times_new: #{new_sorted_elapsed_times.join(' ')}")
260
+ output.puts("elapsed_times_old: #{old_elapsed_times.join(' ')}")
261
+ output.puts("elapsed_times_new: #{new_elapsed_times.join(' ')}")
262
262
  output.puts("elapsed_time_ratio: #{new_elapsed_time / old_elapsed_time}")
263
263
  output.flush
264
264
  end
@@ -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.7"
18
+ VERSION = "1.6.8"
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou