1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge MySQL 5.1.44 into MariaDB.

This commit is contained in:
unknown
2010-03-04 09:03:07 +01:00
301 changed files with 10433 additions and 2269 deletions

View File

@ -59,10 +59,14 @@ injector::transaction::~transaction()
my_free(the_memory, MYF(0));
}
/**
@retval 0 transaction committed
@retval 1 transaction rolled back
*/
int injector::transaction::commit()
{
DBUG_ENTER("injector::transaction::commit()");
m_thd->binlog_flush_pending_rows_event(true);
int error= m_thd->binlog_flush_pending_rows_event(true);
/*
Cluster replication does not preserve statement or
transaction boundaries of the master. Instead, a new
@ -82,9 +86,9 @@ int injector::transaction::commit()
is committed by committing the statement transaction
explicitly.
*/
ha_autocommit_or_rollback(m_thd, 0);
end_trans(m_thd, COMMIT);
DBUG_RETURN(0);
error |= ha_autocommit_or_rollback(m_thd, error);
end_trans(m_thd, error ? ROLLBACK : COMMIT);
DBUG_RETURN(error);
}
int injector::transaction::use_table(server_id_type sid, table tbl)
@ -110,16 +114,17 @@ int injector::transaction::write_row (server_id_type sid, table tbl,
record_type record)
{
DBUG_ENTER("injector::transaction::write_row(...)");
if (int error= check_state(ROW_STATE))
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
m_thd->set_server_id(save_id);
DBUG_RETURN(0);
DBUG_RETURN(error);
}
@ -129,15 +134,16 @@ int injector::transaction::delete_row(server_id_type sid, table tbl,
{
DBUG_ENTER("injector::transaction::delete_row(...)");
if (int error= check_state(ROW_STATE))
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
m_thd->set_server_id(save_id);
DBUG_RETURN(0);
DBUG_RETURN(error);
}
@ -147,15 +153,16 @@ int injector::transaction::update_row(server_id_type sid, table tbl,
{
DBUG_ENTER("injector::transaction::update_row(...)");
if (int error= check_state(ROW_STATE))
int error= check_state(ROW_STATE);
if (error)
DBUG_RETURN(error);
server_id_type save_id= m_thd->server_id;
m_thd->set_server_id(sid);
m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, before, after);
error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, before, after);
m_thd->set_server_id(save_id);
DBUG_RETURN(0);
DBUG_RETURN(error);
}