summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorsvoj@mysql.com/june.mysql.com <>2007-04-13 12:38:27 +0500
committersvoj@mysql.com/june.mysql.com <>2007-04-13 12:38:27 +0500
commited81a81a9ef3370d3260c9aebb79036831b866ef (patch)
tree4e71fd10f53e58f29af50e0e05f819d7b8a8ae96 /myisam
parentc282dd3715e8be3e4a7753587e7b452b97ebbb85 (diff)
downloadmariadb-git-ed81a81a9ef3370d3260c9aebb79036831b866ef.tar.gz
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.
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_info.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/myisam/mi_info.c b/myisam/mi_info.c
index 0435269ed6d..b7de8e7b37d 100644
--- a/myisam/mi_info.c
+++ b/myisam/mi_info.c
@@ -57,9 +57,9 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
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)
{