From: Date: July 25 2007 7:24am Subject: bk commit into 5.1 tree (tomas:1.2565) BUG#30017 List-Archive: http://lists.mysql.com/commits/31524 X-Bug: 30017 Message-Id: <20070725052432.0CED91897B112@linux.local> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-07-25 07:24:25+02:00, tomas@stripped +2 -0 BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do sql/ha_ndbcluster.cc@stripped, 2007-07-25 07:24:23+02:00, tomas@stripped +37 -13 BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do sql/ha_ndbcluster_binlog.cc@stripped, 2007-07-25 07:24:23+02:00, tomas@stripped +13 -0 BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: tomas # Host: whalegate.ndb.mysql.com # Root: /home/tomas/mysql-5.1-new-ndb --- 1.461/sql/ha_ndbcluster.cc 2007-07-03 17:23:33 +02:00 +++ 1.462/sql/ha_ndbcluster.cc 2007-07-25 07:24:23 +02:00 @@ -2812,10 +2812,16 @@ if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + /* + ignore OPTION_BIN_LOG for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag. + */ + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (!(thd->options & OPTION_BIN_LOG)) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } m_rows_changed++; @@ -3101,10 +3107,16 @@ if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + /* + ignore OPTION_BIN_LOG for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag + */ + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (!(thd->options & OPTION_BIN_LOG)) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } /* Execute update operation if we are not doing a scan for update @@ -3168,12 +3180,18 @@ if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) - ((NdbOperation *)trans->getLastDefinedOperation())-> - setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + /* + ignore OPTION_BIN_LOG for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag + */ + if (thd->slave_thread) ((NdbOperation *)trans->getLastDefinedOperation())-> setAnyValue(thd->server_id); + else if (!(thd->options & OPTION_BIN_LOG)) + ((NdbOperation *)trans->getLastDefinedOperation())-> + setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } if (!(m_primary_key_update || m_delete_cannot_batch)) // If deleting from cursor, NoCommit will be handled in next_result @@ -3207,10 +3225,16 @@ if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + /* + ignore OPTION_BIN_LOG for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag + */ + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (!(thd->options & OPTION_BIN_LOG)) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } } --- 1.121/sql/ha_ndbcluster_binlog.cc 2007-06-18 15:41:00 +02:00 +++ 1.122/sql/ha_ndbcluster_binlog.cc 2007-07-25 07:24:23 +02:00 @@ -114,6 +114,9 @@ NDB_SHARE *ndb_schema_share= 0; pthread_mutex_t ndb_schema_share_mutex; +extern my_bool opt_log_slave_updates; +static my_bool g_ndb_log_slave_updates; + /* Schema object distribution handling */ HASH ndb_schema_objects; typedef struct st_ndb_schema_object { @@ -3297,6 +3300,14 @@ originating_server_id); return 0; } + else if (!g_ndb_log_slave_updates) + { + /* + This event comes from a slave applier since it has an originating + server id set. Since option to log slave updates is not set, skip it. + */ + return 0; + } TABLE *table= share->table; DBUG_ASSERT(trans.good()); @@ -3949,6 +3960,8 @@ ! IS_NDB_BLOB_PREFIX(pOp->getEvent()->getTable()->getName())); DBUG_ASSERT(gci <= ndb_latest_received_binlog_epoch); + /* initialize some variables for this epoch */ + g_ndb_log_slave_updates= opt_log_slave_updates; i_ndb-> setReportThreshEventGCISlip(ndb_report_thresh_binlog_epoch_slip); i_ndb->setReportThreshEventFreeMem(ndb_report_thresh_binlog_mem_usage);