| 2262 | |
| 2263 | extern "C" |
| 2264 | void |
| 2265 | binlog_get_cache(THD *thd, uint64_t file_no, uint64_t offset, |
| 2266 | IO_CACHE **out_cache, |
| 2267 | handler_binlog_event_group_info **out_context, |
| 2268 | const rpl_gtid **out_gtid) |
| 2269 | { |
| 2270 | IO_CACHE *cache= nullptr; |
| 2271 | handler_binlog_event_group_info *context= nullptr; |
| 2272 | binlog_cache_mngr *cache_mngr; |
| 2273 | const rpl_gtid *gtid= nullptr; |
| 2274 | /* opt_binlog_engine_hton can be unset during bootstrap. */ |
| 2275 | if (likely(opt_binlog_engine_hton) && |
| 2276 | (cache_mngr= thd->binlog_get_cache_mngr())) |
| 2277 | { |
| 2278 | cache_mngr->engine_binlogged= TRUE; |
| 2279 | cache_mngr->last_commit_pos_file.engine_file_no= file_no; |
| 2280 | cache_mngr->last_commit_pos_offset= offset; |
| 2281 | binlog_cache_data *cache_data= cache_mngr->engine_cache_data(); |
| 2282 | cache= &cache_data->cache_log; |
| 2283 | context= &cache_data->engine_binlog_info; |
| 2284 | /* |
| 2285 | If we are binlogging from both stmt and trx cache in the same event |
| 2286 | group, pass the engine context for out-of-band stmt data as |
| 2287 | engine_ptr2. In this case, we have flushed everything in both |
| 2288 | caches out as out-of-band data already. |
| 2289 | */ |
| 2290 | if (likely(cache_data->trx_cache()) && |
| 2291 | unlikely(!cache_mngr->stmt_cache.empty())) |
| 2292 | context->engine_ptr2= |
| 2293 | cache_mngr->stmt_cache.engine_binlog_info.engine_ptr; |
| 2294 | else |
| 2295 | context->engine_ptr2= nullptr; |
| 2296 | binlog_setup_engine_commit_data(context, cache_mngr); |
| 2297 | gtid= thd->get_last_commit_gtid(); |
| 2298 | } |
| 2299 | *out_cache= cache; |
| 2300 | *out_context= context; |
| 2301 | *out_gtid= gtid; |
| 2302 | } |
| 2303 | |
| 2304 | |
| 2305 | /** |
no test coverage detected