diff -Nru percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/changelog percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/changelog --- percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/changelog 2016-07-19 14:24:33.000000000 +0200 +++ percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/changelog 2017-06-19 15:56:11.000000000 +0200 @@ -1,3 +1,10 @@ +percona-xtradb-cluster-5.5 (5.5.37-25.10+dfsg-0ubuntu0.14.04.4) trusty; urgency=medium + + * d/p/fix_duplicate_primary_key.patch: Fix 'duplicate entry for primary key + on cluster change' (LP: #1366997) + + -- Mario Splivalo Mon, 19 Jun 2017 12:03:27 +0200 + percona-xtradb-cluster-5.5 (5.5.37-25.10+dfsg-0ubuntu0.14.04.2) trusty; urgency=medium * d/p/fix_tc_log_initlization_on_ppc64.patch: Fix log-tc-size for bigger diff -Nru percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/fix_duplicate_primary_key.patch percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/fix_duplicate_primary_key.patch --- percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/fix_duplicate_primary_key.patch 1970-01-01 01:00:00.000000000 +0100 +++ percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/fix_duplicate_primary_key.patch 2017-06-19 12:22:27.000000000 +0200 @@ -0,0 +1,86 @@ +Description: Fix 'duplicate primary key entry on cluster change' + This fixes the issue of Percona refusing an insert to a table due to + 'phantom' primary key violation when cluster size changes (that is + when nodes are added/removed from a cluster, or merely restarted). + . + This fixes the LP: #1366997 +Author: Alexey Kopytov +Bug: https://bugs.launchpad.net/bugs/1366997 +Origin: upstream, http://bazaar.launchpad.net/~percona-core/percona-xtradb-cluster/pxc-5.5.41/revision/838 +Reviewed-By: Mario Splivalo +Last-Update: 2017-06-19 +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg.orig/sql/wsrep_hton.cc ++++ percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/sql/wsrep_hton.cc +@@ -485,7 +485,7 @@ wsrep_run_wsrep_commit(THD *thd, handler + case WSREP_BF_ABORT: + DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); + case WSREP_TRX_FAIL: +- WSREP_DEBUG("commit failed for reason: %d", rcode); ++ WSREP_DEBUG("commit failed for reason: %d %lu %s", rcode, thd->thread_id, thd->query()); + DBUG_PRINT("wsrep", ("replicating commit fail")); + + thd->wsrep_query_state= QUERY_EXEC; +--- percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg.orig/storage/innobase/handler/ha_innodb.cc ++++ percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/storage/innobase/handler/ha_innodb.cc +@@ -6684,6 +6684,14 @@ no_commit: + #ifdef WITH_WSREP + /* workaround for LP bug #355000, retrying the insert */ + case SQLCOM_INSERT: ++ ++ WSREP_DEBUG("DUPKEY error for autoinc\n" ++ "THD %ld, value %llu, off %llu inc %llu", ++ wsrep_thd_thread_id(current_thd), ++ auto_inc, ++ prebuilt->autoinc_offset, ++ prebuilt->autoinc_increment); ++ + if (wsrep_on(current_thd) && + auto_inc_inserted && + wsrep_drupal_282555_workaround && +@@ -8253,10 +8261,10 @@ wsrep_append_key( + DBUG_ENTER("wsrep_append_key"); + bool const copy = true; + #ifdef WSREP_DEBUG_PRINT +- fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s ", ++ fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n SQL: %s ", + (shared) ? "Shared" : "Exclusive", + wsrep_thd_thread_id(thd), trx->id, key_len, +- table_share->table_name.str); ++ table_share->table_name.str, wsrep_thd_query(thd)); + for (int i=0; iautoinc_increment > increment) { + ++#ifdef WITH_WSREP ++ WSREP_DEBUG("autoinc decrease: %llu -> %llu\n" ++ "THD: %ld, current: %llu, autoinc: %llu", ++ prebuilt->autoinc_increment, ++ increment, ++ wsrep_thd_thread_id(ha_thd()), ++ current, autoinc); ++ if (!wsrep_on(ha_thd())) ++ { ++#endif /* WITH_WSREP */ + current = autoinc - prebuilt->autoinc_increment; ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + + current = innobase_next_autoinc( + current, 1, increment, 1, col_max_value); diff -Nru percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/series percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/series --- percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/series 2016-07-19 14:24:09.000000000 +0200 +++ percona-xtradb-cluster-5.5-5.5.37-25.10+dfsg/debian/patches/series 2017-06-19 12:16:03.000000000 +0200 @@ -6,3 +6,4 @@ 70_mysql_va_list.patch fix_standalone_tests.patch fix_tc_log_initialization_on_ppc64.patch +fix_duplicate_primary_key.patch