Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. @@ -206,11 +206,19 @@ extern Binlog_relay_IO_delegate *binlog_relay_io_delegate;
  2. #endif /* HAVE_REPLICATION */
  3.  
  4. /*
  5. - if there is no observers in the delegate, we can return 0
  6. - immediately.
  7. + if semisync replication is not enabled, we can return immediately.
  8. */
  9. -#define RUN_HOOK(group, hook, args) \
  10. - (group ##_delegate->is_empty() ? \
  11. - 0 : group ##_delegate->hook args)
  12. +#ifdef HAVE_REPLICATION
  13. +/*
  14. + As semisync is unpluggined and its hooks are turned into static
  15. + invocations all other hooks are not run for optimization sake.
  16. + Todo: introduce a server flag to allow the plugins' hooks to run
  17. + along with "static" semisync ones.
  18. +*/
  19. +#define RUN_HOOK(group, hook, args) \
  20. + (unlikely(run_hooks_enabled) ? group ##_delegate->hook args : 0)
  21. +#else
  22. +#define RUN_HOOK(group, hook, args) 0
  23. +#endif /* HAVE_REPLICATION */
  24.  
  25. #endif /* RPL_HANDLER_H */
  26.  
  27. @@ -8807,6 +8872,7 @@ static int mysql_init_variables(void)
  28. report_user= report_password = report_host= 0; /* TO BE DELETED */
  29. opt_relay_logname= opt_relaylog_index_name= 0;
  30. slave_retried_transactions= 0;
  31. + run_hooks_enabled= 1; // "dynamic" hooks run by default unlike "static" semisync
  32. log_bin_basename= NULL;
  33. log_bin_index= NULL;
  34.  
  35.  
  36. // SET @@global.rpl_semi_sync_master_enabled = ON
  37. @@ -388,6 +409,7 @@ int ReplSemiSyncMaster::enableMaster()
  38.  
  39. set_master_enabled(true);
  40. state_ = true;
  41. + run_hooks_enabled= 0; // plugin "dynamic" hooks not to run when semisync ON
  42. sql_print_information("Semi-sync replication enabled on the master.");
  43. }
  44. else
  45.  
  46. @@ -44,54 +48,72 @@ class ReplSemiSyncSlave
  47. return slave_enabled_;
  48. }
  49. void setSlaveEnabled(bool enabled) {
  50. + run_hooks_enabled= !enabled; // plugin "dynamic" hooks not to run when semisync ON
  51. slave_enabled_ = enabled;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement