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
a865af0d
Commit
a865af0d
authored
Feb 27, 2006
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bkroot/mysql-5.1-new
into mysql.com:/home/bk/fix-mysql-5.1-release
parents
1f30b152
adc97236
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
56 deletions
+76
-56
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.cc
+1
-1
sql/log_event.cc
sql/log_event.cc
+11
-10
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 @
a865af0d
...
@@ -261,7 +261,7 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
...
@@ -261,7 +261,7 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
my_free
((
gptr
)
table
,
MYF
(
0
));
my_free
((
gptr
)
table
,
MYF
(
0
));
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
assign_new_table_id
(
tabl
e
);
assign_new_table_id
(
shar
e
);
if
(
!
table
->
record
[
1
]
||
table
->
record
[
1
]
==
table
->
record
[
0
])
if
(
!
table
->
record
[
1
]
||
table
->
record
[
1
]
==
table
->
record
[
0
])
{
{
table
->
record
[
1
]
=
alloc_root
(
&
table
->
mem_root
,
table
->
record
[
1
]
=
alloc_root
(
&
table
->
mem_root
,
...
...
sql/log_event.cc
View file @
a865af0d
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#endif
/* MYSQL_CLIENT */
#endif
/* MYSQL_CLIENT */
#include <base64.h>
#include <base64.h>
#include <my_bitmap.h>
#include <my_bitmap.h>
#include <my_vle.h>
#define log_cs &my_charset_latin1
#define log_cs &my_charset_latin1
...
@@ -5128,7 +5127,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
...
@@ -5128,7 +5127,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
byte
const
*
const
var_start
=
(
const
byte
*
)
buf
+
common_header_len
+
byte
const
*
const
var_start
=
(
const
byte
*
)
buf
+
common_header_len
+
post_header_len
;
post_header_len
;
byte
const
*
const
ptr_width
=
var_start
;
byte
const
*
const
ptr_width
=
var_start
;
byte
const
*
const
ptr_after_width
=
my_vle_decode
(
&
m_width
,
ptr_width
);
uchar
*
ptr_after_width
=
(
uchar
*
)
ptr_width
;
m_width
=
net_field_length
(
&
ptr_after_width
);
const
uint
byte_count
=
(
m_width
+
7
)
/
8
;
const
uint
byte_count
=
(
m_width
+
7
)
/
8
;
const
byte
*
const
ptr_rows_data
=
var_start
+
byte_count
+
1
;
const
byte
*
const
ptr_rows_data
=
var_start
+
byte_count
+
1
;
...
@@ -5598,13 +5598,13 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
...
@@ -5598,13 +5598,13 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
Note that this should be the number of *bits*, not the number of
Note that this should be the number of *bits*, not the number of
bytes.
bytes.
*/
*/
byte
sbuf
[
my_vle_
sizeof
(
m_width
)];
byte
sbuf
[
sizeof
(
m_width
)];
my_ptrdiff_t
const
data_size
=
m_rows_cur
-
m_rows_buf
;
my_ptrdiff_t
const
data_size
=
m_rows_cur
-
m_rows_buf
;
char
*
const
sbuf_end
=
(
char
*
const
)
my_vle_encode
(
sbuf
,
sizeof
(
sbuf
),
m_width
);
char
*
const
sbuf_end
=
net_store_length
(
sbuf
,
(
uint
)
m_width
);
DBUG_ASSERT
(
static_cast
<
my_size_t
>
(
sbuf_end
-
(
char
*
const
)
sbuf
)
<=
sizeof
(
sbuf
));
DBUG_ASSERT
(
static_cast
<
my_size_t
>
(
sbuf_end
-
(
char
*
)
sbuf
)
<=
sizeof
(
sbuf
));
return
(
my_b_safe_write
(
file
,
sbuf
,
sbuf_end
-
(
char
*
const
)
sbuf
)
||
return
(
my_b_safe_write
(
file
,
sbuf
,
sbuf_end
-
(
char
*
)
sbuf
)
||
my_b_safe_write
(
file
,
reinterpret_cast
<
byte
*>
(
m_cols
.
bitmap
),
my_b_safe_write
(
file
,
reinterpret_cast
<
byte
*>
(
m_cols
.
bitmap
),
no_bytes_in_map
(
&
m_cols
))
||
no_bytes_in_map
(
&
m_cols
))
||
my_b_safe_write
(
file
,
m_rows_buf
,
data_size
));
my_b_safe_write
(
file
,
m_rows_buf
,
data_size
));
...
@@ -5731,7 +5731,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
...
@@ -5731,7 +5731,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
/* Length of table name + counter + terminating null */
/* Length of table name + counter + terminating null */
byte
const
*
const
ptr_colcnt
=
ptr_tbllen
+
m_tbllen
+
2
;
byte
const
*
const
ptr_colcnt
=
ptr_tbllen
+
m_tbllen
+
2
;
byte
const
*
const
ptr_after_colcnt
=
my_vle_decode
(
&
m_colcnt
,
ptr_colcnt
);
uchar
*
ptr_after_colcnt
=
(
uchar
*
)
ptr_colcnt
;
m_colcnt
=
net_field_length
(
&
ptr_after_colcnt
);
DBUG_PRINT
(
"info"
,(
"m_dblen=%d off=%d m_tbllen=%d off=%d m_colcnt=%d off=%d"
,
DBUG_PRINT
(
"info"
,(
"m_dblen=%d off=%d m_tbllen=%d off=%d m_colcnt=%d off=%d"
,
m_dblen
,
ptr_dblen
-
(
const
byte
*
)
vpart
,
m_dblen
,
ptr_dblen
-
(
const
byte
*
)
vpart
,
...
@@ -6047,9 +6048,9 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
...
@@ -6047,9 +6048,9 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
byte
const
dbuf
[]
=
{
m_dblen
};
byte
const
dbuf
[]
=
{
m_dblen
};
byte
const
tbuf
[]
=
{
m_tbllen
};
byte
const
tbuf
[]
=
{
m_tbllen
};
byte
cbuf
[
my_vle_
sizeof
(
m_colcnt
)];
byte
cbuf
[
sizeof
(
m_colcnt
)];
byte
*
const
cbuf_end
=
my_vle_encode
(
cbuf
,
sizeof
(
cbuf
),
m_colcnt
);
char
*
const
cbuf_end
=
net_store_length
(
cbuf
,
(
uint
)
m_colcnt
);
DBUG_ASSERT
(
static_cast
<
my_size_t
>
(
cbuf_end
-
cbuf
)
<=
sizeof
(
cbuf
));
DBUG_ASSERT
(
static_cast
<
my_size_t
>
(
cbuf_end
-
(
char
*
)
cbuf
)
<=
sizeof
(
cbuf
));
return
(
my_b_safe_write
(
file
,
dbuf
,
sizeof
(
dbuf
))
||
return
(
my_b_safe_write
(
file
,
dbuf
,
sizeof
(
dbuf
))
||
my_b_safe_write
(
file
,
(
const
byte
*
)
m_dbnam
,
m_dblen
+
1
)
||
my_b_safe_write
(
file
,
(
const
byte
*
)
m_dbnam
,
m_dblen
+
1
)
||
...
...
sql/mysql_priv.h
View file @
a865af0d
...
@@ -660,7 +660,7 @@ bool table_cache_init(void);
...
@@ -660,7 +660,7 @@ bool table_cache_init(void);
void
table_cache_free
(
void
);
void
table_cache_free
(
void
);
bool
table_def_init
(
void
);
bool
table_def_init
(
void
);
void
table_def_free
(
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_open_tables
(
void
);
uint
cached_table_definitions
(
void
);
uint
cached_table_definitions
(
void
);
void
kill_mysql
(
void
);
void
kill_mysql
(
void
);
...
...
sql/sql_base.cc
View file @
a865af0d
...
@@ -313,6 +313,22 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
...
@@ -313,6 +313,22 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
conflicts
conflicts
*/
*/
(
void
)
pthread_mutex_lock
(
&
share
->
mutex
);
(
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
))
if
(
my_hash_insert
(
&
table_def_cache
,
(
byte
*
)
share
))
{
{
#ifdef NOT_YET
#ifdef NOT_YET
...
@@ -2392,43 +2408,50 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
...
@@ -2392,43 +2408,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
PARAMETERS
table - Pointer to tabl
e structure
share - Pointer to table shar
e structure
PRE-CONDITION(S)
PRE-CONDITION(S)
tabl
e is non-NULL
shar
e is non-NULL
The LOCK_open mutex is locked
The LOCK_open mutex is locked
The share->mutex is locked
POST-CONDITION(S)
POST-CONDITION(S)
table->s->table_map_id is given a value that with a high certainty
share->table_map_id is given a value that with a high certainty is
is not used by any other table.
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
;
static
ulong
last_table_id
=
ULONG_MAX
;
DBUG_ENTER
(
"assign_new_table_id
(TABLE*)
"
);
DBUG_ENTER
(
"assign_new_table_id"
);
/* Preconditions */
/* Preconditions */
DBUG_ASSERT
(
tabl
e
!=
NULL
);
DBUG_ASSERT
(
shar
e
!=
NULL
);
safe_mutex_assert_owner
(
&
LOCK_open
);
safe_mutex_assert_owner
(
&
LOCK_open
);
safe_mutex_assert_owner
(
&
share
->
mutex
);
ulong
tid
=
++
last_table_id
;
/* get next id */
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
))
if
(
unlikely
(
tid
==
ULONG_MAX
))
tid
=
++
last_table_id
;
tid
=
++
last_table_id
;
table
->
s
->
table_map_id
=
tid
;
share
->
table_map_id
=
tid
;
DBUG_PRINT
(
"info"
,
(
"table_id=%lu"
,
tid
));
DBUG_PRINT
(
"info"
,
(
"table_id=%lu"
,
tid
));
/* Post conditions */
/* Post conditions */
DBUG_ASSERT
(
table
->
s
->
table_map_id
!=
ULONG_MAX
);
DBUG_ASSERT
(
share
->
table_map_id
!=
ULONG_MAX
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2582,20 +2605,6 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
...
@@ -2582,20 +2605,6 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
break
;
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
,
if
(
Table_triggers_list
::
check_n_load
(
thd
,
share
->
db
.
str
,
share
->
table_name
.
str
,
entry
,
0
))
share
->
table_name
.
str
,
entry
,
0
))
{
{
...
...
sql/table.cc
View file @
a865af0d
...
@@ -130,6 +130,24 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
...
@@ -130,6 +130,24 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share
->
version
=
refresh_version
;
share
->
version
=
refresh_version
;
share
->
flush_version
=
flush_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
));
memcpy
((
char
*
)
&
share
->
mem_root
,
(
char
*
)
&
mem_root
,
sizeof
(
mem_root
));
pthread_mutex_init
(
&
share
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
share
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
share
->
cond
,
NULL
);
pthread_cond_init
(
&
share
->
cond
,
NULL
);
...
@@ -180,6 +198,15 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key,
...
@@ -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
->
path
.
length
=
share
->
normalized_path
.
length
=
strlen
(
path
);
share
->
frm_version
=
FRM_VER_TRUE_VARCHAR
;
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
;
DBUG_VOID_RETURN
;
}
}
...
@@ -371,6 +398,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
...
@@ -371,6 +398,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
share
->
error
=
error
;
share
->
error
=
error
;
open_table_error
(
share
,
error
,
(
share
->
open_errno
=
my_errno
),
0
);
open_table_error
(
share
,
error
,
(
share
->
open_errno
=
my_errno
),
0
);
}
}
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
@@ -1503,24 +1531,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
...
@@ -1503,24 +1531,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
*
root_ptr
=
old_root
;
*
root_ptr
=
old_root
;
thd
->
status_var
.
opened_tables
++
;
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
);
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