* get end pos of current log file, this function * will wait if there is nothing available */
| 3115 | * will wait if there is nothing available |
| 3116 | */ |
| 3117 | static my_off_t get_binlog_end_pos(binlog_send_info *info, |
| 3118 | IO_CACHE* log, |
| 3119 | LOG_INFO* linfo) |
| 3120 | { |
| 3121 | my_off_t log_pos= my_b_tell(log); |
| 3122 | |
| 3123 | /** |
| 3124 | * get current binlog end pos |
| 3125 | */ |
| 3126 | mysql_bin_log.lock_binlog_end_pos(); |
| 3127 | char binlog_end_pos_filename[FN_REFLEN]; |
| 3128 | my_off_t end_pos= mysql_bin_log.get_binlog_end_pos(binlog_end_pos_filename); |
| 3129 | mysql_bin_log.unlock_binlog_end_pos(); |
| 3130 | |
| 3131 | do |
| 3132 | { |
| 3133 | if (strcmp(binlog_end_pos_filename, linfo->log_file_name) != 0) |
| 3134 | { |
| 3135 | /** |
| 3136 | * this file is not active, since it's not written to again, |
| 3137 | * it safe to check file length and use that as end_pos |
| 3138 | */ |
| 3139 | end_pos= my_b_filelength(log); |
| 3140 | |
| 3141 | if (log_pos == end_pos) |
| 3142 | return 0; // already at end of file inactive file |
| 3143 | else |
| 3144 | return end_pos; // return size of inactive file |
| 3145 | } |
| 3146 | else |
| 3147 | { |
| 3148 | /** |
| 3149 | * this is the active file |
| 3150 | */ |
| 3151 | |
| 3152 | if (log_pos < end_pos) |
| 3153 | { |
| 3154 | /** |
| 3155 | * there is data available to read |
| 3156 | */ |
| 3157 | return end_pos; |
| 3158 | } |
| 3159 | |
| 3160 | /** |
| 3161 | * check if we should wait for more data |
| 3162 | */ |
| 3163 | if ((info->flags & BINLOG_DUMP_NON_BLOCK) || |
| 3164 | (info->thd->variables.server_id == 0)) |
| 3165 | { |
| 3166 | info->should_stop= true; |
| 3167 | return 0; |
| 3168 | } |
| 3169 | |
| 3170 | /** |
| 3171 | * flush data before waiting |
| 3172 | */ |
| 3173 | if (net_flush(info->net)) |
| 3174 | { |
no test coverage detected