1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge from mysql-5.5 to mysql-5.5-security

No conflicts
This commit is contained in:
Jon Olav Hauglid
2012-03-15 11:25:53 +01:00
18 changed files with 380 additions and 119 deletions

View File

@ -4102,3 +4102,10 @@ UNLOCK TABLES;
# Connection default
DROP PROCEDURE p1;
DROP TABLE t1;
#
# Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
# NON EXISTING DATABASE
#
DROP DATABASE IF EXISTS nodb;
CREATE VIEW nodb.a AS SELECT 1;
ERROR 42000: Unknown database 'nodb'

View File

@ -0,0 +1,6 @@
create table t1 (f1 char(255)) engine innodb;
ibdata1 size: 27262976 bytes
drop table t1;
create table t1 (f1 char(255)) engine innodb;
ibdata1 size: 27262976 bytes
drop table t1;

View File

@ -0,0 +1 @@
--force-restart

View File

@ -0,0 +1,51 @@
# Bug 11766634 59783: InnoDB data grows unexpectedly when inserting,
# truncating, inserting the same set of rows.
#
# Scenario:
# create table t1. Insert $recs records. check size of ibdata1.
# drop table t1. create table t1. Insert the same set of $recs
# records. The size of ibdata1 must not increase.
#
-- source include/not_embedded.inc
-- source include/have_innodb.inc
create table t1 (f1 char(255)) engine innodb;
let $MYSQLD_DATADIR=`select @@datadir`;
let IBDATA1=$MYSQLD_DATADIR/ibdata1;
let $recs = 36262;
--disable_query_log
let $c = $recs;
while ($c)
{
insert into t1 values ('Hello World');
dec $c;
}
--enable_query_log
perl;
my $filesize = -s $ENV{'IBDATA1'};
print "ibdata1 size: $filesize bytes\n";
EOF
drop table t1;
create table t1 (f1 char(255)) engine innodb;
--disable_query_log
let $c = $recs;
while ($c)
{
insert into t1 values ('Hello World');
dec $c;
}
--enable_query_log
perl;
my $filesize = -s $ENV{'IBDATA1'};
print "ibdata1 size: $filesize bytes\n";
EOF
drop table t1;

View File

