Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0d6bfafd
Commit
0d6bfafd
authored
Oct 24, 2007
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Merge 1937:2015 from trunk.
parent
03fcaeec
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
57 deletions
+176
-57
dict/dict0load.c
dict/dict0load.c
+44
-28
handler/ha_innodb.cc
handler/ha_innodb.cc
+33
-21
include/db0err.h
include/db0err.h
+5
-0
include/univ.i
include/univ.i
+10
-8
mysql-test/innodb-semi-consistent-master.opt
mysql-test/innodb-semi-consistent-master.opt
+1
-0
mysql-test/innodb-semi-consistent.result
mysql-test/innodb-semi-consistent.result
+36
-0
mysql-test/innodb-semi-consistent.test
mysql-test/innodb-semi-consistent.test
+46
-0
row/row0sel.c
row/row0sel.c
+1
-0
No files found.
dict/dict0load.c
View file @
0d6bfafd
...
@@ -581,11 +581,13 @@ next_rec:
...
@@ -581,11 +581,13 @@ next_rec:
Loads definitions for table indexes. Adds them to the data dictionary
Loads definitions for table indexes. Adds them to the data dictionary
cache. */
cache. */
static
static
ibool
ulint
dict_load_indexes
(
dict_load_indexes
(
/*==============*/
/*==============*/
/* out: TRUE if ok, FALSE if corruption
/* out: DB_SUCCESS if ok, DB_CORRUPTION
of dictionary table */
if corruption of dictionary table or
DB_UNSUPPORTED if table has unknown index
type */
dict_table_t
*
table
,
/* in: table */
dict_table_t
*
table
,
/* in: table */
mem_heap_t
*
heap
)
/* in: memory heap for temporary storage */
mem_heap_t
*
heap
)
/* in: memory heap for temporary storage */
{
{
...
@@ -608,6 +610,7 @@ dict_load_indexes(
...
@@ -608,6 +610,7 @@ dict_load_indexes(
ibool
is_sys_table
;
ibool
is_sys_table
;
dulint
id
;
dulint
id
;
mtr_t
mtr
;
mtr_t
mtr
;
ulint
error
=
DB_SUCCESS
;
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
@@ -676,7 +679,18 @@ dict_load_indexes(
...
@@ -676,7 +679,18 @@ dict_load_indexes(
field
=
rec_get_nth_field_old
(
rec
,
8
,
&
len
);
field
=
rec_get_nth_field_old
(
rec
,
8
,
&
len
);
page_no
=
mach_read_from_4
(
field
);
page_no
=
mach_read_from_4
(
field
);
if
(
page_no
==
FIL_NULL
)
{
/* We check for unsupported types first, so that the
subsequent checks are relevant for the supported types. */
if
(
type
&
~
(
DICT_CLUSTERED
|
DICT_UNIQUE
))
{
fprintf
(
stderr
,
"InnoDB: Error: unknown type %lu"
" of index %s of table %s
\n
"
,
(
ulong
)
type
,
name_buf
,
table
->
name
);
error
=
DB_UNSUPPORTED
;
goto
func_exit
;
}
else
if
(
page_no
==
FIL_NULL
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"InnoDB: Error: trying to load index %s"
"InnoDB: Error: trying to load index %s"
...
@@ -684,14 +698,10 @@ dict_load_indexes(
...
@@ -684,14 +698,10 @@ dict_load_indexes(
"InnoDB: but the index tree has been freed!
\n
"
,
"InnoDB: but the index tree has been freed!
\n
"
,
name_buf
,
table
->
name
);
name_buf
,
table
->
name
);
btr_pcur_close
(
&
pcur
);
error
=
DB_CORRUPTION
;
mtr_commit
(
&
mtr
);
goto
func_exit
;
}
else
if
((
type
&
DICT_CLUSTERED
)
==
0
return
(
FALSE
);
&&
NULL
==
dict_table_get_first_index
(
table
))
{
}
if
((
type
&
DICT_CLUSTERED
)
==
0
&&
NULL
==
dict_table_get_first_index
(
table
))
{
fputs
(
"InnoDB: Error: trying to load index "
,
fputs
(
"InnoDB: Error: trying to load index "
,
stderr
);
stderr
);
...
@@ -701,18 +711,14 @@ dict_load_indexes(
...
@@ -701,18 +711,14 @@ dict_load_indexes(
fputs
(
"
\n
InnoDB: but the first index"
fputs
(
"
\n
InnoDB: but the first index"
" is not clustered!
\n
"
,
stderr
);
" is not clustered!
\n
"
,
stderr
);
btr_pcur_close
(
&
pcur
);
error
=
DB_CORRUPTION
;
mtr_commit
(
&
mtr
);
goto
func_exit
;
}
else
if
(
is_sys_table
return
(
FALSE
);
&&
((
type
&
DICT_CLUSTERED
)
}
||
((
table
==
dict_sys
->
sys_tables
)
&&
(
name_len
==
(
sizeof
"ID_IND"
)
-
1
)
if
(
is_sys_table
&&
(
0
==
ut_memcmp
(
name_buf
,
&&
((
type
&
DICT_CLUSTERED
)
"ID_IND"
,
name_len
)))))
{
||
((
table
==
dict_sys
->
sys_tables
)
&&
(
name_len
==
(
sizeof
"ID_IND"
)
-
1
)
&&
(
0
==
ut_memcmp
(
name_buf
,
"ID_IND"
,
name_len
)))))
{
/* The index was created in memory already at booting
/* The index was created in memory already at booting
of the database server */
of the database server */
...
@@ -729,10 +735,11 @@ next_rec:
...
@@ -729,10 +735,11 @@ next_rec:
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
}
}
func_exit:
btr_pcur_close
(
&
pcur
);
btr_pcur_close
(
&
pcur
);
mtr_commit
(
&
mtr
);
mtr_commit
(
&
mtr
);
return
(
TRUE
);
return
(
error
);
}
}
/************************************************************************
/************************************************************************
...
@@ -890,11 +897,20 @@ err_exit:
...
@@ -890,11 +897,20 @@ err_exit:
mem_heap_empty
(
heap
);
mem_heap_empty
(
heap
);
dict_load_indexes
(
table
,
heap
);
err
=
dict_load_indexes
(
table
,
heap
);
#ifndef UNIV_HOTBACKUP
#ifndef UNIV_HOTBACKUP
err
=
dict_load_foreigns
(
table
->
name
,
TRUE
);
/* If the force recovery flag is set, we open the table irrespective
of the error condition, since the user may want to dump data from the
clustered index. However we load the foreign key information only if
all indexes were loaded. */
if
(
err
!=
DB_SUCCESS
&&
!
srv_force_recovery
)
{
dict_mem_table_free
(
table
);
table
=
NULL
;
}
else
if
(
err
==
DB_SUCCESS
)
{
err
=
dict_load_foreigns
(
table
->
name
,
TRUE
);
}
# if 0
# if 0
if
(
err
!=
DB_SUCCESS
)
{
if
(
err
!=
DB_SUCCESS
&&
table
!=
NULL
)
{
mutex_enter
(
&
dict_foreign_err_mutex
);
mutex_enter
(
&
dict_foreign_err_mutex
);
...
...
handler/ha_innodb.cc
View file @
0d6bfafd
...
@@ -2384,13 +2384,18 @@ ha_innobase::open(
...
@@ -2384,13 +2384,18 @@ ha_innobase::open(
if
(
NULL
==
ib_table
)
{
if
(
NULL
==
ib_table
)
{
ut_print_timestamp
(
stderr
);
ut_print_timestamp
(
stderr
);
sql_print_error
(
"Cannot find table %s from the internal data "
sql_print_error
(
"Cannot find or open table %s from
\n
"
"dictionary
\n
of InnoDB though the .frm file "
"the internal data dictionary of InnoDB "
"for the table exists. Maybe you
\n
have "
"though the .frm file for the
\n
"
"deleted and recreated InnoDB data files but "
"table exists. Maybe you have deleted and "
"have forgotten
\n
to delete the corresponding "
"recreated InnoDB data
\n
"
".frm files of InnoDB tables, or you
\n
"
"files but have forgotten to delete the "
"have moved .frm files to another database?
\n
"
"corresponding .frm files
\n
"
"of InnoDB tables, or you have moved .frm "
"files to another database?
\n
"
"or, the table contains indexes that this "
"version of the engine
\n
"
"doesn't support.
\n
"
"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html
\n
"
"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html
\n
"
"how you can resolve the problem.
\n
"
,
"how you can resolve the problem.
\n
"
,
norm_name
);
norm_name
);
...
@@ -3544,6 +3549,7 @@ no_commit:
...
@@ -3544,6 +3549,7 @@ no_commit:
/* Handle duplicate key errors */
/* Handle duplicate key errors */
if
(
auto_inc_used
)
{
if
(
auto_inc_used
)
{
ulint
err
;
ulonglong
auto_inc
;
ulonglong
auto_inc
;
/* Note the number of rows processed for this statement, used
/* Note the number of rows processed for this statement, used
...
@@ -3596,7 +3602,11 @@ set_max_autoinc:
...
@@ -3596,7 +3602,11 @@ set_max_autoinc:
ut_a
(
prebuilt
->
table
->
autoinc_increment
>
0
);
ut_a
(
prebuilt
->
table
->
autoinc_increment
>
0
);
auto_inc
+=
prebuilt
->
table
->
autoinc_increment
;
auto_inc
+=
prebuilt
->
table
->
autoinc_increment
;
innobase_set_max_autoinc
(
auto_inc
);
err
=
innobase_set_max_autoinc
(
auto_inc
);
if
(
err
!=
DB_SUCCESS
)
{
error
=
err
;
}
}
}
break
;
break
;
}
}
...
@@ -3829,7 +3839,7 @@ ha_innobase::update_row(
...
@@ -3829,7 +3839,7 @@ ha_innobase::update_row(
if
(
auto_inc
!=
0
)
{
if
(
auto_inc
!=
0
)
{
auto_inc
+=
prebuilt
->
table
->
autoinc_increment
;
auto_inc
+=
prebuilt
->
table
->
autoinc_increment
;
innobase_set_max_autoinc
(
auto_inc
);
error
=
innobase_set_max_autoinc
(
auto_inc
);
}
}
}
}
...
@@ -7288,8 +7298,8 @@ the value of the auto-inc counter. */
...
@@ -7288,8 +7298,8 @@ the value of the auto-inc counter. */
int
int
ha_innobase
::
innobase_read_and_init_auto_inc
(
ha_innobase
::
innobase_read_and_init_auto_inc
(
/*=========================================*/
/*=========================================*/
/* out: 0 or
error code:
/* out: 0 or
generic MySQL
deadlock or lock wait timeout
*/
error code
*/
longlong
*
value
)
/* out: the autoinc value */
longlong
*
value
)
/* out: the autoinc value */
{
{
longlong
auto_inc
;
longlong
auto_inc
;
...
@@ -7346,9 +7356,9 @@ ha_innobase::innobase_read_and_init_auto_inc(
...
@@ -7346,9 +7356,9 @@ ha_innobase::innobase_read_and_init_auto_inc(
++
auto_inc
;
++
auto_inc
;
dict_table_autoinc_initialize
(
innodb_table
,
auto_inc
);
dict_table_autoinc_initialize
(
innodb_table
,
auto_inc
);
}
else
{
}
else
{
fprintf
(
stderr
,
"
InnoDB error: Couldn't read the
"
fprintf
(
stderr
,
"
InnoDB error (%lu): Couldn't read
"
"
max AUTOINC value from
index (%s).
\n
"
,
"
the max AUTOINC value from the
index (%s).
\n
"
,
index
->
name
);
error
,
index
->
name
);
mysql_error
=
1
;
mysql_error
=
1
;
}
}
...
@@ -7432,7 +7442,16 @@ ha_innobase::innobase_get_auto_increment(
...
@@ -7432,7 +7442,16 @@ ha_innobase::innobase_get_auto_increment(
}
else
{
}
else
{
*
value
=
(
ulonglong
)
autoinc
;
*
value
=
(
ulonglong
)
autoinc
;
}
}
/* A deadlock error during normal processing is OK
and can be ignored. */
}
else
if
(
error
!=
DB_DEADLOCK
)
{
ut_print_timestamp
(
stderr
);
sql_print_error
(
" InnoDB Error %lu in "
"::innobase_get_auto_increment()"
,
error
);
}
}
}
while
(
*
value
==
0
&&
error
==
DB_SUCCESS
);
}
while
(
*
value
==
0
&&
error
==
DB_SUCCESS
);
return
(
error
);
return
(
error
);
...
@@ -7465,13 +7484,6 @@ ha_innobase::get_auto_increment(
...
@@ -7465,13 +7484,6 @@ ha_innobase::get_auto_increment(
error
=
innobase_get_auto_increment
(
&
autoinc
);
error
=
innobase_get_auto_increment
(
&
autoinc
);
if
(
error
!=
DB_SUCCESS
)
{
if
(
error
!=
DB_SUCCESS
)
{
/* This should never happen in the code > ver 5.0.6,
since we call this function only after the counter
has been initialized. */
ut_print_timestamp
(
stderr
);
sql_print_error
(
"Error %lu in ::get_auto_increment()"
,
error
);
*
first_value
=
(
~
(
ulonglong
)
0
);
*
first_value
=
(
~
(
ulonglong
)
0
);
return
;
return
;
}
}
...
...
include/db0err.h
View file @
0d6bfafd
...
@@ -69,6 +69,11 @@ Created 5/24/1996 Heikki Tuuri
...
@@ -69,6 +69,11 @@ Created 5/24/1996 Heikki Tuuri
#define DB_PRIMARY_KEY_IS_NULL 48
/* a column in the PRIMARY KEY
#define DB_PRIMARY_KEY_IS_NULL 48
/* a column in the PRIMARY KEY
was found to be NULL */
was found to be NULL */
#define DB_UNSUPPORTED 49
/* when InnoDB sees any artefact or
a feature that it can't recoginize or
work with e.g., FT indexes created by
a later version of the engine. */
/* The following are partial failure codes */
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_FAIL 1000
#define DB_OVERFLOW 1001
#define DB_OVERFLOW 1001
...
...
include/univ.i
View file @
0d6bfafd
...
@@ -329,20 +329,22 @@ typedef void* os_thread_ret_t;
...
@@ -329,20 +329,22 @@ typedef void* os_thread_ret_t;
#
define
UNIV_MEM_DESC
(
addr
,
size
,
b
)
VALGRIND_CREATE_BLOCK
(
addr
,
size
,
b
)
#
define
UNIV_MEM_DESC
(
addr
,
size
,
b
)
VALGRIND_CREATE_BLOCK
(
addr
,
size
,
b
)
#
define
UNIV_MEM_UNDESC
(
b
)
VALGRIND_DISCARD
(
b
)
#
define
UNIV_MEM_UNDESC
(
b
)
VALGRIND_DISCARD
(
b
)
#
define
UNIV_MEM_ASSERT_RW
(
addr
,
size
)
do
{
\
#
define
UNIV_MEM_ASSERT_RW
(
addr
,
size
)
do
{
\
const
void
*
_p
=
(
const
void
*
)
\
const
void
*
_p
=
(
const
void
*
)
(
ulint
)
\
VALGRIND_CHECK_MEM_IS_DEFINED
(
addr
,
size
)
;
\
VALGRIND_CHECK_MEM_IS_DEFINED
(
addr
,
size
)
;
\
if
(
UNIV_LIKELY_NULL
(
_p
))
\
if
(
UNIV_LIKELY_NULL
(
_p
))
\
fprintf
(
stderr
,
"%p[%u] undefined at %d
\n
"
,
\
fprintf
(
stderr
,
"%s:%d: %p[%u] undefined at %ld
\n
"
,
\
(
const
void
*
)
(
addr
),
(
unsigned
)
(
size
),
\
__FILE__
,
__LINE__
,
\
((
const
char
*
)
_p
)
-
((
const
char
*
)
(
addr
)))
;
\
(
const
void
*
)
(
addr
),
(
unsigned
)
(
size
),
(
long
)
\
(((
const
char
*
)
_p
)
-
((
const
char
*
)
(
addr
))))
;
\
}
while
(
0
)
}
while
(
0
)
#
define
UNIV_MEM_ASSERT_W
(
addr
,
size
)
do
{
\
#
define
UNIV_MEM_ASSERT_W
(
addr
,
size
)
do
{
\
const
void
*
_p
=
(
const
void
*
)
\
const
void
*
_p
=
(
const
void
*
)
(
ulint
)
\
VALGRIND_CHECK_MEM_IS_ADDRESSABLE
(
addr
,
size
)
;
\
VALGRIND_CHECK_MEM_IS_ADDRESSABLE
(
addr
,
size
)
;
\
if
(
UNIV_LIKELY_NULL
(
_p
))
\
if
(
UNIV_LIKELY_NULL
(
_p
))
\
fprintf
(
stderr
,
"%p[%u] unwritable at %d
\n
"
,
\
fprintf
(
stderr
,
"%s:%d: %p[%u] unwritable at %ld
\n
"
,
\
(
const
void
*
)
(
addr
),
(
unsigned
)
(
size
),
\
__FILE__
,
__LINE__
,
\
((
const
char
*
)
_p
)
-
((
const
char
*
)
(
addr
)))
;
\
(
const
void
*
)
(
addr
),
(
unsigned
)
(
size
),
(
long
)
\
(((
const
char
*
)
_p
)
-
((
const
char
*
)
(
addr
))))
;
\
}
while
(
0
)
}
while
(
0
)
#
else
#
else
#
define
UNIV_MEM_VALID
(
addr
,
size
)
do
{}
while
(
0
)
#
define
UNIV_MEM_VALID
(
addr
,
size
)
do
{}
while
(
0
)
...
...
mysql-test/innodb-semi-consistent-master.opt
0 → 100644
View file @
0d6bfafd
--innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=2
mysql-test/innodb-semi-consistent.result
0 → 100644
View file @
0d6bfafd
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
select * from t1 where a=3 lock in share mode;
a
3
set session transaction isolation level read committed;
set autocommit=0;
update t1 set a=10 where a=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
update t1 set a=10 where a=5;
select * from t1 where a=2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1 where a=2 limit 1 for update;
a
2
update t1 set a=11 where a=6;
update t1 set a=12 where a=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t1 set a=13 where a=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
update t1 set a=14 where a=1;
commit;
select * from t1;
a
14
2
3
4
10
11
7
drop table t1;
mysql-test/innodb-semi-consistent.test
0 → 100644
View file @
0d6bfafd
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_innodb
.
inc
# basic tests of semi-consistent reads
connect
(
a
,
localhost
,
root
,,);
connect
(
b
,
localhost
,
root
,,);
connection
a
;
set
session
transaction
isolation
level
read
committed
;
create
table
t1
(
a
int
not
null
)
engine
=
innodb
DEFAULT
CHARSET
=
latin1
;
insert
into
t1
values
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
);
set
autocommit
=
0
;
# this should lock the entire table
select
*
from
t1
where
a
=
3
lock
in
share
mode
;
connection
b
;
set
session
transaction
isolation
level
read
committed
;
set
autocommit
=
0
;
--
error
ER_LOCK_WAIT_TIMEOUT
update
t1
set
a
=
10
where
a
=
5
;
connection
a
;
commit
;
connection
b
;
update
t1
set
a
=
10
where
a
=
5
;
connection
a
;
--
error
ER_LOCK_WAIT_TIMEOUT
select
*
from
t1
where
a
=
2
for
update
;
# this should lock the records (1),(2)
select
*
from
t1
where
a
=
2
limit
1
for
update
;
connection
b
;
update
t1
set
a
=
11
where
a
=
6
;
--
error
ER_LOCK_WAIT_TIMEOUT
update
t1
set
a
=
12
where
a
=
2
;
--
error
ER_LOCK_WAIT_TIMEOUT
update
t1
set
a
=
13
where
a
=
1
;
connection
a
;
commit
;
connection
b
;
update
t1
set
a
=
14
where
a
=
1
;
commit
;
connection
a
;
select
*
from
t1
;
drop
table
t1
;
connection
default
;
disconnect
a
;
disconnect
b
;
row/row0sel.c
View file @
0d6bfafd
...
@@ -4079,6 +4079,7 @@ no_gap_lock:
...
@@ -4079,6 +4079,7 @@ no_gap_lock:
mutex_enter
(
&
kernel_mutex
);
mutex_enter
(
&
kernel_mutex
);
if
(
trx
->
was_chosen_as_deadlock_victim
)
{
if
(
trx
->
was_chosen_as_deadlock_victim
)
{
mutex_exit
(
&
kernel_mutex
);
mutex_exit
(
&
kernel_mutex
);
err
=
DB_DEADLOCK
;
goto
lock_wait_or_error
;
goto
lock_wait_or_error
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment