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
32fb502b
Commit
32fb502b
authored
Sep 28, 2007
by
istruewing@stella.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge stella.local:/home2/mydev/mysql-5.1-amain
into stella.local:/home2/mydev/mysql-5.1-axmrg
parents
7ef6e66b
a14e4f0a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
3 deletions
+57
-3
mysql-test/r/heap_btree.result
mysql-test/r/heap_btree.result
+7
-0
mysql-test/t/heap_btree.test
mysql-test/t/heap_btree.test
+9
-0
sql/table.cc
sql/table.cc
+1
-0
storage/heap/hp_delete.c
storage/heap/hp_delete.c
+0
-3
storage/heap/hp_rfirst.c
storage/heap/hp_rfirst.c
+11
-0
storage/heap/hp_rnext.c
storage/heap/hp_rnext.c
+29
-0
No files found.
mysql-test/r/heap_btree.result
View file @
32fb502b
...
...
@@ -307,6 +307,13 @@ UNIQUE USING BTREE(c1)
) ENGINE= MEMORY DEFAULT CHARSET= utf8;
INSERT INTO t1 VALUES('1'), ('2');
DROP TABLE t1;
CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(1),(2),(2);
DELETE FROM t1 WHERE a=2;
SELECT * FROM t1;
a
1
DROP TABLE t1;
End of 4.1 tests
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
...
...
mysql-test/t/heap_btree.test
View file @
32fb502b
...
...
@@ -213,6 +213,15 @@ CREATE TABLE t1 (
INSERT
INTO
t1
VALUES
(
'1'
),
(
'2'
);
DROP
TABLE
t1
;
#
# BUG#30590 - delete from memory table with composite btree primary key
#
CREATE
TABLE
t1
(
a
INT
,
KEY
USING
BTREE
(
a
))
ENGINE
=
MEMORY
;
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
2
);
DELETE
FROM
t1
WHERE
a
=
2
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
4.1
tests
#
...
...
sql/table.cc
View file @
32fb502b
...
...
@@ -969,6 +969,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
parser_name
.
str
=
(
char
*
)
next_chunk
;
parser_name
.
length
=
strlen
((
char
*
)
next_chunk
);
next_chunk
+=
parser_name
.
length
+
1
;
keyinfo
->
parser
=
my_plugin_lock_by_name
(
NULL
,
&
parser_name
,
MYSQL_FTPARSER_PLUGIN
);
if
(
!
keyinfo
->
parser
)
...
...
storage/heap/hp_delete.c
View file @
32fb502b
...
...
@@ -72,10 +72,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
int
res
;
if
(
flag
)
{
info
->
last_pos
=
NULL
;
/* For heap_rnext/heap_rprev */
info
->
lastkey_len
=
0
;
}
custom_arg
.
keyseg
=
keyinfo
->
seg
;
custom_arg
.
key_length
=
hp_rb_make_key
(
keyinfo
,
info
->
recbuf
,
record
,
recpos
);
...
...
storage/heap/hp_rfirst.c
View file @
32fb502b
...
...
@@ -35,6 +35,17 @@ int heap_rfirst(HP_INFO *info, uchar *record, int inx)
sizeof
(
uchar
*
));
info
->
current_ptr
=
pos
;
memcpy
(
record
,
pos
,
(
size_t
)
share
->
reclength
);
/*
If we're performing index_first on a table that was taken from
table cache, info->lastkey_len is initialized to previous query.
Thus we set info->lastkey_len to proper value for subsequent
heap_rnext() calls.
This is needed for DELETE queries only, otherwise this variable is
not used.
Note that the same workaround may be needed for heap_rlast(), but
for now heap_rlast() is never used for DELETE queries.
*/
info
->
lastkey_len
=
0
;
info
->
update
=
HA_STATE_AKTIV
;
}
else
...
...
storage/heap/hp_rnext.c
View file @
32fb502b
...
...
@@ -33,11 +33,40 @@ int heap_rnext(HP_INFO *info, uchar *record)
heap_rb_param
custom_arg
;
if
(
info
->
last_pos
)
{
/*
We enter this branch for non-DELETE queries after heap_rkey()
or heap_rfirst(). As last key position (info->last_pos) is available,
we only need to climb the tree using tree_search_next().
*/
pos
=
tree_search_next
(
&
keyinfo
->
rb_tree
,
&
info
->
last_pos
,
offsetof
(
TREE_ELEMENT
,
left
),
offsetof
(
TREE_ELEMENT
,
right
));
}
else
if
(
!
info
->
lastkey_len
)
{
/*
We enter this branch only for DELETE queries after heap_rfirst(). E.g.
DELETE FROM t1 WHERE a<10. As last key position is not available
(last key is removed by heap_delete()), we must restart search as it
is done in heap_rfirst().
It should be safe to handle this situation without this branch. That is
branch below should find smallest element in a tree as lastkey_len is
zero. tree_search_edge() is a kind of optimisation here as it should be
faster than tree_search_key().
*/
pos
=
tree_search_edge
(
&
keyinfo
->
rb_tree
,
info
->
parents
,
&
info
->
last_pos
,
offsetof
(
TREE_ELEMENT
,
left
));
}
else
{
/*
We enter this branch only for DELETE queries after heap_rkey(). E.g.
DELETE FROM t1 WHERE a=10. As last key position is not available
(last key is removed by heap_delete()), we must restart search as it
is done in heap_rkey().
*/
custom_arg
.
keyseg
=
keyinfo
->
seg
;
custom_arg
.
key_length
=
info
->
lastkey_len
;
custom_arg
.
search_flag
=
SEARCH_SAME
|
SEARCH_FIND
;
...
...
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