summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2016-05-03 16:22:01 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2016-07-19 21:06:42 -0400
commit3db92ee43358f5df256bf1b0db4955ec86bdceee (patch)
tree4debaae28328b7a98c97a527818771125c84c28b /sql/handler.cc
parent10880d67b95d29dc1a764f2ee5c2010dc89659df (diff)
downloadmariadb-git-3db92ee43358f5df256bf1b0db4955ec86bdceee.tar.gz
MW-265 Add support for wsrep_max_ws_rows
Variable wsrep_max_ws_rows limits the number of rows that a transaction can insert/update/delete.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index e84e1b52ca2..6fa937faa84 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6098,6 +6098,17 @@ int handler::ha_write_row(uchar *buf)
rows_changed++;
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);
+ }
+#endif /* WITH_WSREP */
DEBUG_SYNC_C("ha_write_row_end");
DBUG_RETURN(0);
@@ -6131,6 +6142,17 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
rows_changed++;
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;
+ }
+#endif /* WITH_WSREP */
return 0;
}
@@ -6158,6 +6180,17 @@ int handler::ha_delete_row(const uchar *buf)
rows_changed++;
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;
+ }
+#endif /* WITH_WSREP */
return 0;
}