summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-01-11 12:59:30 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2018-01-11 12:59:30 +0100
commitb6cdfacbec61f512ec307a2e112bd7b8c0529827 (patch)
treebbeaf67506b5e06408ff71a536033ca6c6639693
parentbdcd7f79e4a33e08bae31a86cee98e23ff6824ff (diff)
downloadmariadb-git-bb-5.5-MDEV-14690.tar.gz
MDEV-14690: Assertion `page_link == &fake_link' failed in pagecache_write_partbb-5.5-MDEV-14690
Fix the call to correspond protocoll of pagecache call. Fix of misleading variables names.
-rw-r--r--mysql-test/suite/maria/maria.result11
-rw-r--r--mysql-test/suite/maria/maria.test15
-rw-r--r--storage/maria/ma_blockrec.c18
-rw-r--r--storage/maria/ma_page.c40
4 files changed, 64 insertions, 20 deletions
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 890f6bbfaf5..7f8badb78ae 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -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;
diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test
index b6a3e2784b6..04298e22966 100644
--- a/mysql-test/suite/maria/maria.test
+++ b/mysql-test/suite/maria/maria.test
@@ -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
#
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 6a7baa5b4f7..be279f3e236 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -6279,8 +6279,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
uchar *buff, *dir;
uint result;
MARIA_PINNED_PAGE page_link;
- enum pagecache_page_lock unlock_method;
- enum pagecache_page_pin unpin_method;
+ enum pagecache_page_lock lock_method;
+ enum pagecache_page_pin pin_method;
my_off_t end_of_page;
uint error;
DBUG_ENTER("_ma_apply_redo_insert_row_head_or_tail");
@@ -6308,8 +6308,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
fill it entirely with zeroes, then the REDO will put correct data on
it.
*/
- unlock_method= PAGECACHE_LOCK_WRITE;
- unpin_method= PAGECACHE_PIN;
+ lock_method= PAGECACHE_LOCK_WRITE;
+ pin_method= PAGECACHE_PIN;
DBUG_ASSERT(rownr == 0 && new_page);
if (rownr != 0 || !new_page)
@@ -6324,8 +6324,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
}
else
{
- unlock_method= PAGECACHE_LOCK_LEFT_WRITELOCKED;
- unpin_method= PAGECACHE_PIN_LEFT_PINNED;
+ lock_method= PAGECACHE_LOCK_LEFT_WRITELOCKED;
+ pin_method= PAGECACHE_PIN_LEFT_PINNED;
share->pagecache->readwrite_flags&= ~MY_WME;
buff= pagecache_read(share->pagecache, &info->dfile,
@@ -6427,11 +6427,11 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
this group, for this page, would be skipped) and unpin then.
*/
result= 0;
- if (unlock_method == PAGECACHE_LOCK_WRITE &&
+ if (lock_method == PAGECACHE_LOCK_WRITE &&
pagecache_write(share->pagecache,
&info->dfile, page, 0,
buff, PAGECACHE_PLAIN_PAGE,
- unlock_method, unpin_method,
+ lock_method, pin_method,
PAGECACHE_WRITE_DELAY, &page_link.link,
LSN_IMPOSSIBLE))
result= my_errno;
@@ -6452,7 +6452,7 @@ crashed_file:
_ma_set_fatal_error(share, HA_ERR_WRONG_IN_RECORD);
err:
error= my_errno;
- if (unlock_method == PAGECACHE_LOCK_LEFT_WRITELOCKED)
+ if (lock_method == PAGECACHE_LOCK_LEFT_WRITELOCKED)
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index ed62a80e4f7..0e494e22c5b 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -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)
{