[Commits] 84a4db2: Merge branch '5.5-galera' into 10.0-galera

Nirbhay Choubey nirbhay at mariadb.com
Sat Mar 28 23:29:15 EET 2015


revision-id: 84a4db263a1d98e9a2f3c6b5816a9b6b9a019128
parent(s): 555915faa9fc5ec0a7df09b51716be027120fa8c d7445ea6dfbd3be390792c636f755d3bb40d5fbf
committer: Nirbhay Choubey
branch nick: 10.0-galera-b7194
timestamp: 2015-03-28 17:29:10 -0400
message:

Merge branch '5.5-galera' into 10.0-galera


 mysql-test/suite/galera/r/binlog_checksum.result | 36 ++++++++++++
 mysql-test/suite/galera/t/binlog_checksum.test   | 36 ++++++++++++
 mysql-test/suite/wsrep/r/mdev_7798.result        | 13 +++++
 mysql-test/suite/wsrep/t/mdev_7798.opt           |  1 +
 mysql-test/suite/wsrep/t/mdev_7798.test          | 17 ++++++
 sql/log.cc                                       | 70 ------------------------
 sql/log_event.cc                                 |  1 -
 sql/mysqld.cc                                    |  3 +-
 sql/sql_class.cc                                 |  2 -
 sql/sql_class.h                                  |  1 -
 sql/wsrep_applier.cc                             | 11 ++--
 sql/wsrep_mysqld.cc                              |  6 ++
 12 files changed, 115 insertions(+), 82 deletions(-)

