List:Commits« Previous MessageNext Message »
From:jonas oreland Date:January 25 2012 6:07pm
Subject:bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3788 to 3789)
View as plain text  
 3789 jonas oreland	2012-01-25 [merge]
      ndb - merge 71 to 72

    modified:
      storage/ndb/src/kernel/vm/mt.cpp
 3788 Frazer Clement	2012-01-25 [merge]
      Merge 7.1->7.2

    added:
      sql/ndb_repl_tab.cc
      sql/ndb_repl_tab.h
    modified:
      mysql-test/suite/ndb_rpl/r/ndb_rpl_rep_error.result
      mysql-test/suite/ndb_rpl/t/ndb_rpl_rep_error.test
      mysql-test/suite/ndb_rpl/t/show_mysqld_warnings.inc
      sql/ha_ndbcluster_binlog.cc
      sql/ndb_share.h
      sql/ndb_table_guard.h
      storage/ndb/CMakeLists.txt
=== modified file 'storage/ndb/src/kernel/vm/mt.cpp'
--- a/storage/ndb/src/kernel/vm/mt.cpp	2012-01-25 12:38:15 +0000
+++ b/storage/ndb/src/kernel/vm/mt.cpp	2012-01-25 18:06:21 +0000
@@ -2392,6 +2392,50 @@ release_list(thread_local_pool<thr_send_
   pool->release_local(tail);
 }
 
+/**
+ * pack thr_send_pages for a particular send-buffer <em>db</em>
+ *   release pages (local) to <em>pool<em>
+ *
+ * can only be called with sb->m_lock held
+ */
+static
+void
+pack_sb_pages(thread_local_pool<thr_send_page>* pool,
+              thr_repository::send_buffer* sb)
+{
+  assert(sb->m_buffer.m_first_page != 0);
+  assert(sb->m_buffer.m_last_page != 0);
+  assert(sb->m_buffer.m_last_page->m_next == 0);
+
+  thr_send_page* curr = sb->m_buffer.m_first_page;
+  Uint32 curr_free = curr->max_bytes() - (curr->m_bytes + curr->m_start);
+  while (curr->m_next != 0)
+  {
+    thr_send_page* next = curr->m_next;
+    assert(next->m_start == 0); // only first page should have half sent bytes
+    if (next->m_bytes <= curr_free)
+    {
+      thr_send_page * save = next;
+      memcpy(curr->m_data + (curr->m_bytes + curr->m_start),
+             next->m_data,
+             next->m_bytes);
+
+      curr_free -= next->m_bytes;
+
+      curr->m_bytes += next->m_bytes;
+      curr->m_next = next->m_next;
+
+      pool->release_local(save);
+    }
+    else
+    {
+      curr = next;
+      curr_free = curr->max_bytes() - (curr->m_bytes + curr->m_start);
+    }
+  }
+
+  sb->m_buffer.m_last_page = curr;
+}
 
 static
 Uint32
@@ -2455,6 +2499,14 @@ bytes_sent(thread_local_pool<thr_send_pa
   sb->m_buffer.m_first_page = curr;
   assert(sb->m_bytes > bytes);
   sb->m_bytes -= bytes;
+
+  /**
+   * Since not all bytes were sent...
+   *   spend the time to try to pack the pages
+   *   possibly releasing send-buffer
+   */
+  pack_sb_pages(pool, sb);
+
   return sb->m_bytes;
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3788 to 3789) jonas oreland25 Jan