mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
slave master.info FILE -> IO_CACHE
send_file() is more stack-friendly - changed large static buffer to alloc_root() fixed my_b_seek() to work with WRITE_CACHE test case to make sure the slave starts correctly after being stopped truncated words file so the replication tests will take less time
This commit is contained in:
@ -32,7 +32,7 @@ static int send_file(THD *thd)
|
||||
NET* net = &thd->net;
|
||||
int fd = -1,bytes, error = 1;
|
||||
char fname[FN_REFLEN+1];
|
||||
char buf[IO_SIZE*15];
|
||||
char *buf;
|
||||
const char *errmsg = 0;
|
||||
int old_timeout;
|
||||
DBUG_ENTER("send_file");
|
||||
@ -42,6 +42,13 @@ static int send_file(THD *thd)
|
||||
old_timeout = thd->net.timeout;
|
||||
thd->net.timeout = thd->inactive_timeout;
|
||||
|
||||
// spare the stack
|
||||
if(!(buf = alloc_root(&thd->mem_root,IO_SIZE)))
|
||||
{
|
||||
errmsg = "Out of memory";
|
||||
goto err;
|
||||
}
|
||||
|
||||
// we need net_flush here because the client will not know it needs to send
|
||||
// us the file name until it has processed the load event entry
|
||||
if (net_flush(net) || my_net_read(net) == packet_error)
|
||||
@ -62,7 +69,7 @@ static int send_file(THD *thd)
|
||||
goto err;
|
||||
}
|
||||
|
||||
while ((bytes = (int) my_read(fd, (byte*) buf, sizeof(buf),
|
||||
while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE,
|
||||
MYF(MY_WME))) > 0)
|
||||
{
|
||||
if (my_net_write(net, buf, bytes))
|
||||
|
Reference in New Issue
Block a user