List:Commits« Previous MessageNext Message »
From:Dmitry Lenev Date:June 2 2010 10:53am
Subject:bzr commit into mysql-trunk-runtime branch (dlenev:3029)
View as plain text  
#At file:///home/dlenev/src/bzr/mysql-trunk-wfl/ based on revid:dlenev@stripped

 3029 Dmitry Lenev	2010-06-02
      Follow-up for draft the patch that changes approach to
      how we acquire metadata locks for DML statements and
      changes the way MDL locks are acquired/granted in
      contended case.
      
      Review fixes in progress.

    modified:
      sql/sql_plist.h
=== modified file 'sql/sql_plist.h'
--- a/sql/sql_plist.h	2010-05-26 13:15:59 +0000
+++ b/sql/sql_plist.h	2010-06-02 10:53:05 +0000
@@ -21,7 +21,7 @@
 template <typename T, typename B, typename C, typename I>
 class I_P_List_iterator;
 class I_P_List_null_counter;
-template <typename T, typename B> class I_P_List_slow_push_back;
+template <typename T> class I_P_List_no_push_back;
 
 
 /**
@@ -58,12 +58,12 @@ template <typename T, typename B> class 
              efficient push_back() operation. Instance of this class
              is used as place where we store information to support
              this operation.
-             @sa I_P_List_slow_push_back, I_P_List_fast_push_back.
+             @sa I_P_List_no_push_back, I_P_List_fast_push_back.
 */
 
 template <typename T, typename B,
           typename C = I_P_List_null_counter,
-          typename I = I_P_List_slow_push_back<T, B> >
+          typename I = I_P_List_no_push_back<T> >
 class I_P_List : public C, public I
 {
   T *first;
@@ -90,7 +90,7 @@ public:
   }
   inline void push_back(T *a)
   {
-    T **last= I::get_last(&first);
+    T **last= I::get_last();
     *B::next_ptr(a)= *last;
     *last= a;
     *B::prev_ptr(a)= last;
@@ -153,7 +153,7 @@ public:
 
 template <typename T, typename B,
           typename C = I_P_List_null_counter,
-          typename I = I_P_List_slow_push_back<T, B> >
+          typename I = I_P_List_no_push_back<T> >
 class I_P_List_iterator
 {
   const I_P_List<T, B, C, I> *list;
@@ -224,26 +224,20 @@ public:
 
 /**
   Policy class for I_P_List to be used in cases when
-  it is okay that push_back() has O(n) cost.
-
-  QQ: May be it is better to have strategy which does not
-      support push_back() at all rather than have a dead
-      code like now?
+  push_back() operation is not necessary.
 */
 
-template <typename T, typename B> class I_P_List_slow_push_back
+template <typename T> class I_P_List_no_push_back
 {
 protected:
-  I_P_List_slow_push_back(T **a) {};
+  I_P_List_no_push_back(T **a) {};
   void set_last(T **a) {}
-  T** get_last(T **first) const
-  {
-    T **last= first;
-    while (*last)
-      last= B::next_ptr(*last);
-    return last;
-  }
-  void swap(I_P_List_slow_push_back<T, B> &rhs) {}
+  /*
+    T** get_last() const method is intentionally left unimplemented
+    in order to prohibit usage of push_back() method in lists which
+    use this policy.
+  */
+  void swap(I_P_List_no_push_back<T> &rhs) {}
 };
 
 
@@ -258,7 +252,7 @@ template <typename T> class I_P_List_fas
 protected:
   I_P_List_fast_push_back(T **a) : last(a) { };
   void set_last(T **a) { last= a; }
-  T** get_last(T **first) const { return last; }
+  T** get_last() const { return last; }
   void swap(I_P_List_fast_push_back<T> &rhs)
   { swap_variables(T**, last, rhs.last); }
 };


Attachment: [text/bzr-bundle] bzr/dlenev@mysql.com-20100602105305-xjajjrmslv0mlq30.bundle
Thread
bzr commit into mysql-trunk-runtime branch (dlenev:3029)Dmitry Lenev2 Jun