Commit 4a1d105a authored by marko's avatar marko

branches/zip: Merge 1830:1862 from trunk.

parent 81332ff9
......@@ -63,6 +63,7 @@ static handlerton *innodb_hton_ptr;
/* Include necessary InnoDB headers */
extern "C" {
#include "../storage/innobase/include/univ.i"
#include "../storage/innobase/include/btr0sea.h"
#include "../storage/innobase/include/buf0buddy.h"
#include "../storage/innobase/include/os0file.h"
#include "../storage/innobase/include/os0thread.h"
......@@ -128,6 +129,7 @@ static my_bool innobase_locks_unsafe_for_binlog = FALSE;
static my_bool innobase_rollback_on_timeout = FALSE;
static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
static my_bool innobase_use_adaptive_hash_indexes = TRUE;
static char* internal_innobase_data_file_path = NULL;
......@@ -1616,6 +1618,8 @@ innobase_init(
srv_stats_on_metadata = (ibool) innobase_stats_on_metadata;
btr_search_disabled = (ibool) !innobase_use_adaptive_hash_indexes;
srv_print_verbose_log = mysqld_embedded ? 0 : 1;
/* Store the default charset-collation number of this MySQL
......@@ -7309,11 +7313,12 @@ On return if there is no error then the tables AUTOINC lock is locked.*/
ulong
ha_innobase::innobase_get_auto_increment(
/*=====================================*/
ulonglong* value) /* out: autoinc value */
{
ulint error;
ut_a(*value == 0);
*value = 0;
/* Note: If the table is not initialized when we attempt the
read below. We initialize the table's auto-inc counter and
......@@ -7375,7 +7380,7 @@ we have a table-level lock). offset, increment, nb_desired_values are ignored.
void
ha_innobase::get_auto_increment(
/*=================================*/
/*============================*/
ulonglong offset, /* in: */
ulonglong increment, /* in: table autoinc increment */
ulonglong nb_desired_values, /* in: number of values reqd */
......@@ -7467,7 +7472,9 @@ ha_innobase::get_auto_increment(
/* See comment in handler.h */
int
ha_innobase::reset_auto_increment(ulonglong value)
ha_innobase::reset_auto_increment(
/*==============================*/
ulonglong value) /* in: new value for table autoinc */
{
DBUG_ENTER("ha_innobase::reset_auto_increment");
......@@ -8192,6 +8199,17 @@ static MYSQL_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_BOOL(use_adaptive_hash_indexes, innobase_use_adaptive_hash_indexes,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Enable the InnoDB adaptive hash indexes (enabled by default)",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
PLUGIN_VAR_RQCMDARG,
"Replication thread delay (ms) on the slave server if "
"innodb_thread_concurrency is reached (0 by default)",
NULL, NULL, 0, 0, ~0UL, 0);
static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
......@@ -8320,6 +8338,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(open_files),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
MYSQL_SYSVAR(use_adaptive_hash_indexes),
MYSQL_SYSVAR(replication_delay),
MYSQL_SYSVAR(status_file),
MYSQL_SYSVAR(support_xa),
MYSQL_SYSVAR(sync_spin_loops),
......
......@@ -254,20 +254,6 @@ int thd_non_transactional_update(const MYSQL_THD thd);
int thd_binlog_format(const MYSQL_THD thd);
}
/*
don't delete it - it may be re-enabled later
as an optimization for the most common case InnoDB+binlog
*/
#if 0
int innobase_report_binlog_offset_and_commit(
THD* thd,
void* trx_handle,
char* log_file_name,
my_off_t end_offset);
int innobase_commit_complete(void* trx_handle);
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
#endif
typedef struct trx_struct trx_t;
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
......
......@@ -135,6 +135,8 @@ extern int srv_query_thread_priority;
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulint srv_replication_delay;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
......
......@@ -20,6 +20,21 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
/*************************************************************************
Delays execution for at most max_wait_us microseconds or returns earlier
if cond becomes true; cond is evaluated every 2 ms. */
#define UT_WAIT_FOR(cond, max_wait_us) \
do { \
ullint start_us; \
start_us = ut_time_us(NULL); \
while (!(cond) \
&& ut_time_us(NULL) - start_us < (max_wait_us)) {\
\
os_thread_sleep(2000 /* 2 ms */); \
} \
} while (0)
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
......@@ -152,6 +167,18 @@ ut_usectime(
/*========*/
ulint* sec, /* out: seconds since the Epoch */
ulint* ms); /* out: microseconds since the Epoch+*sec */
/**************************************************************
Returns the number of microseconds since epoch. Similar to
time(3), the return value is also stored in *tloc, provided
that tloc is non-NULL. */
ullint
ut_time_us(
/*=======*/
/* out: us since epoch */
ullint* tloc); /* out: us since epoch, if non-NULL */
/**************************************************************
Returns the difference of two times in seconds. */
......@@ -263,6 +290,24 @@ ut_copy_file(
FILE* dest, /* in: output file */
FILE* src); /* in: input file to be appended to output */
/**************************************************************************
snprintf(). */
#ifdef __WIN__
int
ut_snprintf(
/* out: number of characters that would
have been printed if the size were
unlimited, not including the terminating
'\0'. */
char* str, /* out: string */
size_t size, /* in: str size */
const char* fmt, /* in: format */
...); /* in: format values */
#else
#define ut_snprintf snprintf
#endif /* __WIN__ */
#ifndef UNIV_NONINL
#include "ut0ut.ic"
#endif
......
......@@ -3223,3 +3223,36 @@ c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
DROP TABLE IF EXISTS t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1;
SELECT * FROM t2;
a
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (1);
COMMIT;
SELECT * FROM t1 WHERE a=1;
a
1
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
SELECT * FROM t2;
a
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (2);
COMMIT;
SELECT * FROM t1 WHERE a=2;
a
2
SELECT * FROM t1 WHERE a=2;
a
2
DROP TABLE t1;
DROP TABLE t2;
......@@ -2367,6 +2367,48 @@ CREATE TABLE t1 (
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
#
# Bug #21409 Incorrect result returned when in READ-COMMITTED with
# query_cache ON
#
CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,);
CONNECTION c1;
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
CREATE TABLE t2 LIKE t1;
SELECT * FROM t2;
CONNECTION c2;
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (1);
COMMIT;
CONNECTION c1;
SELECT * FROM t1 WHERE a=1;
DISCONNECT c1;
DISCONNECT c2;
CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,);
CONNECTION c1;
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
SELECT * FROM t2;
CONNECTION c2;
SET TX_ISOLATION='read-committed';
SET AUTOCOMMIT=0;
INSERT INTO t1 VALUES (2);
COMMIT;
CONNECTION c1;
# The result set below should be the same for both selects
SELECT * FROM t1 WHERE a=2;
SELECT * FROM t1 WHERE a=2;
DROP TABLE t1;
DROP TABLE t2;
DISCONNECT c1;
DISCONNECT c2;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
......
......@@ -28,6 +28,7 @@ Created 10/8/1995 Heikki Tuuri
#include "srv0srv.h"
#include "ut0mem.h"
#include "ut0ut.h"
#include "os0proc.h"
#include "mem0mem.h"
#include "mem0pool.h"
......@@ -333,6 +334,8 @@ ibool srv_use_checksums = TRUE;
ibool srv_set_thread_priorities = TRUE;
int srv_query_thread_priority = 0;
ulint srv_replication_delay = 0;
/*-------------------------------------------*/
ulong srv_n_spin_wait_rounds = 20;
ulong srv_n_free_tickets_to_enter = 500;
......@@ -983,11 +986,10 @@ srv_conc_enter_innodb(
if (trx->mysql_thd != NULL
&& thd_is_replication_slave_thread(trx->mysql_thd)) {
/* TODO Do something more interesting (based on a config
parameter). Some users what to give the replication
thread very low priority, see http://bugs.mysql.com/25078
This can be done by introducing
innodb_replication_delay(ms) config parameter */
UT_WAIT_FOR(srv_conc_n_threads
< (lint)srv_thread_concurrency,
srv_replication_delay * 1000);
return;
}
......
......@@ -117,6 +117,31 @@ ut_usectime(
*ms = (ulint) tv.tv_usec;
}
/**************************************************************
Returns the number of microseconds since epoch. Similar to
time(3), the return value is also stored in *tloc, provided
that tloc is non-NULL. */
ullint
ut_time_us(
/*=======*/
/* out: us since epoch */
ullint* tloc) /* out: us since epoch, if non-NULL */
{
struct timeval tv;
ullint us;
ut_gettimeofday(&tv, NULL);
us = (ullint) tv.tv_sec * 1000000 + tv.tv_usec;
if (tloc != NULL) {
*tloc = us;
}
return(us);
}
/**************************************************************
Returns the difference of two times in seconds. */
......@@ -487,3 +512,47 @@ ut_copy_file(
}
} while (len > 0);
}
/**************************************************************************
snprintf(). */
#ifdef __WIN__
#include <stdarg.h>
int
ut_snprintf(
/* out: number of characters that would
have been printed if the size were
unlimited, not including the terminating
'\0'. */
char* str, /* out: string */
size_t size, /* in: str size */
const char* fmt, /* in: format */
...) /* in: format values */
{
int res;
va_list ap1;
va_list ap2;
va_start(ap1, fmt);
va_start(ap2, fmt);
res = _vscprintf(fmt, ap1);
if (res == -1) {
return(-1);
}
if (size > 0) {
_vsnprintf(str, size, fmt, ap2);
if ((size_t)res >= size) {
str[size - 1] = '\0';
}
}
va_end(ap1);
va_end(ap2);
return(res);
}
#endif /* __WIN__ */
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