| 2537 | } |
| 2538 | |
| 2539 | static int check_start_offset(binlog_send_info *info, |
| 2540 | const char *log_file_name, |
| 2541 | my_off_t pos) |
| 2542 | { |
| 2543 | IO_CACHE log; |
| 2544 | File file= -1; |
| 2545 | |
| 2546 | /** check that requested position is inside of file */ |
| 2547 | if ((file=open_binlog(&log, log_file_name, &info->errmsg)) < 0) |
| 2548 | { |
| 2549 | info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; |
| 2550 | return 1; |
| 2551 | } |
| 2552 | |
| 2553 | if (pos < BIN_LOG_HEADER_SIZE || pos > my_b_filelength(&log)) |
| 2554 | { |
| 2555 | const char* msg= "Client requested master to start replication from " |
| 2556 | "impossible position"; |
| 2557 | |
| 2558 | info->errmsg= NULL; // don't do further modifications of error_text |
| 2559 | snprintf(info->error_text, sizeof(info->error_text), |
| 2560 | "%s; the first event '%s' at %lld, " |
| 2561 | "the last event read from '%s' at %d, " |
| 2562 | "the last byte read from '%s' at %d.", |
| 2563 | msg, |
| 2564 | my_basename(info->start_log_file_name), pos, |
| 2565 | my_basename(info->start_log_file_name), BIN_LOG_HEADER_SIZE, |
| 2566 | my_basename(info->start_log_file_name), BIN_LOG_HEADER_SIZE); |
| 2567 | info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; |
| 2568 | goto err; |
| 2569 | } |
| 2570 | |
| 2571 | err: |
| 2572 | end_io_cache(&log); |
| 2573 | mysql_file_close(file, MYF(MY_WME)); |
| 2574 | return info->error; |
| 2575 | } |
| 2576 | |
| 2577 | static int init_binlog_sender(binlog_send_info *info, |
| 2578 | LOG_INFO *linfo, |
no test coverage detected