Skip to content

Commit

Permalink
MDEV-14690: Assertion `page_link == &fake_link' failed in pagecache_w…
Browse files Browse the repository at this point in the history
…rite_part

Fix the call to correspond protocoll of pagecache call.
Fix of misleading variables names.
  • Loading branch information
sanja-byelkin committed Jan 11, 2018
1 parent 1f18bd6 commit abb9e70
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 11 deletions.
11 changes: 11 additions & 0 deletions mysql-test/suite/maria/maria.result
Expand Up @@ -2686,3 +2686,14 @@ select count(*) from t1;
count(*)
13
drop table t1;
#
# MDEV-14690: Assertion `page_link == &fake_link' failed in
# pagecache_write_part
#
CREATE TABLE t1 (a CHAR(8), b CHAR(8), c CHAR(8) NOT NULL DEFAULT '', f FLOAT, KEY(f)) ENGINE=Aria;
INSERT INTO t1 (a) VALUES ('foo');
DELETE FROM t1 WHERE c < 'bar';
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (b) VALUES ('');
ALTER TABLE t1 ENABLE KEYS;
DROP TABLE t1;
15 changes: 15 additions & 0 deletions mysql-test/suite/maria/maria.test
Expand Up @@ -1964,6 +1964,21 @@ unlock tables;
select count(*) from t1;
drop table t1;

--echo #
--echo # MDEV-14690: Assertion `page_link == &fake_link' failed in
--echo # pagecache_write_part
--echo #

CREATE TABLE t1 (a CHAR(8), b CHAR(8), c CHAR(8) NOT NULL DEFAULT '', f FLOAT, KEY(f)) ENGINE=Aria;
INSERT INTO t1 (a) VALUES ('foo');
DELETE FROM t1 WHERE c < 'bar';
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (b) VALUES ('');
ALTER TABLE t1 ENABLE KEYS;

# Cleanup
DROP TABLE t1;

#
# End of test
#
Expand Down
40 changes: 29 additions & 11 deletions storage/maria/ma_page.c
Expand Up @@ -229,17 +229,35 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
#endif

page_cleanup(share, page);
res= pagecache_write(share->pagecache,
&share->kfile,
(pgcache_page_no_t) (page->pos / block_size),
level, buff, share->page_type,
lock,
lock == PAGECACHE_LOCK_LEFT_WRITELOCKED ?
PAGECACHE_PIN_LEFT_PINNED :
(lock == PAGECACHE_LOCK_WRITE_UNLOCK ?
PAGECACHE_UNPIN : PAGECACHE_PIN),
PAGECACHE_WRITE_DELAY, &page_link.link,
LSN_IMPOSSIBLE);
{
PAGECACHE_BLOCK_LINK **link;
enum pagecache_page_pin pin;
if (lock == PAGECACHE_LOCK_LEFT_WRITELOCKED)
{
pin= PAGECACHE_PIN_LEFT_PINNED;
link= &page_link.link;
}
else if (lock == PAGECACHE_LOCK_WRITE_UNLOCK)
{
pin= PAGECACHE_UNPIN;
/*
We unlock this page so link should be 0 to prevent it usage
even accidentally
*/
link= NULL;
}
else
{
pin= PAGECACHE_PIN;
link= &page_link.link;
}
res= pagecache_write(share->pagecache,
&share->kfile,
(pgcache_page_no_t) (page->pos / block_size),
level, buff, share->page_type,
lock, pin, PAGECACHE_WRITE_DELAY, link,
LSN_IMPOSSIBLE);
}

if (lock == PAGECACHE_LOCK_WRITE)
{
Expand Down

0 comments on commit abb9e70

Please sign in to comment.