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