List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:February 4 2011 9:07am
Subject:bzr commit into mysql-next-mr-bugfixing branch (guilhem.bichot:3248)
View as plain text  
#At file:///home/mysql_src/bzrrepos_new/wl4800-getter-setter/ based on revid:guilhem.bichot@stripped

 3248 Guilhem Bichot	2011-02-04
      making it compile

    modified:
      sql/opt_trace.cc
      sql/opt_trace.h
      unittest/gunit/opt_trace-t.cc
=== modified file 'sql/opt_trace.cc'
--- a/sql/opt_trace.cc	2011-02-03 20:51:29 +0000
+++ b/sql/opt_trace.cc	2011-02-04 09:07:54 +0000
@@ -53,8 +53,6 @@ private: // Except other classes in this
 public:
   Opt_trace_stmt(Opt_trace_context *ctx_arg, Opt_trace_stmt *parent,
                  bool support_I_S_arg);
-private:
-public:
   /** Ends a trace; destruction may not be possible immediately though */
   Opt_trace_stmt *end();
 
@@ -121,7 +119,7 @@ public:
 //    friend class Opt_trace_stmt;
 //    friend class Opt_trace_iterator;
 
-    // todo: use operator () with and without arg instead of set/get
+    // todo: use () with and without arg instead of set/get
     // const getters
     size_t allowed_mem_size() const { return m_allowed_mem_size; }
     bool malloc_error() const { return m_malloc_error; }
@@ -133,6 +131,7 @@ public:
   };
 
 public:
+  // those are used in lots of places :-(
   Buffer trace_buffer;   ///< Where the trace is accumulated
   Buffer query_buffer;   ///< Where the query is put
 private:
@@ -177,9 +176,6 @@ public:
   size_t alloced_length() const
   { return trace_buffer.alloced_length() + query_buffer.alloced_length(); }
 
-  /** Turn this on only in unit tests for out-of-memory testing */
-  static bool simulate_oom;
-
 //  friend class Opt_trace_context;
 //  friend class Opt_trace_struct;
 //  friend class Opt_trace_disable_I_S;
@@ -795,9 +791,9 @@ bool Opt_trace_context::start(bool suppo
   */
   purge(false);
   /* This purge may have freed space, compute max allowed size: */
-//  stmt->trace_buffer.set_allowed_mem_size(allowed_mem_size(stmt));
+  stmt->trace_buffer.set_allowed_mem_size(allowed_mem_size(stmt));
   /* Trace is always in UTF8, it's "all" that JSON accepts */
-//  stmt->trace_buffer.set_charset(system_charset_info);
+  stmt->trace_buffer.set_charset(system_charset_info);
   DBUG_ASSERT(system_charset_info == &my_charset_utf8_general_ci);
   DBUG_RETURN(false);
 }
@@ -815,7 +811,7 @@ void Opt_trace_context::end()
         Parent regains control, now it needs to be told that its child has
         used space, and thus parent's allowance has shrunk.
       */
-//      parent->trace_buffer.set_allowed_mem_size(allowed_mem_size(parent));
+      parent->trace_buffer.set_allowed_mem_size(allowed_mem_size(parent));
     }
   }
   /*
@@ -1107,7 +1103,7 @@ bool Opt_trace_stmt::Buffer::prealloc()
 }
 
 
-bool Opt_trace_stmt::simulate_oom= false;
+bool Opt_trace_context::simulate_oom_in_buffers= false;
 
 
 bool Opt_trace_stmt::Buffer::append_escaped(const char *str, size_t length)
@@ -1121,7 +1117,7 @@ bool Opt_trace_stmt::Buffer::append_esca
   else
   {
 #ifndef DBUG_OFF // no mostly-useless if() in release binary
-    if (unlikely(simulate_oom))
+    if (unlikely(Opt_trace_context::simulate_oom_in_buffers))
       rc= true;
     else
 #endif
@@ -1225,7 +1221,7 @@ bool Opt_trace_stmt::Buffer::append(cons
   else
   {
 #ifndef DBUG_OFF // no mostly-useless if() in release binary
-    if (unlikely(simulate_oom))
+    if (unlikely(Opt_trace_context::simulate_oom_in_buffers))
       rc= true;
     else
 #endif

=== modified file 'sql/opt_trace.h'
--- a/sql/opt_trace.h	2011-02-03 20:51:29 +0000
+++ b/sql/opt_trace.h	2011-02-04 09:07:54 +0000
@@ -400,6 +400,9 @@ public:
   };
   static const feature_value default_features;
 
+  /** Turn this on only in unit tests for out-of-memory testing */
+  static bool simulate_oom_in_buffers;
+
   /**
      Starts a new trace.
      @param  need_it_for_I_S  Should trace produce output suitable for

=== modified file 'unittest/gunit/opt_trace-t.cc'
--- a/unittest/gunit/opt_trace-t.cc	2011-02-03 13:05:38 +0000
+++ b/unittest/gunit/opt_trace-t.cc	2011-02-04 09:07:54 +0000
@@ -619,9 +619,9 @@ TEST_F(TraceContentTest, OutOfMemory)
     Opt_trace_object oto(&trace);
     {
       Opt_trace_array ota(&trace, "one array");
-      Opt_trace_stmt::simulate_oom= true;
+      Opt_trace_context::simulate_oom_in_buffers= true;
       ota.add(200.4);
-      Opt_trace_stmt::simulate_oom= false;
+      Opt_trace_context::simulate_oom_in_buffers= false;
     }
   }
   trace.end();


Attachment: [text/bzr-bundle] bzr/guilhem.bichot@oracle.com-20110204090754-gy3efm7at6kg9pck.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (guilhem.bichot:3248) Guilhem Bichot4 Feb