Skip to content

Commit

Permalink
jetpants_collins: Pool#after_master_promotion! should also eject any …
Browse files Browse the repository at this point in the history
…slaves that are no longer slaving
  • Loading branch information
evanelias committed Apr 4, 2013
1 parent 91ecb20 commit f94254b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/jetpants_collins/pool.rb
Expand Up @@ -128,6 +128,18 @@ def after_master_promotion!(promoted, enslave_old_master=true)
end
end
end

# Clean up any slaves that are no longer slaving (again only looking at current datacenter)
assets = Jetpants.topology.server_node_assets(@name, :slave)
assets.reject! {|a| a.location && a.location.upcase != Plugin::JetCollins.datacenter}
assets.map(&:to_db).each do |db|
if !db.running? || db.pool != self
db.output "Not replicating from new master, removing from pool #{self}"
db.collins_pool = ''
db.collins_secondary_role = ''
db.collins_status = 'Unallocated'
end
end
end


Expand Down

0 comments on commit f94254b

Please sign in to comment.