File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ # This simple script is used in order to estimate the average PFAIL->FAIL
2+ # state switch after a failure.
3+
4+ set ::sleep_time 10 ; # How much to sleep to trigger PFAIL.
5+ set ::fail_port 30016 ; # Node to put in sleep.
6+ set ::other_port 30001 ; # Node to use to monitor the flag switch.
7+
8+ proc avg vector {
9+ set sum 0.0
10+ foreach x $vector {
11+ set sum [expr {$sum +$x }]
12+ }
13+ expr {$sum /[llength $vector ]}
14+ }
15+
16+ set samples {}
17+ while 1 {
18+ exec redis-cli -p $::fail_port debug sleep $::sleep_time > /dev/null &
19+
20+ # Wait for fail? to appear.
21+ while 1 {
22+ set output [exec redis-cli -p $::other_port cluster nodes]
23+ if {[string match {*fail\? *} $output ]} break
24+ after 100
25+ }
26+
27+ puts " FAIL?"
28+ set start [clock milliseconds]
29+
30+ # Wait for fail? to disappear.
31+ while 1 {
32+ set output [exec redis-cli -p $::other_port cluster nodes]
33+ if {![string match {*fail\? *} $output ]} break
34+ after 100
35+ }
36+
37+ puts " FAIL"
38+ set now [clock milliseconds]
39+ set elapsed [expr {$now -$start }]
40+ puts $elapsed
41+ lappend samples $elapsed
42+
43+ puts " AVG([ llength $samples ] ): [ avg $samples ] "
44+
45+ # Wait for the instance to be available again.
46+ exec redis-cli -p $::fail_port ping
47+
48+ # Wait for the fail flag to be cleared.
49+ after 2000
50+ }
You can’t perform that action at this time.
0 commit comments