Commit 09d2e7f6 authored by Michael Widenius's avatar Michael Widenius

merge with 5.1

(Includes patch for overrun detected by valgrind thanks to previous my_alloca() -> my_malloc() patch)
parents ffb0cd61 0b20943e
...@@ -12,7 +12,7 @@ dnl ...@@ -12,7 +12,7 @@ dnl
dnl When changing the major version number please also check the switch dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb. dnl to update version.c in ndb.
AC_INIT([MariaDB Server], [5.2.4-MariaDB], [], [mysql]) AC_INIT([MariaDB Server], [5.2.5-MariaDB], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
......
...@@ -1359,7 +1359,17 @@ INSERT INTO t1 VALUES (1,'init'); ...@@ -1359,7 +1359,17 @@ INSERT INTO t1 VALUES (1,'init');
DELIMITER |; DELIMITER |;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; # retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES (); INSERT INTO t2 VALUES ();
END| END|
DELIMITER ;| DELIMITER ;|
......
...@@ -12717,6 +12717,7 @@ COUNT(t1.a) ...@@ -12717,6 +12717,7 @@ COUNT(t1.a)
729 729
DROP TABLE t1; DROP TABLE t1;
SET @@join_buffer_size= @save_join_buffer_size; SET @@join_buffer_size= @save_join_buffer_size;
flush tables;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
SELECT * FROM t1; SELECT * FROM t1;
......
...@@ -692,7 +692,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -692,7 +692,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 11419 Using sort_union(idx,PRIMARY); Using where 2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 11419 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM SELECT COUNT(*) FROM
(SELECT * FROM t1 (SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*) COUNT(*)
6145 6145
......
...@@ -75,7 +75,17 @@ TRUNCATE t1; ...@@ -75,7 +75,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init'); INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES (); INSERT INTO t2 VALUES ();
END| END|
BEGIN; BEGIN;
......
...@@ -1594,7 +1594,17 @@ TRUNCATE t1; ...@@ -1594,7 +1594,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init'); INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES (); INSERT INTO t2 VALUES ();
END| END|
BEGIN; BEGIN;
......
...@@ -1594,7 +1594,17 @@ TRUNCATE t1; ...@@ -1594,7 +1594,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init'); INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES (); INSERT INTO t2 VALUES ();
END| END|
BEGIN; BEGIN;
......
...@@ -1630,6 +1630,11 @@ SET @@join_buffer_size= @save_join_buffer_size; ...@@ -1630,6 +1630,11 @@ SET @@join_buffer_size= @save_join_buffer_size;
# BUG#47012 archive tables are not upgradeable, and server crashes on any access # BUG#47012 archive tables are not upgradeable, and server crashes on any access
# #
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
# Remove files to handle possible restart of test
flush tables;
remove_files_wildcard $MYSQLD_DATADIR/test t1.*;
copy_file std_data/bug47012.frm $MYSQLD_DATADIR/test/t1.frm; copy_file std_data/bug47012.frm $MYSQLD_DATADIR/test/t1.frm;
copy_file std_data/bug47012.ARZ $MYSQLD_DATADIR/test/t1.ARZ; copy_file std_data/bug47012.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
copy_file std_data/bug47012.ARM $MYSQLD_DATADIR/test/t1.ARM; copy_file std_data/bug47012.ARM $MYSQLD_DATADIR/test/t1.ARM;
......
...@@ -71,7 +71,7 @@ SELECT COUNT(*) FROM ...@@ -71,7 +71,7 @@ SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx) (SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
SELECT COUNT(*) FROM SELECT COUNT(*) FROM
(SELECT * FROM t1 (SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
--replace_column 9 # --replace_column 9 #
......
...@@ -117,7 +117,17 @@ INSERT INTO t1 VALUES (1,'init'); ...@@ -117,7 +117,17 @@ INSERT INTO t1 VALUES (1,'init');
DELIMITER |; DELIMITER |;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; # retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES (); INSERT INTO t2 VALUES ();
END| END|
DELIMITER ;| DELIMITER ;|
......
...@@ -158,15 +158,13 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, ...@@ -158,15 +158,13 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
{ {
THR_LOCK_DATA *data,**prev; THR_LOCK_DATA *data,**prev;
uint count=0; uint count=0;
THR_LOCK_OWNER *UNINIT_VAR(first_owner);
prev= &list->data; prev= &list->data;
if (list->data) if (list->data)
{ {
enum thr_lock_type last_lock_type=list->data->type; enum thr_lock_type last_lock_type= list->data->type;
THR_LOCK_OWNER *first_owner= list->data->owner;
if (same_owner && list->data)
first_owner= list->data->owner;
for (data=list->data; data && count++ < MAX_LOCKS ; data=data->next) for (data=list->data; data && count++ < MAX_LOCKS ; data=data->next)
{ {
if (data->type != last_lock_type) if (data->type != last_lock_type)
...@@ -184,8 +182,8 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, ...@@ -184,8 +182,8 @@ static int check_lock(struct st_lock_list *list, const char* lock_type,
last_lock_type != TL_WRITE_CONCURRENT_INSERT) last_lock_type != TL_WRITE_CONCURRENT_INSERT)
{ {
fprintf(stderr, fprintf(stderr,
"Warning: Found locks from different threads in %s: %s\n", "Warning: Found locks from different threads in %s at '%s'. org_lock_type: %d last_lock_type: %d new_lock_type: %d\n",
lock_type,where); lock_type, where, list->data->type, last_lock_type, data->type);
return 1; return 1;
} }
if (no_cond && data->cond) if (no_cond && data->cond)
......
...@@ -157,10 +157,6 @@ struct trx_i_s_cache_struct { ...@@ -157,10 +157,6 @@ struct trx_i_s_cache_struct {
ullint last_read; /*!< last time the cache was read; ullint last_read; /*!< last time the cache was read;
measured in microseconds since measured in microseconds since
epoch */ epoch */
mutex_t last_read_mutex;/*!< mutex protecting the
last_read member - it is updated
inside a shared lock of the
rw_lock member */
i_s_table_cache_t innodb_trx; /*!< innodb_trx table */ i_s_table_cache_t innodb_trx; /*!< innodb_trx table */
i_s_table_cache_t innodb_locks; /*!< innodb_locks table */ i_s_table_cache_t innodb_locks; /*!< innodb_locks table */
i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */ i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */
...@@ -1101,13 +1097,6 @@ can_cache_be_updated( ...@@ -1101,13 +1097,6 @@ can_cache_be_updated(
{ {
ullint now; ullint now;
/* Here we read cache->last_read without acquiring its mutex
because last_read is only updated when a shared rw lock on the
whole cache is being held (see trx_i_s_cache_end_read()) and
we are currently holding an exclusive rw lock on the cache.
So it is not possible for last_read to be updated while we are
reading it. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX)); ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
#endif #endif
...@@ -1205,6 +1194,12 @@ trx_i_s_possibly_fetch_data_into_cache( ...@@ -1205,6 +1194,12 @@ trx_i_s_possibly_fetch_data_into_cache(
/*===================================*/ /*===================================*/
trx_i_s_cache_t* cache) /*!< in/out: cache */ trx_i_s_cache_t* cache) /*!< in/out: cache */
{ {
ullint now;
#ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
#endif
if (!can_cache_be_updated(cache)) { if (!can_cache_be_updated(cache)) {
return(1); return(1);
...@@ -1217,6 +1212,10 @@ trx_i_s_possibly_fetch_data_into_cache( ...@@ -1217,6 +1212,10 @@ trx_i_s_possibly_fetch_data_into_cache(
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
/* update cache last read time */
now = ut_time_us(NULL);
cache->last_read = now;
return(0); return(0);
} }
...@@ -1247,16 +1246,12 @@ trx_i_s_cache_init( ...@@ -1247,16 +1246,12 @@ trx_i_s_cache_init(
release kernel_mutex release kernel_mutex
release trx_i_s_cache_t::rw_lock release trx_i_s_cache_t::rw_lock
acquire trx_i_s_cache_t::rw_lock, S acquire trx_i_s_cache_t::rw_lock, S
acquire trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::rw_lock */ release trx_i_s_cache_t::rw_lock */
rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK); rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0; cache->last_read = 0;
mutex_create(&cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t)); table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t)); table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
table_cache_init(&cache->innodb_lock_waits, table_cache_init(&cache->innodb_lock_waits,
...@@ -1307,18 +1302,10 @@ trx_i_s_cache_end_read( ...@@ -1307,18 +1302,10 @@ trx_i_s_cache_end_read(
/*===================*/ /*===================*/
trx_i_s_cache_t* cache) /*!< in: cache */ trx_i_s_cache_t* cache) /*!< in: cache */
{ {
ullint now;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED)); ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED));
#endif #endif
/* update cache last read time */
now = ut_time_us(NULL);
mutex_enter(&cache->last_read_mutex);
cache->last_read = now;
mutex_exit(&cache->last_read_mutex);
rw_lock_s_unlock(&cache->rw_lock); rw_lock_s_unlock(&cache->rw_lock);
} }
......
...@@ -3133,7 +3133,8 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info, ...@@ -3133,7 +3133,8 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info,
key.keyinfo= keyinfo; key.keyinfo= keyinfo;
if (!(buff= (uchar*) my_alloca((uint) keyinfo->block_length + if (!(buff= (uchar*) my_alloca((uint) keyinfo->block_length +
keyinfo->maxlength))) keyinfo->maxlength +
MARIA_INDEX_OVERHEAD_SIZE)))
{ {
_ma_check_print_error(param,"Not enough memory for key block"); _ma_check_print_error(param,"Not enough memory for key block");
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "ma_key_recover.h" #include "ma_key_recover.h"
#include "ma_blockrec.h" #include "ma_blockrec.h"
#define MAX_POINTER_LENGTH 8
/* Functions declared in this file */ /* Functions declared in this file */
static int w_search(MARIA_HA *info, uint32 comp_flag, static int w_search(MARIA_HA *info, uint32 comp_flag,
...@@ -802,7 +800,7 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key, ...@@ -802,7 +800,7 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key,
#endif #endif
if (t_length > 0) if (t_length > 0)
{ {
if (t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH) if (t_length >= keyinfo->maxlength*2+MARIA_INDEX_OVERHEAD_SIZE)
{ {
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -811,7 +809,7 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key, ...@@ -811,7 +809,7 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key,
} }
else else
{ {
if (-t_length >= keyinfo->maxlength*2+MAX_POINTER_LENGTH) if (-t_length >= keyinfo->maxlength*2+MARIA_INDEX_OVERHEAD_SIZE)
{ {
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -152,11 +152,13 @@ typedef struct st_maria_state_info ...@@ -152,11 +152,13 @@ typedef struct st_maria_state_info
#define MARIA_COLUMNDEF_SIZE (2*7+1+1+4) #define MARIA_COLUMNDEF_SIZE (2*7+1+1+4)
#define MARIA_BASE_INFO_SIZE (MY_UUID_SIZE + 5*8 + 6*4 + 11*2 + 6 + 5*2 + 1 + 16) #define MARIA_BASE_INFO_SIZE (MY_UUID_SIZE + 5*8 + 6*4 + 11*2 + 6 + 5*2 + 1 + 16)
#define MARIA_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */ #define MARIA_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */
#define MARIA_MAX_POINTER_LENGTH 7 /* Node pointer */
/* Internal management bytes needed to store 2 transid/key on an index page */ /* Internal management bytes needed to store 2 transid/key on an index page */
#define MARIA_MAX_PACK_TRANSID_SIZE (TRANSID_SIZE+1) #define MARIA_MAX_PACK_TRANSID_SIZE (TRANSID_SIZE+1)
#define MARIA_TRANSID_PACK_OFFSET (256- TRANSID_SIZE - 1) #define MARIA_TRANSID_PACK_OFFSET (256- TRANSID_SIZE - 1)
#define MARIA_MIN_TRANSID_PACK_OFFSET (MARIA_TRANSID_PACK_OFFSET-TRANSID_SIZE) #define MARIA_MIN_TRANSID_PACK_OFFSET (MARIA_TRANSID_PACK_OFFSET-TRANSID_SIZE)
#define MARIA_INDEX_OVERHEAD_SIZE (MARIA_MAX_PACK_TRANSID_SIZE * 2) #define MARIA_INDEX_OVERHEAD_SIZE (MARIA_MAX_PACK_TRANSID_SIZE * 2 + \
MARIA_MAX_POINTER_LENGTH)
#define MARIA_DELETE_KEY_NR 255 /* keynr for deleted blocks */ #define MARIA_DELETE_KEY_NR 255 /* keynr for deleted blocks */
/* /*
......
...@@ -157,10 +157,6 @@ struct trx_i_s_cache_struct { ...@@ -157,10 +157,6 @@ struct trx_i_s_cache_struct {
ullint last_read; /*!< last time the cache was read; ullint last_read; /*!< last time the cache was read;
measured in microseconds since measured in microseconds since
epoch */ epoch */
mutex_t last_read_mutex;/*!< mutex protecting the
last_read member - it is updated
inside a shared lock of the
rw_lock member */
i_s_table_cache_t innodb_trx; /*!< innodb_trx table */ i_s_table_cache_t innodb_trx; /*!< innodb_trx table */
i_s_table_cache_t innodb_locks; /*!< innodb_locks table */ i_s_table_cache_t innodb_locks; /*!< innodb_locks table */
i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */ i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */
...@@ -1101,13 +1097,6 @@ can_cache_be_updated( ...@@ -1101,13 +1097,6 @@ can_cache_be_updated(
{ {
ullint now; ullint now;
/* Here we read cache->last_read without acquiring its mutex
because last_read is only updated when a shared rw lock on the
whole cache is being held (see trx_i_s_cache_end_read()) and
we are currently holding an exclusive rw lock on the cache.
So it is not possible for last_read to be updated while we are
reading it. */
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX)); ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
#endif #endif
...@@ -1205,6 +1194,12 @@ trx_i_s_possibly_fetch_data_into_cache( ...@@ -1205,6 +1194,12 @@ trx_i_s_possibly_fetch_data_into_cache(
/*===================================*/ /*===================================*/
trx_i_s_cache_t* cache) /*!< in/out: cache */ trx_i_s_cache_t* cache) /*!< in/out: cache */
{ {
ullint now;
#ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
#endif
if (!can_cache_be_updated(cache)) { if (!can_cache_be_updated(cache)) {
return(1); return(1);
...@@ -1217,6 +1212,10 @@ trx_i_s_possibly_fetch_data_into_cache( ...@@ -1217,6 +1212,10 @@ trx_i_s_possibly_fetch_data_into_cache(
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
/* update cache last read time */
now = ut_time_us(NULL);
cache->last_read = now;
return(0); return(0);
} }
...@@ -1247,16 +1246,12 @@ trx_i_s_cache_init( ...@@ -1247,16 +1246,12 @@ trx_i_s_cache_init(
release kernel_mutex release kernel_mutex
release trx_i_s_cache_t::rw_lock release trx_i_s_cache_t::rw_lock
acquire trx_i_s_cache_t::rw_lock, S acquire trx_i_s_cache_t::rw_lock, S
acquire trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::rw_lock */ release trx_i_s_cache_t::rw_lock */
rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK); rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0; cache->last_read = 0;
mutex_create(&cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t)); table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t)); table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
table_cache_init(&cache->innodb_lock_waits, table_cache_init(&cache->innodb_lock_waits,
...@@ -1307,18 +1302,10 @@ trx_i_s_cache_end_read( ...@@ -1307,18 +1302,10 @@ trx_i_s_cache_end_read(
/*===================*/ /*===================*/
trx_i_s_cache_t* cache) /*!< in: cache */ trx_i_s_cache_t* cache) /*!< in: cache */
{ {
ullint now;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED)); ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED));
#endif #endif
/* update cache last read time */
now = ut_time_us(NULL);
mutex_enter(&cache->last_read_mutex);
cache->last_read = now;
mutex_exit(&cache->last_read_mutex);
rw_lock_s_unlock(&cache->rw_lock); rw_lock_s_unlock(&cache->rw_lock);
} }
......
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