Commit 7323df78 authored by unknown's avatar unknown

Minor changes. New description in SHOW ENGINES for Maria.

Test for BUG#34106 "auto_increment is reset to 1 when table is recovered from crash"
(fixed by Monty yesterday)


mysql-test/r/maria-recovery.result:
  result, which is correct (before pulling Monty's fix for BUG#34106,
  we got a warning about auto_increment in CHECK TABLE (done in
  maria-verify-recovery.inc), no AUTO_INCREMENT clause in
  SHOW CREATE TABLE, and a failure of the last INSERT.
mysql-test/r/maria.result:
  result
mysql-test/t/maria-recovery.test:
  Test for BUG#34106
mysql-test/t/maria.test:
  look at what is reported in SHOW ENGINES
mysys/my_pread.c:
  changed my mind: if Count argument is >4GB, we'll surely see a segfault
  in the pread() call when it tries to read 4GB from memory, so no need
  to print it in ulonglong format (saves a function call).
mysys/my_read.c:
  changed my mind: if Count argument is >4GB, we'll surely see a segfault
  in the pread() call when it tries to read 4GB from memory, so no need
  to print it in ulonglong format (saves a function call).
mysys/my_write.c:
  changed my mind: if Count argument is >4GB, we'll surely see a segfault
  in the pread() call when it tries to read 4GB from memory, so no need
  to print it in ulonglong format (saves a function call).
storage/maria/ha_maria.cc:
  Description representing the current reality. This can be changed later
storage/maria/ma_page.c:
  When reading the new key_del from a page on disk, if there is a bug
  (like BUG#34062) this key_del could be wrong, we try to catch if it's
  out of the key file.
storage/maria/ma_pagecache.c:
  - no truncation of page's number in DBUG_PRINT (useful for BUG#34062)
  - page_korr instead of uint5korr
storage/maria/ma_recovery.c:
  page_korr instead of uint5korr
storage/maria/plug.in:
  Description representing the current reality. This can be changed later.
parent 8c5cd4f8
...@@ -213,6 +213,32 @@ t1 CREATE TABLE `t1` ( ...@@ -213,6 +213,32 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`i`), PRIMARY KEY (`i`),
KEY `c` (`c`) KEY `c` (`c`)
) ENGINE=MARIA AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ) ENGINE=MARIA AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
* TEST of INSERT's rollback vs state.auto_increment
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values(null, "e");
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL AUTO_INCREMENT,
`c` varchar(6) DEFAULT NULL,
PRIMARY KEY (`i`),
KEY `c` (`c`)
) ENGINE=MARIA AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
insert into t1 values(null, "f");
drop table t1; drop table t1;
* TEST of removing logs manually * TEST of removing logs manually
* shut down mysqld, removed logs, restarted it * shut down mysqld, removed logs, restarted it
......
select * from INFORMATION_SCHEMA.ENGINES where ENGINE="MARIA";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
MARIA YES Crash-safe tables with MyISAM heritage YES NO NO
set global storage_engine=maria; set global storage_engine=maria;
set session storage_engine=maria; set session storage_engine=maria;
set global maria_page_checksum=0; set global maria_page_checksum=0;
......
...@@ -178,6 +178,20 @@ let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash"; ...@@ -178,6 +178,20 @@ let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global maria_checkpoint_interval=1; let $mvr_crash_statement= set global maria_checkpoint_interval=1;
-- source include/maria_verify_recovery.inc -- source include/maria_verify_recovery.inc
show create table t1; show create table t1;
# Test that INSERT's rollback does not set auto-increment counter to 1
# (BUG#34106)
--echo * TEST of INSERT's rollback vs state.auto_increment
-- source include/maria_make_snapshot_for_comparison.inc
let $mvr_restore_old_snapshot=0;
let $mms_compare_physically=0;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global maria_checkpoint_interval=1;
lock tables t1 write;
insert into t1 values(null, "e");
-- source include/maria_verify_recovery.inc
show create table t1;
insert into t1 values(null, "f");
drop table t1; drop table t1;
# Test of removing logs manually # Test of removing logs manually
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
-- source include/have_maria.inc -- source include/have_maria.inc
select * from INFORMATION_SCHEMA.ENGINES where ENGINE="MARIA";
let $default_engine=`select @@global.storage_engine`; let $default_engine=`select @@global.storage_engine`;
let $default_checksum=`select @@global.maria_page_checksum`; let $default_checksum=`select @@global.maria_page_checksum`;
set global storage_engine=maria; set global storage_engine=maria;
......
...@@ -49,11 +49,11 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -49,11 +49,11 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
size_t readbytes; size_t readbytes;
int error= 0; int error= 0;
#ifndef DBUG_OFF #ifndef DBUG_OFF
char llbuf1[22], llbuf2[22]; char llbuf[22];
DBUG_ENTER("my_pread"); DBUG_ENTER("my_pread");
DBUG_PRINT("my",("fd: %d Seek: %s Buffer: 0x%lx Count: %s MyFlags: %d", DBUG_PRINT("my",("fd: %d Seek: %s Buffer: 0x%lx Count: %lu MyFlags: %d",
Filedes, ullstr(offset, llbuf1), Filedes, ullstr(offset, llbuf), (long) Buffer,
(long) Buffer, ullstr(Count, llbuf2), MyFlags)); (ulong)Count, MyFlags));
#endif #endif
for (;;) for (;;)
{ {
...@@ -133,11 +133,11 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count, ...@@ -133,11 +133,11 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
size_t writenbytes, written; size_t writenbytes, written;
uint errors; uint errors;
#ifndef DBUG_OFF #ifndef DBUG_OFF
char llbuf1[22], llbuf2[22]; char llbuf[22];
DBUG_ENTER("my_pwrite"); DBUG_ENTER("my_pwrite");
DBUG_PRINT("my",("fd: %d Seek: %s Buffer: 0x%lx Count: %s MyFlags: %d", DBUG_PRINT("my",("fd: %d Seek: %s Buffer: 0x%lx Count: %lu MyFlags: %d",
Filedes, ullstr(offset, llbuf1), Filedes, ullstr(offset, llbuf), (long) Buffer,
(long) Buffer, ullstr(Count, llbuf2), MyFlags)); (ulong)Count, MyFlags));
#endif #endif
errors= 0; errors= 0;
written= 0; written= 0;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
#include <my_base.h> #include <my_base.h>
#include <m_string.h>
#include <errno.h> #include <errno.h>
/* /*
...@@ -37,12 +36,9 @@ ...@@ -37,12 +36,9 @@
size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
{ {
size_t readbytes, save_count; size_t readbytes, save_count;
#ifndef DBUG_OFF
char llbuf[22];
DBUG_ENTER("my_read"); DBUG_ENTER("my_read");
DBUG_PRINT("my",("fd: %d Buffer: 0x%lx Count: %s MyFlags: %d", DBUG_PRINT("my",("fd: %d Buffer: 0x%lx Count: %lu MyFlags: %d",
Filedes, (long) Buffer, ullstr(Count, llbuf), MyFlags)); Filedes, (long) Buffer, (ulong) Count, MyFlags));
#endif
save_count= Count; save_count= Count;
for (;;) for (;;)
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
#include <m_string.h>
#include <errno.h> #include <errno.h>
...@@ -25,12 +24,9 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags) ...@@ -25,12 +24,9 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
{ {
size_t writenbytes, written; size_t writenbytes, written;
uint errors; uint errors;
#ifndef DBUG_OFF
char llbuf[22];
DBUG_ENTER("my_write"); DBUG_ENTER("my_write");
DBUG_PRINT("my",("fd: %d Buffer: 0x%lx Count: %s MyFlags: %d", DBUG_PRINT("my",("fd: %d Buffer: 0x%lx Count: %lu MyFlags: %d",
Filedes, (long) Buffer, ullstr(Count, llbuf), MyFlags)); Filedes, (long) Buffer, (ulong) Count, MyFlags));
#endif
errors=0; written=0; errors=0; written=0;
/* The behavior of write(fd, buf, 0) is not portable */ /* The behavior of write(fd, buf, 0) is not portable */
......
...@@ -2920,7 +2920,7 @@ mysql_declare_plugin(maria) ...@@ -2920,7 +2920,7 @@ mysql_declare_plugin(maria)
&maria_storage_engine, &maria_storage_engine,
"MARIA", "MARIA",
"MySQL AB", "MySQL AB",
"Traditional transactional MySQL tables", "Crash-safe tables with MyISAM heritage",
PLUGIN_LICENSE_GPL, PLUGIN_LICENSE_GPL,
ha_maria_init, /* Plugin Init */ ha_maria_init, /* Plugin Init */
NULL, /* Plugin Deinit */ NULL, /* Plugin Deinit */
......
...@@ -175,7 +175,7 @@ int _ma_write_keypage(register MARIA_HA *info, ...@@ -175,7 +175,7 @@ int _ma_write_keypage(register MARIA_HA *info,
@return @return
@retval 0 ok @retval 0 ok
retval 1 error @retval 1 error
*/ */
...@@ -327,8 +327,14 @@ my_off_t _ma_new(register MARIA_HA *info, int level, ...@@ -327,8 +327,14 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
(single linked list): (single linked list):
*/ */
share->current_key_del= mi_sizekorr(buff+share->keypage_header); share->current_key_del= mi_sizekorr(buff+share->keypage_header);
DBUG_ASSERT(share->current_key_del != share->state.key_del && #ifndef DBUG_OFF
share->current_key_del); my_off_t current_key_del= share->current_key_del;
DBUG_ASSERT(current_key_del != share->state.key_del &&
(current_key_del != 0) &&
((current_key_del == HA_OFFSET_ERROR) ||
(current_key_del <=
(info->state->key_file_length - block_size))));
#endif
} }
(*page_link)->unlock= PAGECACHE_LOCK_WRITE_UNLOCK; (*page_link)->unlock= PAGECACHE_LOCK_WRITE_UNLOCK;
......
...@@ -2959,16 +2959,19 @@ uchar *pagecache_read(PAGECACHE *pagecache, ...@@ -2959,16 +2959,19 @@ uchar *pagecache_read(PAGECACHE *pagecache,
int error= 0; int error= 0;
enum pagecache_page_pin pin= lock_to_pin[test(buff==0)][lock]; enum pagecache_page_pin pin= lock_to_pin[test(buff==0)][lock];
PAGECACHE_BLOCK_LINK *fake_link; PAGECACHE_BLOCK_LINK *fake_link;
#ifndef DBUG_OFF
char llbuf[22];
DBUG_ENTER("pagecache_read"); DBUG_ENTER("pagecache_read");
DBUG_PRINT("enter", ("fd: %u page: %lu buffer: 0x%lx level: %u " DBUG_PRINT("enter", ("fd: %u page: %s buffer: 0x%lx level: %u "
"t:%s %s %s", "t:%s %s %s",
(uint) file->file, (ulong) pageno, (uint) file->file, ullstr(pageno, llbuf),
(ulong) buff, level, (ulong) buff, level,
page_cache_page_type_str[type], page_cache_page_type_str[type],
page_cache_page_lock_str[lock], page_cache_page_lock_str[lock],
page_cache_page_pin_str[pin])); page_cache_page_pin_str[pin]));
DBUG_ASSERT(buff != 0 || (buff == 0 && (pin == PAGECACHE_PIN || DBUG_ASSERT(buff != 0 || (buff == 0 && (pin == PAGECACHE_PIN ||
pin == PAGECACHE_PIN_LEFT_PINNED))); pin == PAGECACHE_PIN_LEFT_PINNED)));
#endif
if (!page_link) if (!page_link)
page_link= &fake_link; page_link= &fake_link;
...@@ -3458,10 +3461,12 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, ...@@ -3458,10 +3461,12 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
PAGECACHE_BLOCK_LINK *fake_link; PAGECACHE_BLOCK_LINK *fake_link;
int error= 0; int error= 0;
int need_lock_change= write_lock_change_table[lock].need_lock_change; int need_lock_change= write_lock_change_table[lock].need_lock_change;
#ifndef DBUG_OFF
char llbuf[22];
DBUG_ENTER("pagecache_write_part"); DBUG_ENTER("pagecache_write_part");
DBUG_PRINT("enter", ("fd: %u page: %lu level: %u type: %s lock: %s " DBUG_PRINT("enter", ("fd: %u page: %s level: %u type: %s lock: %s "
"pin: %s mode: %s offset: %u size %u", "pin: %s mode: %s offset: %u size %u",
(uint) file->file, (ulong) pageno, level, (uint) file->file, ullstr(pageno, llbuf), level,
page_cache_page_type_str[type], page_cache_page_type_str[type],
page_cache_page_lock_str[lock], page_cache_page_lock_str[lock],
page_cache_page_pin_str[pin], page_cache_page_pin_str[pin],
...@@ -3471,6 +3476,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, ...@@ -3471,6 +3476,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
DBUG_ASSERT(lock != PAGECACHE_LOCK_LEFT_READLOCKED); DBUG_ASSERT(lock != PAGECACHE_LOCK_LEFT_READLOCKED);
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK); DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK);
DBUG_ASSERT(offset + size <= pagecache->block_size); DBUG_ASSERT(offset + size <= pagecache->block_size);
#endif
if (!page_link) if (!page_link)
page_link= &fake_link; page_link= &fake_link;
...@@ -4431,8 +4437,8 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache, ...@@ -4431,8 +4437,8 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
ptr[0]= (share->kfile.file == block->hash_link->file.file); ptr[0]= (share->kfile.file == block->hash_link->file.file);
ptr++; ptr++;
DBUG_ASSERT(block->hash_link->pageno < ((ULL(1)) << 40)); DBUG_ASSERT(block->hash_link->pageno < ((ULL(1)) << 40));
int5store(ptr, block->hash_link->pageno); page_store(ptr, block->hash_link->pageno);
ptr+= 5; ptr+= PAGE_STORE_SIZE;
lsn_store(ptr, block->rec_lsn); lsn_store(ptr, block->rec_lsn);
ptr+= LSN_STORE_SIZE; ptr+= LSN_STORE_SIZE;
if (block->rec_lsn != LSN_MAX) if (block->rec_lsn != LSN_MAX)
......
...@@ -3009,8 +3009,8 @@ static LSN parse_checkpoint_record(LSN lsn) ...@@ -3009,8 +3009,8 @@ static LSN parse_checkpoint_record(LSN lsn)
ptr+= 2; ptr+= 2;
is_index= ptr[0]; is_index= ptr[0];
ptr++; ptr++;
page_id= uint5korr(ptr); page_id= page_korr(ptr);
ptr+= 5; ptr+= PAGE_STORE_SIZE;
rec_lsn= lsn_korr(ptr); rec_lsn= lsn_korr(ptr);
ptr+= LSN_STORE_SIZE; ptr+= LSN_STORE_SIZE;
if (new_page((is_index << 16) | table_id, if (new_page((is_index << 16) | table_id,
......
MYSQL_STORAGE_ENGINE(maria,, [Maria Storage Engine], MYSQL_STORAGE_ENGINE(maria,, [Maria Storage Engine],
[Traditional transactional MySQL tables], [max,max-no-ndb]) [Crash-safe tables with MyISAM heritage], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria]) MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria])
MYSQL_PLUGIN_STATIC(maria, [libmaria.a]) MYSQL_PLUGIN_STATIC(maria, [libmaria.a])
# Maria will probably go first into max builds, not all builds, # Maria will probably go first into max builds, not all builds,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment