Commit 64341975 authored by Alexey Botchkov's avatar Alexey Botchkov

Bug #47139 Test "merge" crashes in "embedded" run

  In fact this crashes in normal (not embedded) run also.
  The problem is in the memory mapping. Handling the ha_myisammrg::extra(MMAP)
  the MERGE engine tries to mmap all the tables it unites.
  Though some can be empty and then in the mi_dynmap_file()
  we call the my_mmap(0). Normally this call returns MAP_FAILED,
  but not on FreeBSD. There it returns like a 'normal' value,
  and after the consequitive munmap systems gets unstable and
  crashes on some system call later.

per-file comments:
  storage/myisam/mi_dynrec.c
Bug #47139      Test "merge" crashes in "embedded" run
    don't try to mmap zero-length area, just return at once.
parent 6d9aa9ea
......@@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
{
DBUG_ENTER("mi_dynmap_file");
if (size > (my_off_t) (~((size_t) 0)))
if (size == 0 || size > (my_off_t) (~((size_t) 0)))
{
DBUG_PRINT("warning", ("File is too large for mmap"));
if (size)
DBUG_PRINT("warning", ("File is too large for mmap"));
else
DBUG_PRINT("warning", ("Do not mmap zero-length"));
DBUG_RETURN(1);
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment