Commit 65427708 authored by kent@mysql.com's avatar kent@mysql.com

Merge mysql.com:/Users/kent/mysql/bk/mysql-4.1

into mysql.com:/Users/kent/mysql/bk/mysql-5.0
parents cfba073c 76956fdf
...@@ -262,6 +262,7 @@ our $opt_user; ...@@ -262,6 +262,7 @@ our $opt_user;
our $opt_user_test; our $opt_user_test;
our $opt_valgrind; our $opt_valgrind;
our $opt_valgrind_mysqltest;
our $opt_valgrind_all; our $opt_valgrind_all;
our $opt_valgrind_options; our $opt_valgrind_options;
...@@ -524,6 +525,7 @@ sub command_line_setup () { ...@@ -524,6 +525,7 @@ sub command_line_setup () {
'gcov' => \$opt_gcov, 'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof, 'gprof' => \$opt_gprof,
'valgrind:s' => \$opt_valgrind, 'valgrind:s' => \$opt_valgrind,
'valgrind-mysqltest:s' => \$opt_valgrind_mysqltest,
'valgrind-all:s' => \$opt_valgrind_all, 'valgrind-all:s' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options, 'valgrind-options=s' => \$opt_valgrind_options,
...@@ -708,9 +710,15 @@ sub command_line_setup () { ...@@ -708,9 +710,15 @@ sub command_line_setup () {
# "" option set with no argument # "" option set with no argument
# "somestring" option is name/path of valgrind executable # "somestring" option is name/path of valgrind executable
if ( defined $opt_valgrind_all and ! $opt_valgrind ) # Take executable path from any of them, if any
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
# If valgrind flag not defined, define if other valgrind flags are
unless ( defined $opt_valgrind )
{ {
$opt_valgrind= $opt_valgrind_all; $opt_valgrind= ""
if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;
} }
if ( ! $opt_testcase_timeout ) if ( ! $opt_testcase_timeout )
...@@ -2392,7 +2400,7 @@ sub run_mysqltest ($) { ...@@ -2392,7 +2400,7 @@ sub run_mysqltest ($) {
mtr_init_args(\$args); mtr_init_args(\$args);
if ( defined $opt_valgrind ) if ( defined $opt_valgrind_mysqltest )
{ {
valgrind_arguments($args, \$exe); valgrind_arguments($args, \$exe);
} }
...@@ -2501,6 +2509,8 @@ sub valgrind_arguments { ...@@ -2501,6 +2509,8 @@ sub valgrind_arguments {
mtr_add_arg($args, "--alignment=8"); mtr_add_arg($args, "--alignment=8");
mtr_add_arg($args, "--leak-check=yes"); mtr_add_arg($args, "--leak-check=yes");
mtr_add_arg($args, "--num-callers=16"); mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
if ( defined $opt_valgrind_all ) if ( defined $opt_valgrind_all )
{ {
...@@ -2584,10 +2594,11 @@ Options for coverage, profiling etc ...@@ -2584,10 +2594,11 @@ Options for coverage, profiling etc
gcov FIXME gcov FIXME
gprof FIXME gprof FIXME
valgrind[=exe] Run the "mysqltest" executable as well as the "mysqld" valgrind[=EXE] Run the "mysqltest" executable as well as the "mysqld"
server using valgrind, optionally specifying the server using valgrind, optionally specifying the
executable path/name executable path/name
valgrind-all FIXME valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
valgrind-options=ARGS Extra options to give valgrind valgrind-options=ARGS Extra options to give valgrind
Misc options Misc options
......
...@@ -229,7 +229,8 @@ NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection, ...@@ -229,7 +229,8 @@ NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection,
: m_ndb_cluster_connection(ndb_cluster_connection->m_impl), : m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
m_dictionary(ndb), m_dictionary(ndb),
theCurrentConnectIndex(0), theCurrentConnectIndex(0),
theNdbObjectIdMap(1024,1024), theNdbObjectIdMap(ndb_cluster_connection->m_impl.m_transporter_facade->theMutexPtr,
1024,1024),
theNoOfDBnodes(0) theNoOfDBnodes(0)
{ {
int i; int i;
......
...@@ -30,7 +30,7 @@ class NdbObjectIdMap //: NdbLockable ...@@ -30,7 +30,7 @@ class NdbObjectIdMap //: NdbLockable
{ {
public: public:
STATIC_CONST( InvalidId = ~(Uint32)0 ); STATIC_CONST( InvalidId = ~(Uint32)0 );
NdbObjectIdMap(Uint32 initalSize = 128, Uint32 expandSize = 10); NdbObjectIdMap(NdbMutex*, Uint32 initalSize = 128, Uint32 expandSize = 10);
~NdbObjectIdMap(); ~NdbObjectIdMap();
Uint32 map(void * object); Uint32 map(void * object);
...@@ -46,14 +46,16 @@ private: ...@@ -46,14 +46,16 @@ private:
void * m_obj; void * m_obj;
} * m_map; } * m_map;
NdbMutex * m_mutex;
void expand(Uint32 newSize); void expand(Uint32 newSize);
}; };
inline inline
NdbObjectIdMap::NdbObjectIdMap(Uint32 sz, Uint32 eSz) { NdbObjectIdMap::NdbObjectIdMap(NdbMutex* mutex, Uint32 sz, Uint32 eSz) {
m_size = 0; m_size = 0;
m_firstFree = InvalidId; m_firstFree = InvalidId;
m_map = 0; m_map = 0;
m_mutex = mutex;
m_expandSize = eSz; m_expandSize = eSz;
expand(sz); expand(sz);
#ifdef DEBUG_OBJECTMAP #ifdef DEBUG_OBJECTMAP
...@@ -131,21 +133,26 @@ NdbObjectIdMap::getObject(Uint32 id){ ...@@ -131,21 +133,26 @@ NdbObjectIdMap::getObject(Uint32 id){
inline void inline void
NdbObjectIdMap::expand(Uint32 incSize){ NdbObjectIdMap::expand(Uint32 incSize){
NdbMutex_Lock(m_mutex);
Uint32 newSize = m_size + incSize; Uint32 newSize = m_size + incSize;
MapEntry * tmp = (MapEntry*)malloc(newSize * sizeof(MapEntry)); MapEntry * tmp = (MapEntry*)realloc(m_map, newSize * sizeof(MapEntry));
if (m_map) { if (likely(tmp != 0))
memcpy(tmp, m_map, m_size * sizeof(MapEntry)); {
free((void*)m_map); m_map = tmp;
for(Uint32 i = m_size; i<newSize; i++){
m_map[i].m_next = i + 1;
}
m_firstFree = m_size;
m_map[newSize-1].m_next = InvalidId;
m_size = newSize;
} }
m_map = tmp; else
{
for(Uint32 i = m_size; i<newSize; i++){ ndbout_c("NdbObjectIdMap::expand unable to expand!!");
m_map[i].m_next = i + 1;
} }
m_firstFree = m_size; NdbMutex_Unlock(m_mutex);
m_map[newSize-1].m_next = InvalidId;
m_size = newSize;
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment