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 02110-1335 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 wsrep_error_label; 29 30 #define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \ 31 if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \ 32 table_list_, alter_info_)) \ 33 goto wsrep_error_label; 34 35 #define WSREP_TO_ISOLATION_END \ 36 if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \ 37 wsrep_to_isolation_end(thd); 38 39 /* 40 Checks if lex->no_write_to_binlog is set for statements that use LOCAL or 41 NO_WRITE_TO_BINLOG. 42 */ 43 #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \ 44 if (WSREP(thd) && !thd->lex->no_write_to_binlog \ 45 && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label; 46 47 #define WSREP_DEBUG(...) \ 48 if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) 49 #define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) 50 #define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) 51 #define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) 52 53 #define WSREP_SYNC_WAIT(thd_, before_) \ 54 do { if (WSREP_CLIENT(thd_) && \ 55 wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } while(0) 56 #define WSREP_ERROR_LABEL wsrep_error_label 57 #else 58 #define IF_WSREP(A,B) B 59 #define DBUG_ASSERT_IF_WSREP(A) 60 #define WSREP_DEBUG(...) 61 #define WSREP_INFO(...) 62 #define WSREP_WARN(...) 63 #define WSREP_ERROR(...) 64 #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) 65 #define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) 66 #define WSREP_TO_ISOLATION_END 67 #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) 68 #define WSREP_SYNC_WAIT(thd_, before_) do { } while(0) 69 #define WSREP_ERROR_LABEL goto wsrep_error_label; wsrep_error_label 70 71 #endif /* WITH_WSREP */ 72 73 #endif /* WSREP_INCLUDED */ 74