Bug #23215 STOP INSTANCE takes too much time
Submitted: 12 Oct 2006 13:41 Modified: 16 Jan 2007 20:49
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:Instance Manager Severity:S2 (Serious)
Version:5.1.12 BK OS:Linux (Linux)
Assigned to: Alexander Nozdrin CPU Architecture:Any

[12 Oct 2006 13:41] Alexander Nozdrin
Description:
STOP INSTANCE takes too about 30 seconds to stop an instance.
Moreover, while it is working, other statements are not
processed by Instance Manager, which is very bad.

How to repeat:
1. Start Instance Manager with configured nonguarded instance
   (let's say "mysqld2");

2. Connect to IM by mysql-client and issue the following:

   mysql> START INSTANCE mysqld2;
   Query OK, 0 rows affected (0.00 sec)
   Instance started

   mysql> STOP INSTANCE mysqld2;
   Query OK, 0 rows affected (34.65 sec)

3. While STOP INSTANCE is being executed, connect to IM by another
   mysql-client and try issue any statement (SHOW INSTANCES, for one).
   It will hang until STOP INSTANCE completion.
[27 Oct 2006 11:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/14473

ChangeSet@1.2326, 2006-10-27 15:30:40+04:00, anozdrin@alik. +28 -0
  Fix for the following bugs:
    - BUG#22306: STOP INSTANCE can not be applied for instances in Crashed,
      Failed and Abandoned;
    - BUG#23476: DROP INSTANCE does not work
    - BUG#23215: STOP INSTANCE takes too much time
  
  The problems were as follows:
    - BUG#22306: STOP INSTANCE checked that mysqld is up and running.
      If it was not so, STOP INSTANCE reported an error.
    - BUG#23476: the problem was that DROP INSTANCE tried to stop
      inactive instance;
    - BUG#23215: the problem was that locks were not acquired properly,
      so the instance-monitoring thread could not acquire the mutex,
      holded by the query-processing thread.
  
  The general idea of the fix is to re-implement locking scheme.
[29 Nov 2006 12:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/16088

ChangeSet@1.2382, 2006-11-29 13:43:55+03:00, anozdrin@booka. +12 -0
  Fix for the following bugs:
    - BUG#22306: STOP INSTANCE can not be applied for instances in Crashed,
      Failed and Abandoned;
    - BUG#23476: DROP INSTANCE does not work
    - BUG#23215: STOP INSTANCE takes too much time
  
  BUG#22306:
  The problem was that STOP INSTANCE checked that mysqld is up and running.
  If it was not so, STOP INSTANCE reported an error. Now, STOP INSTANCE
  reports an error if the instance has been started (mysqld can be down).
  
  BUG#23476:
  The problem was that DROP INSTANCE tried to stop inactive instance. The fix is
  trivial.
  
  BUG#23215:
  The problem was that locks were not acquired properly, so the
  instance-monitoring thread could not acquire the mutex, holded by the
  query-processing thread.
  
  The fix is to simplify locking scheme by moving instance-related information to
  Instance-class out of Guardian-class. This allows to get rid of storing a
  separate list of Instance-information in Guardian and keeping it synchronized
  with the original list in Instance_map.
[29 Nov 2006 16:45] Konstantin Osipov
Approved the second patch by email.
[16 Jan 2007 20:49] Paul Dubois
Noted in 5.1.15 changelog.

The Instance Manager STOP INSTANCE command took too much time and
caused Instance Manager to be unresponsive.