Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8c797644
Commit
8c797644
authored
Oct 25, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mysql.com:/home/jonas/src/mysql-4.1-ndb
parents
c766cb4c
3c889df5
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
71 deletions
+74
-71
ndb/include/portlib/NdbMutex.h
ndb/include/portlib/NdbMutex.h
+0
-2
ndb/src/common/portlib/NdbTCP.cpp
ndb/src/common/portlib/NdbTCP.cpp
+14
-16
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+11
-9
ndb/src/mgmsrv/MgmtSrvr.hpp
ndb/src/mgmsrv/MgmtSrvr.hpp
+1
-0
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+4
-3
ndb/src/ndbapi/NdbEventOperationImpl.cpp
ndb/src/ndbapi/NdbEventOperationImpl.cpp
+10
-13
ndb/src/ndbapi/Ndbinit.cpp
ndb/src/ndbapi/Ndbinit.cpp
+0
-15
ndb/src/ndbapi/ndb_cluster_connection.cpp
ndb/src/ndbapi/ndb_cluster_connection.cpp
+24
-7
ndb/test/ndbapi/testDeadlock.cpp
ndb/test/ndbapi/testDeadlock.cpp
+5
-3
ndb/test/ndbapi/testOIBasic.cpp
ndb/test/ndbapi/testOIBasic.cpp
+5
-3
No files found.
ndb/include/portlib/NdbMutex.h
View file @
8c797644
...
@@ -31,13 +31,11 @@ extern "C" {
...
@@ -31,13 +31,11 @@ extern "C" {
#if defined NDB_OSE || defined NDB_SOFTOSE
#if defined NDB_OSE || defined NDB_SOFTOSE
#include <ose.h>
#include <ose.h>
typedef
SEMAPHORE
NdbMutex
;
typedef
SEMAPHORE
NdbMutex
;
#define NDB_MUTEX_INITIALIZER { 1, 0, 0 }
#elif defined NDB_WIN32
#elif defined NDB_WIN32
typedef
CRITICAL_SECTION
NdbMutex
;
typedef
CRITICAL_SECTION
NdbMutex
;
#else
#else
#include <pthread.h>
#include <pthread.h>
typedef
pthread_mutex_t
NdbMutex
;
typedef
pthread_mutex_t
NdbMutex
;
#define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#endif
#endif
/**
/**
...
...
ndb/src/common/portlib/NdbTCP.cpp
View file @
8c797644
...
@@ -16,29 +16,27 @@
...
@@ -16,29 +16,27 @@
#include <ndb_global.h>
#include <ndb_global.h>
#include <
NdbMutex
.h>
#include <
my_net
.h>
#include <NdbTCP.h>
#include <NdbTCP.h>
#if defined NDB_WIN32 || defined SCO
static
NdbMutex
&
LOCK_gethostbyname
=
*
NdbMutex_Create
();
#else
static
NdbMutex
LOCK_gethostbyname
=
NDB_MUTEX_INITIALIZER
;
#endif
extern
"C"
extern
"C"
int
int
Ndb_getInAddr
(
struct
in_addr
*
dst
,
const
char
*
address
)
{
Ndb_getInAddr
(
struct
in_addr
*
dst
,
const
char
*
address
)
{
DBUG_ENTER
(
"Ndb_getInAddr"
);
DBUG_ENTER
(
"Ndb_getInAddr"
);
struct
hostent
*
hostPtr
;
{
NdbMutex_Lock
(
&
LOCK_gethostbyname
);
int
tmp_errno
;
hostPtr
=
gethostbyname
(
address
);
struct
hostent
tmp_hostent
,
*
hp
;
if
(
hostPtr
!=
NULL
)
{
char
buff
[
GETHOSTBYNAME_BUFF_SIZE
];
dst
->
s_addr
=
((
struct
in_addr
*
)
*
hostPtr
->
h_addr_list
)
->
s_addr
;
hp
=
my_gethostbyname_r
(
address
,
&
tmp_hostent
,
buff
,
sizeof
(
buff
),
NdbMutex_Unlock
(
&
LOCK_gethostbyname
);
&
tmp_errno
);
if
(
hp
)
{
memcpy
(
dst
,
hp
->
h_addr
,
min
(
sizeof
(
*
dst
),
(
size_t
)
hp
->
h_length
));
my_gethostbyname_r_free
();
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
NdbMutex_Unlock
(
&
LOCK_gethostbyname
);
my_gethostbyname_r_free
(
);
}
/* Try it as aaa.bbb.ccc.ddd. */
/* Try it as aaa.bbb.ccc.ddd. */
dst
->
s_addr
=
inet_addr
(
address
);
dst
->
s_addr
=
inet_addr
(
address
);
if
(
dst
->
s_addr
!=
if
(
dst
->
s_addr
!=
...
...
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
8c797644
...
@@ -534,6 +534,12 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
...
@@ -534,6 +534,12 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
m_statisticsListner
.
m_logLevel
=
se
.
m_logLevel
;
m_statisticsListner
.
m_logLevel
=
se
.
m_logLevel
;
}
}
if
((
m_node_id_mutex
=
NdbMutex_Create
())
==
0
)
{
ndbout
<<
"mutex creation failed line = "
<<
__LINE__
<<
endl
;
exit
(
-
1
);
}
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -627,7 +633,9 @@ MgmtSrvr::~MgmtSrvr()
...
@@ -627,7 +633,9 @@ MgmtSrvr::~MgmtSrvr()
stopEventLog
();
stopEventLog
();
NdbCondition_Destroy
(
theMgmtWaitForResponseCondPtr
);
NdbMutex_Destroy
(
m_configMutex
);
NdbMutex_Destroy
(
m_node_id_mutex
);
NdbCondition_Destroy
(
theMgmtWaitForResponseCondPtr
);
NdbMutex_Destroy
(
m_configMutex
);
if
(
m_newConfig
!=
NULL
)
if
(
m_newConfig
!=
NULL
)
free
(
m_newConfig
);
free
(
m_newConfig
);
...
@@ -2087,12 +2095,6 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
...
@@ -2087,12 +2095,6 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
return
nodeTypes
[
nodeId
];
return
nodeTypes
[
nodeId
];
}
}
#ifdef NDB_WIN32
static
NdbMutex
&
f_node_id_mutex
=
*
NdbMutex_Create
();
#else
static
NdbMutex
f_node_id_mutex
=
NDB_MUTEX_INITIALIZER
;
#endif
bool
bool
MgmtSrvr
::
alloc_node_id
(
NodeId
*
nodeId
,
MgmtSrvr
::
alloc_node_id
(
NodeId
*
nodeId
,
enum
ndb_mgm_node_type
type
,
enum
ndb_mgm_node_type
type
,
...
@@ -2111,7 +2113,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
...
@@ -2111,7 +2113,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
}
}
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
Guard
g
(
&
f
_node_id_mutex
);
Guard
g
(
m
_node_id_mutex
);
int
no_mgm
=
0
;
int
no_mgm
=
0
;
NodeBitmask
connected_nodes
(
m_reserved_nodes
);
NodeBitmask
connected_nodes
(
m_reserved_nodes
);
for
(
Uint32
i
=
0
;
i
<
MAX_NODES
;
i
++
)
for
(
Uint32
i
=
0
;
i
<
MAX_NODES
;
i
++
)
...
@@ -2528,7 +2530,7 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
...
@@ -2528,7 +2530,7 @@ MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
MgmtSrvr
::
Allocated_resources
::~
Allocated_resources
()
MgmtSrvr
::
Allocated_resources
::~
Allocated_resources
()
{
{
Guard
g
(
&
f
_node_id_mutex
);
Guard
g
(
m_mgmsrv
.
m
_node_id_mutex
);
if
(
!
m_reserved_nodes
.
isclear
())
{
if
(
!
m_reserved_nodes
.
isclear
())
{
// node has been reserved, force update signal to ndb nodes
// node has been reserved, force update signal to ndb nodes
global_flag_send_heartbeat_now
=
1
;
global_flag_send_heartbeat_now
=
1
;
...
...
ndb/src/mgmsrv/MgmtSrvr.hpp
View file @
8c797644
...
@@ -101,6 +101,7 @@ public:
...
@@ -101,6 +101,7 @@ public:
MgmtSrvr
&
m_mgmsrv
;
MgmtSrvr
&
m_mgmsrv
;
NodeBitmask
m_reserved_nodes
;
NodeBitmask
m_reserved_nodes
;
};
};
NdbMutex
*
m_node_id_mutex
;
/**
/**
* Start/initate the event log.
* Start/initate the event log.
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
8c797644
...
@@ -1365,7 +1365,8 @@ Ndb::pollEvents(int aMillisecondNumber)
...
@@ -1365,7 +1365,8 @@ Ndb::pollEvents(int aMillisecondNumber)
#ifdef VM_TRACE
#ifdef VM_TRACE
#include <NdbMutex.h>
#include <NdbMutex.h>
static
NdbMutex
print_state_mutex
=
NDB_MUTEX_INITIALIZER
;
extern
NdbMutex
*
ndb_print_state_mutex
;
static
bool
static
bool
checkdups
(
NdbConnection
**
list
,
unsigned
no
)
checkdups
(
NdbConnection
**
list
,
unsigned
no
)
{
{
...
@@ -1383,7 +1384,7 @@ Ndb::printState(const char* fmt, ...)
...
@@ -1383,7 +1384,7 @@ Ndb::printState(const char* fmt, ...)
va_start
(
ap
,
fmt
);
va_start
(
ap
,
fmt
);
vsprintf
(
buf
,
fmt
,
ap
);
vsprintf
(
buf
,
fmt
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
NdbMutex_Lock
(
&
print_state_mutex
);
NdbMutex_Lock
(
ndb_
print_state_mutex
);
bool
dups
=
false
;
bool
dups
=
false
;
ndbout
<<
buf
<<
" ndb="
<<
hex
<<
this
<<
dec
;
ndbout
<<
buf
<<
" ndb="
<<
hex
<<
this
<<
dec
;
#ifndef NDB_WIN32
#ifndef NDB_WIN32
...
@@ -1421,7 +1422,7 @@ Ndb::printState(const char* fmt, ...)
...
@@ -1421,7 +1422,7 @@ Ndb::printState(const char* fmt, ...)
}
}
for
(
unsigned
i
=
0
;
i
<
theNoOfCompletedTransactions
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
theNoOfCompletedTransactions
;
i
++
)
theCompletedTransactionsArray
[
i
]
->
printState
();
theCompletedTransactionsArray
[
i
]
->
printState
();
NdbMutex_Unlock
(
&
print_state_mutex
);
NdbMutex_Unlock
(
ndb_
print_state_mutex
);
}
}
#endif
#endif
...
...
ndb/src/ndbapi/NdbEventOperationImpl.cpp
View file @
8c797644
...
@@ -573,12 +573,8 @@ int NdbEventOperationImpl::wait(void *p, int aMillisecondNumber)
...
@@ -573,12 +573,8 @@ int NdbEventOperationImpl::wait(void *p, int aMillisecondNumber)
*
*
*/
*/
extern
NdbMutex
*
ndb_global_event_buffer_mutex
;
static
NdbGlobalEventBuffer
*
ndbGlobalEventBuffer
=
NULL
;
static
NdbGlobalEventBuffer
*
ndbGlobalEventBuffer
=
NULL
;
#ifdef NDB_WIN32
static
NdbMutex
&
ndbGlobalEventBufferMutex
=
*
NdbMutex_Create
();
#else
static
NdbMutex
ndbGlobalEventBufferMutex
=
NDB_MUTEX_INITIALIZER
;
#endif
/*
/*
* Class NdbGlobalEventBufferHandle
* Class NdbGlobalEventBufferHandle
...
@@ -607,18 +603,18 @@ NdbGlobalEventBufferHandle::NdbGlobalEventBufferHandle
...
@@ -607,18 +603,18 @@ NdbGlobalEventBufferHandle::NdbGlobalEventBufferHandle
exit
(
-
1
);
exit
(
-
1
);
}
}
NdbMutex_Lock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Lock
(
ndb_global_event_buffer_m
utex
);
if
(
ndbGlobalEventBuffer
==
NULL
)
{
if
(
ndbGlobalEventBuffer
==
NULL
)
{
if
(
ndbGlobalEventBuffer
==
NULL
)
{
if
(
ndbGlobalEventBuffer
==
NULL
)
{
ndbGlobalEventBuffer
=
new
NdbGlobalEventBuffer
();
ndbGlobalEventBuffer
=
new
NdbGlobalEventBuffer
();
if
(
!
ndbGlobalEventBuffer
)
{
if
(
!
ndbGlobalEventBuffer
)
{
NdbMutex_Unlock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Unlock
(
ndb_global_event_buffer_m
utex
);
ndbout_c
(
"NdbGlobalEventBufferHandle:: failed to allocate ndbGlobalEventBuffer"
);
ndbout_c
(
"NdbGlobalEventBufferHandle:: failed to allocate ndbGlobalEventBuffer"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
}
}
NdbMutex_Unlock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Unlock
(
ndb_global_event_buffer_m
utex
);
GUARD
(
real_init
(
this
,
MAX_NUMBER_ACTIVE_EVENTS
));
GUARD
(
real_init
(
this
,
MAX_NUMBER_ACTIVE_EVENTS
));
}
}
...
@@ -631,12 +627,12 @@ NdbGlobalEventBufferHandle::~NdbGlobalEventBufferHandle()
...
@@ -631,12 +627,12 @@ NdbGlobalEventBufferHandle::~NdbGlobalEventBufferHandle()
ndbGlobalEventBuffer
->
real_remove
(
this
);
ndbGlobalEventBuffer
->
real_remove
(
this
);
ndbGlobalEventBuffer
->
unlock
();
ndbGlobalEventBuffer
->
unlock
();
NdbMutex_Lock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Lock
(
ndb_global_event_buffer_m
utex
);
if
(
ndbGlobalEventBuffer
->
m_handlers
.
size
()
==
0
)
{
if
(
ndbGlobalEventBuffer
->
m_handlers
.
size
()
==
0
)
{
delete
ndbGlobalEventBuffer
;
delete
ndbGlobalEventBuffer
;
ndbGlobalEventBuffer
=
NULL
;
ndbGlobalEventBuffer
=
NULL
;
}
}
NdbMutex_Unlock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Unlock
(
ndb_global_event_buffer_m
utex
);
}
}
void
void
...
@@ -770,13 +766,13 @@ void
...
@@ -770,13 +766,13 @@ void
NdbGlobalEventBuffer
::
lock
()
NdbGlobalEventBuffer
::
lock
()
{
{
if
(
!
m_group_lock_flag
)
if
(
!
m_group_lock_flag
)
NdbMutex_Lock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Lock
(
ndb_global_event_buffer_m
utex
);
}
}
void
void
NdbGlobalEventBuffer
::
unlock
()
NdbGlobalEventBuffer
::
unlock
()
{
{
if
(
!
m_group_lock_flag
)
if
(
!
m_group_lock_flag
)
NdbMutex_Unlock
(
&
ndbGlobalEventBufferM
utex
);
NdbMutex_Unlock
(
ndb_global_event_buffer_m
utex
);
}
}
void
void
NdbGlobalEventBuffer
::
add_drop_lock
()
NdbGlobalEventBuffer
::
add_drop_lock
()
...
@@ -1232,7 +1228,8 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
...
@@ -1232,7 +1228,8 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
n
+=
hasData
(
h
->
m_bufferIds
[
i
]);
n
+=
hasData
(
h
->
m_bufferIds
[
i
]);
if
(
n
)
return
n
;
if
(
n
)
return
n
;
int
r
=
NdbCondition_WaitTimeout
(
h
->
p_cond
,
&
ndbGlobalEventBufferMutex
,
aMillisecondNumber
);
int
r
=
NdbCondition_WaitTimeout
(
h
->
p_cond
,
ndb_global_event_buffer_mutex
,
aMillisecondNumber
);
if
(
r
>
0
)
if
(
r
>
0
)
return
-
1
;
return
-
1
;
...
...
ndb/src/ndbapi/Ndbinit.cpp
View file @
8c797644
...
@@ -42,11 +42,6 @@ void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *);
...
@@ -42,11 +42,6 @@ void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *);
static
char
*
ndbConnectString
=
0
;
static
char
*
ndbConnectString
=
0
;
static
int
theNoOfNdbObjects
=
0
;
static
int
theNoOfNdbObjects
=
0
;
static
Ndb_cluster_connection
*
global_ndb_cluster_connection
=
0
;
static
Ndb_cluster_connection
*
global_ndb_cluster_connection
=
0
;
#if defined NDB_WIN32 || defined SCO
static
NdbMutex
&
createNdbMutex
=
*
NdbMutex_Create
();
#else
static
NdbMutex
createNdbMutex
=
NDB_MUTEX_INITIALIZER
;
#endif
/***************************************************************************
/***************************************************************************
...
@@ -58,7 +53,6 @@ Remark: Connect to the database.
...
@@ -58,7 +53,6 @@ Remark: Connect to the database.
Ndb
::
Ndb
(
const
char
*
aDataBase
,
const
char
*
aSchema
)
{
Ndb
::
Ndb
(
const
char
*
aDataBase
,
const
char
*
aSchema
)
{
DBUG_ENTER
(
"Ndb::Ndb()"
);
DBUG_ENTER
(
"Ndb::Ndb()"
);
DBUG_PRINT
(
"enter"
,(
"(old)Ndb::Ndb this=0x%x"
,
this
));
DBUG_PRINT
(
"enter"
,(
"(old)Ndb::Ndb this=0x%x"
,
this
));
NdbMutex_Lock
(
&
createNdbMutex
);
if
(
theNoOfNdbObjects
<
0
)
if
(
theNoOfNdbObjects
<
0
)
abort
();
// old and new Ndb constructor used mixed
abort
();
// old and new Ndb constructor used mixed
theNoOfNdbObjects
++
;
theNoOfNdbObjects
++
;
...
@@ -66,7 +60,6 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) {
...
@@ -66,7 +60,6 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) {
global_ndb_cluster_connection
=
new
Ndb_cluster_connection
(
ndbConnectString
);
global_ndb_cluster_connection
=
new
Ndb_cluster_connection
(
ndbConnectString
);
global_ndb_cluster_connection
->
connect
();
global_ndb_cluster_connection
->
connect
();
}
}
NdbMutex_Unlock
(
&
createNdbMutex
);
setup
(
global_ndb_cluster_connection
,
aDataBase
,
aSchema
);
setup
(
global_ndb_cluster_connection
,
aDataBase
,
aSchema
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -171,8 +164,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
...
@@ -171,8 +164,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
prefixEnd
=
prefixName
+
(
len
<
(
int
)
sizeof
(
prefixName
)
?
len
:
prefixEnd
=
prefixName
+
(
len
<
(
int
)
sizeof
(
prefixName
)
?
len
:
sizeof
(
prefixName
)
-
1
);
sizeof
(
prefixName
)
-
1
);
NdbMutex_Lock
(
&
createNdbMutex
);
theWaiter
.
m_mutex
=
TransporterFacade
::
instance
()
->
theMutexPtr
;
theWaiter
.
m_mutex
=
TransporterFacade
::
instance
()
->
theMutexPtr
;
// Signal that the constructor has finished OK
// Signal that the constructor has finished OK
...
@@ -191,8 +182,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
...
@@ -191,8 +182,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection,
theGlobalEventBufferHandle
=
h
;
theGlobalEventBufferHandle
=
h
;
}
}
NdbMutex_Unlock
(
&
createNdbMutex
);
theDictionary
=
new
NdbDictionaryImpl
(
*
this
);
theDictionary
=
new
NdbDictionaryImpl
(
*
this
);
if
(
theDictionary
==
NULL
)
{
if
(
theDictionary
==
NULL
)
{
ndbout_c
(
"Ndb cailed to allocate dictionary"
);
ndbout_c
(
"Ndb cailed to allocate dictionary"
);
...
@@ -232,8 +221,6 @@ Ndb::~Ndb()
...
@@ -232,8 +221,6 @@ Ndb::~Ndb()
TransporterFacade
::
instance
()
->
close
(
theNdbBlockNumber
,
theFirstTransId
);
TransporterFacade
::
instance
()
->
close
(
theNdbBlockNumber
,
theFirstTransId
);
}
}
NdbMutex_Lock
(
&
createNdbMutex
);
if
(
global_ndb_cluster_connection
!=
0
)
{
if
(
global_ndb_cluster_connection
!=
0
)
{
theNoOfNdbObjects
--
;
theNoOfNdbObjects
--
;
if
(
theNoOfNdbObjects
==
0
){
if
(
theNoOfNdbObjects
==
0
){
...
@@ -242,8 +229,6 @@ Ndb::~Ndb()
...
@@ -242,8 +229,6 @@ Ndb::~Ndb()
}
}
}
//if
}
//if
NdbMutex_Unlock
(
&
createNdbMutex
);
// if (theSchemaConToNdbList != NULL)
// if (theSchemaConToNdbList != NULL)
// closeSchemaTransaction(theSchemaConToNdbList);
// closeSchemaTransaction(theSchemaConToNdbList);
while
(
theConIdleList
!=
NULL
)
while
(
theConIdleList
!=
NULL
)
...
...
ndb/src/ndbapi/ndb_cluster_connection.cpp
View file @
8c797644
...
@@ -29,6 +29,12 @@
...
@@ -29,6 +29,12 @@
static
int
g_run_connect_thread
=
0
;
static
int
g_run_connect_thread
=
0
;
#include <NdbMutex.h>
NdbMutex
*
ndb_global_event_buffer_mutex
=
NULL
;
#ifdef VM_TRACE
NdbMutex
*
ndb_print_state_mutex
=
NULL
;
#endif
Ndb_cluster_connection
::
Ndb_cluster_connection
(
const
char
*
connect_string
)
Ndb_cluster_connection
::
Ndb_cluster_connection
(
const
char
*
connect_string
)
{
{
DBUG_ENTER
(
"Ndb_cluster_connection"
);
DBUG_ENTER
(
"Ndb_cluster_connection"
);
...
@@ -42,6 +48,17 @@ Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string)
...
@@ -42,6 +48,17 @@ Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string)
m_local_config
=
0
;
m_local_config
=
0
;
m_connect_thread
=
0
;
m_connect_thread
=
0
;
m_connect_callback
=
0
;
m_connect_callback
=
0
;
if
(
ndb_global_event_buffer_mutex
==
NULL
)
{
ndb_global_event_buffer_mutex
=
NdbMutex_Create
();
}
#ifdef VM_TRACE
if
(
ndb_print_state_mutex
==
NULL
)
{
ndb_print_state_mutex
=
NdbMutex_Create
();
}
#endif
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -85,10 +102,9 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void))
...
@@ -85,10 +102,9 @@ int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void))
if
((
r
=
connect
(
1
))
==
1
)
if
((
r
=
connect
(
1
))
==
1
)
{
{
DBUG_PRINT
(
"info"
,(
"starting thread"
));
DBUG_PRINT
(
"info"
,(
"starting thread"
));
m_connect_thread
=
NdbThread_Create
(
run_ndb_cluster_connection_connect_thread
,
m_connect_thread
=
(
void
**
)
this
,
NdbThread_Create
(
run_ndb_cluster_connection_connect_thread
,
32768
,
(
void
**
)
this
,
32768
,
"ndb_cluster_connection"
,
"ndb_cluster_connection"
,
NDB_THREAD_PRIO_LOW
);
NDB_THREAD_PRIO_LOW
);
}
}
else
if
(
r
<
0
)
else
if
(
r
<
0
)
...
@@ -112,13 +128,14 @@ int Ndb_cluster_connection::connect(int reconnect)
...
@@ -112,13 +128,14 @@ int Ndb_cluster_connection::connect(int reconnect)
if
(
m_local_config
==
0
)
{
if
(
m_local_config
==
0
)
{
m_local_config
=
new
LocalConfig
();
m_local_config
=
new
LocalConfig
();
if
(
!
m_local_config
->
init
(
m_connect_string
,
0
))
{
if
(
!
m_local_config
->
init
(
m_connect_string
,
0
))
{
ndbout
<<
"Configuration error: Unable to retrieve local config"
<<
endl
;
ndbout
_c
(
"Configuration error: Unable to retrieve local config"
)
;
m_local_config
->
printError
();
m_local_config
->
printError
();
m_local_config
->
printUsage
();
m_local_config
->
printUsage
();
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
}
}
m_config_retriever
=
new
ConfigRetriever
(
*
m_local_config
,
NDB_VERSION
,
NODE_TYPE_API
);
m_config_retriever
=
new
ConfigRetriever
(
*
m_local_config
,
NDB_VERSION
,
NODE_TYPE_API
);
}
}
else
else
if
(
reconnect
==
0
)
if
(
reconnect
==
0
)
...
...
ndb/test/ndbapi/testDeadlock.cpp
View file @
8c797644
...
@@ -48,14 +48,14 @@ printusage()
...
@@ -48,14 +48,14 @@ printusage()
static
Opt
g_opt
;
static
Opt
g_opt
;
static
NdbMutex
ndbout_mutex
=
NDB_MUTEX_INITIALIZER
;
static
NdbMutex
*
ndbout_mutex
=
NULL
;
#define DBG(x) \
#define DBG(x) \
do { \
do { \
if (! g_opt.m_dbg) break; \
if (! g_opt.m_dbg) break; \
NdbMutex_Lock(
&
ndbout_mutex); \
NdbMutex_Lock(ndbout_mutex); \
ndbout << "line " << __LINE__ << " " << x << endl; \
ndbout << "line " << __LINE__ << " " << x << endl; \
NdbMutex_Unlock(
&
ndbout_mutex); \
NdbMutex_Unlock(ndbout_mutex); \
} while (0)
} while (0)
#define CHK(x) \
#define CHK(x) \
...
@@ -492,6 +492,8 @@ wl1822_main(char scantx)
...
@@ -492,6 +492,8 @@ wl1822_main(char scantx)
NDB_COMMAND
(
testOdbcDriver
,
"testDeadlock"
,
"testDeadlock"
,
"testDeadlock"
,
65535
)
NDB_COMMAND
(
testOdbcDriver
,
"testDeadlock"
,
"testDeadlock"
,
"testDeadlock"
,
65535
)
{
{
ndb_init
();
ndb_init
();
if
(
ndbout_mutex
==
NULL
)
ndbout_mutex
=
NdbMutex_Create
();
while
(
++
argv
,
--
argc
>
0
)
{
while
(
++
argv
,
--
argc
>
0
)
{
const
char
*
arg
=
argv
[
0
];
const
char
*
arg
=
argv
[
0
];
if
(
strcmp
(
arg
,
"-scan"
)
==
0
)
{
if
(
strcmp
(
arg
,
"-scan"
)
==
0
)
{
...
...
ndb/test/ndbapi/testOIBasic.cpp
View file @
8c797644
...
@@ -137,7 +137,7 @@ static const bool g_compare_null = true;
...
@@ -137,7 +137,7 @@ static const bool g_compare_null = true;
// log and error macros
// log and error macros
static
NdbMutex
ndbout_mutex
=
NDB_MUTEX_INITIALIZER
;
static
NdbMutex
*
ndbout_mutex
=
NULL
;
static
unsigned
getthrno
();
static
unsigned
getthrno
();
...
@@ -160,9 +160,9 @@ getthrstr()
...
@@ -160,9 +160,9 @@ getthrstr()
#define LLN(n, s) \
#define LLN(n, s) \
do { \
do { \
if ((n) > g_opt.m_v) break; \
if ((n) > g_opt.m_v) break; \
if (g_opt.m_msglock) NdbMutex_Lock(
&
ndbout_mutex); \
if (g_opt.m_msglock) NdbMutex_Lock(ndbout_mutex); \
ndbout << getthrstr() << s << endl; \
ndbout << getthrstr() << s << endl; \
if (g_opt.m_msglock) NdbMutex_Unlock(
&
ndbout_mutex); \
if (g_opt.m_msglock) NdbMutex_Unlock(ndbout_mutex); \
} while(0)
} while(0)
#define LL0(s) LLN(0, s)
#define LL0(s) LLN(0, s)
...
@@ -3349,6 +3349,8 @@ runtest(Par par)
...
@@ -3349,6 +3349,8 @@ runtest(Par par)
NDB_COMMAND
(
testOIBasic
,
"testOIBasic"
,
"testOIBasic"
,
"testOIBasic"
,
65535
)
NDB_COMMAND
(
testOIBasic
,
"testOIBasic"
,
"testOIBasic"
,
"testOIBasic"
,
65535
)
{
{
ndb_init
();
ndb_init
();
if
(
ndbout_mutex
==
NULL
)
ndbout_mutex
=
NdbMutex_Create
();
while
(
++
argv
,
--
argc
>
0
)
{
while
(
++
argv
,
--
argc
>
0
)
{
const
char
*
arg
=
argv
[
0
];
const
char
*
arg
=
argv
[
0
];
if
(
*
arg
!=
'-'
)
{
if
(
*
arg
!=
'-'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment