#At file:///home/mysql_src/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/ based on revid:guilhem.bichot@stripped
3284 Guilhem Bichot 2011-03-22
review comments
@ sql/handler.h
avoid recompiling all engines when changing opt_trace.h
@ sql/opt_trace.cc
dead code removed
@ sql/opt_trace.h
mention of bug number
@ sql/opt_trace2server.cc
dead code removed
modified:
sql/handler.h
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-03-21 17:55:41 +0000
+++ b/sql/handler.h 2011-03-22 10:08:27 +0000
@@ -28,7 +28,7 @@
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA */
#include "sql_cache.h"
#include "structs.h" /* SHOW_COMP_OPTION */
-#include "opt_trace.h" // For Opt_trace_array
+class Opt_trace_array;
#include <my_global.h>
#include <my_handler.h>
=== modified file 'sql/opt_trace.cc'
--- a/sql/opt_trace.cc 2011-03-21 17:55:41 +0000
+++ b/sql/opt_trace.cc 2011-03-22 10:08:27 +0000
@@ -1058,27 +1058,8 @@ bool Opt_trace_context::start(enum enum_
since_offset_0++;
}
-#ifdef WHEN_WE_HAVE_NEW_NOTHROW
- /*
- If we could even overload new(nothrow) so that it supports the DBUG below,
- we could test it below:
- */
- DBUG_EXECUTE_IF("opt_trace_oom1", DBUG_SET("+d,simulate_out_of_memory"););
- Opt_trace_stmt *stmt= new(nothrow)
- Opt_trace_stmt(this, new_stmt_support_I_S);
- DBUG_EXECUTE_IF("opt_trace_oom1",
- DBUG_SET("-d,simulate_out_of_memory");
- /*
- turn this flag off or we'll never be able to issue any
- statement!
- */
- DBUG_SET("-d,opt_trace_oom1"););
- if (unlikely(stmt == NULL))
- goto err;
-#else
// OOM-unsafe "new".
Opt_trace_stmt *stmt= new Opt_trace_stmt(this, new_stmt_support_I_S);
-#endif
DBUG_PRINT("opt",("new stmt %p support_I_S %d", stmt,
new_stmt_support_I_S));
=== modified file 'sql/opt_trace.h'
--- a/sql/opt_trace.h 2011-03-21 18:33:56 +0000
+++ b/sql/opt_trace.h 2011-03-22 10:08:27 +0000
@@ -329,16 +329,15 @@ struct TABLE;
Note that the debug binary may crash if OOM (OOM can cause syntax
errors...).
@todo @c new error handling. In released and pushbuild2 builds, @c
- my_new.cc:new is used, which is broken (if allocation fails the constructor
- is still called, and segfault). In builds with g++, the standard @c new
- doesn't work either (it throws an exception but as we use -fno-exceptions we
- cannot catch it and it kills the program).
+ my_new.cc:new is used, which is broken (BUG#11822322). In builds with g++,
+ the standard @c new doesn't work either (it throws an exception but as we
+ use -fno-exceptions we cannot catch it and it kills the program).
As we don't support exceptions, we need new(nothrow) in order to be able to
handle OOM.
But "nothrow" is in the standard C++ library, which we don't link with.
So we have two calls to "new" (one to create Opt_trace_context, one to
create Opt_trace_stmt), which may crash. When we have nothrow we should
- change them new(nothrow). Grep for WHEN_WE_HAVE_NEW_NOTHROW .
+ change them new(nothrow).
*/
class Opt_trace_struct;
=== modified file 'sql/opt_trace2server.cc'
--- a/sql/opt_trace2server.cc 2011-03-21 17:55:41 +0000
+++ b/sql/opt_trace2server.cc 2011-03-22 10:08:27 +0000
@@ -180,12 +180,7 @@ bool opt_trace_start(THD *thd, const TAB
*/
if (thd->opt_trace == NULL)
{
-#ifdef WHEN_WE_HAVE_NEW_NOTHROW
- if ((thd->opt_trace= new(nothrow) Opt_trace_context) == NULL)
- DBUG_RETURN(false);
-#else
thd->opt_trace= new Opt_trace_context; // OOM-unsafe "new".
-#endif
allocated_here= true;
}
Attachment: [text/bzr-bundle] bzr/guilhem.bichot@oracle.com-20110322100827-zl5sbwvbyz3xgs0h.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (guilhem.bichot:3284) | Guilhem Bichot | 22 Mar |