| 306 | } |
| 307 | |
| 308 | int Binlog_transmit_delegate::reserve_header(THD *thd, ushort flags, |
| 309 | String *packet) |
| 310 | { |
| 311 | /* NOTE2ME: Maximum extra header size for each observer, I hope 32 |
| 312 | bytes should be enough for each Observer to reserve their extra |
| 313 | header. If later found this is not enough, we can increase this |
| 314 | /HEZX |
| 315 | */ |
| 316 | #define RESERVE_HEADER_SIZE 32 |
| 317 | unsigned char header[RESERVE_HEADER_SIZE]; |
| 318 | ulong hlen; |
| 319 | Binlog_transmit_param param; |
| 320 | param.flags= flags; |
| 321 | param.server_id= thd->server_id; |
| 322 | |
| 323 | DBUG_EXECUTE_IF("crash_binlog_transmit_hook", DBUG_SUICIDE();); |
| 324 | |
| 325 | int ret= 0; |
| 326 | read_lock(); |
| 327 | Observer_info_iterator iter= observer_info_iter(); |
| 328 | Observer_info *info= iter++; |
| 329 | for (; info; info= iter++) |
| 330 | { |
| 331 | plugin_ref plugin= |
| 332 | my_plugin_lock(thd, &info->plugin); |
| 333 | if (!plugin) |
| 334 | { |
| 335 | ret= 1; |
| 336 | break; |
| 337 | } |
| 338 | hlen= 0; |
| 339 | if (((Observer *)info->observer)->reserve_header |
| 340 | && ((Observer *)info->observer)->reserve_header(¶m, |
| 341 | header, |
| 342 | RESERVE_HEADER_SIZE, |
| 343 | &hlen)) |
| 344 | { |
| 345 | ret= 1; |
| 346 | plugin_unlock(thd, plugin); |
| 347 | break; |
| 348 | } |
| 349 | plugin_unlock(thd, plugin); |
| 350 | if (hlen == 0) |
| 351 | continue; |
| 352 | if (hlen > RESERVE_HEADER_SIZE || packet->append((char *)header, hlen)) |
| 353 | { |
| 354 | ret= 1; |
| 355 | break; |
| 356 | } |
| 357 | } |
| 358 | unlock(); |
| 359 | return ret; |
| 360 | } |
| 361 | |
| 362 | int Binlog_transmit_delegate::before_send_event(THD *thd, ushort flags, |
| 363 | String *packet, |
nothing calls this directly
no test coverage detected