List:Internals« Previous MessageNext Message »
From:Rich Prohaska Date:October 11 2012 1:55pm
Subject:XA problems in mysql-5.6.7-rc
View as plain text  
Hello All,

TokuDB supports XA and runs in both MariaDB and MySQL.  It works in
MariaDB without any patches.  Unfortunately, there are several XA bugs
related to multiple XA storage engines in MySQL 5.6.7.  It would be
great if these bugs were fixed in MySQL.  One way to test these
changes is to include another example storage engine that supports XA.
 This storage engine does not even need to work; it just needs to
export the prepare method in the handlerton interface.

There is a block of code in handler.cc surrounded by
WILL_BE_DELETED_LATER.  If I disable the debug assert, what else do I
need to worry about?

Here are the patches we made to fix XA related bugs in 5.6.7 so far:


Index: sql/mysqld.cc
===================================================================
--- sql/mysqld.cc	(revision 48441)
+++ sql/mysqld.cc	(working copy)
@@ -7731,7 +7731,7 @@
   {"Table_open_cache_overflows",(char*) offsetof(STATUS_VAR,
table_open_cache_overflows), SHOW_LONGLONG_STATUS},
 #ifdef HAVE_MMAP
   {"Tc_log_max_pages_used",    (char*) &tc_log_max_pages_used,  SHOW_LONG},
-  {"Tc_log_page_size",         (char*) &tc_log_page_size,       SHOW_LONG},
+  {"Tc_log_page_size",         (char*) &tc_log_page_size,
SHOW_LONG_NOFLUSH},
   {"Tc_log_page_waits",        (char*) &tc_log_page_waits,      SHOW_LONG},
 #endif
   {"Threads_cached",           (char*) &blocked_pthread_count,
SHOW_LONG_NOFLUSH},
Index: sql/handler.cc
===================================================================
--- sql/handler.cc	(revision 48441)
+++ sql/handler.cc	(working copy)
@@ -1814,11 +1816,13 @@
     sql_print_information("Starting crash recovery...");

 #ifndef WILL_BE_DELETED_LATER
+#if 0
   /*
     for now, only InnoDB supports 2pc. It means we can always safely
     rollback all pending transactions, without risking inconsistent data
   */
   DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog
+#endif
   tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK
   info.dry_run=FALSE;
 #endif
Index: sql/log.cc
===================================================================
--- sql/log.cc	(revision 48441)
+++ sql/log.cc	(working copy)
@@ -2512,8 +2512,9 @@
     mysql_mutex_init(key_PAGE_lock, &pg->lock, MY_MUTEX_INIT_FAST);
     mysql_cond_init(key_PAGE_cond, &pg->cond, 0);
     pg->start=(my_xid *)(data + i*tc_log_page_size);
-    pg->end=(my_xid *)(pg->start + tc_log_page_size);
+    pg->end=(my_xid *)(data + (i+1)*tc_log_page_size);
     pg->size=pg->free=tc_log_page_size/sizeof(my_xid);
+    pg->ptr=pg->start;
   }
   pages[0].size=pages[0].free=
                 (tc_log_page_size-TC_LOG_HEADER_SIZE)/sizeof(my_xid);
@@ -2633,7 +2634,7 @@
   my_xid xid= thd->transaction.xid_state.xid.get_my_xid();

   if (all && xid)
-    if ((cookie= log_xid(thd, xid)))
+    if (!(cookie= log_xid(thd, xid)))
       DBUG_RETURN(RESULT_ABORTED);    // Failed to log the transaction

   if (ha_commit_low(thd, all))
@@ -2774,7 +2775,8 @@
   /* marking 'syncing' slot free */
   mysql_mutex_lock(&LOCK_sync);
   syncing=0;
-  mysql_cond_signal(&active->cond);        // wake up a new syncer
+  if (active)
+      mysql_cond_signal(&active->cond);        // wake up a new syncer
   mysql_mutex_unlock(&LOCK_sync);
   return err;
 }
Thread
XA problems in mysql-5.6.7-rcRich Prohaska11 Oct
  • Re: XA problems in mysql-5.6.7-rcSergei Golubchik11 Oct
    • Re: XA problems in mysql-5.6.7-rcRich Prohaska11 Oct
      • Re: XA problems in mysql-5.6.7-rcSergei Golubchik11 Oct
        • Re: XA problems in mysql-5.6.7-rcRich Prohaska17 Oct