mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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.
This commit is contained in:
committed by
Nirbhay Choubey
parent
10880d67b9
commit
3db92ee433
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user