From: Date: April 12 2007 1:47pm Subject: bk commit into 5.0 tree (svoj:1.2439) BUG#27516 List-Archive: http://lists.mysql.com/commits/24382 X-Bug: 27516 Message-Id: <20070412114728.78EE041CEC6@june.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of svoj. When svoj does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-04-12 16:47:25+05:00, svoj@stripped +1 -0 BUG#27516 - divide by zero crash during optimize table When a table status is requested by statement like SHOW TABLE STATUS and there is another statement (e.g. DELETE) sets number of records to 0 concurrently, we may get division by zero error, which crashes a server. This is fixed by using thread local variable x->records instead of shared info->state->records when we check if it is zero and divide by it. myisam/mi_info.c@stripped, 2007-04-12 16:47:23+05:00, svoj@stripped +3 -3 Information schema does not lock a table when it requests table state info. If another thread sets info->state->records to 0 after we check if it is 0 and before we divide by it we may get division by zero error. Check and divide by local x->records variable instead of shared info->state->records. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: svoj # Host: june.mysql.com # Root: /home/svoj/devel/mysql/BUG27516/mysql-5.0-engines --- 1.17/myisam/mi_info.c 2006-12-31 00:02:04 +04:00 +++ 1.18/myisam/mi_info.c 2007-04-12 16:47:23 +05:00 @@ -57,9 +57,9 @@ int mi_status(MI_INFO *info, register MI x->keys = share->state.header.keys; x->check_time = share->state.check_time; - x->mean_reclength = info->state->records ? - (ulong) ((info->state->data_file_length-info->state->empty)/ - info->state->records) : (ulong) share->min_pack_length; + x->mean_reclength= x->records ? + (ulong) ((x->data_file_length - x->delete_length) / + x->records) : (ulong) share->min_pack_length; } if (flag & HA_STATUS_ERRKEY) {