groonga-query-log 1.6.7 → 1.7.2

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: b9d218a019817b6222c63db7cb6dcde54452d56dba3ad1026e678e0d64a8ca1c
4
+ data.tar.gz: 4755e11de2ab221a1db0a1d6c2fa86c3bf05e18c3cd30e451096160bf870e169
5
5
  SHA512:
6
- metadata.gz: 942d6b83901dcc4b2bccf8c8639da85cfac8472db3bd59738a8f386b9811c7bb141a7718a3140043b68cef0c71e3434cafabd9686e18a685ca49e0918da24321
7
- data.tar.gz: 23c25f00387e3755908222434477d487c7f5f1a707c54f4a86d2969a17c3bb2fcfffbfe88bee7e157651665956b42aa3d27b1d54f2ac9d5246361886be235028
6
+ metadata.gz: 1380025523bbb3debb587da39f774f7e2cb7aab6301e2d6f66ebf9c7fed3baccbfa5e4fc57202db3e1d00c53a37686196d1165df560ba9c824cce68efd21af03
7
+ data.tar.gz: ed36cd1e75dc79eb701238bad818ee0a42531d1ff47ebaba255bdfeb68574f173f49e44f0e38e786d45d41981d720c6ac2e5d32f6a84fa8abebdcde0adebe8bb
@@ -1,8 +1,47 @@
1
1
  # News
2
2
 
3
+ ## 1.7.2: 2020-06-02
4
+
5
+ ### Fixes
6
+
7
+ * `server-verifier`: Fixed a bug that performance verification
8
+ doesn't try 5 times.
9
+
10
+ ## 1.7.1: 2020-06-01
11
+
12
+ ### Fixes
13
+
14
+ * `server-verifier`: Fixed a bug that performance verification with
15
+ `--stop-onlfailre` doesn't work.
16
+
17
+ * `run-regression-test`: Fixed a bug that failure is ignored.
18
+
19
+ ## 1.7.0: 2020-05-31
20
+
21
+ ### Fixes
22
+
23
+ * `server-verifier`: Fixed a bug that performance verification
24
+ doesn't work.
25
+
26
+ ## 1.6.9: 2020-05-30
27
+
28
+ ### Fixes
29
+
30
+ * `server-verifier`: Fixed a bug that performance verification
31
+ doesn't work.
32
+
33
+ ## 1.6.8: 2020-05-30
34
+
35
+ ### Improvements
36
+
37
+ * `server-verifier`: Stopped sorting elapsed times.
38
+
39
+ * `run-regression-test`: Ensured killing Groonga server on start up
40
+ error.
41
+
3
42
  ## 1.6.7: 2020-05-30
4
43
 
5
- ### Improves
44
+ ### Improvements
6
45
 
7
46
  * `extract`: Added support for no command request case such as `/`.
8
47
 
@@ -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,42 @@ 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
+ true
794
+ ensure
795
+ @old.shutdown
783
796
  end
784
797
  end
785
798
  new_thread = Thread.new do
786
- @new.run do
787
- run_test
799
+ @new.run
800
+ begin
801
+ ready_queue.push(true)
802
+ wait_queue.pop
803
+ true
804
+ ensure
805
+ @new.shutdown
788
806
  end
789
807
  end
808
+ test_thread = Thread.new do
809
+ ready_queue.pop
810
+ ready_queue.pop
811
+ success = run_test
812
+ wait_queue.push(true)
813
+ wait_queue.push(true)
814
+ success
815
+ end
790
816
 
791
817
  old_thread_success = old_thread.value
792
818
  new_thread_success = new_thread.value
819
+ test_thread_success = test_thread.value
793
820
 
794
- old_thread_success and new_thread_success
821
+ old_thread_success and new_thread_success and test_thread_success
795
822
  end
796
823
 
797
824
  def n_executed_commands
@@ -800,10 +827,7 @@ module GroongaQueryLog
800
827
 
801
828
  private
802
829
  def run_test
803
- @n_ready_waits -= 1
804
- return true unless @n_ready_waits.zero?
805
-
806
- same = true
830
+ success = true
807
831
  query_log_paths.each do |query_log_path|
808
832
  log_path = test_log_path(query_log_path)
809
833
  if @options[:skip_finished_queries] and log_path.exist?
@@ -828,24 +852,14 @@ module GroongaQueryLog
828
852
  callback = nil
829
853
  end
830
854
  unless verify_server(log_path, query_log_path, &callback)
831
- same = false
855
+ success = false
832
856
  break if @stop_on_failure
833
857
  end
834
858
  rescue Interrupt
835
859
  puts("Interrupt: #{query_log_path}")
836
860
  end
837
861
  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
- same
862
+ success
849
863
  end
850
864
 
851
865
  def verify_server(test_log_path, query_log_path, &callback)
@@ -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
@@ -188,11 +188,19 @@ module GroongaQueryLog
188
188
  end
189
189
 
190
190
  if @options.verify_performance?
191
- verify_performance(command, response1, response2)
191
+ verify_performance(command,
192
+ groonga1_client,
193
+ groonga2_client,
194
+ response1,
195
+ response2)
192
196
  end
193
197
  end
194
198
 
195
- def verify_performance(command, response1, response2)
199
+ def verify_performance(command,
200
+ groonga1_client,
201
+ groonga2_client,
202
+ response1,
203
+ response2)
196
204
  responses1 = [response1]
197
205
  responses2 = [response2]
198
206
  verifier = PerformanceVerifier.new(command,
@@ -203,23 +211,24 @@ module GroongaQueryLog
203
211
 
204
212
  n_tries = 4
205
213
  n_tries.times do
214
+ return if stop?
215
+
206
216
  responses1 << groonga1_client.execute(command)
207
217
  responses2 << groonga2_client.execute(command)
208
218
  verifier = PerformanceVerifier.new(command,
209
219
  responses1,
210
220
  responses2,
211
221
  @options.performance_verifier_options)
212
- if verifier.slow?
213
- @slow = true
214
- @events.push([:slow,
215
- command,
216
- verifier.old_elapsed_time,
217
- verifier.new_elapsed_time,
218
- verifier.old_sorted_elapsed_time,
219
- verifier.new_sorted_elapsed_time])
220
- return
221
- end
222
+ return unless verifier.slow?
222
223
  end
224
+
225
+ @slow = true
226
+ @events.push([:slow,
227
+ command,
228
+ verifier.old_elapsed_time,
229
+ verifier.new_elapsed_time,
230
+ verifier.old_elapsed_times,
231
+ verifier.new_elapsed_times])
223
232
  end
224
233
 
225
234
  def rewrite_filter(command, name)
@@ -251,14 +260,14 @@ module GroongaQueryLog
251
260
  command,
252
261
  old_elapsed_time,
253
262
  new_elapsed_time,
254
- old_sorted_elapsed_times,
255
- new_sorted_elapsed_times)
263
+ old_elapsed_times,
264
+ new_elapsed_times)
256
265
  command_source = command.original_source || command.to_uri_format
257
266
  output.puts("command: #{command_source}")
258
267
  output.puts("elapsed_time_old: #{old_elapsed_time}")
259
268
  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(' ')}")
269
+ output.puts("elapsed_times_old: #{old_elapsed_times.join(' ')}")
270
+ output.puts("elapsed_times_new: #{new_elapsed_times.join(' ')}")
262
271
  output.puts("elapsed_time_ratio: #{new_elapsed_time / old_elapsed_time}")
263
272
  output.flush
264
273
  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.7.2"
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.7
4
+ version: 1.7.2
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-05-30 00:00:00.000000000 Z
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: charty