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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7410b6cb
Commit
7410b6cb
authored
May 03, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem where key_read was not cleaned up properly, which caused assert in innodb test.
parent
9e4f394e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
30 deletions
+52
-30
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+23
-11
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+2
-2
sql/opt_sum.cc
sql/opt_sum.cc
+10
-4
sql/sql_base.cc
sql/sql_base.cc
+3
-2
sql/sql_update.cc
sql/sql_update.cc
+14
-11
No files found.
mysql-test/r/innodb.result
View file @
7410b6cb
...
@@ -1139,7 +1139,7 @@ a b
...
@@ -1139,7 +1139,7 @@ a b
drop table t1;
drop table t1;
CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb;
CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb;
CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb;
CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
,(10,10),(11,11),(12,12)
;
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
update t1,t2 set t1.a=t1.a+100;
update t1,t2 set t1.a=t1.a+100;
select * from t1;
select * from t1;
...
@@ -1153,6 +1153,9 @@ a b
...
@@ -1153,6 +1153,9 @@ a b
107 7
107 7
108 8
108 8
109 9
109 9
110 10
111 11
112 12
update t1,t2 set t1.a=t1.a+100 where t1.a=101;
update t1,t2 set t1.a=t1.a+100 where t1.a=101;
select * from t1;
select * from t1;
a b
a b
...
@@ -1165,6 +1168,9 @@ a b
...
@@ -1165,6 +1168,9 @@ a b
107 7
107 7
108 8
108 8
109 9
109 9
110 10
111 11
112 12
update t1,t2 set t1.b=t1.b+10 where t1.b=2;
update t1,t2 set t1.b=t1.b+10 where t1.b=2;
select * from t1;
select * from t1;
a b
a b
...
@@ -1176,8 +1182,11 @@ a b
...
@@ -1176,8 +1182,11 @@ a b
107 7
107 7
108 8
108 8
109 9
109 9
110 10
111 11
102 12
102 12
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b where t1.b between 3 and 5;
112 12
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
select * from t1;
select * from t1;
a b
a b
201 1
201 1
...
@@ -1188,18 +1197,21 @@ a b
...
@@ -1188,18 +1197,21 @@ a b
107 7
107 7
108 8
108 8
109 9
109 9
110 10
111 11
102 12
102 12
112 12
select * from t2;
select * from t2;
a b
a b
1
5
1
1
2
5
2
2
3 5
6 6
4 5
7 7
5 5
8 8
6 5
9 9
7 5
3 13
8 5
4 14
9
5
5 1
5
drop table t1,t2;
drop table t1,t2;
create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb;
create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb;
create table t2 (a int not null auto_increment primary key, b int);
create table t2 (a int not null auto_increment primary key, b int);
...
...
mysql-test/t/innodb.test
View file @
7410b6cb
...
@@ -776,7 +776,7 @@ drop table t1;
...
@@ -776,7 +776,7 @@ drop table t1;
CREATE
TABLE
t1
(
a
int
not
null
primary
key
,
b
int
not
null
,
key
(
b
))
type
=
innodb
;
CREATE
TABLE
t1
(
a
int
not
null
primary
key
,
b
int
not
null
,
key
(
b
))
type
=
innodb
;
CREATE
TABLE
t2
(
a
int
not
null
primary
key
,
b
int
not
null
,
key
(
b
))
type
=
innodb
;
CREATE
TABLE
t2
(
a
int
not
null
primary
key
,
b
int
not
null
,
key
(
b
))
type
=
innodb
;
INSERT
INTO
t1
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
INSERT
INTO
t1
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
)
,(
10
,
10
),(
11
,
11
),(
12
,
12
)
;
INSERT
INTO
t2
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
INSERT
INTO
t2
values
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
# Full join, without key
# Full join, without key
...
@@ -792,7 +792,7 @@ update t1,t2 set t1.b=t1.b+10 where t1.b=2;
...
@@ -792,7 +792,7 @@ update t1,t2 set t1.b=t1.b+10 where t1.b=2;
select
*
from
t1
;
select
*
from
t1
;
# Range key (in t1)
# Range key (in t1)
update
t1
,
t2
set
t1
.
b
=
t1
.
b
+
2
,
t2
.
b
=
t1
.
b
where
t1
.
b
between
3
and
5
;
update
t1
,
t2
set
t1
.
b
=
t1
.
b
+
2
,
t2
.
b
=
t1
.
b
+
10
where
t1
.
b
between
3
and
5
and
t1
.
a
=
t2
.
a
+
100
;
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t2
;
select
*
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
...
sql/opt_sum.cc
View file @
7410b6cb
...
@@ -191,13 +191,13 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -191,13 +191,13 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
ref
.
key_buff
=
key_buff
;
ref
.
key_buff
=
key_buff
;
TABLE
*
table
=
((
Item_field
*
)
expr
)
->
field
->
table
;
TABLE
*
table
=
((
Item_field
*
)
expr
)
->
field
->
table
;
if
((
outer_tables
&
table
->
map
)
||
if
((
table
->
file
->
table_flags
()
&
HA_NOT_READ_AFTER_KEY
))
!
find_range_key
(
&
ref
,
((
Item_field
*
)
expr
)
->
field
,
conds
))
{
{
const_result
=
0
;
const_result
=
0
;
break
;
break
;
}
}
if
((
table
->
file
->
table_flags
()
&
HA_NOT_READ_AFTER_KEY
))
if
((
outer_tables
&
table
->
map
)
||
!
find_range_key
(
&
ref
,
((
Item_field
*
)
expr
)
->
field
,
conds
))
{
{
const_result
=
0
;
const_result
=
0
;
break
;
break
;
...
@@ -348,7 +348,13 @@ bool part_of_cond(COND *cond,Field *field)
...
@@ -348,7 +348,13 @@ bool part_of_cond(COND *cond,Field *field)
}
}
/* Check if we can get value for field by using a key */
/*
Check if we can get value for field by using a key
NOTES
This function may set table->key_read to 1, which must be reset after
index is used! (This can only happen when function returns 1)
*/
static
bool
find_range_key
(
TABLE_REF
*
ref
,
Field
*
field
,
COND
*
cond
)
static
bool
find_range_key
(
TABLE_REF
*
ref
,
Field
*
field
,
COND
*
cond
)
{
{
...
...
sql/sql_base.cc
View file @
7410b6cb
...
@@ -482,8 +482,9 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
...
@@ -482,8 +482,9 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
{
{
DBUG_ENTER
(
"close_thread_table"
);
DBUG_ENTER
(
"close_thread_table"
);
bool
found_old_table
=
0
;
bool
found_old_table
=
0
;
TABLE
*
table
=*
table_ptr
;
TABLE
*
table
=
*
table_ptr
;
DBUG_ASSERT
(
table
->
key_read
==
0
);
*
table_ptr
=
table
->
next
;
*
table_ptr
=
table
->
next
;
if
(
table
->
version
!=
refresh_version
||
if
(
table
->
version
!=
refresh_version
||
...
...
sql/sql_update.cc
View file @
7410b6cb
...
@@ -62,6 +62,7 @@ int mysql_update(THD *thd,
...
@@ -62,6 +62,7 @@ int mysql_update(THD *thd,
int
error
=
0
;
int
error
=
0
;
uint
used_index
,
want_privilege
;
uint
used_index
,
want_privilege
;
ulong
query_id
=
thd
->
query_id
,
timestamp_query_id
;
ulong
query_id
=
thd
->
query_id
,
timestamp_query_id
;
ha_rows
updated
,
found
;
key_map
old_used_keys
;
key_map
old_used_keys
;
TABLE
*
table
;
TABLE
*
table
;
SQL_SELECT
*
select
;
SQL_SELECT
*
select
;
...
@@ -192,9 +193,8 @@ int mysql_update(THD *thd,
...
@@ -192,9 +193,8 @@ int mysql_update(THD *thd,
limit
,
&
examined_rows
))
==
limit
,
&
examined_rows
))
==
HA_POS_ERROR
)
HA_POS_ERROR
)
{
{
delete
select
;
free_io_cache
(
table
);
free_io_cache
(
table
);
DBUG_RETURN
(
-
1
)
;
goto
err
;
}
}
/*
/*
Filesort has already found and selected the rows we want to update,
Filesort has already found and selected the rows we want to update,
...
@@ -214,10 +214,7 @@ int mysql_update(THD *thd,
...
@@ -214,10 +214,7 @@ int mysql_update(THD *thd,
IO_CACHE
tempfile
;
IO_CACHE
tempfile
;
if
(
open_cached_file
(
&
tempfile
,
mysql_tmpdir
,
TEMP_PREFIX
,
if
(
open_cached_file
(
&
tempfile
,
mysql_tmpdir
,
TEMP_PREFIX
,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
{
goto
err
;
delete
select
;
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
}
init_read_record
(
&
info
,
thd
,
table
,
select
,
0
,
1
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
0
,
1
);
thd
->
proc_info
=
"Searching rows for update"
;
thd
->
proc_info
=
"Searching rows for update"
;
...
@@ -256,10 +253,7 @@ int mysql_update(THD *thd,
...
@@ -256,10 +253,7 @@ int mysql_update(THD *thd,
error
=
1
;
/* purecov: inspected */
error
=
1
;
/* purecov: inspected */
select
->
file
=
tempfile
;
// Read row ptrs from this file
select
->
file
=
tempfile
;
// Read row ptrs from this file
if
(
error
>=
0
)
if
(
error
>=
0
)
{
goto
err
;
delete
select
;
DBUG_RETURN
(
-
1
);
}
}
}
if
(
table
->
key_read
)
if
(
table
->
key_read
)
{
{
...
@@ -272,7 +266,7 @@ int mysql_update(THD *thd,
...
@@ -272,7 +266,7 @@ int mysql_update(THD *thd,
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
0
,
1
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
0
,
1
);
ha_rows
updated
=
0L
,
found
=
0L
;
updated
=
found
=
0
;
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
thd
->
cuted_fields
=
0L
;
thd
->
cuted_fields
=
0L
;
thd
->
proc_info
=
"Updating"
;
thd
->
proc_info
=
"Updating"
;
...
@@ -365,6 +359,15 @@ int mysql_update(THD *thd,
...
@@ -365,6 +359,15 @@ int mysql_update(THD *thd,
thd
->
count_cuted_fields
=
0
;
/* calc cuted fields */
thd
->
count_cuted_fields
=
0
;
/* calc cuted fields */
free_io_cache
(
table
);
free_io_cache
(
table
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
err:
delete
select
;
if
(
table
->
key_read
)
{
table
->
key_read
=
0
;
table
->
file
->
extra
(
HA_EXTRA_NO_KEYREAD
);
}
DBUG_RETURN
(
-
1
);
}
}
...
...
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