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
7dad8f16
Commit
7dad8f16
authored
Sep 13, 2013
by
Andrew McDonnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip deleted records mid table.
parent
62cb9fbe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
233 additions
and
3 deletions
+233
-3
mysql-test/suite/oqgraph/regression_796647b.result
mysql-test/suite/oqgraph/regression_796647b.result
+221
-0
mysql-test/suite/oqgraph/regression_796647b.test
mysql-test/suite/oqgraph/regression_796647b.test
+6
-0
storage/oqgraph/oqgraph_thunk.cc
storage/oqgraph/oqgraph_thunk.cc
+6
-3
No files found.
mysql-test/suite/oqgraph/regression_796647b.result
0 → 100644
View file @
7dad8f16
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph;
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
PRIMARY KEY (from_id,to_id),
INDEX (to_id)
) ENGINE=MyISAM;
CREATE TABLE graph (
latch VARCHAR(32) NULL,
origid BIGINT UNSIGNED NULL,
destid BIGINT UNSIGNED NULL,
weight DOUBLE NULL,
seq BIGINT UNSIGNED NULL,
linkid BIGINT UNSIGNED NULL,
KEY (latch, origid, destid) USING HASH,
KEY (latch, destid, origid) USING HASH
) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id';
INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1);
INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1);
INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3);
INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5);
SELECT count(*) FROM graph;
count(*)
8
SELECT count(*) FROM graph_base;
count(*)
8
INSERT INTO graph_base(from_id, to_id) VALUES (5,7);
INSERT INTO graph_base(from_id, to_id) VALUES (9,9);
INSERT INTO graph_base(from_id, to_id) VALUES (10,11);
INSERT INTO graph_base(from_id, to_id) VALUES (11,12);
INSERT INTO graph_base(from_id, to_id) VALUES (12,10);
SELECT count(*) FROM graph;
count(*)
13
SELECT count(*) FROM graph_base;
count(*)
13
INSERT INTO graph_base(from_id, to_id) VALUES (11,13);
INSERT INTO graph_base(from_id, to_id) VALUES (10,14);
INSERT INTO graph_base(from_id, to_id) VALUES (14,13);
SELECT count(*) FROM graph;
count(*)
16
SELECT count(*) FROM graph_base;
count(*)
16
DELETE FROM graph_base where from_id=10 and to_id=11;
INSERT INTO graph_base(from_id, to_id) VALUES (10,15);
INSERT INTO graph_base(from_id, to_id) VALUES (15,13);
INSERT INTO graph_base(from_id, to_id) VALUES (10,11);
SELECT count(*) FROM graph;
count(*)
18
SELECT count(*) FROM graph_base;
count(*)
18
INSERT INTO graph_base(from_id, to_id) VALUES (21,22);
INSERT INTO graph_base(from_id, to_id) VALUES (4,17);
INSERT INTO graph_base(from_id, to_id) VALUES (4,16);
INSERT INTO graph_base(from_id, to_id) VALUES (17,18);
INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
SELECT count(*) FROM graph;
count(*)
23
SELECT count(*) FROM graph_base;
count(*)
23
SELECT * from graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
NULL 5 6 1 NULL NULL
NULL 6 5 1 NULL NULL
NULL 5 7 1 NULL NULL
NULL 9 9 1 NULL NULL
NULL 10 15 1 NULL NULL
NULL 11 12 1 NULL NULL
NULL 12 10 1 NULL NULL
NULL 11 13 1 NULL NULL
NULL 10 14 1 NULL NULL
NULL 14 13 1 NULL NULL
NULL 15 13 1 NULL NULL
NULL 10 11 1 NULL NULL
NULL 21 22 1 NULL NULL
NULL 4 17 1 NULL NULL
NULL 4 16 1 NULL NULL
NULL 17 18 1 NULL NULL
NULL 4 6 1 NULL NULL
SELECT * from graph where latch='0';
latch origid destid weight seq linkid
0 NULL NULL NULL NULL 1
0 NULL NULL NULL NULL 2
0 NULL NULL NULL NULL 3
0 NULL NULL NULL NULL 4
0 NULL NULL NULL NULL 5
0 NULL NULL NULL NULL 6
0 NULL NULL NULL NULL 7
0 NULL NULL NULL NULL 9
0 NULL NULL NULL NULL 10
0 NULL NULL NULL NULL 15
0 NULL NULL NULL NULL 11
0 NULL NULL NULL NULL 12
0 NULL NULL NULL NULL 13
0 NULL NULL NULL NULL 14
0 NULL NULL NULL NULL 21
0 NULL NULL NULL NULL 22
0 NULL NULL NULL NULL 17
0 NULL NULL NULL NULL 16
0 NULL NULL NULL NULL 18
SELECT * from graph_base;
from_id to_id
1 2
1 3
2 1
3 1
3 4
4 3
4 6
4 16
4 17
5 6
5 7
6 5
9 9
10 11
10 14
10 15
11 12
11 13
12 10
14 13
15 13
17 18
21 22
# And delete all references to node 5
DELETE FROM graph_base WHERE from_id=5;
DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
# This is currently bogus:
SELECT count(*) FROM graph;
count(*)
21
SELECT count(*) FROM graph_base;
count(*)
21
SELECT * from graph;
latch origid destid weight seq linkid
NULL 1 2 1 NULL NULL
NULL 2 1 1 NULL NULL
NULL 1 3 1 NULL NULL
NULL 3 1 1 NULL NULL
NULL 3 4 1 NULL NULL
NULL 4 3 1 NULL NULL
NULL 6 5 1 NULL NULL
NULL 9 9 1 NULL NULL
NULL 10 15 1 NULL NULL
NULL 11 12 1 NULL NULL
NULL 12 10 1 NULL NULL
NULL 11 13 1 NULL NULL
NULL 10 14 1 NULL NULL
NULL 14 13 1 NULL NULL
NULL 15 13 1 NULL NULL
NULL 10 11 1 NULL NULL
NULL 21 22 1 NULL NULL
NULL 4 17 1 NULL NULL
NULL 4 16 1 NULL NULL
NULL 17 18 1 NULL NULL
NULL 4 6 1 NULL NULL
SELECT * from graph where latch='0';
latch origid destid weight seq linkid
0 NULL NULL NULL NULL 1
0 NULL NULL NULL NULL 2
0 NULL NULL NULL NULL 3
0 NULL NULL NULL NULL 4
0 NULL NULL NULL NULL 6
0 NULL NULL NULL NULL 5
0 NULL NULL NULL NULL 9
0 NULL NULL NULL NULL 10
0 NULL NULL NULL NULL 15
0 NULL NULL NULL NULL 11
0 NULL NULL NULL NULL 12
0 NULL NULL NULL NULL 13
0 NULL NULL NULL NULL 14
0 NULL NULL NULL NULL 21
0 NULL NULL NULL NULL 22
0 NULL NULL NULL NULL 17
0 NULL NULL NULL NULL 16
0 NULL NULL NULL NULL 18
SELECT * from graph_base;
from_id to_id
1 2
1 3
2 1
3 1
3 4
4 3
4 6
4 16
4 17
6 5
9 9
10 11
10 14
10 15
11 12
11 13
12 10
14 13
15 13
17 18
21 22
DELETE FROM graph_base;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
DROP TABLE graph_base;
DROP TABLE graph;
mysql-test/suite/oqgraph/regression_796647b.test
View file @
7dad8f16
...
@@ -65,6 +65,9 @@ INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
...
@@ -65,6 +65,9 @@ INSERT INTO graph_base (from_id,to_id) VALUES (4,6);
#-- we get a segfault
#-- we get a segfault
SELECT
count
(
*
)
FROM
graph
;
SELECT
count
(
*
)
FROM
graph
;
SELECT
count
(
*
)
FROM
graph_base
;
SELECT
count
(
*
)
FROM
graph_base
;
SELECT
*
from
graph
;
SELECT
*
from
graph
where
latch
=
'0'
;
SELECT
*
from
graph_base
;
--
echo
# And delete all references to node 5
--
echo
# And delete all references to node 5
DELETE
FROM
graph_base
WHERE
from_id
=
5
;
DELETE
FROM
graph_base
WHERE
from_id
=
5
;
...
@@ -76,6 +79,9 @@ DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
...
@@ -76,6 +79,9 @@ DELETE FROM graph_base WHERE from_id=3 AND to_id=5;
--
echo
# This is currently bogus:
--
echo
# This is currently bogus:
SELECT
count
(
*
)
FROM
graph
;
SELECT
count
(
*
)
FROM
graph
;
SELECT
count
(
*
)
FROM
graph_base
;
SELECT
count
(
*
)
FROM
graph_base
;
SELECT
*
from
graph
;
SELECT
*
from
graph
where
latch
=
'0'
;
SELECT
*
from
graph_base
;
DELETE
FROM
graph_base
;
DELETE
FROM
graph_base
;
...
...
storage/oqgraph/oqgraph_thunk.cc
View file @
7dad8f16
...
@@ -286,8 +286,11 @@ int oqgraph3::cursor::seek_next()
...
@@ -286,8 +286,11 @@ int oqgraph3::cursor::seek_next()
if
(
_index
<
0
)
if
(
_index
<
0
)
{
{
if
(
int
rc
=
table
.
file
->
ha_rnd_next
(
table
.
record
[
0
]))
// We need to skip over any deleted records we encounter beyond the start of the table. Bug 796647b
{
int
rc
;
while
(
((
rc
=
table
.
file
->
ha_rnd_next
(
table
.
record
[
0
])))
!=
0
)
{
if
(
rc
==
HA_ERR_RECORD_DELETED
)
continue
;
table
.
file
->
ha_rnd_end
();
table
.
file
->
ha_rnd_end
();
return
clear_position
(
rc
);
return
clear_position
(
rc
);
}
}
...
@@ -513,7 +516,7 @@ int oqgraph3::cursor::seek_to(
...
@@ -513,7 +516,7 @@ int oqgraph3::cursor::seek_to(
if
((
rc
=
table
.
file
->
ha_rnd_init
(
true
)))
if
((
rc
=
table
.
file
->
ha_rnd_init
(
true
)))
return
clear_position
(
rc
);
return
clear_position
(
rc
);
// We need to skip over any deleted records we encounter
. Bug 796647
// We need to skip over any deleted records we encounter
at the start of the table. Bug 796647c
while
(
((
rc
=
table
.
file
->
ha_rnd_next
(
table
.
record
[
0
])))
!=
0
)
{
while
(
((
rc
=
table
.
file
->
ha_rnd_next
(
table
.
record
[
0
])))
!=
0
)
{
if
(
rc
==
HA_ERR_RECORD_DELETED
)
if
(
rc
==
HA_ERR_RECORD_DELETED
)
continue
;
continue
;
...
...
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