summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster.cc
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.mysql.com>2007-06-27 22:33:03 +0200
committerunknown <tomas@poseidon.mysql.com>2007-06-27 22:33:03 +0200
commit546997818549053d5ffe605735e1ca8054892d14 (patch)
tree9a76fda7f80997e537844f1cf8d8e626b4c59367 /sql/ha_ndbcluster.cc
parenta290e0b362dc79fe02d00dc2e492e9f01e9ec464 (diff)
downloadmariadb-git-546997818549053d5ffe605735e1ca8054892d14.tar.gz
Bug #29222 Statement mode replicates both statement and rows when writing to an NDB table
- only log statements locally (changes will not be logged on other servers) mysql-test/r/ndb_binlog_format.result: New BitKeeper file ``mysql-test/r/ndb_binlog_format.result'' mysql-test/t/ndb_binlog_format.test: New BitKeeper file ``mysql-test/t/ndb_binlog_format.test''
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r--sql/ha_ndbcluster.cc30
1 files changed, 22 insertions, 8 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 102c21d19a0..2b34eff8479 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -2812,7 +2812,8 @@ int ha_ndbcluster::write_row(uchar *record)
if (unlikely(m_slow_path))
{
- if (!(thd->options & OPTION_BIN_LOG))
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ if (thd_ndb->trans_options & TNTO_NO_LOGGING)
op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
else if (thd->slave_thread)
op->setAnyValue(thd->server_id);
@@ -3101,7 +3102,8 @@ int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data)
if (unlikely(m_slow_path))
{
- if (!(thd->options & OPTION_BIN_LOG))
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ if (thd_ndb->trans_options & TNTO_NO_LOGGING)
op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
else if (thd->slave_thread)
op->setAnyValue(thd->server_id);
@@ -3168,7 +3170,8 @@ int ha_ndbcluster::delete_row(const uchar *record)
if (unlikely(m_slow_path))
{
- if (!(thd->options & OPTION_BIN_LOG))
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ if (thd_ndb->trans_options & TNTO_NO_LOGGING)
((NdbOperation *)trans->getLastDefinedOperation())->
setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
else if (thd->slave_thread)
@@ -3207,7 +3210,8 @@ int ha_ndbcluster::delete_row(const uchar *record)
if (unlikely(m_slow_path))
{
- if (!(thd->options & OPTION_BIN_LOG))
+ Thd_ndb *thd_ndb= get_thd_ndb(thd);
+ if (thd_ndb->trans_options & TNTO_NO_LOGGING)
op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
else if (thd->slave_thread)
op->setAnyValue(thd->server_id);
@@ -4385,8 +4389,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
thd_ndb->query_state&= NDB_QUERY_NORMAL;
thd_ndb->trans_options= 0;
thd_ndb->m_slow_path= FALSE;
- if (thd->slave_thread ||
- !(thd->options & OPTION_BIN_LOG))
+ if (!(thd->options & OPTION_BIN_LOG) ||
+ thd->variables.binlog_format == BINLOG_FORMAT_STMT)
+ {
+ thd_ndb->trans_options|= TNTO_NO_LOGGING;
+ thd_ndb->m_slow_path= TRUE;
+ }
+ else if (thd->slave_thread)
thd_ndb->m_slow_path= TRUE;
trans_register_ha(thd, FALSE, ndbcluster_hton);
}
@@ -4406,8 +4415,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
thd_ndb->query_state&= NDB_QUERY_NORMAL;
thd_ndb->trans_options= 0;
thd_ndb->m_slow_path= FALSE;
- if (thd->slave_thread ||
- !(thd->options & OPTION_BIN_LOG))
+ if (!(thd->options & OPTION_BIN_LOG) ||
+ thd->variables.binlog_format == BINLOG_FORMAT_STMT)
+ {
+ thd_ndb->trans_options|= TNTO_NO_LOGGING;
+ thd_ndb->m_slow_path= TRUE;
+ }
+ else if (thd->slave_thread)
thd_ndb->m_slow_path= TRUE;
trans_register_ha(thd, TRUE, ndbcluster_hton);