Commit bae6276d authored by Sergey Vojtovich's avatar Sergey Vojtovich

Update to innoplug-1.0.4.

parent 058cd625
......@@ -494,17 +494,12 @@ sub collect_one_suite($)
next if ($test->{'skip'} || !$test->{'innodb_test'});
# Exceptions
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
next if ($test->{'name'} eq 'main.innodb_mysql'); # Diff in show (fk)
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
# innodb_file_per_table is rw with innodb_plugin
next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic');
# innodb_lock_wait_timeout is rw with innodb_plugin
next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
# Diff around innodb_thread_concurrency variable
next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
next if ($test->{'name'} eq 'main.innodb_bug42101-nonzero');
next if ($test->{'name'} eq 'main.innodb_bug21704');
next if ($test->{'name'} eq 'main.innodb_bug45357');
# Copy test options
my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test))
......
select @@innodb_file_format;
@@innodb_file_format
Antelope
select @@innodb_file_format_check;
@@innodb_file_format_check
Antelope
set global innodb_file_format=antelope;
set global innodb_file_format=barracuda;
set global innodb_file_format=cheetah;
ERROR HY000: Incorrect arguments to SET
select @@innodb_file_format;
@@innodb_file_format
Barracuda
set global innodb_file_format=default;
select @@innodb_file_format;
@@innodb_file_format
Antelope
set global innodb_file_format=on;
ERROR HY000: Incorrect arguments to SET
set global innodb_file_format=off;
ERROR HY000: Incorrect arguments to SET
select @@innodb_file_format;
@@innodb_file_format
Antelope
set global innodb_file_format_check=antelope;
set global innodb_file_format_check=barracuda;
set global innodb_file_format_check=cheetah;
ERROR HY000: Incorrect arguments to SET
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
set global innodb_file_format_check=default;
Warnings:
Warning 1210 Ignoring SET innodb_file_format=on
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
set global innodb_file_format=on;
ERROR HY000: Incorrect arguments to SET
set global innodb_file_format=off;
ERROR HY000: Incorrect arguments to SET
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
-- source include/have_innodb.inc
-- source suite/innodb/include/have_innodb_plugin.inc
let $format=`select @@innodb_file_format`;
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
select @@innodb_file_format;
select @@innodb_file_format_check;
set global innodb_file_format=antelope;
set global innodb_file_format=barracuda;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=cheetah;
select @@innodb_file_format;
set global innodb_file_format=default;
select @@innodb_file_format;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=on;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=off;
select @@innodb_file_format;
set global innodb_file_format_check=antelope;
set global innodb_file_format_check=barracuda;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format_check=cheetah;
select @@innodb_file_format_check;
set global innodb_file_format_check=default;
select @@innodb_file_format_check;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=on;
--error ER_WRONG_ARGUMENTS
set global innodb_file_format=off;
select @@innodb_file_format_check;
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval set global innodb_file_format=$format;
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
-- enable_query_log
......@@ -74,5 +74,5 @@ SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea
usr/usr0sess.c
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
ut/ut0list.c ut/ut0wqueue.c)
ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS)
ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION)
MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
\ No newline at end of file
Portions of this software contain modifications contributed by Percona, Inc.
These contributions are used with the following license:
Copyright (c) 2008, 2009, Percona Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the Percona Inc. nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Portions of this software contain modifications contributed by
Sun Microsystems, Inc. These contributions are used with the following
license:
Copyright (c) 2009, Sun Microsystems, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of Sun Microsystems, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2009-07-20 The InnoDB Team
* buf/buf0rea.c, handler/ha_innodb.cc, include/srv0srv.h,
srv/srv0srv.c:
Change the read ahead parameter name to innodb_read_ahead_threshold.
Change the meaning of this parameter to signify the number of pages
that must be sequentially accessed for InnoDB to trigger a readahead
request.
2009-07-20 The InnoDB Team
* handler/ha_innodb.cc:
Fix Bug#39802 On Windows, 32-bit time_t should be enforced
2009-07-16 The InnoDB Team
* include/univ.i:
Support inlining of functions and prefetch with Sun Studio.
These changes are based on contribution from Sun Microsystems Inc.
under a BSD license.
2009-07-14 The InnoDB Team
* fil/fil0fil.c:
Fix Bug#45814 URL reference in InnoDB server errors needs adjusting to
match documentation
2009-07-14 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb_bug21704.result,
mysql-test/innodb_bug21704.test:
Fix Bug#21704 Renaming column does not update FK definition
2009-07-10 The InnoDB Team
* handler/ha_innodb.cc, srv/srv0srv.c:
Change the defaults for
innodb_sync_spin_loops: 20 -> 30
innodb_spin_wait_delay: 5 -> 6
2009-07-08 The InnoDB Team
* buf/buf0flu.c, handler/ha_innodb.cc, include/buf0flu.h,
include/log0log.h, include/log0log.ic, include/srv0srv.h,
srv/srv0srv.c:
Implement the adaptive flushing of dirty pages, which uses
a heuristics based flushing rate of dirty pages to avoid IO
bursts at checkpoint. Expose new configure knob
innodb_adaptive_flushing to control whether the new flushing
algorithm should be used.
2009-07-07 The InnoDB Team
* handler/ha_innodb.cc, include/srv0srv.h, log/log0log.c,
srv/srv0srv.c:
Implement IO capacity tuning. Expose new configure knob
innodb_io_capacity to control the master threads IO rate. The
ibuf merge is also changed from synchronous to asynchronous.
These changes are based on contribution from Google Inc.
under a BSD license.
2009-07-02 The InnoDB Team
* include/ut0ut.h, plug.in, ut/ut0ut.c:
Use the PAUSE instruction inside the spinloop if it is available,
Thanks to Mikael Ronstrom <mikael@mysql.com>.
2009-06-29 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb_file_format.test,
mysql-test/innodb_file_format.result:
Do not crash on SET GLOBAL innodb_file_format=DEFAULT
or SET GLOBAL innodb_file_format_check=DEFAULT.
2009-06-29 The InnoDB Team
* buf/buf0buf.c, buf/buf0rea.c, lock/lock0lock.c:
Tolerate missing tablespaces during crash recovery and when
printing information on locks.
2009-06-29 The InnoDB Team
* buf/buf0buf.c:
Fix a race condition when reading buf_fix_count.
Currently, it is not being protected by the buffer pool mutex,
but by the block mutex.
2009-06-29 The InnoDB Team
* handler/handler0alter.cc:
Start the user transaction prebuilt->trx if it was not started
before adding or dropping an index. Without this fix, the
table could be locked outside an active transaction.
2009-06-25 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb_bug42101.test,
mysql-test/innodb_bug42101.result,
mysql-test/innodb_bug42101-nonzero.test,
mysql-test/innodb_bug42101-nonzero.result:
Fix Bug#45749 Race condition in SET GLOBAL
innodb_commit_concurrency=DEFAULT
2009-06-25 The InnoDB Team
* dict/dict0dict.c:
When an index column cannot be found in the table during index
creation, display additional diagnostic before an assertion failure.
This does NOT fix Bug #44571 InnoDB Plugin crashes on ADD INDEX,
but it helps understand the reason of the crash.
2009-06-17 The InnoDB Team
* row/row0merge.c:
Fix Bug#45426 UNIV_DEBUG build cause assertion error at CREATE INDEX
2009-06-17 The InnoDB Team
* mysql-test/innodb_bug45357.result, mysql-test/innodb_bug45357.test,
row/row0mysql.c:
Fix Bug#45357 5.1.35 crashes with Failing assertion: index->type &
DICT_CLUSTERED
2009-06-17 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
mysql-test/innodb-autoinc.test:
Fix Bug#44030 Error: (1500) Couldn't read the MAX(ID) autoinc value
from the index (PRIMARY)
2009-06-11 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb.result, srv/srv0srv.c:
Change the following defaults:
max_dirty_pages_pct: from 90 to 75, max allowed from 100 to 99
additional_mem_pool_size: from 1 to 8 MB
buffer_pool_size: from 8 to 128 MB
log_buffer_size: from 1 to 8 MB
read_io_threads/write_io_threads: from 1 to 4
2009-06-09 The InnoDB Team
* handler/ha_innodb.cc, include/trx0trx.h, trx/trx0trx.c:
Enable Group Commit functionality that was broken in 5.0 when
distributed transactions were introduced.
2009-06-05 The InnoDB Team
* handler/ha_innodb.cc, include/os0file.h, include/srv0srv.h,
os/os0file.c, srv/srv0srv.c, srv/srv0start.c:
Enable functionality to have multiple background IO helper threads.
Expose new configure knobs innodb_read_io_threads and
innodb_write_io_threads and deprecate innodb_file_io_threads (this
parameter was relevant only on windows). Internally this allows
multiple segments for read and write IO request arrays where one
thread works on one segment.
2009-06-05 The InnoDB Team
* buf/buf0lru.c, buf/buf0rea.c, handler/ha_innodb.cc,
include/srv0srv.h, srv/srv0srv.c:
Fix a bug in linear read ahead:
1) Take into account access pattern when deciding whether or not to
do linear read ahead.
2) Expose a knob innodb_read_ahead_factor = [0-64] default (8),
dynamic, global to control linear read ahead behavior. This is the
value of the number of pages that InnoDB will tolerate within a
64 page extent even if they are accessed out of order or have
not been accessed at all. This number (which varies from 0 to 64)
is indicative of the slack that we have when deciding about linear
readahead.
3) Disable random read ahead. Keep the code for now.
2009-06-03 The InnoDB Team
* dict/dict0dict.c, mysql-test/t/innodb_mysql.test,
mysql-test/r/innodb_mysql.result:
Fix Bug#39793 Foreign keys not constructed when column
has a '#' in a comment or default value
2009-05-27 The InnoDB Team
* Doxyfile:
Allow the extraction of documentation from the code base with the
Doxygen tool. Convert and add many (but not yet all) comments to
Doxygen format.
2009-05-19 The InnoDB Team
* btr/btr0btr.c, btr/btr0cur.c, lock/lock0lock.c,
......
This diff is collapsed.
This diff is collapsed.
......@@ -49,6 +49,7 @@ Created 10/16/1994 Heikki Tuuri
#include "row0upd.h"
#ifndef UNIV_HOTBACKUP
#include "mtr0log.h"
#include "page0page.h"
#include "page0zip.h"
#include "rem0rec.h"
......
......@@ -1672,26 +1672,28 @@ lookup:
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
buf_pool_mutex_exit();
return(NULL);
}
block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex);
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
ut_error;
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
block_mutex = &buf_pool_zip_mutex;
mutex_enter(block_mutex);
bpage->buf_fix_count++;
break;
goto got_block;
case BUF_BLOCK_FILE_PAGE:
block_mutex = &((buf_block_t*) bpage)->mutex;
mutex_enter(block_mutex);
/* Discard the uncompressed page frame if possible. */
if (buf_LRU_free_block(bpage, FALSE, NULL)
== BUF_LRU_FREED) {
......@@ -1702,9 +1704,13 @@ lookup:
buf_block_buf_fix_inc((buf_block_t*) bpage,
__FILE__, __LINE__);
break;
goto got_block;
}
ut_error;
goto err_exit;
got_block:
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
buf_pool_mutex_exit();
......@@ -2006,6 +2012,7 @@ buf_page_get_gen(
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|| (mode == BUF_GET_NO_LATCH));
ut_ad(zip_size == fil_space_get_zip_size(space));
ut_ad(ut_is_2pow(zip_size));
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
#endif
......@@ -2079,12 +2086,15 @@ loop2:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
bpage = &block->page;
/* Protect bpage->buf_fix_count. */
mutex_enter(&buf_pool_zip_mutex);
if (bpage->buf_fix_count
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* This condition often occurs when the buffer
is not buffer-fixed, but I/O-fixed by
buf_page_init_for_read(). */
mutex_exit(&buf_pool_zip_mutex);
wait_until_unfixed:
/* The block is buffer-fixed or I/O-fixed.
Try again later. */
......@@ -2096,6 +2106,7 @@ wait_until_unfixed:
/* Allocate an uncompressed page. */
buf_pool_mutex_exit();
mutex_exit(&buf_pool_zip_mutex);
block = buf_LRU_get_free_block(0);
ut_a(block);
......@@ -2182,10 +2193,10 @@ wait_until_unfixed:
block->page.buf_fix_count = 1;
buf_block_set_io_fix(block, BUF_IO_READ);
buf_pool->n_pend_unzip++;
rw_lock_x_lock(&block->lock);
mutex_exit(&block->mutex);
mutex_exit(&buf_pool_zip_mutex);
buf_pool->n_pend_unzip++;
buf_buddy_free(bpage, sizeof *bpage);
......@@ -2203,10 +2214,10 @@ wait_until_unfixed:
/* Unfix and unlatch the block. */
buf_pool_mutex_enter();
mutex_enter(&block->mutex);
buf_pool->n_pend_unzip--;
block->page.buf_fix_count--;
buf_block_set_io_fix(block, BUF_IO_NONE);
mutex_exit(&block->mutex);
buf_pool->n_pend_unzip--;
rw_lock_x_unlock(&block->lock);
if (UNIV_UNLIKELY(!success)) {
......
......@@ -44,6 +44,39 @@ Created 11/11/1995 Heikki Tuuri
#include "os0file.h"
#include "trx0sys.h"
/**********************************************************************
These statistics are generated for heuristics used in estimating the
rate at which we should flush the dirty blocks to avoid bursty IO
activity. Note that the rate of flushing not only depends on how many
dirty pages we have in the buffer pool but it is also a fucntion of
how much redo the workload is generating and at what rate. */
/* @{ */
/** Number of intervals for which we keep the history of these stats.
Each interval is 1 second, defined by the rate at which
srv_error_monitor_thread() calls buf_flush_stat_update(). */
#define BUF_FLUSH_STAT_N_INTERVAL 20
/** Sampled values buf_flush_stat_cur.
Not protected by any mutex. Updated by buf_flush_stat_update(). */
static buf_flush_stat_t buf_flush_stat_arr[BUF_FLUSH_STAT_N_INTERVAL];
/** Cursor to buf_flush_stat_arr[]. Updated in a round-robin fashion. */
static ulint buf_flush_stat_arr_ind;
/** Values at start of the current interval. Reset by
buf_flush_stat_update(). */
static buf_flush_stat_t buf_flush_stat_cur;
/** Running sum of past values of buf_flush_stat_cur.
Updated by buf_flush_stat_update(). Not protected by any mutex. */
static buf_flush_stat_t buf_flush_stat_sum;
/** Number of pages flushed through non flush_list flushes. */
static ulint buf_lru_flush_page_count = 0;
/* @} */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/******************************************************************//**
Validates the flush list.
......@@ -1102,6 +1135,13 @@ flush_next:
srv_buf_pool_flushed += page_count;
/* We keep track of all flushes happening as part of LRU
flush. When estimating the desired rate at which flush_list
should be flushed we factor in this value. */
if (flush_type == BUF_FLUSH_LRU) {
buf_lru_flush_page_count += page_count;
}
return(page_count);
}
......@@ -1197,6 +1237,117 @@ buf_flush_free_margin(void)
}
}
/*********************************************************************
Update the historical stats that we are collecting for flush rate
heuristics at the end of each interval.
Flush rate heuristic depends on (a) rate of redo log generation and
(b) the rate at which LRU flush is happening. */
UNIV_INTERN
void
buf_flush_stat_update(void)
/*=======================*/
{
buf_flush_stat_t* item;
ib_uint64_t lsn_diff;
ib_uint64_t lsn;
ulint n_flushed;
lsn = log_get_lsn();
if (buf_flush_stat_cur.redo == 0) {
/* First time around. Just update the current LSN
and return. */
buf_flush_stat_cur.redo = lsn;
return;
}
item = &buf_flush_stat_arr[buf_flush_stat_arr_ind];
/* values for this interval */
lsn_diff = lsn - buf_flush_stat_cur.redo;
n_flushed = buf_lru_flush_page_count
- buf_flush_stat_cur.n_flushed;
/* add the current value and subtract the obsolete entry. */
buf_flush_stat_sum.redo += lsn_diff - item->redo;
buf_flush_stat_sum.n_flushed += n_flushed - item->n_flushed;
/* put current entry in the array. */
item->redo = lsn_diff;
item->n_flushed = n_flushed;
/* update the index */
buf_flush_stat_arr_ind++;
buf_flush_stat_arr_ind %= BUF_FLUSH_STAT_N_INTERVAL;
/* reset the current entry. */
buf_flush_stat_cur.redo = lsn;
buf_flush_stat_cur.n_flushed = buf_lru_flush_page_count;
}
/*********************************************************************
Determines the fraction of dirty pages that need to be flushed based
on the speed at which we generate redo log. Note that if redo log
is generated at a significant rate without corresponding increase
in the number of dirty pages (for example, an in-memory workload)
it can cause IO bursts of flushing. This function implements heuristics
to avoid this burstiness.
@return number of dirty pages to be flushed / second */
UNIV_INTERN
ulint
buf_flush_get_desired_flush_rate(void)
/*==================================*/
{
ulint redo_avg;
ulint lru_flush_avg;
ulint n_dirty;
ulint n_flush_req;
lint rate;
ib_uint64_t lsn = log_get_lsn();
ulint log_capacity = log_get_capacity();
/* log_capacity should never be zero after the initialization
of log subsystem. */
ut_ad(log_capacity != 0);
/* Get total number of dirty pages. It is OK to access
flush_list without holding any mtex as we are using this
only for heuristics. */
n_dirty = UT_LIST_GET_LEN(buf_pool->flush_list);
/* An overflow can happen if we generate more than 2^32 bytes
of redo in this interval i.e.: 4G of redo in 1 second. We can
safely consider this as infinity because if we ever come close
to 4G we'll start a synchronous flush of dirty pages. */
/* redo_avg below is average at which redo is generated in
past BUF_FLUSH_STAT_N_INTERVAL + redo generated in the current
interval. */
redo_avg = (ulint) (buf_flush_stat_sum.redo
/ BUF_FLUSH_STAT_N_INTERVAL
+ (lsn - buf_flush_stat_cur.redo));
/* An overflow can happen possibly if we flush more than 2^32
pages in BUF_FLUSH_STAT_N_INTERVAL. This is a very very
unlikely scenario. Even when this happens it means that our
flush rate will be off the mark. It won't affect correctness
of any subsystem. */
/* lru_flush_avg below is rate at which pages are flushed as
part of LRU flush in past BUF_FLUSH_STAT_N_INTERVAL + the
number of pages flushed in the current interval. */
lru_flush_avg = buf_flush_stat_sum.n_flushed
/ BUF_FLUSH_STAT_N_INTERVAL
+ (buf_lru_flush_page_count
- buf_flush_stat_cur.n_flushed);
n_flush_req = (n_dirty * redo_avg) / log_capacity;
/* The number of pages that we want to flush from the flush
list is the difference between the required rate and the
number of pages that we are historically flushing from the
LRU list */
rate = n_flush_req - lru_flush_avg;
return(rate > 0 ? (ulint) rate : 0);
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/******************************************************************//**
Validates the flush list.
......
......@@ -456,11 +456,12 @@ buf_LRU_get_recent_limit(void)
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
limit = buf_page_get_LRU_position(bpage) - len / BUF_LRU_INITIAL_RATIO;
limit = buf_page_get_LRU_position(bpage);
len /= BUF_LRU_INITIAL_RATIO;
buf_pool_mutex_exit();
return(limit);
return(limit > len ? (limit - len) : 0);
}
/********************************************************************//**
......
......@@ -44,14 +44,11 @@ the accessed pages when deciding whether to read-ahead */
/** There must be at least this many pages in buf_pool in the area to start
a random read-ahead */
#define BUF_READ_AHEAD_RANDOM_THRESHOLD (5 + buf_read_ahead_random_area / 8)
#define BUF_READ_AHEAD_RANDOM_THRESHOLD (1 + BUF_READ_AHEAD_RANDOM_AREA / 2)
/** The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
/** The linear read-ahead threshold */
#define LINEAR_AREA_THRESHOLD_COEF 5 / 8
/** If there are buf_pool->curr_size per the number below pending reads, then
read-ahead is not done: this is to prevent flooding the buffer pool with
i/o-fixed buffer blocks */
......@@ -199,6 +196,9 @@ buf_read_ahead_random(
ulint i;
ulint buf_read_ahead_random_area;
/* We have currently disabled random readahead */
return(0);
if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */
return(0);
......@@ -423,6 +423,7 @@ buf_read_ahead_linear(
ulint i;
const ulint buf_read_ahead_linear_area
= BUF_READ_AHEAD_LINEAR_AREA;
ulint threshold;
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
/* No read-ahead to avoid thread deadlocks */
......@@ -482,6 +483,11 @@ buf_read_ahead_linear(
asc_or_desc = -1;
}
/* How many out of order accessed pages can we ignore
when working out the access pattern for linear readahead */
threshold = ut_min((64 - srv_read_ahead_threshold),
BUF_READ_AHEAD_AREA);
fail_count = 0;
for (i = low; i < high; i++) {
......@@ -491,27 +497,27 @@ buf_read_ahead_linear(
/* Not accessed */
fail_count++;
} else if (pred_bpage
&& (ut_ulint_cmp(
} else if (pred_bpage) {
int res = (ut_ulint_cmp(
buf_page_get_LRU_position(bpage),
buf_page_get_LRU_position(pred_bpage))
!= asc_or_desc)) {
buf_page_get_LRU_position(pred_bpage)));
/* Accesses not in the right order */
if (res != 0 && res != asc_or_desc) {
fail_count++;
pred_bpage = bpage;
}
}
if (fail_count > buf_read_ahead_linear_area
* LINEAR_AREA_THRESHOLD_COEF) {
if (fail_count > threshold) {
/* Too many failures: return */
buf_pool_mutex_exit();
return(0);
}
if (bpage && buf_page_is_accessed(bpage)) {
pred_bpage = bpage;
}
}
/* If we got this far, we know that enough pages in the area have
been accessed in the right order: linear read-ahead can be sensible */
......@@ -746,6 +752,14 @@ buf_read_recv_pages(
ulint i;
zip_size = fil_space_get_zip_size(space);
if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
/* It is a single table tablespace and the .ibd file is
missing: do nothing */
return;
}
tablespace_version = fil_space_get_version(space);
for (i = 0; i < n_stored; i++) {
......
......@@ -146,7 +146,8 @@ dtype_is_non_binary_string_type(
/*********************************************************************//**
Forms a precise type from the < 4.1.2 format precise type plus the
charset-collation code. */
charset-collation code.
@return precise type, including the charset-collation code */
UNIV_INTERN
ulint
dtype_form_prtype(
......
......@@ -1693,6 +1693,11 @@ dict_index_find_cols(
}
/* It is an error not to find a matching column. */
fputs("InnoDB: Error: no matching column for ", stderr);
ut_print_name(stderr, NULL, FALSE, field->name);
fputs(" in ", stderr);
dict_index_name_print(stderr, NULL, index);
fputs("!\n", stderr);
ut_error;
found:
......@@ -2974,7 +2979,7 @@ scan_more:
} else if (quote) {
/* Within quotes: do not look for
starting quotes or comments. */
} else if (*sptr == '"' || *sptr == '`') {
} else if (*sptr == '"' || *sptr == '`' || *sptr == '\'') {
/* Starting quote: remember the quote character. */
quote = *sptr;
} else if (*sptr == '#'
......
......@@ -103,7 +103,9 @@ dict_mem_table_free(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_d(table->cached = FALSE);
#ifndef UNIV_HOTBACKUP
mutex_free(&(table->autoinc_mutex));
#endif /* UNIV_HOTBACKUP */
mem_heap_free(table->heap);
}
......
......@@ -2954,7 +2954,7 @@ fil_open_single_table_tablespace(
" a temporary table #sql...,\n"
"InnoDB: and MySQL removed the .ibd file for this.\n"
"InnoDB: Please refer to\n"
"InnoDB: " REFMAN "innodb-troubleshooting.html\n"
"InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n"
"InnoDB: for how to resolve the issue.\n", stderr);
mem_free(filepath);
......@@ -2996,7 +2996,7 @@ fil_open_single_table_tablespace(
"InnoDB: commands DISCARD TABLESPACE and"
" IMPORT TABLESPACE?\n"
"InnoDB: Please refer to\n"
"InnoDB: " REFMAN "innodb-troubleshooting.html\n"
"InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n"
"InnoDB: for how to resolve the issue.\n",
(ulong) space_id, (ulong) space_flags,
(ulong) id, (ulong) flags);
......@@ -3677,7 +3677,7 @@ fil_space_for_table_exists_in_mem(
}
error_exit:
fputs("InnoDB: Please refer to\n"
"InnoDB: " REFMAN "innodb-troubleshooting.html\n"
"InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n"
"InnoDB: for how to resolve the issue.\n", stderr);
mem_free(path);
......
......@@ -264,7 +264,8 @@ ulint
fseg_n_reserved_pages_low(
/*======================*/
fseg_inode_t* header, /*!< in: segment inode */
ulint* used, /*!< out: number of pages used (<= reserved) */
ulint* used, /*!< out: number of pages used (not
more than reserved) */
mtr_t* mtr); /*!< in: mtr handle */
/********************************************************************//**
Marks a page used. The page must reside within the extents of the given
......@@ -2337,7 +2338,8 @@ ulint
fseg_n_reserved_pages_low(
/*======================*/
fseg_inode_t* inode, /*!< in: segment inode */
ulint* used, /*!< out: number of pages used (<= reserved) */
ulint* used, /*!< out: number of pages used (not
more than reserved) */
mtr_t* mtr) /*!< in: mtr handle */
{
ulint ret;
......@@ -3564,45 +3566,6 @@ fseg_free_step_not_header(
return(FALSE);
}
/*******************************************************************//**
Frees a segment. The freeing is performed in several mini-transactions,
so that there is no danger of bufferfixing too many buffer pages. */
UNIV_INTERN
void
fseg_free(
/*======*/
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no,/*!< in: page number where the segment header is
placed */
ulint offset) /*!< in: byte offset of the segment header on that
page */
{
mtr_t mtr;
ibool finished;
fseg_header_t* header;
fil_addr_t addr;
addr.page = page_no;
addr.boffset = offset;
for (;;) {
mtr_start(&mtr);
header = fut_get_ptr(space, zip_size, addr, RW_X_LATCH, &mtr);
finished = fseg_free_step(header, &mtr);
mtr_commit(&mtr);
if (finished) {
return;
}
}
}
/**********************************************************************//**
Returns the first extent descriptor for a segment. We think of the extent
lists of the segment catenated in the order FSEG_FULL -> FSEG_NOT_FULL
......@@ -3758,6 +3721,7 @@ fseg_validate_low(
return(TRUE);
}
#ifdef UNIV_DEBUG
/*******************************************************************//**
Validates a segment.
@return TRUE if ok */
......@@ -3785,6 +3749,7 @@ fseg_validate(
return(ret);
}
#endif /* UNIV_DEBUG */
/*******************************************************************//**
Writes info of a segment. */
......
......@@ -57,7 +57,7 @@ ha_create_func(
ulint i;
#endif /* !UNIV_HOTBACKUP */
ut_ad(ut_is_2pow(n));
ut_ad(ut_is_2pow(n_mutexes));
table = hash_create(n);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
......@@ -250,28 +250,6 @@ ha_delete_hash_node(
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
}
/*************************************************************//**
Deletes an entry from a hash table. */
UNIV_INTERN
void
ha_delete(
/*======*/
hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: folded value of data */
void* data) /*!< in: data, must not be NULL and must exist
in the hash table */
{
ha_node_t* node;
ASSERT_HASH_MUTEX_OWN(table, fold);
node = ha_search_with_data(table, fold, data);
ut_a(node);
ha_delete_hash_node(table, node);
}
/*********************************************************//**
Looks for an element when we know the pointer to the data, and updates
the pointer to data, if found. */
......
This diff is collapsed.
......@@ -646,6 +646,7 @@ ha_innobase::add_index(
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads. */
trx_search_latch_release_if_reserved(prebuilt->trx);
trx_start_if_not_started(prebuilt->trx);
/* Create a background transaction for the operations on
the data dictionary tables. */
......@@ -1135,6 +1136,7 @@ ha_innobase::final_drop_index(
update_thd();
trx_search_latch_release_if_reserved(prebuilt->trx);
trx_start_if_not_started(prebuilt->trx);
/* Create a background transaction for the operations on
the data dictionary tables. */
......
/*****************************************************************************
Copyright (c) 2008, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/*******************************************************************//**
@file handler/handler0vars.h
This file contains accessor functions for dynamic plugin on Windows.
***********************************************************************/
#if defined __WIN__ && defined MYSQL_DYNAMIC_PLUGIN
/*******************************************************************//**
This is a list of externals that can not be resolved by delay loading.
They have to be resolved indirectly via their addresses in the .map file.
All of them are external variables. */
extern CHARSET_INFO* wdl_my_charset_bin;
extern CHARSET_INFO* wdl_my_charset_latin1;
extern CHARSET_INFO* wdl_my_charset_filename;
extern CHARSET_INFO** wdl_system_charset_info;
extern CHARSET_INFO** wdl_default_charset_info;
extern CHARSET_INFO** wdl_all_charsets;
extern system_variables* wdl_global_system_variables;
extern char* wdl_mysql_real_data_home;
extern char** wdl_mysql_data_home;
extern char** wdl_tx_isolation_names;
extern char** wdl_binlog_format_names;
extern char* wdl_reg_ext;
extern pthread_mutex_t* wdl_LOCK_thread_count;
extern key_map* wdl_key_map_full;
extern MY_TMPDIR* wdl_mysql_tmpdir_list;
extern bool* wdl_mysqld_embedded;
extern uint* wdl_lower_case_table_names;
extern ulong* wdl_specialflag;
extern int* wdl_my_umask;
#define my_charset_bin (*wdl_my_charset_bin)
#define my_charset_latin1 (*wdl_my_charset_latin1)
#define my_charset_filename (*wdl_my_charset_filename)
#define system_charset_info (*wdl_system_charset_info)
#define default_charset_info (*wdl_default_charset_info)
#define all_charsets (wdl_all_charsets)
#define global_system_variables (*wdl_global_system_variables)
#define mysql_real_data_home (wdl_mysql_real_data_home)
#define mysql_data_home (*wdl_mysql_data_home)
#define tx_isolation_names (wdl_tx_isolation_names)
#define binlog_format_names (wdl_binlog_format_names)
#define reg_ext (wdl_reg_ext)
#define LOCK_thread_count (*wdl_LOCK_thread_count)
#define key_map_full (*wdl_key_map_full)
#define mysql_tmpdir_list (*wdl_mysql_tmpdir_list)
#define mysqld_embedded (*wdl_mysqld_embedded)
#define lower_case_table_names (*wdl_lower_case_table_names)
#define specialflag (*wdl_specialflag)
#define my_umask (*wdl_my_umask)
#endif
This diff is collapsed.
......@@ -209,7 +209,7 @@ ibuf_count_check(
}
#endif
/** Offsets in bits for the bits describing a single page in the bitmap */
/** @name Offsets to the per-page bits in the insert buffer bitmap */
/* @{ */
#define IBUF_BITMAP_FREE 0 /*!< Bits indicating the
amount of free space */
......@@ -1159,13 +1159,12 @@ ibuf_dummy_index_add_col(
dict_table_get_nth_col(index->table, i), len);
}
/********************************************************************//**
Deallocates a dummy index for inserting a record to a non-clustered index.
*/
Deallocates a dummy index for inserting a record to a non-clustered index. */
static
void
ibuf_dummy_index_free(
/*==================*/
dict_index_t* index) /*!< in: dummy index */
dict_index_t* index) /*!< in, own: dummy index */
{
dict_table_t* table = index->table;
......
......@@ -76,6 +76,7 @@ struct buf_buddy_stat_struct {
ib_uint64_t relocated_usec;
};
/** Statistics of buddy blocks of a given size. */
typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
/** Statistics of the buddy system, indexed by block size.
......
......@@ -36,7 +36,7 @@ Created 11/5/1995 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
#include "os0proc.h"
/** Modes for buf_page_get_gen */
/** @name Modes for buf_page_get_gen */
/* @{ */
#define BUF_GET 10 /*!< get always */
#define BUF_GET_IF_IN_POOL 11 /*!< get if in pool */
......@@ -47,7 +47,7 @@ Created 11/5/1995 Heikki Tuuri
not to set a latch, and it
should be used with care */
/* @} */
/** Modes for buf_page_get_known_nowait */
/** @name Modes for buf_page_get_known_nowait */
/* @{ */
#define BUF_MAKE_YOUNG 51 /*!< Move the block to the
start of the LRU list if there
......@@ -242,7 +242,7 @@ buf_page_get_known_nowait(
Given a tablespace id and page number tries to get that page. If the
page is not in the buffer pool it is not loaded and NULL is returned.
Suitable for using when holding the kernel mutex. */
UNIV_INTERN
const buf_block_t*
buf_page_try_get_func(
/*==================*/
......@@ -252,6 +252,12 @@ buf_page_try_get_func(
ulint line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mini-transaction */
/** Tries to get a page. If the page is not in the buffer pool it is
not loaded. Suitable for using when holding the kernel mutex.
@param space_id in: tablespace id
@param page_no in: page number
@param mtr in: mini-transaction
@return the page if in buffer pool, NULL if not */
#define buf_page_try_get(space_id, page_no, mtr) \
buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
......@@ -928,10 +934,16 @@ buf_pointer_is_block_field(
/*=======================*/
const void* ptr); /*!< in: pointer not
dereferenced */
/** Find out if a pointer corresponds to a buf_block_t::mutex.
@param m in: mutex candidate
@return TRUE if m is a buf_block_t::mutex */
#define buf_pool_is_block_mutex(m) \
buf_pointer_is_block_field((void *)(m))
buf_pointer_is_block_field((const void*)(m))
/** Find out if a pointer corresponds to a buf_block_t::lock.
@param l in: rw-lock candidate
@return TRUE if l is a buf_block_t::lock */
#define buf_pool_is_block_lock(l) \
buf_pointer_is_block_field((void *)(l))
buf_pointer_is_block_field((const void*)(l))
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*********************************************************************//**
......@@ -945,15 +957,6 @@ buf_frame_get_page_zip(
const byte* ptr); /*!< in: pointer to the page */
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/********************************************************************//**
This function is used to get info if there is an io operation
going on on a buffer page.
@return TRUE if io going on */
UNIV_INLINE
ibool
buf_page_io_query(
/*==============*/
buf_page_t* bpage); /*!< in: pool block, must be bufferfixed */
/********************************************************************//**
Function which inits a page for read to the buffer buf_pool. If the page is
(1) already in buf_pool, or
(2) if we specify to read only ibuf pages and the page is not an ibuf page, or
......@@ -1036,10 +1039,12 @@ buf_get_free_list_len(void);
for compressed and uncompressed frames */
struct buf_page_struct{
/** None of the following bit-fields must be modified without
holding buf_page_get_mutex() [block->mutex or buf_pool_zip_mutex],
since they can be stored in the same machine word. Some of them are
additionally protected by buf_pool_mutex. */
/** @name General fields
None of these bit-fields must be modified without holding
buf_page_get_mutex() [buf_block_struct::mutex or
buf_pool_zip_mutex], since they can be stored in the same
machine word. Some of these fields are additionally protected
by buf_pool_mutex. */
/* @{ */
unsigned space:32; /*!< tablespace id; also protected
......@@ -1084,8 +1089,8 @@ struct buf_page_struct{
ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */
#endif /* UNIV_DEBUG */
/** @defgroup buf_page_flush Page flushing fields; protected
by buf_pool_mutex */
/** @name Page flushing fields
All these are protected by buf_pool_mutex. */
/* @{ */
UT_LIST_NODE_T(buf_page_t) list;
......@@ -1094,11 +1099,11 @@ struct buf_page_struct{
buf_pool_mutex, in one of the
following lists in buf_pool:
BUF_BLOCK_NOT_USED: free
BUF_BLOCK_FILE_PAGE: flush_list
BUF_BLOCK_ZIP_DIRTY: flush_list
BUF_BLOCK_ZIP_PAGE: zip_clean
BUF_BLOCK_ZIP_FREE: zip_free[] */
- BUF_BLOCK_NOT_USED: free
- BUF_BLOCK_FILE_PAGE: flush_list
- BUF_BLOCK_ZIP_DIRTY: flush_list
- BUF_BLOCK_ZIP_PAGE: zip_clean
- BUF_BLOCK_ZIP_FREE: zip_free[] */
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
when buf_pool_mutex is free, the
......@@ -1124,10 +1129,9 @@ struct buf_page_struct{
on disk; zero if all
modifications are on disk */
/* @} */
/** @defgroup buf_LRU LRU replacement algorithm */
/** @ingroup buf_LRU
protected by buf_pool_mutex only (not buf_pool_zip_mutex or
buf_block_struct::mutex) */
/** @name LRU replacement algorithm fields
These fields are protected by buf_pool_mutex only (not
buf_pool_zip_mutex or buf_block_struct::mutex). */
/* @{ */
UT_LIST_NODE_T(buf_page_t) LRU;
......@@ -1158,11 +1162,11 @@ struct buf_page_struct{
purposes without holding any
mutex or latch */
/* @} */
#ifdef UNIV_DEBUG_FILE_ACCESSES
# ifdef UNIV_DEBUG_FILE_ACCESSES
ibool file_page_was_freed;
/*!< this is set to TRUE when fsp
frees a page in buffer pool */
#endif /* UNIV_DEBUG_FILE_ACCESSES */
# endif /* UNIV_DEBUG_FILE_ACCESSES */
#endif /* !UNIV_HOTBACKUP */
};
......@@ -1170,7 +1174,7 @@ struct buf_page_struct{
struct buf_block_struct{
/** @defgroup buf_block_general General fields */
/** @name General fields */
/* @{ */
buf_page_t page; /*!< page information; this must
......@@ -1211,7 +1215,7 @@ struct buf_block_struct{
but this flag is not set because
we do not keep track of all pages */
/* @} */
/** @defgroup buf_block_search Optimistic search field */
/** @name Optimistic search field */
/* @{ */
ib_uint64_t modify_clock; /*!< this clock is incremented every
......@@ -1226,9 +1230,8 @@ struct buf_block_struct{
bufferfixed, or (2) the thread has an
x-latch on the block */
/* @} */
/** @defgroup buf_block_hash Hash search fields */
/** @ingroup buf_block_hash
NOTE that the first 4 fields are NOT protected by any semaphore! */
/** @name Hash search fields (unprotected)
NOTE that these fields are NOT protected by any semaphore! */
/* @{ */
ulint n_hash_helps; /*!< counter which controls building
......@@ -1243,11 +1246,11 @@ struct buf_block_struct{
indexed in the hash index */
/* @} */
/** @ingroup buf_block_hash
/** @name Hash search fields
These 6 fields may only be modified when we have
an x-latch on btr_search_latch AND
a) we are holding an s-latch or x-latch on buf_block_struct::lock or
b) we know that buf_block_struct::buf_fix_count == 0.
- we are holding an s-latch or x-latch on buf_block_struct::lock or
- we know that buf_block_struct::buf_fix_count == 0.
An exception to this is when we init or create a page
in the buffer pool in buf0buf.c. */
......@@ -1274,15 +1277,15 @@ struct buf_block_struct{
dict_index_t* index; /*!< Index for which the adaptive
hash index has been created. */
/* @} */
/** Debug fields */
# ifdef UNIV_SYNC_DEBUG
/** @name Debug fields */
/* @{ */
#ifdef UNIV_SYNC_DEBUG
rw_lock_t debug_latch; /*!< in the debug version, each thread
which bufferfixes the block acquires
an s-latch here; so we can use the
debug utilities in sync0rw */
#endif
/* @} */
# endif
#endif /* !UNIV_HOTBACKUP */
};
......@@ -1300,6 +1303,7 @@ Compute the hash fold value for blocks in buf_pool->zip_hash. */
#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
/** @brief The buffer pool structure.
......@@ -1308,7 +1312,7 @@ directory (buf) to see it. Do not use from outside! */
struct buf_pool_struct{
/** @defgroup buf_pool_general General fields */
/** @name General fields */
/* @{ */
ulint n_chunks; /*!< number of buffer pool chunks */
......@@ -1346,7 +1350,7 @@ struct buf_pool_struct{
ulint n_pages_created_old;/*!< number of pages created in
the pool with no read */
/* @} */
/** @defgroup buf_pool_flush Page flushing algorithm fields */
/** @name Page flushing algorithm fields */
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
......@@ -1381,7 +1385,7 @@ struct buf_pool_struct{
allocated */
/* @} */
/** @defgroup buf_LRU LRU replacement algorithm */
/** @name LRU replacement algorithm fields */
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) free;
......@@ -1408,7 +1412,10 @@ struct buf_pool_struct{
unzip_LRU list */
/* @} */
/** @defgroup buf_buddy Buddy allocator of compressed pages */
/** @name Buddy allocator fields
The buddy allocator is used for allocating compressed page
frames and buf_page_t descriptors of blocks that exist
in the buffer pool only in compressed form. */
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */
......@@ -1430,8 +1437,8 @@ extern mutex_t buf_pool_mutex;
(of type buf_page_t, not buf_block_t) */
extern mutex_t buf_pool_zip_mutex;
/** Accessors for buf_pool_mutex. Use these instead of accessing
buf_pool_mutex directly. */
/** @name Accessors for buf_pool_mutex.
Use these instead of accessing buf_pool_mutex directly. */
/* @{ */
/** Test if buf_pool_mutex is owned. */
......
......@@ -779,29 +779,6 @@ buf_page_address_fold(
return((space << 20) + space + offset);
}
/********************************************************************//**
This function is used to get info if there is an io operation
going on on a buffer page.
@return TRUE if io going on */
UNIV_INLINE
ibool
buf_page_io_query(
/*==============*/
buf_page_t* bpage) /*!< in: buf_pool block, must be bufferfixed */
{
ibool io_fixed;
buf_pool_mutex_enter();
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->buf_fix_count > 0);
io_fixed = buf_page_get_io_fix(bpage) != BUF_IO_NONE;
buf_pool_mutex_exit();
return(io_fixed);
}
/********************************************************************//**
Gets the youngest modification log sequence number for a frame.
Returns zero if not file page or no modification occurred yet.
......
......@@ -127,6 +127,44 @@ buf_flush_ready_for_replace(
/*========================*/
buf_page_t* bpage); /*!< in: buffer control block, must be
buf_page_in_file(bpage) and in the LRU list */
/** @brief Statistics for selecting flush rate based on redo log
generation speed.
These statistics are generated for heuristics used in estimating the
rate at which we should flush the dirty blocks to avoid bursty IO
activity. Note that the rate of flushing not only depends on how many
dirty pages we have in the buffer pool but it is also a fucntion of
how much redo the workload is generating and at what rate. */
struct buf_flush_stat_struct
{
ib_uint64_t redo; /**< amount of redo generated. */
ulint n_flushed; /**< number of pages flushed. */
};
/** Statistics for selecting flush rate of dirty pages. */
typedef struct buf_flush_stat_struct buf_flush_stat_t;
/*********************************************************************
Update the historical stats that we are collecting for flush rate
heuristics at the end of each interval. */
UNIV_INTERN
void
buf_flush_stat_update(void);
/*=======================*/
/*********************************************************************
Determines the fraction of dirty pages that need to be flushed based
on the speed at which we generate redo log. Note that if redo log
is generated at significant rate without a corresponding increase
in the number of dirty pages (for example, an in-memory workload)
it can cause IO bursts of flushing. This function implements heuristics
to avoid this burstiness.
@return number of dirty pages to be flushed / second */
UNIV_INTERN
ulint
buf_flush_get_desired_flush_rate(void);
/*==================================*/
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/******************************************************************//**
Validates the flush list.
......
......@@ -68,10 +68,10 @@ buf_LRU_buf_pool_running_out(void);
These are low-level functions
#########################################################################*/
/* Minimum LRU list length for which the LRU_old pointer is defined */
/** Minimum LRU list length for which the LRU_old pointer is defined */
#define BUF_LRU_OLD_MIN_LEN 80
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
/******************************************************************//**
......@@ -227,18 +227,18 @@ buf_LRU_print(void);
/*===============*/
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
/******************************************************************//**
/** @brief Statistics for selecting the LRU list for eviction.
These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O
and page_zip_decompress() operations. Based on the statistics we decide
if we want to evict from buf_pool->unzip_LRU or buf_pool->LRU. */
/** Statistics for selecting the LRU list for eviction. */
struct buf_LRU_stat_struct
{
ulint io; /**< Counter of buffer pool I/O operations. */
ulint unzip; /**< Counter of page_zip_decompress operations. */
};
/** Statistics for selecting the LRU list for eviction. */
typedef struct buf_LRU_stat_struct buf_LRU_stat_t;
/** Current operation counters. Not protected by any mutex.
......
......@@ -124,14 +124,16 @@ buf_read_recv_pages(
ulint n_stored); /*!< in: number of page numbers
in the array */
/* The size in pages of the area which the read-ahead algorithms read if
/** The size in pages of the area which the read-ahead algorithms read if
invoked */
#define BUF_READ_AHEAD_AREA \
ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
/* Modes used in read-ahead */
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
#define BUF_READ_IBUF_PAGES_ONLY 131
/** read any page */
#define BUF_READ_ANY_PAGE 132
/* @} */
#endif
......@@ -278,7 +278,8 @@ dtype_get_mblen(
ulint* mbmaxlen); /*!< out: maximum length of a
multi-byte character */
/*********************************************************************//**
Gets the MySQL charset-collation code for MySQL string types. */
Gets the MySQL charset-collation code for MySQL string types.
@return MySQL charset-collation code */
UNIV_INLINE
ulint
dtype_get_charset_coll(
......@@ -286,7 +287,8 @@ dtype_get_charset_coll(
ulint prtype);/*!< in: precise data type */
/*********************************************************************//**
Forms a precise type from the < 4.1.2 format precise type plus the
charset-collation code. */
charset-collation code.
@return precise type, including the charset-collation code */
UNIV_INTERN
ulint
dtype_form_prtype(
......
......@@ -28,7 +28,8 @@ Created 1/16/1996 Heikki Tuuri
# include "ha_prototypes.h"
/*********************************************************************//**
Gets the MySQL charset-collation code for MySQL string types. */
Gets the MySQL charset-collation code for MySQL string types.
@return MySQL charset-collation code */
UNIV_INLINE
ulint
dtype_get_charset_coll(
......
This diff is collapsed.
This diff is collapsed.
......@@ -164,16 +164,6 @@ is inserted.
# define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
/*************************************************************//**
Deletes an entry from a hash table. */
UNIV_INTERN
void
ha_delete(
/*======*/
hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: folded value of data */
void* data); /*!< in: data, must not be NULL and must exist
in the hash table */
/*********************************************************//**
Looks for an element when we know the pointer to the data and deletes
it from the hash table if found.
......
......@@ -461,14 +461,6 @@ lock_table(
dict_table_t* table, /*!< in: database table in dictionary cache */
enum lock_mode mode, /*!< in: lock mode */
que_thr_t* thr); /*!< in: query thread */
/*********************************************************************//**
Checks if there are any locks set on the table.
@return TRUE if there are lock(s) */
UNIV_INTERN
ibool
lock_is_on_table(
/*=============*/
dict_table_t* table); /*!< in: database table in dictionary cache */
/*************************************************************//**
Removes a granted record lock of a transaction from the queue and grants
locks to other transactions waiting in the queue if they now are entitled
......@@ -483,14 +475,6 @@ lock_rec_unlock(
const rec_t* rec, /*!< in: record */
enum lock_mode lock_mode);/*!< in: LOCK_S or LOCK_X */
/*********************************************************************//**
Releases a table lock.
Releases possible other transactions waiting for this lock. */
UNIV_INTERN
void
lock_table_unlock(
/*==============*/
lock_t* lock); /*!< in: lock */
/*********************************************************************//**
Releases transaction locks, and releases possible other transactions waiting
because of these locks. */
UNIV_INTERN
......
This diff is collapsed.
......@@ -385,6 +385,18 @@ log_get_lsn(void)
return(lsn);
}
/****************************************************************
Gets the log group capacity. It is OK to read the value without
holding log_sys->mutex because it is constant.
@return log group capacity */
UNIV_INLINE
ulint
log_get_capacity(void)
/*==================*/
{
return(log_sys->log_group_capacity);
}
/***********************************************************************//**
Checks if there is need for a log buffer flush or a new checkpoint, and does
this if yes. Any database operation should call this when it has modified
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -41,7 +41,9 @@ Created 9/5/1995 Heikki Tuuri
#include "os0sync.h"
#include "sync0arr.h"
#if defined(UNIV_DEBUG) && !defined(UNIV_HOTBACKUP)
extern my_bool timed_mutexes;
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
#ifdef HAVE_WINDOWS_ATOMICS
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment