MCPcopy Create free account
hub / github.com/MariaDB/server / get_binlog_end_pos

Function get_binlog_end_pos

sql/sql_repl.cc:3117–3186  ·  view source on GitHub ↗

* get end pos of current log file, this function * will wait if there is nothing available */

Source from the content-addressed store, hash-verified

3115 * will wait if there is nothing available
3116 */
3117static 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 {

Callers 1

send_one_binlog_fileFunction · 0.85

Calls 8

my_b_tellFunction · 0.85
my_b_filelengthFunction · 0.85
net_flushFunction · 0.85
wait_new_eventsFunction · 0.85
should_stopFunction · 0.85
lock_binlog_end_posMethod · 0.80
get_binlog_end_posMethod · 0.80
unlock_binlog_end_posMethod · 0.80

Tested by

no test coverage detected