diff --cc sql/log.cc
index 37e19da,d4403f4..b6b5ea6
--- a/sql/log.cc
+++ b/sql/log.cc
@@@ -581,113 -542,48 +581,43 @@@ void thd_binlog_rollback_stmt(THD * thd
      (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
    if (cache_mngr) cache_mngr->trx_cache.set_prev_position(MY_OFF_T_UNDEF);
  }
 -#endif /* WITH_WSREP */
  
- #ifdef REMOVED
- /*
-   Write the contents of a cache to memory buffer.
- 
-   This function quite the same as MYSQL_BIN_LOG::write_cache(),
-   with the exception that here we write in buffer instead of log file.
-  */
- 
- int wsrep_write_cache(IO_CACHE *cache, uchar **buf, int *buf_len)
 -bool LOGGER::is_log_table_enabled(uint log_table_type)
--{
- 
-   if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
-     return ER_ERROR_ON_WRITE;
-   uint length= my_b_bytes_in_cache(cache);
-   long long total_length = 0;
-   uchar *buf_ptr = NULL;
- 
-   do
-   {
-     /* bail out if buffer grows too large
-        This is a temporary fix to avoid flooding replication
-        TODO: remove this check for 0.7.4 release
-      */
-     if (total_length > wsrep_max_ws_size)
-     {
-       WSREP_WARN("transaction size limit (%lld) exceeded: %lld",
-                  wsrep_max_ws_size, total_length);
-       if (reinit_io_cache(cache, WRITE_CACHE, 0, 0, 0))
-       {
-         WSREP_WARN("failed to initialize io-cache");
-       } 
-       if (buf_ptr) my_free(*buf);
-       *buf_len = 0;
-       return ER_ERROR_ON_WRITE;
-     }
-     if (total_length > 0)
-     {
-       *buf_len += length;
-       *buf = (uchar *)my_realloc(*buf, total_length+length, 
-                                  MYF(MY_ALLOW_ZERO_PTR));
-       if (!*buf)
-       {
-         WSREP_ERROR("io cache write problem: %d %d", *buf_len, length);
-         return ER_ERROR_ON_WRITE;
-       }
-       buf_ptr = *buf+total_length;
-     }
-     else
-     {
-       if (buf_ptr != NULL)
-       {
-         WSREP_ERROR("io cache alloc error: %d %d", *buf_len, length);
-         my_free(*buf);
-       }
-       if (length > 0) 
-       {
-         *buf = (uchar *) my_malloc(length, MYF(0));
-         buf_ptr = *buf;
-         *buf_len = length;
-       }
-     }
-     total_length += length;
- 
-     memcpy(buf_ptr, cache->read_pos, length);
-     cache->read_pos=cache->read_end;
-   } while ((cache->file >= 0) && (length= my_b_fill(cache)));
- 
-   return 0;
 -  switch (log_table_type) {
 -  case QUERY_LOG_SLOW:
 -    return (table_log_handler != NULL) && opt_slow_log;
 -  case QUERY_LOG_GENERAL:
 -    return (table_log_handler != NULL) && opt_log ;
 -  default:
 -    DBUG_ASSERT(0);
 -    return FALSE;                             /* make compiler happy */
 -  }
--}
- #endif /* REMOVED */
 +#endif
  
  
 -/* Check if a given table is opened log table */
 -int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
 -                       const char *table_name, bool check_if_opened)
 +/**
 +   Check if a given table is opened log table
 +
 +   @param table             Table to check
 +   @param check_if_opened   Only fail if it's a log table in use
 +   @param error_msg	    String to put in error message if not ok.
 +                            No error message if 0
 +   @return 0 ok
 +   @return # Type of log file
 + */
 +
 +int check_if_log_table(const TABLE_LIST *table,
 +                       bool check_if_opened,
 +                       const char *error_msg)
  {
 -  if (db_len == 5 &&
 -      !(lower_case_table_names ?
 -        my_strcasecmp(system_charset_info, db, "mysql") :
 -        strcmp(db, "mysql")))
 +  int result= 0;
 +  if (table->db_length == 5 &&
 +      !my_strcasecmp(table_alias_charset, table->db, "mysql"))
    {
 -    if (table_name_len == 11 && !(lower_case_table_names ?
 -                                  my_strcasecmp(system_charset_info,
 -                                                table_name, "general_log") :
 -                                  strcmp(table_name, "general_log")))
 +    const char *table_name= table->table_name;
 +
 +    if (table->table_name_length == 11 &&
 +        !my_strcasecmp(table_alias_charset, table_name, "general_log"))
      {
 -      if (!check_if_opened || logger.is_log_table_enabled(QUERY_LOG_GENERAL))
 -        return QUERY_LOG_GENERAL;
 -      return 0;
 +      result= QUERY_LOG_GENERAL;
 +      goto end;
      }
  
 -    if (table_name_len == 8 && !(lower_case_table_names ?
 -      my_strcasecmp(system_charset_info, table_name, "slow_log") :
 -      strcmp(table_name, "slow_log")))
 +    if (table->table_name_length == 8 &&
 +        !my_strcasecmp(table_alias_charset, table_name, "slow_log"))
      {
 -      if (!check_if_opened || logger.is_log_table_enabled(QUERY_LOG_SLOW))
 -        return QUERY_LOG_SLOW;
 -      return 0;
 +      result= QUERY_LOG_SLOW;
 +      goto end;
      }
    }
    return 0;
diff --cc sql/log_event.cc
index 31abf46,658c93b..733b30f
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@@ -12722,48 -11276,6 +12722,47 @@@ void Incident_log_event::pack_info(THD 
    protocol->store(buf, bytes, &my_charset_bin);
  }
  #endif
 +#if WITH_WSREP && !defined(MYSQL_CLIENT)
- Format_description_log_event *wsrep_format_desc; // TODO: free them at the end
 +/*
 +  read the first event from (*buf). The size of the (*buf) is (*buf_len).
 +  At the end (*buf) is shitfed to point to the following event or NULL and
 +  (*buf_len) will be changed to account just being read bytes of the 1st event.
 +*/
 +#define WSREP_MAX_ALLOWED_PACKET 1024*1024*1024 // current protocol max
 +
 +Log_event* wsrep_read_log_event(
 +  char **arg_buf, size_t *arg_buf_len,
 +  const Format_description_log_event *description_event)
 +{
 +  DBUG_ENTER("wsrep_read_log_event");
 +  char *head= (*arg_buf);
 +
 +  uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
 +  char *buf= (*arg_buf);
 +  const char *error= 0;
 +  Log_event *res=  0;
 +
 +  if (data_len > WSREP_MAX_ALLOWED_PACKET)
 +  {
 +    error = "Event too big";
 +    goto err;
 +  }
 +
 +  res= Log_event::read_log_event(buf, data_len, &error, description_event, false);
 +
 +err:
 +  if (!res)
 +  {
 +    DBUG_ASSERT(error != 0);
 +    sql_print_error("Error in Log_event::read_log_event(): "
 +                    "'%s', data_len: %d, event_type: %d",
 +		    error,data_len,head[EVENT_TYPE_OFFSET]);
 +  }
 +  (*arg_buf)+= data_len;
 +  (*arg_buf_len)-= data_len;
 +  DBUG_RETURN(res);
 +}
 +#endif
  
  
  #ifdef MYSQL_CLIENT
diff --cc sql/sql_class.cc
index 0187149,d40ca89..8106eb9
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@@ -1604,9 -1475,9 +1604,8 @@@ void THD::init(void
    wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
    wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
    wsrep_converted_lock_session= false;
 -  //wsrep_retry_autocommit= ::wsrep_retry_autocommit;
    wsrep_retry_counter= 0;
--  wsrep_rli= NULL;
 +  wsrep_rgi= NULL;
    wsrep_PA_safe= true;
    wsrep_consistency_check = NO_CONSISTENCY_CHECK;
    wsrep_mysql_replicated  = 0;
@@@ -1820,8 -1686,7 +1819,7 @@@ THD::~THD(
    mysql_mutex_lock(&LOCK_wsrep_thd);
    mysql_mutex_unlock(&LOCK_wsrep_thd);
    mysql_mutex_destroy(&LOCK_wsrep_thd);
--  if (wsrep_rli) delete wsrep_rli;
 +  if (wsrep_rgi) delete wsrep_rgi;
    if (wsrep_status_vars) wsrep->stats_free(wsrep, wsrep_status_vars);
  #endif
    /* Close connection */
diff --cc sql/sql_class.h
index 2119312,3418e16..9b42f31
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@@ -2777,8 -2370,7 +2777,7 @@@ public
    // wsrep_seqno_t             wsrep_trx_seqno;
    wsrep_trx_meta_t          wsrep_trx_meta;
    uint32                    wsrep_rand;
--  Relay_log_info*           wsrep_rli;
 +  rpl_group_info*           wsrep_rgi;
    bool                      wsrep_converted_lock_session;
    wsrep_ws_handle_t         wsrep_ws_handle;
  #ifdef WSREP_PROC_INFO
diff --cc sql/wsrep_applier.cc
index f8e82f6,3736431..8e5c493
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@@ -76,13 -77,10 +76,10 @@@ static inline Format_description_log_ev
  wsrep_get_apply_format(THD* thd)
  {
    if (thd->wsrep_apply_format)
-       return (Format_description_log_event*) thd->wsrep_apply_format;
-   /* TODO: mariadb does not support rli->get_rli_description_event()
-    * => look for alternative way to remember last FDE in replication
-    */
-   //return thd->wsrep_rli->get_rli_description_event();
-   thd->wsrep_apply_format = new Format_description_log_event(4);
-   return (Format_description_log_event*) thd->wsrep_apply_format;
+   {
+     return (Format_description_log_event*) thd->wsrep_apply_format;
+   }
 -  return thd->wsrep_rli->relay_log.description_event_for_exec;
++  return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
  }
  
  static wsrep_cb_status_t wsrep_apply_events(THD*        thd,
diff --cc sql/wsrep_mysqld.cc
index c5036d5,a48e28b..9ac6889
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@@ -1132,23 -1127,20 +1133,28 @@@ int wsrep_to_buf_helper
    if (open_cached_file(&tmp_io_cache, mysql_tmpdir, TEMP_PREFIX,
                         65536, MYF(MY_WME)))
      return 1;
 -
    int ret(0);
  
+   Format_description_log_event *tmp_fd= new Format_description_log_event(4);
+   tmp_fd->checksum_alg= binlog_checksum_options;
+   tmp_fd->write(&tmp_io_cache);
+   delete tmp_fd;
+ 
 +#ifdef GTID_SUPPORT
 +  if (thd->variables.gtid_next.type == GTID_GROUP)
 +  {
 +      Gtid_log_event gtid_ev(thd, FALSE, &thd->variables.gtid_next);
 +      if (!gtid_ev.is_valid()) ret= 0;
 +      if (!ret && gtid_ev.write(&tmp_io_cache)) ret= 1;
 +  }
 +#endif /* GTID_SUPPORT */
 +
    /* if there is prepare query, add event for it */
 -  if (thd->wsrep_TOI_pre_query)
 +  if (!ret && thd->wsrep_TOI_pre_query)
    {
      Query_log_event ev(thd, thd->wsrep_TOI_pre_query,
 -                       thd->wsrep_TOI_pre_query_len,
 -                       FALSE, FALSE, FALSE, 0);
 +		       thd->wsrep_TOI_pre_query_len,
 +		       FALSE, FALSE, FALSE, 0);
      if (ev.write(&tmp_io_cache)) ret= 1;
    }
  


More information about the commits mailing list