Description:
Removing agents causes all history to be deleted in a single transaction via cascading foreign keys, which can take a very long time. Removing multiple agents at once can effectively shut down monitoring for several days.
How to repeat:
Run a production system with half a dozen slaves, then remove all those slaves at once after much history has accumulated.
Suggested fix:
Rather than cascading deletes for all data, do something like:
o Remove all data collection and advisor schedules for the agent
o Enter a loop that removes all data collection for the agent in chunks (1000 rows, 10000 rows, whatever)
o Once complete, remove all other information about the agent/server etc.
Would also like some extra verbose information on the progress during one of these deletes or rollbacks.