1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

cleanup: LOAD DATA replication support in IO_CACHE

remove some 14-year old code that added support for
LOAD DATA replication to IO_CACHE:
* three callbacks, of which only two were actually used and that
  were only needed for LOAD DATA replication but were
  tested in every IO_CACHE instance
* an additional opaque void * argument in IO_CACHE, also only
  used for LOAD DATA replication, but present everywhere
* the code to close IO_CACHE prematurely in LOAD DATA to have
  these callbacks called in the correct order and a long
  comment explaining what will happen if IO_CACHE is not
  closed prematurely
* a variable to track whether IO_CACHE was closed prematurely
  (to avoid double-closing it)
This commit is contained in:
Sergei Golubchik
2015-05-16 08:48:52 +02:00
parent 91dab5ddb6
commit 80e61ae21e
5 changed files with 37 additions and 98 deletions

View File

@ -4119,20 +4119,20 @@ err:
@retval 0 success
@retval 1 failure
*/
int log_loaded_block(IO_CACHE* file)
int log_loaded_block(IO_CACHE* file, uchar *Buffer, size_t Count)
{
DBUG_ENTER("log_loaded_block");
LOAD_FILE_INFO *lf_info;
LOAD_FILE_IO_CACHE *lf_info= static_cast<LOAD_FILE_IO_CACHE*>(file);
uint block_len;
/* buffer contains position where we started last read */
uchar* buffer= (uchar*) my_b_get_buffer_start(file);
uint max_event_size= current_thd->variables.max_allowed_packet;
lf_info= (LOAD_FILE_INFO*) file->arg;
uint max_event_size= lf_info->thd->variables.max_allowed_packet;
if (lf_info->thd->is_current_stmt_binlog_format_row())
DBUG_RETURN(0);
goto ret;
if (lf_info->last_pos_in_file != HA_POS_ERROR &&
lf_info->last_pos_in_file >= my_b_get_pos_in_file(file))
DBUG_RETURN(0);
goto ret;
for (block_len= (uint) (my_b_get_bytes_in_buffer(file)); block_len > 0;
buffer += MY_MIN(block_len, max_event_size),
@ -4158,7 +4158,9 @@ int log_loaded_block(IO_CACHE* file)
lf_info->wrote_create_file= 1;
}
}
DBUG_RETURN(0);
ret:
int res= Buffer ? lf_info->real_read_function(file, Buffer, Count) : 0;
DBUG_RETURN(res);
}