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
a4c389ca
Commit
a4c389ca
authored
Feb 01, 2006
by
marty@linux.site
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrapped get/set_ndb_share_state with mutex lock
parent
f90661e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+10
-9
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+20
-0
No files found.
sql/ha_ndbcluster.cc
View file @
a4c389ca
...
...
@@ -1041,7 +1041,8 @@ int ha_ndbcluster::get_metadata(const char *path)
DBUG_RETURN
(
1
);
}
if
(
m_share
->
state
!=
NSS_ALTERED
&&
cmp_frm
(
tab
,
pack_data
,
pack_length
))
if
(
get_ndb_share_state
(
m_share
)
!=
NSS_ALTERED
&&
cmp_frm
(
tab
,
pack_data
,
pack_length
))
{
if
(
!
invalidating_ndb_table
)
{
...
...
@@ -4434,7 +4435,7 @@ int ha_ndbcluster::create_handler_files(const char *file)
NDBDICT
*
dict
=
ndb
->
getDictionary
();
if
(
!
(
tab
=
dict
->
getTable
(
m_tabname
)))
DBUG_RETURN
(
0
);
// Must be a create, ignore since frm is saved in create
DBUG_ASSERT
(
m_share
->
state
==
NSS_ALTERED
);
DBUG_ASSERT
(
get_ndb_share_state
(
m_share
)
==
NSS_ALTERED
);
name
=
table
->
s
->
normalized_path
.
str
;
DBUG_PRINT
(
"enter"
,
(
"m_tabname: %s, path: %s"
,
m_tabname
,
name
));
if
(
readfrm
(
name
,
&
data
,
&
length
)
||
...
...
@@ -4453,7 +4454,7 @@ int ha_ndbcluster::create_handler_files(const char *file)
my_free
((
char
*
)
data
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
char
*
)
pack_data
,
MYF
(
MY_ALLOW_ZERO_PTR
));
}
m_share
->
state
=
NSS_INITIAL
;
set_ndb_share_state
(
m_share
,
NSS_INITIAL
)
;
free_share
(
&
m_share
);
// Decrease ref_count
DBUG_RETURN
(
error
);
...
...
@@ -4590,7 +4591,7 @@ int ha_ndbcluster::add_index(TABLE *table_arg,
if
(
!
error
)
{
ndbcluster_get_share
(
m_share
);
// Increase ref_count
m_share
->
state
=
NSS_ALTERED
;
set_ndb_share_state
(
m_share
,
NSS_ALTERED
)
;
}
DBUG_RETURN
(
error
);
}
...
...
@@ -4629,7 +4630,7 @@ int ha_ndbcluster::prepare_drop_index(TABLE *table_arg,
Ndb
*
ndb
=
thd_ndb
->
ndb
;
renumber_indexes
(
ndb
,
table_arg
);
ndbcluster_get_share
(
m_share
);
// Increase ref_count
m_share
->
state
=
NSS_ALTERED
;
set_ndb_share_state
(
m_share
,
NSS_ALTERED
)
;
DBUG_RETURN
(
0
);
}
...
...
@@ -5280,7 +5281,7 @@ int ndbcluster_discover(THD* thd, const char *db, const char *name,
dict
->
invalidateTable
(
name
);
strxnmov
(
key
,
FN_LEN
-
1
,
mysql_data_home
,
"/"
,
db
,
"/"
,
name
,
NullS
);
NDB_SHARE
*
share
=
get_share
(
key
,
0
,
false
);
if
(
share
&&
share
->
state
==
NSS_ALTERED
)
if
(
share
&&
get_ndb_share_state
(
share
)
==
NSS_ALTERED
)
{
// Frm has been altered on disk, but not yet written to ndb
if
(
readfrm
(
key
,
&
data
,
&
len
))
...
...
@@ -5532,7 +5533,7 @@ int ndbcluster_find_all_files(THD *thd)
else
if
(
cmp_frm
(
ndbtab
,
pack_data
,
pack_length
))
{
NDB_SHARE
*
share
=
get_share
(
key
,
0
,
false
);
if
(
!
share
||
share
->
state
!=
NSS_ALTERED
)
if
(
!
share
||
get_ndb_share_state
(
share
)
!=
NSS_ALTERED
)
{
discover
=
1
;
sql_print_information
(
"NDB: mismatch in frm for %s.%s, discovering..."
,
...
...
@@ -9524,7 +9525,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN
(
HA_ADMIN_NOT_IMPLEMENTED
);
}
}
#ifdef HAVE_NDB_BINLOG
if
(
is_tablespace
)
ndbcluster_log_schema_op
(
thd
,
0
,
thd
->
query
,
thd
->
query_length
,
...
...
@@ -9537,7 +9538,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
""
,
info
->
logfile_group_name
,
0
,
0
,
SOT_LOGFILE_GROUP
);
#endif
DBUG_RETURN
(
FALSE
);
ndberror:
...
...
sql/ha_ndbcluster.h
View file @
a4c389ca
...
...
@@ -118,6 +118,26 @@ typedef struct st_ndbcluster_share {
#endif
}
NDB_SHARE
;
inline
NDB_SHARE_STATE
get_ndb_share_state
(
NDB_SHARE
*
share
)
{
NDB_SHARE_STATE
state
;
pthread_mutex_lock
(
&
share
->
mutex
);
state
=
share
->
state
;
pthread_mutex_unlock
(
&
share
->
mutex
);
return
state
;
}
inline
void
set_ndb_share_state
(
NDB_SHARE
*
share
,
NDB_SHARE_STATE
state
)
{
pthread_mutex_lock
(
&
share
->
mutex
);
share
->
state
=
state
;
pthread_mutex_unlock
(
&
share
->
mutex
);
}
#ifdef HAVE_NDB_BINLOG
/* NDB_SHARE.flags */
#define NSF_HIDDEN_PK 1
/* table has hidden primary key */
...
...
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