Skip to content

Commit 94b13c7

Browse files
committed
Copy cluster tools from master
1 parent cfbea17 commit 94b13c7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spec/support/cluster_tools.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def step_up(address)
142142
# - call step down on the existing primary
143143
# - call step up on the target in a loop until it becomes the primary
144144
def change_primary
145+
start = Time.now
145146
existing_primary = admin_client.cluster.next_primary
146147
existing_primary_address = existing_primary.address
147148

@@ -171,7 +172,7 @@ def change_primary
171172
persistently_step_up(target.address)
172173

173174
new_primary = admin_client.cluster.next_primary
174-
puts "#{Time.now} [CT] Primary changed to #{new_primary.address}"
175+
puts "#{Time.now} [CT] Primary changed to #{new_primary.address}. Time to change primaries: #{Time.now - start}"
175176
end
176177

177178
def persistently_step_up(address)
@@ -348,8 +349,6 @@ def close_clients
348349
end
349350
end
350351

351-
private
352-
353352
def each_server(&block)
354353
admin_client.cluster.servers_list.each(&block)
355354
end
@@ -360,6 +359,8 @@ def direct_client_for_each_server(&block)
360359
end
361360
end
362361

362+
private
363+
363364
def reset_server_states
364365
each_server do |server|
365366
server.unknown!

0 commit comments

Comments
 (0)