diff options
author | Monty <monty@mariadb.org> | 2015-11-29 17:51:23 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-11-29 17:51:23 +0200 |
commit | c3018b0ff4fb02c029787d03867adf0530607bab (patch) | |
tree | c3497838c222af9445a16312ecbd0e78ebc62f66 /sql | |
parent | 654547b5b4b21aec719a84149595464364c96eea (diff) | |
download | mariadb-git-c3018b0ff4fb02c029787d03867adf0530607bab.tar.gz |
Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks,
as safemalloc warnings stopped tests from passing on MacOSX.
- Ensure that all clients takes character-set-dir, as the
libmysqlclient library will use it.
- mysql-test-run now passes character-set-dir to all external clients.
- Changed dynstr_free() so that it can be called twice (made freeing code easier)
- Changed rpl_global_gtid_slave_state to be allocated dynamicly as it
includes a mutex that needs to be initizlied/destroyed before my_end() is called.
- Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as
their job are better handling by constructor and delete.
- Print alias instead of table_name in check_duplicate_key as
table_name may have been converted to lower case.
Other things:
- Fixed a case in time_to_datetime_with_warn() where we where
using && instead of & in tests
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log_event.cc | 22 | ||||
-rw-r--r-- | sql/rpl_gtid.cc | 42 | ||||
-rw-r--r-- | sql/rpl_gtid.h | 3 | ||||
-rw-r--r-- | sql/rpl_parallel.cc | 2 | ||||
-rw-r--r-- | sql/rpl_rli.cc | 30 | ||||
-rw-r--r-- | sql/rpl_rli.h | 2 | ||||
-rw-r--r-- | sql/slave.cc | 18 | ||||
-rw-r--r-- | sql/sql_repl.cc | 14 | ||||
-rw-r--r-- | sql/sql_table.cc | 7 | ||||
-rw-r--r-- | sql/sql_time.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 2 |
11 files changed, 65 insertions, 79 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 215bb6df0f8..54be1394a95 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4294,7 +4294,8 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, rgi->gtid_pending= false; gtid= rgi->current_gtid; - if (rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false)) + if (rpl_global_gtid_slave_state->record_gtid(thd, >id, sub_id, + true, false)) { int errcode= thd->get_stmt_da()->sql_errno(); if (!is_parallel_retry_error(rgi, errcode)) @@ -4513,7 +4514,7 @@ compare_errors: end: if (sub_id && !thd->is_slave_error) - rpl_global_gtid_slave_state.update_state_hash(sub_id, >id, rgi); + rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, rgi); /* Probably we have set thd->query, thd->db, thd->catalog to point to places @@ -6281,7 +6282,7 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi) rli->group_master_log_name, (ulong) rli->group_master_log_pos)); mysql_mutex_unlock(&rli->data_lock); - rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi); + rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi); flush_relay_log_info(rli); /* @@ -6751,7 +6752,7 @@ Gtid_list_log_event::Gtid_list_log_event(const char *buf, uint event_len, for (i= 0; i < count; ++i) { if (!(sub_id_list[i]= - rpl_global_gtid_slave_state.next_sub_id(list[i].domain_id))) + rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id))) { my_free(list); my_free(sub_id_list); @@ -6806,7 +6807,7 @@ Gtid_list_log_event::Gtid_list_log_event(slave_connection_state *gtid_set, for (i= 0; i < count; ++i) { if (!(sub_id_list[i]= - rpl_global_gtid_slave_state.next_sub_id(list[i].domain_id))) + rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id))) { my_free(list); my_free(sub_id_list); @@ -6879,11 +6880,11 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi) uint32 i; for (i= 0; i < count; ++i) { - if ((ret= rpl_global_gtid_slave_state.record_gtid(thd, &list[i], + if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i], sub_id_list[i], false, false))) return ret; - rpl_global_gtid_slave_state.update_state_hash(sub_id_list[i], &list[i], + rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i], NULL); } } @@ -7383,7 +7384,8 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi) rgi->gtid_pending= false; gtid= rgi->current_gtid; - err= rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false); + err= rpl_global_gtid_slave_state->record_gtid(thd, >id, sub_id, true, + false); if (err) { int ec= thd->get_stmt_da()->sql_errno(); @@ -7416,7 +7418,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi) thd->mdl_context.release_transactional_locks(); if (!res && sub_id) - rpl_global_gtid_slave_state.update_state_hash(sub_id, >id, rgi); + rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, rgi); /* Increment the global status commit count variable @@ -8169,7 +8171,7 @@ int Stop_log_event::do_update_pos(rpl_group_info *rgi) rgi->inc_event_relay_log_pos(); else if (!rgi->is_parallel_exec) { - rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi); + rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi); rli->inc_group_relay_log_pos(0, rgi); flush_relay_log_info(rli); } diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 77645fd3c7a..683f2492097 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -243,8 +243,10 @@ rpl_slave_state_free_element(void *arg) rpl_slave_state::rpl_slave_state() - : last_sub_id(0), inited(false), loaded(false) + : last_sub_id(0), loaded(false) { + mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state, + MY_MUTEX_INIT_SLOW); my_hash_init(&hash, &my_charset_bin, 32, offsetof(element, domain_id), sizeof(uint32), NULL, rpl_slave_state_free_element, HASH_UNIQUE); } @@ -252,15 +254,9 @@ rpl_slave_state::rpl_slave_state() rpl_slave_state::~rpl_slave_state() { -} - - -void -rpl_slave_state::init() -{ - DBUG_ASSERT(!inited); - mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state, MY_MUTEX_INIT_SLOW); - inited= true; + truncate_hash(); + my_hash_free(&hash); + mysql_mutex_destroy(&LOCK_slave_state); } @@ -285,16 +281,6 @@ rpl_slave_state::truncate_hash() my_hash_reset(&hash); } -void -rpl_slave_state::deinit() -{ - if (!inited) - return; - truncate_hash(); - my_hash_free(&hash); - mysql_mutex_destroy(&LOCK_slave_state); -} - int rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id, @@ -2097,16 +2083,16 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, uint64 wakeup_seq_no; queue_element *cur_waiter; - mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); /* The elements in the gtid_slave_state_hash are never re-allocated once they enter the hash, so we do not need to re-do the lookup after releasing and re-aquiring the lock. */ if (!slave_state_elem && - !(slave_state_elem= rpl_global_gtid_slave_state.get_element(domain_id))) + !(slave_state_elem= rpl_global_gtid_slave_state->get_element(domain_id))) { - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); remove_from_wait_queue(he, &elem); promote_new_waiter(he); if (did_enter_cond) @@ -2123,7 +2109,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, We do not have to wait. (We will be removed from the wait queue when we call process_wait_hash() below. */ - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); } else if ((cur_waiter= slave_state_elem->gtid_waiter) && slave_state_elem->min_wait_seq_no <= seq_no) @@ -2135,7 +2121,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, lock). */ elem.do_small_wait= false; - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); } else { @@ -2160,7 +2146,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, else mysql_mutex_unlock(&LOCK_gtid_waiting); thd->ENTER_COND(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state, + &rpl_global_gtid_slave_state->LOCK_slave_state, &stage_master_gtid_wait_primary, &old_stage); do { @@ -2170,7 +2156,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, { int err= mysql_cond_timedwait(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state, + &rpl_global_gtid_slave_state->LOCK_slave_state, wait_until); if (err == ETIMEDOUT || err == ETIME) { @@ -2180,7 +2166,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, } else mysql_cond_wait(&slave_state_elem->COND_wait_gtid, - &rpl_global_gtid_slave_state.LOCK_slave_state); + &rpl_global_gtid_slave_state->LOCK_slave_state); } while (slave_state_elem->gtid_waiter == &elem); wakeup_seq_no= slave_state_elem->highest_seq_no; /* diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index 997540728a5..d17ddf3451a 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -161,14 +161,11 @@ struct rpl_slave_state mysql_mutex_t LOCK_slave_state; uint64 last_sub_id; - bool inited; bool loaded; rpl_slave_state(); ~rpl_slave_state(); - void init(); - void deinit(); void truncate_hash(); ulong count() const { return hash.records; } int update(uint32 domain_id, uint32 server_id, uint64 sub_id, diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index a1e6f44c58f..b2e957a3e6e 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1112,7 +1112,7 @@ handle_rpl_parallel_thread(void *arg) if (opt_gtid_ignore_duplicates) { int res= - rpl_global_gtid_slave_state.check_duplicate_gtid(&rgi->current_gtid, + rpl_global_gtid_slave_state->check_duplicate_gtid(&rgi->current_gtid, rgi); if (res < 0) { diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 3b2fea93c3b..8c7724d88a3 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -37,7 +37,7 @@ static int count_relay_log_space(Relay_log_info* rli); Current replication state (hash of last GTID executed, per replication domain). */ -rpl_slave_state rpl_global_gtid_slave_state; +rpl_slave_state *rpl_global_gtid_slave_state; /* Object used for MASTER_GTID_WAIT(). */ gtid_waiting rpl_global_gtid_waiting; @@ -1340,7 +1340,7 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd, else { inc_group_relay_log_pos(event_master_log_pos, rgi); - if (rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi)) + if (rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi)) { report(WARNING_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, rgi->gtid_info(), "Failed to update GTID state in %s.%s, slave state may become " @@ -1466,9 +1466,9 @@ rpl_load_gtid_slave_state(THD *thd) uint32 i; DBUG_ENTER("rpl_load_gtid_slave_state"); - mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state); - bool loaded= rpl_global_gtid_slave_state.loaded; - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); + bool loaded= rpl_global_gtid_slave_state->loaded; + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); if (loaded) DBUG_RETURN(0); @@ -1568,23 +1568,23 @@ rpl_load_gtid_slave_state(THD *thd) } } - mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state); - if (rpl_global_gtid_slave_state.loaded) + mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); + if (rpl_global_gtid_slave_state->loaded) { - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); goto end; } for (i= 0; i < array.elements; ++i) { get_dynamic(&array, (uchar *)&tmp_entry, i); - if ((err= rpl_global_gtid_slave_state.update(tmp_entry.gtid.domain_id, + if ((err= rpl_global_gtid_slave_state->update(tmp_entry.gtid.domain_id, tmp_entry.gtid.server_id, tmp_entry.sub_id, tmp_entry.gtid.seq_no, NULL))) { - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); my_error(ER_OUT_OF_RESOURCES, MYF(0)); goto end; } @@ -1597,14 +1597,14 @@ rpl_load_gtid_slave_state(THD *thd) mysql_bin_log.bump_seq_no_counter_if_needed(entry->gtid.domain_id, entry->gtid.seq_no)) { - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); my_error(ER_OUT_OF_RESOURCES, MYF(0)); goto end; } } - rpl_global_gtid_slave_state.loaded= true; - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + rpl_global_gtid_slave_state->loaded= true; + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); err= 0; /* Clear HA_ERR_END_OF_FILE */ @@ -1672,7 +1672,7 @@ rpl_group_info::~rpl_group_info() int event_group_new_gtid(rpl_group_info *rgi, Gtid_log_event *gev) { - uint64 sub_id= rpl_global_gtid_slave_state.next_sub_id(gev->domain_id); + uint64 sub_id= rpl_global_gtid_slave_state->next_sub_id(gev->domain_id); if (!sub_id) { /* Out of memory caused hash insertion to fail. */ @@ -1787,7 +1787,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) --gtid-ignore-duplicates. */ if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL) - rpl_global_gtid_slave_state.release_domain_owner(this); + rpl_global_gtid_slave_state->release_domain_owner(this); } /* diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 1e8bb66ffbe..d6ff96e2368 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -843,7 +843,7 @@ public: int init_relay_log_info(Relay_log_info* rli, const char* info_fname); -extern struct rpl_slave_state rpl_global_gtid_slave_state; +extern struct rpl_slave_state *rpl_global_gtid_slave_state; extern gtid_waiting rpl_global_gtid_waiting; int rpl_load_gtid_slave_state(THD *thd); diff --git a/sql/slave.cc b/sql/slave.cc index f1ca76d1692..3f8bc066378 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2185,8 +2185,8 @@ after_set_capability: (master_row= mysql_fetch_row(master_res)) && (master_row[0] != NULL)) { - rpl_global_gtid_slave_state.load(mi->io_thd, master_row[0], - strlen(master_row[0]), false, false); + rpl_global_gtid_slave_state->load(mi->io_thd, master_row[0], + strlen(master_row[0]), false, false); } else if (check_io_slave_killed(mi, NULL)) goto slave_killed_err; @@ -2496,7 +2496,7 @@ bool show_master_info(THD *thd, Master_info *mi, bool full) DBUG_ENTER("show_master_info"); String gtid_pos; - if (full && rpl_global_gtid_slave_state.tostring(>id_pos, NULL, 0)) + if (full && rpl_global_gtid_slave_state->tostring(>id_pos, NULL, 0)) DBUG_RETURN(TRUE); if (send_show_master_info_header(thd, full, gtid_pos.length())) DBUG_RETURN(TRUE); @@ -3593,7 +3593,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, if (opt_gtid_ignore_duplicates) { - int res= rpl_global_gtid_slave_state.check_duplicate_gtid + int res= rpl_global_gtid_slave_state->check_duplicate_gtid (&serial_rgi->current_gtid, serial_rgi); if (res < 0) { @@ -4548,7 +4548,7 @@ pthread_handler_t handle_slave_sql(void *arg) It will then be updated as required by GTID and GTID_LIST events found while applying events read from relay logs. */ - rli->relay_log_state.load(&rpl_global_gtid_slave_state); + rli->relay_log_state.load(rpl_global_gtid_slave_state); } rli->gtid_skip_flag = GTID_SKIP_NOT; if (init_relay_log_pos(rli, @@ -4779,9 +4779,9 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, To handle this when we restart the SQL thread, mark the current per-domain position in the Relay_log_info. */ - mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state); - domain_count= rpl_global_gtid_slave_state.count(); - mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state); + mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state); + domain_count= rpl_global_gtid_slave_state->count(); + mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state); if (domain_count > 1) { inuse_relaylog *ir; @@ -4792,7 +4792,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, the relay log back to a known safe place to start (prior to any not yet applied transaction in any domain). */ - rli->restart_gtid_pos.load(&rpl_global_gtid_slave_state, NULL, 0); + rli->restart_gtid_pos.load(rpl_global_gtid_slave_state, NULL, 0); if ((ir= rli->inuse_relaylog_list)) { rpl_gtid *gtid= ir->relay_log_state; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 69fb2150764..cceab00ac60 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -986,8 +986,8 @@ check_slave_start_position(binlog_send_info *info, const char **errormsg, rpl_gtid master_replication_gtid; rpl_gtid start_gtid; bool start_at_own_slave_pos= - rpl_global_gtid_slave_state.domain_to_gtid(slave_gtid->domain_id, - &master_replication_gtid) && + rpl_global_gtid_slave_state->domain_to_gtid(slave_gtid->domain_id, + &master_replication_gtid) && slave_gtid->server_id == master_replication_gtid.server_id && slave_gtid->seq_no == master_replication_gtid.seq_no; @@ -4032,14 +4032,14 @@ int log_loaded_block(IO_CACHE* file) void rpl_init_gtid_slave_state() { - rpl_global_gtid_slave_state.init(); + rpl_global_gtid_slave_state= new rpl_slave_state; } void rpl_deinit_gtid_slave_state() { - rpl_global_gtid_slave_state.deinit(); + delete rpl_global_gtid_slave_state; } @@ -4075,7 +4075,7 @@ rpl_append_gtid_state(String *dest, bool use_binlog) (err= mysql_bin_log.get_most_recent_gtid_list(>id_list, &num_gtids))) return err; - err= rpl_global_gtid_slave_state.tostring(dest, gtid_list, num_gtids); + err= rpl_global_gtid_slave_state->tostring(dest, gtid_list, num_gtids); my_free(gtid_list); return err; @@ -4100,7 +4100,7 @@ rpl_load_gtid_state(slave_connection_state *state, bool use_binlog) (err= mysql_bin_log.get_most_recent_gtid_list(>id_list, &num_gtids))) return err; - err= state->load(&rpl_global_gtid_slave_state, gtid_list, num_gtids); + err= state->load(rpl_global_gtid_slave_state, gtid_list, num_gtids); my_free(gtid_list); return err; @@ -4197,7 +4197,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len) bool rpl_gtid_pos_update(THD *thd, char *str, size_t len) { - if (rpl_global_gtid_slave_state.load(thd, str, len, true, true)) + if (rpl_global_gtid_slave_state->load(thd, str, len, true, true)) { my_error(ER_FAILED_GTID_STATE_INIT, MYF(0)); return true; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e0f7184b0e8..89da57a46d3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3183,13 +3183,14 @@ static void check_duplicate_key(THD *thd, // Report a warning if we have two identical keys. + DBUG_ASSERT(thd->lex->query_tables->alias); if (all_columns_are_identical) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_DUP_INDEX, ER(ER_DUP_INDEX), key_info->name, thd->lex->query_tables->db, - thd->lex->query_tables->table_name); + thd->lex->query_tables->alias); break; } } @@ -4650,8 +4651,8 @@ int create_table_impl(THD *thd, bool frm_only= create_table_mode == C_ALTER_TABLE_FRM_ONLY; bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only; DBUG_ENTER("mysql_create_table_no_lock"); - DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d", - db, table_name, internal_tmp_table)); + DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s", + db, table_name, internal_tmp_table, path)); if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { diff --git a/sql/sql_time.cc b/sql/sql_time.cc index f2596401c2e..b55b1d76b99 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -1328,7 +1328,7 @@ time_to_datetime_with_warn(THD *thd, only in the old mode. */ if (time_to_datetime(thd, from, to) || - ((thd->variables.old_behavior && OLD_MODE_ZERO_DATE_TIME_CAST) && + ((thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST) && check_date(to, fuzzydate, &warn))) { ErrConvTime str(from); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index d8970263ed7..770f066140e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1604,7 +1604,7 @@ Sys_var_gtid_slave_pos::global_value_ptr(THD *thd, LEX_STRING *base) But if the table is not loaded (eg. missing mysql_upgrade_db or some such), then the slave state must be empty anyway. */ - if ((rpl_global_gtid_slave_state.loaded && + if ((rpl_global_gtid_slave_state->loaded && rpl_append_gtid_state(&str, false)) || !(p= thd->strmake(str.ptr(), str.length()))) { |