wsrep.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright 2014 Codership Oy <http://www.codership.com> & SkySQL Ab
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. #include <my_config.h>
  13. #ifndef WSREP_INCLUDED
  14. #define WSREP_INCLUDED
  15. #ifdef WITH_WSREP
  16. #define IF_WSREP(A,B) A
  17. #define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
  18. #define WSREP_MYSQL_DB (char *)"mysql"
  19. #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
  20. if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
  21. goto error;
  22. #define WSREP_TO_ISOLATION_END \
  23. if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
  24. wsrep_to_isolation_end(thd);
  25. /*
  26. Checks if lex->no_write_to_binlog is set for statements that use LOCAL or
  27. NO_WRITE_TO_BINLOG.
  28. */
  29. #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \
  30. if (WSREP(thd) && !thd->lex->no_write_to_binlog \
  31. && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error;
  32. #define WSREP_DEBUG(...) \
  33. if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
  34. #define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
  35. #define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
  36. #define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
  37. #else
  38. #define IF_WSREP(A,B) B
  39. #define DBUG_ASSERT_IF_WSREP(A)
  40. #define WSREP_DEBUG(...)
  41. #define WSREP_INFO(...)
  42. #define WSREP_WARN(...)
  43. #define WSREP_ERROR(...)
  44. #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_)
  45. #define WSREP_TO_ISOLATION_END
  46. #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
  47. #endif
  48. #endif /* WSERP_INCLUDED */