Created
July 20, 2016 03:00
-
-
Save nirbhayc/21dd29a9f32fc1203e5c00abfb8922de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sql/handler.cc b/sql/handler.cc | |
index 6fa937f..0db8a5a 100644 | |
--- a/sql/handler.cc | |
+++ b/sql/handler.cc | |
@@ -6099,15 +6099,7 @@ int handler::ha_write_row(uchar *buf) | |
if (unlikely(error= binlog_log_row(table, 0, buf, log_func))) | |
DBUG_RETURN(error); /* purecov: inspected */ | |
#ifdef WITH_WSREP | |
- current_thd->wsrep_affected_rows++; | |
- if (wsrep_max_ws_rows && | |
- current_thd->wsrep_exec_mode != REPL_RECV && | |
- current_thd->wsrep_affected_rows > wsrep_max_ws_rows) | |
- { | |
- current_thd->transaction_rollback_request= TRUE; | |
- my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0)); | |
- DBUG_RETURN(ER_ERROR_DURING_COMMIT); | |
- } | |
+ current_thd->wsrep_affected_rows ++; | |
#endif /* WITH_WSREP */ | |
DEBUG_SYNC_C("ha_write_row_end"); | |
@@ -6143,15 +6135,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data) | |
if (unlikely(error= binlog_log_row(table, old_data, new_data, log_func))) | |
return error; | |
#ifdef WITH_WSREP | |
- current_thd->wsrep_affected_rows++; | |
- if (wsrep_max_ws_rows && | |
- current_thd->wsrep_exec_mode != REPL_RECV && | |
- current_thd->wsrep_affected_rows > wsrep_max_ws_rows) | |
- { | |
- current_thd->transaction_rollback_request= TRUE; | |
- my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0)); | |
- return ER_ERROR_DURING_COMMIT; | |
- } | |
+ current_thd->wsrep_affected_rows ++; | |
#endif /* WITH_WSREP */ | |
return 0; | |
} | |
@@ -6181,15 +6165,7 @@ int handler::ha_delete_row(const uchar *buf) | |
if (unlikely(error= binlog_log_row(table, buf, 0, log_func))) | |
return error; | |
#ifdef WITH_WSREP | |
- current_thd->wsrep_affected_rows++; | |
- if (wsrep_max_ws_rows && | |
- current_thd->wsrep_exec_mode != REPL_RECV && | |
- current_thd->wsrep_affected_rows > wsrep_max_ws_rows) | |
- { | |
- current_thd->transaction_rollback_request= TRUE; | |
- my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0)); | |
- return ER_ERROR_DURING_COMMIT; | |
- } | |
+ current_thd->wsrep_affected_rows ++; | |
#endif /* WITH_WSREP */ | |
return 0; | |
} | |
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc | |
index 5cb9102..9ce0294 100644 | |
--- a/sql/wsrep_binlog.cc | |
+++ b/sql/wsrep_binlog.cc | |
@@ -288,12 +288,29 @@ int wsrep_write_cache(wsrep_t* const wsrep, | |
IO_CACHE* const cache, | |
size_t* const len) | |
{ | |
- if (wsrep_incremental_data_collection) { | |
- return wsrep_write_cache_inc(wsrep, thd, cache, len); | |
- } | |
- else { | |
- return wsrep_write_cache_once(wsrep, thd, cache, len); | |
- } | |
+ int err; | |
+ | |
+ if ((wsrep_max_ws_rows > 0) && | |
+ (thd->wsrep_affected_rows > wsrep_max_ws_rows)) | |
+ { | |
+ /* | |
+ No. of rows affected by the current transaction is larger than | |
+ wsrep_max_ws_rows. The transaction must fail. | |
+ */ | |
+ err= WSREP_TRX_SIZE_EXCEEDED; | |
+ } | |
+ else if (wsrep_incremental_data_collection) | |
+ { | |
+ err= wsrep_write_cache_inc(wsrep, thd, cache, len); | |
+ } | |
+ else | |
+ { | |
+ err= wsrep_write_cache_once(wsrep, thd, cache, len); | |
+ } | |
+ | |
+ /* thd->wsrep_affected_rows is reset in THD::cleanup_after_query(). */ | |
+ | |
+ return err; | |
} | |
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment