Skip to content

Instantly share code, notes, and snippets.

View nirbhayc's full-sized avatar

Nirbhay Choubey nirbhayc

  • Bloomberg LP
  • New York
View GitHub Profile
package syncWrites;
/**
* Check Galera discrepancies in sync writes (parameter wsrep_sync_wait)
*
* Run:
* scp Java/bin/syncWrite/* [email protected]:syncWrite/Java/syncWrite; ssh [email protected] '(cd syncWrite/Java; java -cp ".:mysql-connector-java-5.1.39-bin.jar" syncWrite.simplified --pass *** --db test --nodes 10.9.202.189,100.64.6.114,10.9.197.46 --sw 7)'
*/
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 11c1bef..04ba4aa 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -995,6 +995,12 @@ bool wsrep_sync_wait (THD* thd, uint mask)
return true;
}
}
+ /* SELECT must have waited for wsrep_sync_wait=1. */
+ else if ((thd->lex->sql_command == SQLCOM_SELECT) &&
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 5bcea76..678ac87 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -148,10 +148,8 @@ int threadpool_add_connection(THD *thd)
if (!setup_connection_thread_globals(thd))
{
- if (!login_connection(thd))
+ if (!thd_prepare_connection(thd))
diff --git a/sql/handler.cc b/sql/handler.cc
index 6fa937f..d1f8380 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6100,8 +6100,7 @@ int handler::ha_write_row(uchar *buf)
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 &&
diff --git a/sql/handler.cc b/sql/handler.cc
index 6fa937f..0db8a5a 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6099,15 +6099,7 @@ int handler::ha_write_row(uchar *buf)
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 &&
MariaDB 10.1.15
===============
a) ./bin/mysqld
MariaDB [test]> select @@query_cache_size, @@query_cache_type;
+--------------------+--------------------+
| @@query_cache_size | @@query_cache_type |
+--------------------+--------------------+
| 1048576 | OFF |
+--------------------+--------------------+
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# Deadlock
#
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 3bce8ba..ffc9601 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -426,6 +426,9 @@ enum wsrep_trx_status
thd->wsrep_query_state = QUERY_COMMITTING;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
+ DBUG_EXECUTE_IF("wsrep_sleep_on_query_committing",
+ my_sleep(5000000););
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_1
CREATE TABLE t1(i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
# Open a new connection to perform a parallel ALTER TABLE.
--let $galera_connection_name = node_1a
--let $galera_server_number = 1