@ -1,15 +1,8 @@
include/master-slave.inc
[connection master]
[The default value shown for the slave's port number is the actual port number of the slave]
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
2 127.0.0.1 SLAVE_PORT 1
[The default value shown for the slave's port number is the actual port number of the slave]
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
include/start_slave.inc
[Slave restarted with the report-port set to some value]
[The value shown for the slave's port number is 9000 which is the value set for report-port]
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
2 127.0.0.1 9000 1
include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
include/rpl_end.inc

View File

@ -0,0 +1,5 @@
include/master-slave.inc
[connection master]
include/assert.inc [Assert that relay log space is close to the limit]
include/diff_tables.inc [master:test.t1,slave:test.t1]
include/rpl_end.inc

View File

@ -21,16 +21,10 @@ source include/master-slave.inc;
connection master;
--echo [The default value shown for the slave's port number is the actual port number of the slave]
source include/show_slave_hosts.inc;
# SLAVE_PORT is the value of the port we should get.
let $show_statement= SHOW SLAVE HOSTS;
let $field= Port;
let $condition= 'SLAVE_PORT';
source include/wait_show_condition.inc;
--echo [The default value shown for the slave's port number is the actual port number of the slave]
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
--let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
--let assert_cond= $report_port = "$SLAVE_MYPORT"
--source include/assert.inc
# Start the server with some value being passed to the report_port= <option>
# this will be used incase we have to mask the value of the slave's port
@ -46,14 +40,10 @@ connection slave;
--echo [Slave restarted with the report-port set to some value]
connection master;
--echo [The value shown for the slave's port number is 9000 which is the value set for report-port]
--source include/show_slave_hosts.inc
# 9000 is the value of the port we should get.
let $show_statement= SHOW SLAVE HOSTS;
let $field= Port;
let $condition= '9000';
source include/wait_show_condition.inc;
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
--let assert_text= The value shown for the slave's port number is 9000 which is the value set for report-port.
--let assert_cond= $report_port = "9000"
--source include/assert.inc
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
--relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096

View File

@ -0,0 +1,101 @@
#
# BUG#12400313 / BUG#64503 test case
#
#
# Description
# -----------
#
# This test case starts the slave server with:
# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096
#
# Then it issues some queries that will cause the slave to reach
# relay-log-space-limit. We lock the table so that the SQL thread is
# not able to purge the log and then we issue some more statements.
#
# The purpose is to show that the IO thread will honor the limits
# while the SQL thread is not able to purge the relay logs, which did
# not happen before this patch. In addition we assert that while
# ignoring the limit (SQL thread needs to rotate before purging), the
# IO thread does not do it in an uncontrolled manner.
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
--source include/have_innodb.inc
--disable_query_log
CREATE TABLE t1 (c1 TEXT) engine=InnoDB;
INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
--sync_slave_with_master
# wait for the SQL thread to sleep
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Slave has read all relay log; waiting for the slave I/O thread to update it'
--source include/wait_show_condition.inc
# now the io thread has set rli->ignore_space_limit
# lets lock the table so that once the SQL thread awakes
# it blocks there and does not set rli->ignore_space_limit
# back to zero
LOCK TABLE t1 WRITE;
# now issue more statements that will overflow the
# rli->log_space_limit (in this case ~10K)
--connection master
INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
--connection slave
# ASSERT that the IO thread waits for the SQL thread to release some
# space before continuing
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= LIKE 'Waiting for %'
# before the patch (IO would have transfered everything)
#--let $condition= = 'Waiting for master to send event'
# after the patch (now it waits for space to be freed)
#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space'
--source include/wait_show_condition.inc
# without the patch we can uncomment the following two lines and
# watch the IO thread synchronize with the master, thus writing
# relay logs way over the space limit
#--connection master
#--source include/sync_slave_io_with_master.inc
## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge
--let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1)
--let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1)
--let $assert_text= Assert that relay log space is close to the limit
--let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15
--source include/assert.inc
# unlock the table and let SQL thread continue applying events
UNLOCK TABLES;
--connection master
--sync_slave_with_master
--let $diff_tables=master:test.t1,slave:test.t1
--source include/diff_tables.inc
--connection master
DROP TABLE t1;
--enable_query_log
--sync_slave_with_master
--source include/rpl_end.inc

View File

@ -4136,6 +4136,17 @@ disconnect con2;
disconnect con3;
--echo #
--echo # Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
--echo # NON EXISTING DATABASE
--echo #
--disable_warnings
DROP DATABASE IF EXISTS nodb;
--enable_warnings
--error ER_BAD_DB_ERROR
CREATE VIEW nodb.a AS SELECT 1;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc

View File

@ -3619,8 +3619,6 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
mysql_mutex_lock(&rli->log_space_lock);
rli->relay_log.purge_logs(to_purge_if_included, included,
0, 0, &rli->log_space_total);
// Tell the I/O thread to take the relay_log_space_limit into account
rli->ignore_log_space_limit= 0;
mysql_mutex_unlock(&rli->log_space_lock);
/*

View File

@ -201,6 +201,13 @@ public:
ulonglong log_space_limit,log_space_total;
bool ignore_log_space_limit;
/*
Used by the SQL thread to instructs the IO thread to rotate
the logs when the SQL thread needs to purge to release some
disk space.
*/
bool sql_force_rotate_relay;
/*
When it commits, InnoDB internally stores the master log position it has
processed so far; the position to store is the one of the end of the

View File

@ -1586,6 +1586,54 @@ Waiting for the slave SQL thread to free enough relay log space");
!(slave_killed=io_slave_killed(thd,mi)) &&
!rli->ignore_log_space_limit)
mysql_cond_wait(&rli->log_space_cond, &rli->log_space_lock);
/*
Makes the IO thread read only one event at a time
until the SQL thread is able to purge the relay
logs, freeing some space.
Therefore, once the SQL thread processes this next
event, it goes to sleep (no more events in the queue),
sets ignore_log_space_limit=true and wakes the IO thread.
However, this event may have been enough already for
the SQL thread to purge some log files, freeing
rli->log_space_total .
This guarantees that the SQL and IO thread move
forward only one event at a time (to avoid deadlocks),
when the relay space limit is reached. It also
guarantees that when the SQL thread is prepared to
rotate (to be able to purge some logs), the IO thread
will know about it and will rotate.
NOTE: The ignore_log_space_limit is only set when the SQL
thread sleeps waiting for events.
*/
if (rli->ignore_log_space_limit)
{
#ifndef DBUG_OFF
{
char llbuf1[22], llbuf2[22];
DBUG_PRINT("info", ("log_space_limit=%s "
"log_space_total=%s "
"ignore_log_space_limit=%d "
"sql_force_rotate_relay=%d",
llstr(rli->log_space_limit,llbuf1),
llstr(rli->log_space_total,llbuf2),
(int) rli->ignore_log_space_limit,
(int) rli->sql_force_rotate_relay));
}
#endif
if (rli->sql_force_rotate_relay)
{
rotate_relay_log(rli->mi);
rli->sql_force_rotate_relay= false;
}
rli->ignore_log_space_limit= false;
}
thd->exit_cond(save_proc_info);
DBUG_RETURN(slave_killed);
}
@ -4655,19 +4703,45 @@ static Log_event* next_event(Relay_log_info* rli)
constraint, because we do not want the I/O thread to block because of
space (it's ok if it blocks for any other reason (e.g. because the
master does not send anything). Then the I/O thread stops waiting
and reads more events.
The SQL thread decides when the I/O thread should take log_space_limit
into account again : ignore_log_space_limit is reset to 0
in purge_first_log (when the SQL thread purges the just-read relay
log), and also when the SQL thread starts. We should also reset
ignore_log_space_limit to 0 when the user does RESET SLAVE, but in
fact, no need as RESET SLAVE requires that the slave
and reads one more event and starts honoring log_space_limit again.
If the SQL thread needs more events to be able to rotate the log (it
might need to finish the current group first), then it can ask for one
more at a time. Thus we don't outgrow the relay log indefinitely,
but rather in a controlled manner, until the next rotate.
When the SQL thread starts it sets ignore_log_space_limit to false.
We should also reset ignore_log_space_limit to 0 when the user does
RESET SLAVE, but in fact, no need as RESET SLAVE requires that the slave
be stopped, and the SQL thread sets ignore_log_space_limit to 0 when
it stops.
*/
mysql_mutex_lock(&rli->log_space_lock);
// prevent the I/O thread from blocking next times
rli->ignore_log_space_limit= 1;
/*
If we have reached the limit of the relay space and we
are going to sleep, waiting for more events:
1. If outside a group, SQL thread asks the IO thread
to force a rotation so that the SQL thread purges
logs next time it processes an event (thus space is
freed).
2. If in a group, SQL thread asks the IO thread to
ignore the limit and queues yet one more event
so that the SQL thread finishes the group and
is are able to rotate and purge sometime soon.
*/
if (rli->log_space_limit &&
rli->log_space_limit < rli->log_space_total)
{
/* force rotation if not in an unfinished group */
rli->sql_force_rotate_relay= !rli->is_in_group();
/* ask for one more event */
rli->ignore_log_space_limit= true;
}
/*
If the I/O thread is blocked, unblock it. Ok to broadcast
after unlock, because the mutex is only destroyed in

View File

@ -444,6 +444,13 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
view= lex->unlink_first_table(&link_to_local);
if (check_db_dir_existence(view->db))
{
my_error(ER_BAD_DB_ERROR, MYF(0), view->db);
res= TRUE;
goto err;
}
if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view))
{
res= TRUE;

View File

@ -337,10 +337,9 @@ btr_pcur_restore_position_func(
case BTR_PCUR_BEFORE:
mode = PAGE_CUR_L;
break;
#ifdef UNIV_DEBUG
default:
ut_error;
#endif /* UNIV_DEBUG */
mode = 0;
}
btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,

View File

@ -211,15 +211,13 @@ fseg_n_reserved_pages_low(
/********************************************************************//**
Marks a page used. The page must reside within the extents of the given
segment. */
static
static __attribute__((nonnull))
void
fseg_mark_page_used(
/*================*/
fseg_inode_t* seg_inode,/*!< in: segment inode */
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page, /*!< in: page offset */
xdes_t* descr, /* extent descriptor */
mtr_t* mtr); /*!< in: mtr */
/**********************************************************************//**
Returns the first extent descriptor for a segment. We think of the extent
@ -643,12 +641,10 @@ xdes_calc_descriptor_index(
/********************************************************************//**
Gets pointer to a the extent descriptor of a page. The page where the extent
descriptor resides is x-locked. If the page offset is equal to the free limit
of the space, adds new extents from above the free limit to the space free
list, if not free limit == space size. This adding is necessary to make the
descriptor defined, as they are uninitialized above the free limit.
descriptor resides is x-locked. This function no longer extends the data
file.
@return pointer to the extent descriptor, NULL if the page does not
exist in the space or if the offset exceeds the free limit */
exist in the space or if the offset is >= the free limit */
UNIV_INLINE __attribute__((nonnull, warn_unused_result))
xdes_t*
xdes_get_descriptor_with_space_hdr(
@ -678,19 +674,10 @@ xdes_get_descriptor_with_space_hdr(
zip_size = dict_table_flags_to_zip_size(
mach_read_from_4(sp_header + FSP_SPACE_FLAGS));
/* If offset is >= size or > limit, return NULL */
if ((offset >= size) || (offset > limit)) {
if ((offset >= size) || (offset >= limit)) {
return(NULL);
}
/* If offset is == limit, fill free list of the space. */
if (offset == limit) {
fsp_fill_free_list(FALSE, space, sp_header, mtr);
}
descr_page_no = xdes_calc_descriptor_page(zip_size, offset);
if (descr_page_no == 0) {
@ -2811,7 +2798,7 @@ got_hinted_page:
ut_ad(xdes_get_bit(ret_descr, XDES_FREE_BIT,
ret_page % FSP_EXTENT_SIZE, mtr) == TRUE);
fseg_mark_page_used(seg_inode, space, zip_size, ret_page, mtr);
fseg_mark_page_used(seg_inode, ret_page, ret_descr, mtr);
}
return(fsp_page_create(
@ -3217,27 +3204,21 @@ fsp_get_available_space_in_free_extents(
/********************************************************************//**
Marks a page used. The page must reside within the extents of the given
segment. */
static
static __attribute__((nonnull))
void
fseg_mark_page_used(
/*================*/
fseg_inode_t* seg_inode,/*!< in: segment inode */
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page, /*!< in: page offset */
xdes_t* descr, /* extent descriptor */
mtr_t* mtr) /*!< in: mtr */
{
xdes_t* descr;
ulint not_full_n_used;
ut_ad(seg_inode && mtr);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
descr = xdes_get_descriptor(space, zip_size, page, mtr);
ut_ad(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr)
== mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr));

View File

@ -4964,6 +4964,74 @@ function_exit:
return(TRUE);
}
/*********************************************************************//**
Validate record locks up to a limit.
@return lock at limit or NULL if no more locks in the hash bucket */
static __attribute__((nonnull, warn_unused_result))
const lock_t*
lock_rec_validate(
/*==============*/
ulint start, /*!< in: lock_sys->rec_hash
bucket */
ib_uint64_t* limit) /*!< in/out: upper limit of
(space, page_no) */
{
lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
for (lock = HASH_GET_FIRST(lock_sys->rec_hash, start);
lock != NULL;
lock = HASH_GET_NEXT(hash, lock)) {
ib_uint64_t current;
ut_a(trx_in_trx_list(lock->trx));
ut_a(lock_get_type(lock) == LOCK_REC);
current = ut_ull_create(
lock->un_member.rec_lock.space,
lock->un_member.rec_lock.page_no);
if (current > *limit) {
*limit = current + 1;
return(lock);
}
}
return(NULL);
}
/*********************************************************************//**
Validate a record lock's block */
static
void
lock_rec_block_validate(
/*====================*/
ulint space,
ulint page_no)
{
/* The lock and the block that it is referring to may be freed at
this point. We pass BUF_GET_POSSIBLY_FREED to skip a debug check.
If the lock exists in lock_rec_validate_page() we assert
!block->page.file_page_was_freed. */
mtr_t mtr;
buf_block_t* block;
mtr_start(&mtr);
block = buf_page_get_gen(
space, fil_space_get_zip_size(space),
page_no, RW_X_LATCH, NULL,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
mtr_commit(&mtr);
}
/*********************************************************************//**
Validates the lock system.
@return TRUE if ok */
@ -4996,60 +5064,21 @@ lock_validate(void)
trx = UT_LIST_GET_NEXT(trx_list, trx);
}
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
/* Iterate over all the record locks and validate the locks. We
don't want to hog the lock_sys_t::mutex and the trx_sys_t::mutex.
Release both mutexes during the validation check. */
ulint space;
ulint page_no;
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
const lock_t* lock;
ib_uint64_t limit = 0;
for (;;) {
mtr_t mtr;
buf_block_t* block;
while ((lock = lock_rec_validate(i, &limit)) != NULL) {
lock = HASH_GET_FIRST(lock_sys->rec_hash, i);
while (lock) {
ib_uint64_t space_page;
ut_a(trx_in_trx_list(lock->trx));
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
space_page = ut_ull_create(space, page_no);
if (space_page >= limit) {
break;
}
lock = HASH_GET_NEXT(hash, lock);
}
if (!lock) {
break;
}
ulint space = lock->un_member.rec_lock.space;
ulint page_no = lock->un_member.rec_lock.page_no;
lock_mutex_exit_kernel();
/* The lock and the block that it is referring
to may be freed at this point. We pass
BUF_GET_POSSIBLY_FREED to skip a debug check.
If the lock exists in lock_rec_validate_page()
we assert !block->page.file_page_was_freed. */
mtr_start(&mtr);
block = buf_page_get_gen(
space, fil_space_get_zip_size(space),
page_no, RW_X_LATCH, NULL,
BUF_GET_POSSIBLY_FREED,
__FILE__, __LINE__, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
ut_ad(lock_rec_validate_page(block));
mtr_commit(&mtr);
limit++;
lock_rec_block_validate(space, page_no);
lock_mutex_enter_kernel();
}
}

View File

@ -155,7 +155,7 @@ int main(void)
"conn %ld to: '%-.64s' user: '%-.32s' host: '%-.64s' (%-.64s)",
1L, NULL, NULL, NULL, NULL);
test1("Hello string `I am a string`",
"Hello string %`s", "I am a string");
"Hello string `%s`", "I am a string");
test1("Hello TEST",
"Hello %05s", "TEST");
test1("My `Q` test",