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
584388c7
Commit
584388c7
authored
Feb 23, 2006
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysqldev@production.mysql.com:my/mysql-5.1-release
into mysql.com:/users/mkindahl/bk/merge-b17181-mysql-5.1-new
parents
5d0187f0
5dab541c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
46 deletions
+65
-46
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.cc
+1
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+35
-26
sql/table.cc
sql/table.cc
+28
-18
No files found.
sql/ha_ndbcluster_binlog.cc
View file @
584388c7
...
...
@@ -310,7 +310,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
table
=
0
;
break
;
}
assign_new_table_id
(
table
);
assign_new_table_id
(
table
_share
);
if
(
!
table
->
record
[
1
]
||
table
->
record
[
1
]
==
table
->
record
[
0
])
{
table
->
record
[
1
]
=
alloc_root
(
&
table
->
mem_root
,
...
...
sql/mysql_priv.h
View file @
584388c7
...
...
@@ -657,7 +657,7 @@ bool table_cache_init(void);
void
table_cache_free
(
void
);
bool
table_def_init
(
void
);
void
table_def_free
(
void
);
void
assign_new_table_id
(
TABLE
*
tabl
e
);
void
assign_new_table_id
(
TABLE
_SHARE
*
shar
e
);
uint
cached_open_tables
(
void
);
uint
cached_table_definitions
(
void
);
void
kill_mysql
(
void
);
...
...
sql/sql_base.cc
View file @
584388c7
...
...
@@ -313,6 +313,22 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
conflicts
*/
(
void
)
pthread_mutex_lock
(
&
share
->
mutex
);
/*
We assign a new table id under the protection of the LOCK_open and
the share's own mutex. We do this insted of creating a new mutex
and using it for the sole purpose of serializing accesses to a
static variable, we assign the table id here. We assign it to the
share before inserting it into the table_def_cache to be really
sure that it cannot be read from the cache without having a table
id assigned.
CAVEAT. This means that the table cannot be used for
binlogging/replication purposes, unless get_table_share() has been
called directly or indirectly.
*/
assign_new_table_id
(
share
);
if
(
my_hash_insert
(
&
table_def_cache
,
(
byte
*
)
share
))
{
#ifdef NOT_YET
...
...
@@ -2383,43 +2399,50 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
/*
Function to assign a new table map id to a table.
Function to assign a new table map id to a table
share
.
PARAMETERS
table - Pointer to tabl
e structure
share - Pointer to table shar
e structure
PRE-CONDITION(S)
tabl
e is non-NULL
shar
e is non-NULL
The LOCK_open mutex is locked
The share->mutex is locked
POST-CONDITION(S)
table->s->table_map_id is given a value that with a high certainty
is not used by any other table.
share->table_map_id is given a value that with a high certainty is
not used by any other table (the only case where a table id can be
reused is on wrap-around, which means more than 4 billion table
shares open at the same time).
table->s
->table_map_id is not ULONG_MAX.
share
->table_map_id is not ULONG_MAX.
*/
void
assign_new_table_id
(
TABLE
*
tabl
e
)
void
assign_new_table_id
(
TABLE
_SHARE
*
shar
e
)
{
static
ulong
last_table_id
=
ULONG_MAX
;
DBUG_ENTER
(
"assign_new_table_id
(TABLE*)
"
);
DBUG_ENTER
(
"assign_new_table_id"
);
/* Preconditions */
DBUG_ASSERT
(
tabl
e
!=
NULL
);
DBUG_ASSERT
(
shar
e
!=
NULL
);
safe_mutex_assert_owner
(
&
LOCK_open
);
safe_mutex_assert_owner
(
&
share
->
mutex
);
ulong
tid
=
++
last_table_id
;
/* get next id */
/* There is one reserved number that cannot be used. */
/*
There is one reserved number that cannot be used. Remember to
change this when 6-byte global table id's are introduced.
*/
if
(
unlikely
(
tid
==
ULONG_MAX
))
tid
=
++
last_table_id
;
table
->
s
->
table_map_id
=
tid
;
share
->
table_map_id
=
tid
;
DBUG_PRINT
(
"info"
,
(
"table_id=%lu"
,
tid
));
/* Post conditions */
DBUG_ASSERT
(
table
->
s
->
table_map_id
!=
ULONG_MAX
);
DBUG_ASSERT
(
share
->
table_map_id
!=
ULONG_MAX
);
DBUG_VOID_RETURN
;
}
...
...
@@ -2573,20 +2596,6 @@ retry:
break
;
}
/*
We assign a new table id under the protection of the LOCK_open
mutex. We assign a new table id here instead of inside openfrm()
since that function can be used without acquiring any lock (e.g.,
inside ha_create_table()). Insted of creatint a new mutex and
using it for the sole purpose of serializing accesses to a static
variable, we assign the table id here.
CAVEAT. This means that the table cannot be used for
binlogging/replication purposes, unless open_table() has been called
directly or indirectly.
*/
assign_new_table_id
(
entry
);
if
(
Table_triggers_list
::
check_n_load
(
thd
,
share
->
db
.
str
,
share
->
table_name
.
str
,
entry
,
0
))
{
...
...
sql/table.cc
View file @
584388c7
...
...
@@ -130,6 +130,24 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share
->
version
=
refresh_version
;
share
->
flush_version
=
flush_version
;
#ifdef HAVE_ROW_BASED_REPLICATION
/*
This constant is used to mark that no table map version has been
assigned. No arithmetic is done on the value: it will be
overwritten with a value taken from MYSQL_BIN_LOG.
*/
share
->
table_map_version
=
~
(
ulonglong
)
0
;
/*
Since alloc_table_share() can be called without any locking (for
example, ha_create_table... functions), we do not assign a table
map id here. Instead we assign a value that is not used
elsewhere, and then assign a table map id inside open_table()
under the protection of the LOCK_open mutex.
*/
share
->
table_map_id
=
ULONG_MAX
;
#endif
memcpy
((
char
*
)
&
share
->
mem_root
,
(
char
*
)
&
mem_root
,
sizeof
(
mem_root
));
pthread_mutex_init
(
&
share
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
share
->
cond
,
NULL
);
...
...
@@ -180,6 +198,15 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key,
share
->
path
.
length
=
share
->
normalized_path
.
length
=
strlen
(
path
);
share
->
frm_version
=
FRM_VER_TRUE_VARCHAR
;
#ifdef HAVE_ROW_BASED_REPLICATION
/*
Temporary tables are not replicated, but we set up these fields
anyway to be able to catch errors.
*/
share
->
table_map_version
=
~
(
ulonglong
)
0
;
share
->
table_map_id
=
ULONG_MAX
;
#endif
DBUG_VOID_RETURN
;
}
...
...
@@ -371,6 +398,7 @@ err_not_open:
share
->
error
=
error
;
open_table_error
(
share
,
error
,
(
share
->
open_errno
=
my_errno
),
0
);
}
DBUG_RETURN
(
error
);
}
...
...
@@ -1503,24 +1531,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
*
root_ptr
=
old_root
;
thd
->
status_var
.
opened_tables
++
;
#ifdef HAVE_REPLICATION
/*
This constant is used to mark that no table map version has been
assigned. No arithmetic is done on the value: it will be
overwritten with a value taken from MYSQL_BIN_LOG.
*/
share
->
table_map_version
=
~
(
ulonglong
)
0
;
/*
Since openfrm() can be called without any locking (for example,
ha_create_table... functions), we do not assign a table map id
here. Instead we assign a value that is not used elsewhere, and
then assign a table map id inside open_table() under the
protection of the LOCK_open mutex.
*/
share
->
table_map_id
=
ULONG_MAX
;
#endif
DBUG_RETURN
(
0
);
...
...
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