2006-12-31 02:29:11 +01:00
|
|
|
/* Copyright (C) 2006 MySQL AB
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-27 02:23:51 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2006-12-31 02:29:11 +01:00
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
#include "mysql_priv.h"
|
|
|
|
#include "rpl_injector.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
injector::transaction - member definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* inline since it's called below */
|
|
|
|
inline
|
2006-05-05 08:45:58 +02:00
|
|
|
injector::transaction::transaction(MYSQL_BIN_LOG *log, THD *thd)
|
2006-02-24 16:19:55 +01:00
|
|
|
: m_state(START_STATE), m_thd(thd)
|
2006-01-12 19:51:02 +01:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
Default initialization of m_start_pos (which initializes it to garbage).
|
|
|
|
We need to fill it in using the code below.
|
|
|
|
*/
|
|
|
|
LOG_INFO log_info;
|
|
|
|
log->get_current_log(&log_info);
|
|
|
|
/* !!! binlog_pos does not follow RAII !!! */
|
|
|
|
m_start_pos.m_file_name= my_strdup(log_info.log_file_name, MYF(0));
|
|
|
|
m_start_pos.m_file_pos= log_info.pos;
|
|
|
|
|
WL#3072 Maria Recovery
All statements doing an implicit commit now also do one in Maria.
This is useful because LOCK TABLES; REPAIR; crash; is not rollback-able,
the implicit commit of REPAIR avoid that Recovery tries to rollback
and fails.
Fix for BUG#33827 "COMMIT AND CHAIN causes serious Valgrind error"
(maybe not the definite one, depends on the assigned dev).
mysql-test/t/maria-recovery.test:
test of REPAIR's implicit commit. I cannot commit the result file
because maria-recovery fails in vanilla tree (seen in pushbuild) but
its new section looks like:
repair table t1;
Table Op Msg_type Msg_text
mysqltest.t1 repair status OK
insert into t1 values(2);
select * from t1;
a
1
2
3
SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
failure
use mysqltest;
select * from t1;
a
1
3
Which is as it should be.
sql/rpl_injector.cc:
fix for BUG#33827
sql/sql_parse.cc:
- All DDLs and mysql_admin_table() (REPAIR etc) use end_actrive_trans()
to do an implicit commit so we add there an implicit commit of the
Maria transaction.
- Fix for BUG#33827
storage/maria/ha_maria.cc:
- A method to do implicit commit in Maria
- After an implicit commit, if it was under LOCK TABLES, the locked
tables have a stale file->trn: update it.
storage/maria/ha_maria.h:
new static method
storage/maria/ma_check.c:
bugfix: this disabling of transactionality had the effect that if
LOCK TABLES; REPAIR; INSERT then the INSERT ran non-transactional
(so couldn't be undone in case of crash, if, by bad chance, its
effect on pages went to disk).
storage/maria/ma_checkpoint.c:
indentation
storage/maria/ma_recovery.c:
dbug statements
storage/maria/trnman.c:
When doing an implicit commit we need to know the number of locked
tables of the committed transaction and copy it to the new transaction
storage/maria/trnman_public.h:
prototype change
2008-01-11 22:48:54 +01:00
|
|
|
m_thd->lex->start_transaction_opt= 0; /* for begin_trans() */
|
2006-01-12 19:51:02 +01:00
|
|
|
begin_trans(m_thd);
|
2006-11-13 15:42:01 +01:00
|
|
|
|
|
|
|
thd->set_current_stmt_binlog_row_based();
|
2006-01-12 19:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
injector::transaction::~transaction()
|
|
|
|
{
|
2006-03-11 06:58:48 +01:00
|
|
|
if (!good())
|
|
|
|
return;
|
|
|
|
|
2006-01-12 19:51:02 +01:00
|
|
|
/* Needed since my_free expects a 'char*' (instead of 'void*'). */
|
|
|
|
char* const the_memory= const_cast<char*>(m_start_pos.m_file_name);
|
|
|
|
|
|
|
|
/*
|
|
|
|
We set the first character to null just to give all the copies of the
|
|
|
|
start position a (minimal) chance of seening that the memory is lost.
|
|
|
|
All assuming the my_free does not step over the memory, of course.
|
|
|
|
*/
|
|
|
|
*the_memory= '\0';
|
|
|
|
|
|
|
|
my_free(the_memory, MYF(0));
|
|
|
|
}
|
|
|
|
|
2010-01-24 08:03:23 +01:00
|
|
|
/**
|
|
|
|
@retval 0 transaction committed
|
|
|
|
@retval 1 transaction rolled back
|
|
|
|
*/
|
2006-01-12 19:51:02 +01:00
|
|
|
int injector::transaction::commit()
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::transaction::commit()");
|
2010-01-24 08:03:23 +01:00
|
|
|
int error= m_thd->binlog_flush_pending_rows_event(true);
|
A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem".
The idea of the fix is to ensure that we always commit the current
statement at the end of dispatch_command(). In order to not issue
redundant disc syncs, an optimization of the two-phase commit
protocol is implemented to bypass the two phase commit if
the transaction is read-only.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
Update test results.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
Update test results.
mysql-test/suite/rpl_ndb/t/disabled.def:
Disable the tests, for which this changeset reveals a bug:
the injector thread does not always add 'statement commit' to the
rows injected in circular replication set up.
To be investigated separately.
sql/ha_ndbcluster_binlog.cc:
Add close_thread_tables() to run_query: this ensures
that all tables are closed and there is no pending statement transaction.
sql/handler.cc:
Implement optimisation of read-only transactions.
If a transaction consists only of DML statements that do not change
data, we do not perform a two-phase commit for it
(run one phase commit only).
sql/handler.h:
Implement optimisation of read-only transactions.
If a transaction consists only of DML statements that do not change
data, we do not perform a two-phase commit for it
(run one phase commit only).
sql/log.cc:
Mark the binlog transaction read-write whenever it's started.
We never read from binlog, so it's safe and least intrusive to add
this mark up here.
sql/log_event.cc:
Update to the new layout of thd->transaction.
sql/rpl_injector.cc:
Always commit statement transaction before committing the global one.
sql/sp.cc:
Ad comments.
sql/sp_head.cc:
Add comments.
sql/sql_base.cc:
Commit transaction at the end of the statement. Always.
sql/sql_class.cc:
Update thd_ha_data to return the right pointer in the new layout.
Fix select_dumpvar::send_data to properly return operation status.
A test case from commit.inc would lead to an assertion failure in the
diagnostics area (double assignment). Not test otherwise by the test suite.
sql/sql_class.h:
Implement a new layout of storage engine transaction info in which
it is easy to access all members related to the handlerton only
based on ht->slot.
sql/sql_cursor.cc:
Update to the new layout of thd->transaction.
sql/sql_delete.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_do.cc:
Add DO always clears the error, we must rollback the current
statement before this happens. Otherwise the statement will be committed,
and not rolled back in the end.
sql/sql_insert.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_load.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_parse.cc:
Implement optimisation of read-only transactions: bypass 2-phase
commit for them.
Always commit statement transaction before commiting the global one.
Fix an unrelated crash in check_table_access, when called from
information_schema.
sql/sql_partition.cc:
Partitions commit at the end of a DDL operation.
Make sure that send_ok() is done only if the commit has succeeded.
sql/sql_table.cc:
Use ha_autocommit_or_rollback and end_active_trans everywhere.
Add end_trans to mysql_admin_table, so that it leaves no pending
transaction.
sql/sql_udf.cc:
Remvove a redundant call to close_thread_tables()
sql/sql_update.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
mysql-test/include/commit.inc:
New BitKeeper file ``mysql-test/include/commit.inc''
mysql-test/r/commit_1innodb.result:
New BitKeeper file ``mysql-test/r/commit_1innodb.result''
mysql-test/t/commit_1innodb.test:
New BitKeeper file ``mysql-test/t/commit_1innodb.test''
2008-02-19 12:43:01 +01:00
|
|
|
/*
|
|
|
|
Cluster replication does not preserve statement or
|
|
|
|
transaction boundaries of the master. Instead, a new
|
|
|
|
transaction on replication slave is started when a new GCI
|
|
|
|
(global checkpoint identifier) is issued, and is committed
|
|
|
|
when the last event of the check point has been received and
|
|
|
|
processed. This ensures consistency of each cluster in
|
|
|
|
cluster replication, and there is no requirement for stronger
|
|
|
|
consistency: MySQL replication is asynchronous with other
|
|
|
|
engines as well.
|
|
|
|
|
|
|
|
A practical consequence of that is that row level replication
|
|
|
|
stream passed through the injector thread never contains
|
|
|
|
COMMIT events.
|
|
|
|
Here we should preserve the server invariant that there is no
|
|
|
|
outstanding statement transaction when the normal transaction
|
|
|
|
is committed by committing the statement transaction
|
|
|
|
explicitly.
|
|
|
|
*/
|
2010-01-24 08:03:23 +01:00
|
|
|
error |= ha_autocommit_or_rollback(m_thd, error);
|
|
|
|
end_trans(m_thd, error ? ROLLBACK : COMMIT);
|
|
|
|
DBUG_RETURN(error);
|
2006-01-12 19:51:02 +01:00
|
|
|
}
|
|
|
|
|
2006-02-24 16:19:55 +01:00
|
|
|
int injector::transaction::use_table(server_id_type sid, table tbl)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::transaction::use_table");
|
|
|
|
|
|
|
|
int error;
|
|
|
|
|
|
|
|
if ((error= check_state(TABLE_STATE)))
|
|
|
|
DBUG_RETURN(error);
|
|
|
|
|
2007-04-12 16:13:49 +02:00
|
|
|
server_id_type save_id= m_thd->server_id;
|
2006-02-24 16:19:55 +01:00
|
|
|
m_thd->set_server_id(sid);
|
|
|
|
error= m_thd->binlog_write_table_map(tbl.get_table(),
|
|
|
|
tbl.is_transactional());
|
2007-04-12 16:13:49 +02:00
|
|
|
m_thd->set_server_id(save_id);
|
2006-02-24 16:19:55 +01:00
|
|
|
DBUG_RETURN(error);
|
|
|
|
}
|
|
|
|
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
int injector::transaction::write_row (server_id_type sid, table tbl,
|
|
|
|
MY_BITMAP const* cols, size_t colcnt,
|
|
|
|
record_type record)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::transaction::write_row(...)");
|
2010-01-24 08:03:23 +01:00
|
|
|
|
2010-01-28 22:51:40 +01:00
|
|
|
int error= check_state(ROW_STATE);
|
|
|
|
if (error)
|
2006-02-24 16:19:55 +01:00
|
|
|
DBUG_RETURN(error);
|
|
|
|
|
2007-04-12 16:13:49 +02:00
|
|
|
server_id_type save_id= m_thd->server_id;
|
2006-01-12 19:51:02 +01:00
|
|
|
m_thd->set_server_id(sid);
|
2010-01-24 08:03:23 +01:00
|
|
|
error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
|
|
|
|
cols, colcnt, record);
|
2007-04-12 16:13:49 +02:00
|
|
|
m_thd->set_server_id(save_id);
|
2010-01-24 08:03:23 +01:00
|
|
|
DBUG_RETURN(error);
|
2006-01-12 19:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int injector::transaction::delete_row(server_id_type sid, table tbl,
|
|
|
|
MY_BITMAP const* cols, size_t colcnt,
|
|
|
|
record_type record)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::transaction::delete_row(...)");
|
2006-02-24 16:19:55 +01:00
|
|
|
|
2010-01-28 22:51:40 +01:00
|
|
|
int error= check_state(ROW_STATE);
|
|
|
|
if (error)
|
2006-02-24 16:19:55 +01:00
|
|
|
DBUG_RETURN(error);
|
|
|
|
|
2007-04-12 16:13:49 +02:00
|
|
|
server_id_type save_id= m_thd->server_id;
|
2006-01-12 19:51:02 +01:00
|
|
|
m_thd->set_server_id(sid);
|
2010-01-24 08:03:23 +01:00
|
|
|
error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
|
|
|
|
cols, colcnt, record);
|
2007-04-12 16:13:49 +02:00
|
|
|
m_thd->set_server_id(save_id);
|
2010-01-24 08:03:23 +01:00
|
|
|
DBUG_RETURN(error);
|
2006-01-12 19:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int injector::transaction::update_row(server_id_type sid, table tbl,
|
|
|
|
MY_BITMAP const* cols, size_t colcnt,
|
|
|
|
record_type before, record_type after)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::transaction::update_row(...)");
|
2006-02-24 16:19:55 +01:00
|
|
|
|
2010-01-28 22:51:40 +01:00
|
|
|
int error= check_state(ROW_STATE);
|
|
|
|
if (error)
|
2006-02-24 16:19:55 +01:00
|
|
|
DBUG_RETURN(error);
|
|
|
|
|
2007-04-12 16:13:49 +02:00
|
|
|
server_id_type save_id= m_thd->server_id;
|
2006-01-12 19:51:02 +01:00
|
|
|
m_thd->set_server_id(sid);
|
2010-01-24 08:03:23 +01:00
|
|
|
error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
|
|
|
|
cols, colcnt, before, after);
|
2007-04-12 16:13:49 +02:00
|
|
|
m_thd->set_server_id(save_id);
|
2010-01-24 08:03:23 +01:00
|
|
|
DBUG_RETURN(error);
|
2006-01-12 19:51:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
injector::transaction::binlog_pos injector::transaction::start_pos() const
|
|
|
|
{
|
|
|
|
return m_start_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
injector - member definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This constructor is called below */
|
|
|
|
inline injector::injector()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static injector *s_injector= 0;
|
|
|
|
injector *injector::instance()
|
|
|
|
{
|
|
|
|
if (s_injector == 0)
|
|
|
|
s_injector= new injector;
|
|
|
|
/* "There can be only one [instance]" */
|
|
|
|
return s_injector;
|
|
|
|
}
|
|
|
|
|
2006-06-19 14:31:22 +02:00
|
|
|
void injector::free_instance()
|
|
|
|
{
|
|
|
|
injector *inj = s_injector;
|
|
|
|
|
|
|
|
if (inj != 0)
|
|
|
|
{
|
|
|
|
s_injector= 0;
|
|
|
|
delete inj;
|
|
|
|
}
|
|
|
|
}
|
2006-01-12 19:51:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
injector::transaction injector::new_trans(THD *thd)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::new_trans(THD*)");
|
|
|
|
/*
|
|
|
|
Currently, there is no alternative to using 'mysql_bin_log' since that
|
|
|
|
is hardcoded into the way the handler is using the binary log.
|
|
|
|
*/
|
|
|
|
DBUG_RETURN(transaction(&mysql_bin_log, thd));
|
|
|
|
}
|
|
|
|
|
|
|
|
void injector::new_trans(THD *thd, injector::transaction *ptr)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("injector::new_trans(THD *, transaction *)");
|
|
|
|
/*
|
|
|
|
Currently, there is no alternative to using 'mysql_bin_log' since that
|
|
|
|
is hardcoded into the way the handler is using the binary log.
|
|
|
|
*/
|
|
|
|
transaction trans(&mysql_bin_log, thd);
|
|
|
|
ptr->swap(trans);
|
|
|
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2007-03-29 20:31:09 +02:00
|
|
|
|
|
|
|
int injector::record_incident(THD *thd, Incident incident)
|
|
|
|
{
|
|
|
|
Incident_log_event ev(thd, incident);
|
|
|
|
if (int error= mysql_bin_log.write(&ev))
|
|
|
|
return error;
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-12-01 00:32:51 +01:00
|
|
|
return mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
|
2007-03-29 20:31:09 +02:00
|
|
|
}
|
|
|
|
|
2007-04-03 14:31:46 +02:00
|
|
|
int injector::record_incident(THD *thd, Incident incident, LEX_STRING const message)
|
2007-03-29 20:31:09 +02:00
|
|
|
{
|
|
|
|
Incident_log_event ev(thd, incident, message);
|
|
|
|
if (int error= mysql_bin_log.write(&ev))
|
|
|
|
return error;
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-12-01 00:32:51 +01:00
|
|
|
return mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
|
2007-03-29 20:31:09 +02:00
|
|
|
}
|