Bug #27651 Very high load can cause event api to get out of sync, "out of order buckets"
Submitted: 4 Apr 2007 15:54 Modified: 17 Apr 2007 13:44
Reporter: Jonas Oreland
Status: Closed
Category:Server: ClusterRep Severity:S3 (Non-critical)
Version:5.0-wl2325-5.0, 5.1* OS:Any
Assigned to: Jonas Oreland Target Version:

[4 Apr 2007 15:54] Jonas Oreland
Description:
.

How to repeat:
.

Suggested fix:
===== storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 1.26 vs edited =====
--- 1.26/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp       2007-04-04 15:53:18
+02:00
+++ storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp    2007-04-04 15:52:43 +02:00
@@ -533,7 +533,7 @@
 NdbEventBuffer::NdbEventBuffer(Ndb *ndb) :
   m_system_nodes(ndb->theImpl->theNoOfDBnodes),
   m_ndb(ndb),
-  m_latestGCI(0),
+  m_latestGCI(0), m_latest_complete_GCI(0)
   m_total_alloc(0),
   m_free_thresh(10),
   m_min_free_thresh(10),
@@ -856,6 +856,7 @@
   const Uint32 cnt= rep->gcp_complete_rep_count;
 
   Gci_container *bucket = find_bucket(&m_active_gci, gci);
+  Uint32 idx = bucket - m_active_gci.getBase();
 
   if (unlikely(bucket == 0))
   {
@@ -895,8 +896,20 @@
       }
       reportStatus();
       bzero(bucket, sizeof(Gci_container));
-      bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE;
-      bucket->m_gcp_complete_rep_count = m_system_nodes;
+      if (likely(idx < ACTIVE_GCI_DIRECTORY_SIZE))
+      {
+        /**
+         * Only "prepare" next GCI if we're in
+         *   the first 4 highest GCI's...else
+         *   this is somekind of "late" GCI...
+         *   which is only initialized to 0
+         *
+         *   This to make sure we dont get several buckets with same GCI
+         */
+        bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE;
+        bucket->m_gcp_complete_rep_count = m_system_nodes;
+      }
+      
       if(unlikely(m_latest_complete_GCI > gci))
       {
        complete_outof_order_gcis();
[10 Apr 2007 10:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/24124

ChangeSet@1.2137, 2007-04-10 10:10:34+02:00, jonas@perch.ndb.mysql.com +1 -0
  ndb - bug#27651 (wl2325-5.0)
    Only prepare "next" GCI if we're in the first 4 highest GCI's
      to avoid we can get several buckets with same GCI
[10 Apr 2007 10:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/24127

ChangeSet@1.2453, 2007-04-10 10:15:35+02:00, jonas@perch.ndb.mysql.com +1 -0
  ndb - bug#27651 (5.1)
    Only prepare "next" GCI if we're in the first 4 highest GCI's
      to avoid we can get several buckets with same GCI
[15 Apr 2007 18:48] Bugs System
Pushed into 5.1.18-beta
[17 Apr 2007 13:44] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of
that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version,
including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.18 and telco-6.1.6 changelogs.