summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.cc8
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/wsrep_mysqld.cc22
3 files changed, 28 insertions, 10 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c10eedaadfb..622b0f6c5f5 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -4611,7 +4611,13 @@ extern "C" void thd_progress_report(MYSQL_THD thd,
return;
if (thd->progress.max_counter != max_progress) // Simple optimization
{
- mysql_mutex_lock(&thd->LOCK_thd_data);
+ /*
+ Better to not wait in the unlikely event that LOCK_thd_data is locked
+ as Galera can potentially have this locked for a long time.
+ Progress counters will fix themselves after the next call.
+ */
+ if (mysql_mutex_trylock(&thd->LOCK_thd_data))
+ return;
thd->progress.counter= progress;
thd->progress.max_counter= max_progress;
mysql_mutex_unlock(&thd->LOCK_thd_data);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6029b92e0d9..ceb298aefc6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -18504,9 +18504,9 @@ bool Create_tmp_table::add_fields(THD *thd,
distinct_record_structure= true;
}
li.rewind();
- uint uneven_delta= 0;
while ((item=li++))
{
+ uint uneven_delta;
current_counter= (((param->hidden_field_count < (fieldnr + 1)) &&
distinct_record_structure &&
(!m_with_cycle ||
@@ -18569,8 +18569,8 @@ bool Create_tmp_table::add_fields(THD *thd,
uneven_delta= m_uneven_bit_length;
add_field(table, new_field, fieldnr++, param->force_not_null_cols);
- uneven_delta= m_uneven_bit_length - uneven_delta;
m_field_count[current_counter]++;
+ m_uneven_bit[current_counter]+= (m_uneven_bit_length - uneven_delta);
if (!(new_field->flags & NOT_NULL_FLAG))
{
@@ -18651,8 +18651,8 @@ bool Create_tmp_table::add_fields(THD *thd,
uneven_delta= m_uneven_bit_length;
add_field(table, new_field, fieldnr++, param->force_not_null_cols);
- uneven_delta= m_uneven_bit_length - uneven_delta;
m_field_count[current_counter]++;
+ m_uneven_bit[current_counter]+= (m_uneven_bit_length - uneven_delta);
if (item->marker == 4 && item->maybe_null)
{
@@ -18662,7 +18662,6 @@ bool Create_tmp_table::add_fields(THD *thd,
if (current_counter == distinct)
new_field->flags|= FIELD_PART_OF_TMP_UNIQUE;
}
- m_uneven_bit[current_counter]+= uneven_delta;
}
DBUG_ASSERT(fieldnr == m_field_count[other] + m_field_count[distinct]);
DBUG_ASSERT(m_blob_count == m_blobs_count[other] + m_blobs_count[distinct]);
@@ -18821,7 +18820,6 @@ bool Create_tmp_table::finalize(THD *thd,
if (!(field->flags & NOT_NULL_FLAG))
{
-
recinfo->null_bit= (uint8)1 << (null_counter[current_counter] & 7);
recinfo->null_pos= (null_pack_base[current_counter] +
null_counter[current_counter]/8);
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 4940b0839b9..aa6a7a2ca63 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -32,6 +32,7 @@
#include "sp_head.h"
#include "sql_show.h"
#include "sp.h"
+#include "handler.h"
#include "wsrep_priv.h"
#include "wsrep_thd.h"
#include "wsrep_sst.h"
@@ -1986,10 +1987,23 @@ bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
return true;
break;
case SQLCOM_ALTER_TABLE:
- if (create_info &&
- !wsrep_should_replicate_ddl(thd, create_info->db_type->db_type))
- return false;
- /* fallthrough */
+ {
+ if (create_info)
+ {
+ enum legacy_db_type db_type;
+
+ if (create_info->db_type)
+ db_type= create_info->db_type->db_type;
+ else
+ {
+ const handlerton *hton= ha_default_handlerton(thd);
+ db_type= hton->db_type;
+ }
+ if (!wsrep_should_replicate_ddl(thd, db_type))
+ return false;
+ }
+ }
+ /* fallthrough */
default:
if (table && !thd->find_temporary_table(db, table))
{