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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4972f4d8
Commit
4972f4d8
authored
Jul 14, 2010
by
Davi Arnaut
Browse files
Options
Browse Files
Download
Plain Diff
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
parents
11b6ff0f
ce789702
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
19 deletions
+34
-19
storage/ndb/src/common/portlib/NdbMutex.c
storage/ndb/src/common/portlib/NdbMutex.c
+8
-13
storage/ndb/src/ndbapi/DictCache.cpp
storage/ndb/src/ndbapi/DictCache.cpp
+26
-6
No files found.
storage/ndb/src/common/portlib/NdbMutex.c
View file @
4972f4d8
...
@@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void)
...
@@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void)
{
{
NdbMutex
*
pNdbMutex
;
NdbMutex
*
pNdbMutex
;
int
result
;
int
result
;
DBUG_ENTER
(
"NdbMutex_Create"
);
pNdbMutex
=
(
NdbMutex
*
)
NdbMem_Allocate
(
sizeof
(
NdbMutex
));
pNdbMutex
=
(
NdbMutex
*
)
NdbMem_Allocate
(
sizeof
(
NdbMutex
));
DBUG_PRINT
(
"info"
,(
"NdbMem_Allocate 0x%lx"
,
(
long
)
pNdbMutex
));
if
(
pNdbMutex
==
NULL
)
if
(
pNdbMutex
==
NULL
)
DBUG_RETURN
(
NULL
)
;
return
NULL
;
result
=
pthread_mutex_init
(
pNdbMutex
,
NULL
);
result
=
pthread_mutex_init
(
pNdbMutex
,
NULL
);
assert
(
result
==
0
);
assert
(
result
==
0
);
DBUG_RETURN
(
pNdbMutex
);
return
pNdbMutex
;
}
}
int
NdbMutex_Destroy
(
NdbMutex
*
p_mutex
)
int
NdbMutex_Destroy
(
NdbMutex
*
p_mutex
)
{
{
int
result
;
int
result
;
DBUG_ENTER
(
"NdbMutex_Destroy"
);
if
(
p_mutex
==
NULL
)
if
(
p_mutex
==
NULL
)
DBUG_RETURN
(
-
1
)
;
return
-
1
;
result
=
pthread_mutex_destroy
(
p_mutex
);
result
=
pthread_mutex_destroy
(
p_mutex
);
DBUG_PRINT
(
"info"
,(
"NdbMem_Free 0x%lx"
,
(
long
)
p_mutex
));
NdbMem_Free
(
p_mutex
);
NdbMem_Free
(
p_mutex
);
DBUG_RETURN
(
result
);
return
result
;
}
}
...
...
storage/ndb/src/ndbapi/DictCache.cpp
View file @
4972f4d8
...
@@ -20,8 +20,10 @@
...
@@ -20,8 +20,10 @@
#include <NdbCondition.h>
#include <NdbCondition.h>
#include <NdbSleep.h>
#include <NdbSleep.h>
static
NdbTableImpl
f_invalid_table
;
static
NdbTableImpl
*
f_invalid_table
=
0
;
static
NdbTableImpl
f_altered_table
;
static
NdbTableImpl
*
f_altered_table
=
0
;
static
int
ndb_dict_cache_count
=
0
;
Ndb_local_table_info
*
Ndb_local_table_info
*
Ndb_local_table_info
::
create
(
NdbTableImpl
*
table_impl
,
Uint32
sz
)
Ndb_local_table_info
::
create
(
NdbTableImpl
*
table_impl
,
Uint32
sz
)
...
@@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){
...
@@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){
DBUG_ENTER
(
"GlobalDictCache::GlobalDictCache"
);
DBUG_ENTER
(
"GlobalDictCache::GlobalDictCache"
);
m_tableHash
.
createHashTable
();
m_tableHash
.
createHashTable
();
m_waitForTableCondition
=
NdbCondition_Create
();
m_waitForTableCondition
=
NdbCondition_Create
();
if
(
f_invalid_table
==
NULL
)
f_invalid_table
=
new
NdbTableImpl
();
if
(
f_altered_table
==
NULL
)
f_altered_table
=
new
NdbTableImpl
();
ndb_dict_cache_count
++
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
GlobalDictCache
::~
GlobalDictCache
(){
GlobalDictCache
::~
GlobalDictCache
(){
DBUG_ENTER
(
"GlobalDictCache::~GlobalDictCache"
);
DBUG_ENTER
(
"GlobalDictCache::~GlobalDictCache"
);
if
(
--
ndb_dict_cache_count
==
0
)
{
if
(
f_invalid_table
)
{
delete
f_invalid_table
;
f_invalid_table
=
0
;
}
if
(
f_altered_table
)
{
delete
f_altered_table
;
f_altered_table
=
0
;
}
}
NdbElement_t
<
Vector
<
TableVersion
>
>
*
curr
=
m_tableHash
.
getNext
(
0
);
NdbElement_t
<
Vector
<
TableVersion
>
>
*
curr
=
m_tableHash
.
getNext
(
0
);
while
(
curr
!=
0
){
while
(
curr
!=
0
){
Vector
<
TableVersion
>
*
vers
=
curr
->
theData
;
Vector
<
TableVersion
>
*
vers
=
curr
->
theData
;
...
@@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
...
@@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
TableVersion
&
ver
=
vers
->
back
();
TableVersion
&
ver
=
vers
->
back
();
if
(
ver
.
m_status
!=
RETREIVING
||
if
(
ver
.
m_status
!=
RETREIVING
||
!
(
ver
.
m_impl
==
0
||
!
(
ver
.
m_impl
==
0
||
ver
.
m_impl
==
&
f_invalid_table
||
ver
.
m_impl
==
&
f_altered_table
)
||
ver
.
m_impl
==
f_invalid_table
||
ver
.
m_impl
==
f_altered_table
)
||
ver
.
m_version
!=
0
||
ver
.
m_version
!=
0
||
ver
.
m_refCount
==
0
){
ver
.
m_refCount
==
0
){
abort
();
abort
();
...
@@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
...
@@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
ver
.
m_version
=
tab
->
m_version
;
ver
.
m_version
=
tab
->
m_version
;
ver
.
m_status
=
OK
;
ver
.
m_status
=
OK
;
}
}
else
if
(
ver
.
m_impl
==
&
f_invalid_table
)
else
if
(
ver
.
m_impl
==
f_invalid_table
)
{
{
DBUG_PRINT
(
"info"
,
(
"Table DROPPED invalid"
));
DBUG_PRINT
(
"info"
,
(
"Table DROPPED invalid"
));
ver
.
m_impl
=
tab
;
ver
.
m_impl
=
tab
;
...
@@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
...
@@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab)
ver
.
m_status
=
DROPPED
;
ver
.
m_status
=
DROPPED
;
ver
.
m_impl
->
m_status
=
NdbDictionary
::
Object
::
Invalid
;
ver
.
m_impl
->
m_status
=
NdbDictionary
::
Object
::
Invalid
;
}
}
else
if
(
ver
.
m_impl
==
&
f_altered_table
)
else
if
(
ver
.
m_impl
==
f_altered_table
)
{
{
DBUG_PRINT
(
"info"
,
(
"Table DROPPED altered"
));
DBUG_PRINT
(
"info"
,
(
"Table DROPPED altered"
));
ver
.
m_impl
=
tab
;
ver
.
m_impl
=
tab
;
...
@@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name,
...
@@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name,
if
(
i
==
sz
-
1
&&
ver
.
m_status
==
RETREIVING
)
if
(
i
==
sz
-
1
&&
ver
.
m_status
==
RETREIVING
)
{
{
ver
.
m_impl
=
altered
?
&
f_altered_table
:
&
f_invalid_table
;
ver
.
m_impl
=
altered
?
f_altered_table
:
f_invalid_table
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
}
}
...
...
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