summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2015-10-05 09:42:03 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2016-02-22 16:21:04 -0500
commitc0dac420e5d5cfd14d1f6fea12288da4d29617ca (patch)
tree2745c6f54f096527663d52309044dd54841ecbb9
parent0ec457b0de083e45b815a04f4f6de0bcc002ffc6 (diff)
downloadmariadb-git-c0dac420e5d5cfd14d1f6fea12288da4d29617ca.tar.gz
refs codership/mysql-wsrep#31
- Removes useless call to wsrep_xid_init() in wsrep_apply_events(). Transaction's xid is already initialized at that point. - Adds call to wsrep_set_SE_checkpoint() for committing TOI events in the applier side. - Includes test case that reproduced the issue.
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#31.result10
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#31.test39
-rw-r--r--sql/wsrep_applier.cc19
3 files changed, 58 insertions, 10 deletions
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#31.result b/mysql-test/suite/galera/r/mysql-wsrep#31.result
new file mode 100644
index 00000000000..a21bb3eccfd
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#31.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('test');
+CREATE DATABASE db;
+Shutting down server 2 ...
+Recovering server 2 ...
+Performing --wsrep-recover ...
+Restarting server ...
+Using --wsrep-start-position when starting mysqld ...
+DROP TABLE t1;
+DROP DATABASE db;
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#31.test b/mysql-test/suite/galera/t/mysql-wsrep#31.test
new file mode 100644
index 00000000000..b6b6d1ebb4d
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#31.test
@@ -0,0 +1,39 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('test');
+CREATE DATABASE db;
+
+--connection node_2
+--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
+--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--let $expected_position = $expected_position_uuid:$expected_position_seqno
+
+--echo Shutting down server 2 ...
+--source include/shutdown_mysqld.inc
+
+--echo Recovering server 2 ...
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+if ($galera_wsrep_start_position != $expected_position)
+{
+ die(Expected position: $expected_position, found $galera_wsrep_start_position);
+}
+
+--echo Restarting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
+
+--connection node_1
+DROP TABLE t1;
+DROP DATABASE db;
+
+
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 4d95b38a371..5cfc9981342 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -150,9 +150,6 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
/* Use the original server id for logging. */
thd->set_server_id(ev->server_id);
thd->set_time(); // time the query
- wsrep_xid_init(&thd->transaction.xid_state.xid,
- thd->wsrep_trx_meta.gtid.uuid,
- thd->wsrep_trx_meta.gtid.seqno);
thd->lex->current_select= 0;
if (!ev->when)
{
@@ -281,8 +278,7 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
return rcode;
}
-static wsrep_cb_status_t wsrep_commit(THD* const thd,
- wsrep_seqno_t const global_seqno)
+static wsrep_cb_status_t wsrep_commit(THD* const thd)
{
#ifdef WSREP_PROC_INFO
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
@@ -301,7 +297,11 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
#ifdef GTID_SUPPORT
thd->variables.gtid_next.set_automatic();
#endif /* GTID_SUPPORT */
- // TODO: mark snapshot with global_seqno.
+ if (thd->wsrep_apply_toi)
+ {
+ wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid,
+ thd->wsrep_trx_meta.gtid.seqno);
+ }
}
#ifdef WSREP_PROC_INFO
@@ -315,8 +315,7 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
return rcode;
}
-static wsrep_cb_status_t wsrep_rollback(THD* const thd,
- wsrep_seqno_t const global_seqno)
+static wsrep_cb_status_t wsrep_rollback(THD* const thd)
{
#ifdef WSREP_PROC_INFO
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
@@ -353,9 +352,9 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
wsrep_cb_status_t rcode;
if (commit)
- rcode = wsrep_commit(thd, meta->gtid.seqno);
+ rcode = wsrep_commit(thd);
else
- rcode = wsrep_rollback(thd, meta->gtid.seqno);
+ rcode = wsrep_rollback(thd);
wsrep_set_apply_format(thd, NULL);
thd->mdl_context.release_transactional_locks();