Commit c2d4bb68 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

----------------------------------------------------------
revno: 2630.7.1
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-lock-tables-new
timestamp: Mon 2008-06-02 15:14:18 +0400
message:
  Fix a test suite timeout in partition.test and partition_csv.test

storage/csv/ha_tina.cc:
  Change the blobroot mem root life cycle and thus fix a memory hog
  in case of many csv handlers.
parent fefb6d36
......@@ -448,6 +448,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin);
chain= chain_buffer;
file_buff= new Transparent_file();
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);;
}
......@@ -594,7 +595,7 @@ int ha_tina::find_current_row(uchar *buf)
bool read_all;
DBUG_ENTER("ha_tina::find_current_row");
free_root(&blobroot, MYF(MY_MARK_BLOCKS_FREE));
free_root(&blobroot, MYF(0));
/*
We do not read further then local_saved_data_file_length in order
......@@ -1073,8 +1074,6 @@ int ha_tina::rnd_init(bool scan)
records_is_known= 0;
chain_ptr= chain;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
DBUG_RETURN(0);
}
......@@ -1192,6 +1191,7 @@ int ha_tina::extra(enum ha_extra_function operation)
DBUG_RETURN(0);
}
/*
Set end_pos to the last valid byte of continuous area, closest
to the given "hole", stored in the buffer. "Valid" here means,
......@@ -1394,8 +1394,6 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
/* set current position to the beginning of the file */
current_position= next_position= 0;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
/* Read the file row-by-row. If everything is ok, repair is not needed. */
while (!(rc= find_current_row(buf)))
{
......@@ -1595,8 +1593,6 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
/* set current position to the beginning of the file */
current_position= next_position= 0;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
/* Read the file row-by-row. If everything is ok, repair is not needed. */
while (!(rc= find_current_row(buf)))
{
......@@ -1604,7 +1600,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
count--;
current_position= next_position;
}
free_root(&blobroot, MYF(0));
my_free((char*)buf, MYF(0));
......
......@@ -98,6 +98,7 @@ class ha_tina: public handler
my_free(chain, 0);
if (file_buff)
delete file_buff;
free_root(&blobroot, MYF(0));
}
const char *table_type() const { return "CSV"; }
const char *index_type(uint inx) { return "NONE"; }
......
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