Commit c415ca98 authored by unknown's avatar unknown

Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-advance

into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-loghandlerfixes


storage/maria/ma_loghandler.c:
  Auto merged
parents de483409 76d9f3c6
......@@ -8,7 +8,7 @@ else
COMMITTER=$USER
fi
FROM=$COMMITTER@mysql.com
COMMITS=commits@lists.mysql.com
COMMITS=maria@lists.mysql.com
DOCS=docs-commit@mysql.com
LIMIT=10000
VERSION="maria"
......@@ -73,11 +73,11 @@ else
fi
#++
# commits@ or dev-private@ mail
# maria@ or dev-private@ mail
#--
LIST="commits"
TO="commits@lists.mysql.com"
TO="maria@lists.mysql.com"
if [ -f .tree-is-private ]
then
LIST="dev-private"
......
#!/usr/bin/perl
#!/usr/bin/env perl
#
# A driver program to test DBUG features - runs tests (shell commands)
......
-- require r/have_maria.require
disable_query_log;
show variables like "have_maria";
--require r/true.require
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'maria';
enable_query_log;
Variable_name Value
have_maria YES
This diff is collapsed.
This diff is collapsed.
......@@ -172,6 +172,16 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
6 LINESTRING(145 145,155 155)
7 LINESTRING(144 144,156 156)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -297,6 +307,9 @@ SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
45 LINESTRING(51 51,60 60)
46 LINESTRING(51 41,60 50)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
......@@ -1469,7 +1482,7 @@ INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
1
2
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
......
set global maria_log_file_size=4294967295;
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
* shut down mysqld, removed logs, restarted it
use mysqltest;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 line 1 line A NULL 32 NULL SPATIAL
CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t2 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
* TEST of REDO: see if recovery can reconstruct if we give it an old table
* copied t2 for feeding_recovery
* copied t1 for feeding_recovery
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
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
* copied t2 back for feeding_recovery
* copied t1 back for feeding_recovery
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
* TEST of INSERT and DELETE's rollback
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_flush_states,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 t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
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 t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
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 t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
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;
drop table t1,t2;
......@@ -2195,13 +2195,6 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
drop table t1;
create table t1 (s varchar(25), fulltext(s)) TRANSACTIONAL= 1;
ERROR HY000: Maria can't yet handle SPATIAL or FULLTEXT keys in transactional mode. For now use TRANSACTIONAL=0
drop table if exists t1;
create table t1 ( fid int not null auto_increment primary key,
g geometry not null, spatial key(g));
ERROR HY000: Maria can't yet handle SPATIAL or FULLTEXT keys in transactional mode. For now use TRANSACTIONAL=0
drop table if exists t1;
set global maria_log_file_size=4294967296;
Warnings:
Warning 1292 Truncated incorrect log_file_size value: '4294967296'
......
This diff is collapsed.
This diff is collapsed.
--skip-stack-trace --skip-core-file
# Test of Recovery of R-tree (table t1) and fulltext (table t2) indices
--source include/not_embedded.inc
# Don't test this under valgrind, memory leaks will occur as we crash
--source include/not_valgrind.inc
# Binary must be compiled with debug for crash to occur
--source include/have_debug.inc
--source include/have_maria.inc
set global maria_log_file_size=4294967295;
let $MARIA_LOG=.;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
# not autocommit in the main test.
connect (admin, 127.0.0.1, root,,mysqltest,,);
--enable_reconnect
connection default;
use mysqltest;
--enable_reconnect
-- source include/maria_empty_logs.inc
let $mms_tables=2;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t1;
CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t2;
let $query1= INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
let $query2= INSERT INTO t2 VALUES
('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model'),
('We want to see', 'if this is recoverable'),
('Or rather leaves a bad corrupted table', 'after a crash'),
('Test of REDOs', 'and then UNDOs'),
('Recovery is interesting', 'but sometimes complicated'),
('But what if it was simple', 'and boring?'),
('I wish I knew more', 'about how fulltext works'),
('Maybe I should read about it', 'on the Internet');
--echo * TEST of REDO: see if recovery can reconstruct if we give it an old table
-- source include/maria_make_snapshot_for_feeding_recovery.inc
--disable_query_log
let $1=120; # 8 is smallest value to cause root split; 12 for child split
while($1)
{
eval $query1;
eval $query2;
dec $1;
}
let $1=120;
while($1)
{
delete from t1 limit 1;
delete from t1 limit 10;
delete from t1 limit 7;
delete from t1 limit 2;
delete from t2 limit 6;
dec $1;
}
--enable_query_log
-- source include/maria_make_snapshot_for_comparison.inc
# we want recovery to run on the first snapshot made above
let $mvr_restore_old_snapshot=1;
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;
# the script below will trigger recovery and compare checksums
-- source include/maria_verify_recovery.inc
# Test of REDO + UNDO
--echo * TEST of INSERT and DELETE's rollback
# different types of crash => a loop; here are loop control variables
let $crash_no_flush=1;
let $crash_flush_whole_page_cache=0;
let $crash_flush_states=0;
let $crash_flush_whole_log=0;
let $crash_loop=1;
# we want recovery to use the tables as they were at time of crash
let $mvr_restore_old_snapshot=0;
# UNDO phase prevents physical comparison, normally,
# so we'll only use checksums to compare.
let $mms_compare_physically=0;
let $mvr_crash_statement= set global maria_checkpoint_interval=1;
# Note that we don't remove logs between iterations. Test is
# cumulative (each new recovery processes more log records than the previous).
while ($crash_loop)
{
if ($crash_flush_whole_log)
{
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
# set up what next iteration should do:
let $crash_flush_whole_log=0;
let $crash_loop=0;
}
if ($crash_flush_states)
{
let $mvr_debug_option="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
let $crash_flush_states=0;
let $crash_flush_whole_log=1;
}
if ($crash_flush_whole_page_cache)
{
let $mvr_debug_option="+d,maria_flush_whole_page_cache,maria_crash";
let $crash_flush_whole_page_cache=0;
let $crash_flush_states=1;
}
if ($crash_no_flush)
{
let $mvr_debug_option="+d,maria_crash";
let $crash_no_flush=0;
let $crash_flush_whole_page_cache=1;
}
# Your committed statements here
-- source include/maria_make_snapshot_for_comparison.inc
# Your statements which we expect to be rolled back
lock tables t1 write, t2 write;
--disable_query_log
let $1=120;
while($1)
{
eval $query1;
eval $query2;
dec $1;
}
let $1=120;
while($1)
{
delete from t1 limit 1;
delete from t1 limit 10;
delete from t1 limit 7;
delete from t1 limit 2;
delete from t2 limit 6;
dec $1;
}
--enable_query_log
-- source include/maria_verify_recovery.inc
}
# Finally check when we make the table empty
# This is currently hitting BUG#36319 so is disabled
if (0)
{
-- source include/maria_make_snapshot_for_comparison.inc
lock tables t1 write, t2 write;
select count(*) from t1;
delete from t1;
select count(*) from t1;
select count(*) from t2;
delete from t2;
select count(*) from t2;
}
-- source include/maria_verify_recovery.inc
drop table t1,t2;
......@@ -1410,18 +1410,6 @@ create table t1 (a int);
show create table t1;
drop table t1;
#
# Show that we can't yet create fulltext or spatial index with Maria
#
--error 138
create table t1 (s varchar(25), fulltext(s)) TRANSACTIONAL= 1;
drop table if exists t1;
--error 138
create table t1 ( fid int not null auto_increment primary key,
g geometry not null, spatial key(g));
drop table if exists t1;
#
# Test warning on log file size truncates
#
......
......@@ -67,6 +67,9 @@ void wqueue_add_to_queue(WQUEUE *wqueue, struct st_my_thread_var *thread)
thread->next= last->next;
last->next= thread;
}
#ifndef DBUG_OFF
thread->prev= NULL; /* force segfault if used */
#endif
wqueue->last_thread= thread;
}
......@@ -140,26 +143,27 @@ void wqueue_release_queue(WQUEUE *wqueue)
@brief Removes all threads waiting for read or first one waiting for write.
@param wqueue pointer to the queue structure
@apram thread pointer to the thread to be added to the queue
@param thread pointer to the thread to be added to the queue
@note This function is applicable only to single linked lists.
*/
void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue)
{
struct st_my_thread_var *last= wqueue->last_thread;
struct st_my_thread_var *next= last->next;
struct st_my_thread_var **prev= &last->next;
struct st_my_thread_var *thread;
struct st_my_thread_var *new_last= NULL;
struct st_my_thread_var *new_list= NULL;
uint first_type= next->lock_type;
if (first_type == MY_PTHREAD_LOCK_WRITE)
{
/* release first waiting for write lock */
thread= next;
pthread_cond_signal(&thread->suspend);
if (thread == last)
pthread_cond_signal(&next->suspend);
if (next == last)
wqueue->last_thread= NULL;
*prev= thread->next;
thread->next= NULL;
else
last->next= next->next;
next->next= NULL;
return;
}
do
......@@ -169,26 +173,22 @@ void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue)
if (thread->lock_type == MY_PTHREAD_LOCK_WRITE)
{
/* skip waiting for write lock */
*prev= thread;
prev= &thread->next;
new_last= NULL;
if (new_list)
{
thread->next= new_list->next;
new_list= new_list->next= thread;
}
else
new_list= thread->next= thread;
}
else
{
/* release waiting for read lock */
pthread_cond_signal(&thread->suspend);
new_last= thread->next;
thread->next= NULL;
}
} while (thread != last);
if (new_last)
{
/* last was deleted */
if (new_last == last)
wqueue->last_thread= NULL; /* empty list */
else
wqueue->last_thread= new_last;
}
wqueue->last_thread= new_list;
}
......
......@@ -659,7 +659,6 @@ static sys_var_have_plugin sys_have_csv(&vars, "have_csv", C_STRING_WITH_LEN("cs
static sys_var_have_variable sys_have_dlopen(&vars, "have_dynamic_loading", &have_dlopen);
static sys_var_have_variable sys_have_geometry(&vars, "have_geometry", &have_geometry);
static sys_var_have_plugin sys_have_innodb(&vars, "have_innodb", C_STRING_WITH_LEN("innodb"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_plugin sys_have_maria(&vars, "have_maria", C_STRING_WITH_LEN("maria"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_plugin sys_have_ndbcluster(&vars, "have_ndbcluster", C_STRING_WITH_LEN("ndbcluster"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl);
static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl);
......
......@@ -62,7 +62,7 @@ TARGET_LINK_LIBRARIES(maria_read_log maria myisam mysys dbug strings zlib wsock3
ADD_EXECUTABLE(maria_pack maria_pack.c)
TARGET_LINK_LIBRARIES(maria_pack maria myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(maria_dump_log ma_loghandler.c)
ADD_EXECUTABLE(maria_dump_log ma_loghandler.c unittest/ma_loghandler_examples.c)
TARGET_LINK_LIBRARIES(maria_dump_log maria myisam mysys dbug strings zlib wsock32)
SET_TARGET_PROPERTIES(maria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG")
......
......@@ -63,7 +63,7 @@ maria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmaria.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
maria_dump_log_SOURCES= ma_loghandler.c
maria_dump_log_SOURCES= ma_loghandler.c unittest/ma_loghandler_examples.c
maria_dump_log_CPPFLAGS= -DMARIA_DUMP_LOG
noinst_PROGRAMS = ma_test1 ma_test2 ma_test3 ma_rt_test ma_sp_test
noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h \
......
......@@ -2768,7 +2768,7 @@ static int ha_maria_init(void *p)
maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */
res= maria_init() || ma_control_file_create_or_open() ||
res= maria_init() || ma_control_file_open(TRUE) ||
!init_pagecache(maria_pagecache,
(size_t) pagecache_buffer_size, pagecache_division_limit,
pagecache_age_threshold, maria_block_size, 0) ||
......
......@@ -3812,9 +3812,6 @@ static int delete_dir_entry(uchar *buff, uint block_size, uint record_number,
leave the page as write locked as we may put
the new row into the old position.
NOTES
Uses info->keyread_buff
RETURN
0 ok
1 error
......@@ -3934,9 +3931,6 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
info Handler
tails Pointer to vector of tail positions, ending with 0
NOTES
Uses info->keyread_buff
RETURN
0 ok
1 error
......@@ -5211,9 +5205,9 @@ uint ma_calc_length_for_store_length(ulong nr)
/* Retrive a stored number */
static ulong ma_get_length(uchar **packet)
static ulong ma_get_length(const uchar **packet)
{
reg1 uchar *pos= *packet;
reg1 const uchar *pos= *packet;
if (*pos < 251)
{
(*packet)++;
......@@ -6031,7 +6025,7 @@ uint _ma_apply_redo_purge_row_head_or_tail(MARIA_HA *info, LSN lsn,
pgcache_page_no_t page;
uint rownr, empty_space;
uint block_size= share->block_size;
uchar *buff= info->keyread_buff;
uchar *buff;
int result;
uint error;
MARIA_PINNED_PAGE page_link;
......@@ -6558,7 +6552,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
header+= 2 + row.field_lengths_length;
}
if (share->base.blobs)
row.blob_length= ma_get_length(&header);
row.blob_length= ma_get_length((const uchar**)&header);
/* We need to build up a record (without blobs) in rec_buff */
if (!(record= my_malloc(share->base.reclength, MYF(MY_WME))))
......@@ -6739,8 +6733,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
{
MARIA_SHARE *share= info->s;
MARIA_RECORD_POS record_pos;
uchar *field_length_data;
const uchar *field_length_data_end, *extent_info;
const uchar *field_length_data, *field_length_data_end, *extent_info;
uchar *current_record, *orig_record;
pgcache_page_no_t page;
ha_checksum checksum_delta;
......@@ -6773,7 +6766,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
Set header to point to old field values, generated by
fill_update_undo_parts()
*/
field_length_header= ma_get_length(&header);
field_length_header= ma_get_length((const uchar**)&header);
field_length_data= header;
header+= field_length_header;
field_length_data_end= header;
......
......@@ -98,6 +98,7 @@ static void report_keypage_fault(HA_CHECK *param, MARIA_HA *info,
static my_bool create_new_data_handle(MARIA_SORT_PARAM *param, File new_file);
static my_bool _ma_flush_table_files_before_swap(HA_CHECK *param,
MARIA_HA *info);
static TrID max_trid_in_system(void);
void maria_chk_init(HA_CHECK *param)
......@@ -4441,7 +4442,16 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
for (;;)
{
int flag;
/*
Assume table is transactional and it had LSN pages in the
cache. Repair has flushed them, left data pages stay in
cache, and disabled transactionality (so share's current page
type is PLAIN); page cache would assert if it finds a cached LSN page
while _ma_scan_block_record() requested a PLAIN page. So we use
UNKNOWN.
*/
enum pagecache_page_type save_page_type= share->page_type;
share->page_type= PAGECACHE_READ_UNKNOWN_PAGE;
if (info != sort_info->new_info)
{
/* Safe scanning */
......@@ -4458,6 +4468,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
flag= _ma_scan_block_record(info, sort_param->record,
info->cur_row.nextpos, 1);
}
share->page_type= save_page_type;
if (!flag)
{
if (sort_param->calc_checksum)
......@@ -6444,3 +6455,21 @@ static void report_keypage_fault(HA_CHECK *param, MARIA_HA *info,
"error: %d",
llstr(position / block_size, buff), my_errno);
}
/**
When we want to check a table, we verify that the transaction ids of rows
and keys are not bigger than the biggest id generated by Maria so far, which
is returned by the function below.
@note If control file is not open, 0 may be returned; to not confuse
this with a valid max trid of 0, the caller should notice that it failed to
open the control file (ma_control_file_inited() can serve for that).
*/
static TrID max_trid_in_system(void)
{
TrID id= trnman_get_max_trid(); /* 0 if transac manager not initialized */
/* 'id' may be far bigger, if last shutdown is old */
return max(id, max_trid_in_control_file);
}
......@@ -244,8 +244,8 @@ static int really_execute_checkpoint(void)
such hook would be called before translog_flush (and we must be sure
that log was flushed before we write to the control file).
*/
if (unlikely(ma_control_file_write_and_force(lsn, FILENO_IMPOSSIBLE,
CONTROL_FILE_UPDATE_ONLY_LSN)))
if (unlikely(ma_control_file_write_and_force(lsn, last_logno,
max_trid_in_control_file)))
{
translog_unlock();
goto err;
......
This diff is collapsed.
This diff is collapsed.
......@@ -393,16 +393,6 @@ int maria_create(const char *name, enum data_file_type datafile_type,
length= real_length_diff= 0;
min_key_length= key_length= pointer;
if ((keydef->flag & (HA_SPATIAL | HA_FULLTEXT) &&
ci->transactional))
{
my_errno= HA_ERR_UNSUPPORTED;
my_message(HA_ERR_UNSUPPORTED,
"Maria can't yet handle SPATIAL or FULLTEXT keys in "
"transactional mode. For now use TRANSACTIONAL=0", MYF(0));
goto err_no_lock;
}
if (keydef->flag & HA_SPATIAL)
{
#ifdef HAVE_SPATIAL
......
This diff is collapsed.
......@@ -335,6 +335,10 @@ uint _ma_ft_convert_to_ft2(MARIA_HA *info, uint keynr, uchar *key)
_ma_store_page_used(share, info->buff, length + share->keypage_header);
memcpy(info->buff + share->keypage_header, key_ptr, length);
info->keyread_buff_used= info->page_changed=1; /* info->buff is used */
/**
@todo RECOVERY BUG this is not logged yet. Ok as this code is never
called, but soon it will be.
*/
if ((root= _ma_new(info, DFLT_INIT_HITS, &page_link)) == HA_OFFSET_ERROR ||
_ma_write_keypage(info, keyinfo, root, page_link->write_lock,
DFLT_INIT_HITS, info->buff))
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -160,7 +160,8 @@ enum en_key_op
KEY_OP_DEL_PREFIX, /* Delete data at start of page */
KEY_OP_ADD_SUFFIX, /* Insert data at end of page */
KEY_OP_DEL_SUFFIX, /* Delete data at end of page */
KEY_OP_CHECK /* For debugging; CRC of used part of page */
KEY_OP_CHECK, /* For debugging; CRC of used part of page */
KEY_OP_MULTI_COPY /* List of memcpy()s with fixed-len sources in page */
};
/* Size of log file; One log file is restricted to 4G */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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