1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Manual merge of patch for Bug#46364 from mysql-next-mr-bugfixing.

Conflicts:
  - mysql-test/r/mysqld--help-win.result
  - sql/sys_vars.cc

Original revsion (in next-mr-bugfixing):
------------------------------------------------------------
revno: 2971 [merge]
revision-id: alfranio.correia@sun.com-20100121210527-rbuheu5rnsmcakh1
committer: Alfranio Correia <alfranio.correia@sun.com>
branch nick: mysql-next-mr-bugfixing
timestamp: Thu 2010-01-21 21:05:27 +0000
message:
  BUG#46364 MyISAM transbuffer problems (NTM problem)
        
  It is well-known that due to concurrency issues, a slave can become
  inconsistent when a transaction contains updates to both transaction and
  non-transactional tables.
                      
  In a nutshell, the current code-base tries to preserve causality among the
  statements by writing non-transactional statements to the txn-cache which
  is flushed upon commit. However, modifications done to non-transactional
  tables on behalf of a transaction become immediately visible to other
  connections but may not immediately get into the binary log and therefore
  consistency may be broken.
              
  In general, it is impossible to automatically detect causality/dependency
  among statements by just analyzing the statements sent to the server. This
  happen because dependency may be hidden in the application code and it is
  necessary to know a priori all the statements processed in the context of
  a transaction such as in a procedure. Moreover, even for the few cases that
  we could automatically address in the server, the computation effort
  required could make the approach infeasible.
              
  So, in this patch we introduce the option
        - "--binlog-direct-non-transactional-updates" that can be used to bypass
        the current behavior in order to write directly to binary log statements
        that change non-transactional tables.
  
  Besides, it is used to enable the WL#2687 which is disabled by default.
    ------------------------------------------------------------
    revno: 2970.1.1
    revision-id: alfranio.correia@sun.com-20100121131034-183r4qdyld7an5a0
    parent: alik@sun.com-20100121083914-r9rz2myto3tkdya0
    committer: Alfranio Correia <alfranio.correia@sun.com>
    branch nick: mysql-next-mr-bugfixing
    timestamp: Thu 2010-01-21 13:10:34 +0000
    message:
      BUG#46364 MyISAM transbuffer problems (NTM problem)
            
      It is well-known that due to concurrency issues, a slave can become
      inconsistent when a transaction contains updates to both transaction and
      non-transactional tables.
                          
      In a nutshell, the current code-base tries to preserve causality among the
      statements by writing non-transactional statements to the txn-cache which
      is flushed upon commit. However, modifications done to non-transactional
      tables on behalf of a transaction become immediately visible to other
      connections but may not immediately get into the binary log and therefore
      consistency may be broken.
                  
      In general, it is impossible to automatically detect causality/dependency
      among statements by just analyzing the statements sent to the server. This
      happen because dependency may be hidden in the application code and it is
      necessary to know a priori all the statements processed in the context of
      a transaction such as in a procedure. Moreover, even for the few cases that
      we could automatically address in the server, the computation effort
      required could make the approach infeasible.
                  
      So, in this patch we introduce the option
            - "--binlog-direct-non-transactional-updates" that can be used to bypass
            the current behavior in order to write directly to binary log statements
            that change non-transactional tables.
      
      Besides, it is used to enable the WL#2687 which is disabled by default.
This commit is contained in:
Alexander Nozdrin
2010-02-02 10:56:42 +03:00
parent 562c6046d4
commit 33e5e125f5
29 changed files with 933 additions and 298 deletions

View File

@ -219,13 +219,12 @@ while (`SELECT $ddl_cases >= 1`)
# in the binary log:
#
# 1: DDL EVENT which triggered the previous commmit.
# 2: COMMIT
# 3: BEGIN
# 4: TABLE MAP EVENT
# 5: TABLE MAP EVENT (ndb_apply_status)
# 2: BEGIN
# 3: TABLE MAP EVENT
# 4: TABLE MAP EVENT (ndb_apply_status)
# 5: ROW EVENT
# 6: ROW EVENT
# 7: ROW EVENT
# 8: COMMIT
# 7: COMMIT
#
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`)
{
@ -362,8 +361,11 @@ while (`SELECT $ddl_cases >= 1`)
# does not commit the current transaction.
#
# 1: BEGIN
# 2: INSERT
# 3: CREATE TEMPORARY
# 2: CREATE TEMPORARY
# 3: COMMIT
# 4: BEGIN
# 5: INSERT
# 6: COMMIT
#
# In RBR the transaction is not committed either and the statement is not
# written to the binary log:
@ -371,10 +373,11 @@ while (`SELECT $ddl_cases >= 1`)
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
#
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'` )
{
let $commit_event_row_number= 4;
let $commit_event_row_number= 6;
}
#
# In NDB (RBR mode), the commit event is the sixth event
@ -482,9 +485,14 @@ while (`SELECT $ddl_cases >= 1`)
# In SBR and MIXED modes, the DDL statement is written to the binary log
# but does not commit the current transaction:
#
# In SBR, we have what follows:
#
# 1: BEGIN
# 2: INSERT
# 3: DROP TEMPORARY
# 2: DROP TEMPORARY
# 3: COMMIT
# 4: BEGIN
# 5: INSERT
# 6: COMMIT
#
# In RBR the transaction is not committed either and the statement is not
# written to the binary log:
@ -492,8 +500,13 @@ while (`SELECT $ddl_cases >= 1`)
# 1: BEGIN
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: COMMIT
#
if (`select @@binlog_format = 'STATEMENT'`)
{
let $commit_event_row_number= 6;
}
if (`select @@binlog_format = 'ROW'`)
{
let $commit_event_row_number= 4;
}
@ -503,6 +516,7 @@ while (`SELECT $ddl_cases >= 1`)
# 2: TABLE MAP EVENT
# 3: ROW EVENT
# 4: DROP TEMPORARY table IF EXISTS
# 5: COMMIT
#
if (`select @@binlog_format = 'MIXED'`)
{