Commit 1d726038 authored by Michael Widenius's avatar Michael Widenius

Merge; No notable changes

.bzr-mysql/default.conf:
  Automatic merge
config/ac-macros/plugins.m4:
  Automatic merge
configure.in:
  Automatic merge
include/my_global.h:
  Automatic merge
mysql-test/include/maria_empty_logs.inc:
  Use Guilmhems version, but don't echo use database
mysql-test/r/maria-no-logging.result:
  Automatic merge
mysql-test/r/maria-page-checksum.result:
  Automatic merge
mysql-test/r/maria-recover.result:
  Automatic merge
mysql-test/r/maria2.result:
  Automatic merge
mysql-test/t/maria-no-logging.test:
  Automatic merge
mysql-test/t/maria-page-checksum.test:
  Automatic merge
mysql-test/t/maria-purge.test:
  Automatic merge
mysql-test/t/maria-recover.test:
  Automatic merge
mysql-test/t/maria2.test:
  Automatic merge
sql/sql_table.cc:
  Automatic merge
storage/maria/CMakeLists.txt:
  Automatic merge
storage/maria/ma_ft_parser.c:
  Automatic merge
storage/maria/ma_loghandler.c:
  Automatic merge
storage/maria/ma_recovery.c:
  Automatic merge
storage/maria/ma_rt_test.c:
  Manual merge
storage/maria/ma_state.c:
  Automatic merge
storage/maria/ma_test_force_start.pl:
  Automatic merge
storage/maria/plug.in:
  Automatic merge
storage/maria/unittest/CMakeLists.txt:
  Automatic merge
storage/maria/unittest/Makefile.am:
  Automatic merge
storage/maria/unittest/ma_test_all-t:
  Automatic merge
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Automatic merge
storage/maria/unittest/ma_test_recovery.pl:
  Automatic merge
storage/myisam/rt_test.c:
  Automatic merge
parents 52cb0c24 4f14b87d
[MYSQL]
tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
post_commit_to = maria-private@mysql.com
post_commit_to = maria@lists.mysql.com
post_commit_url = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
tree_name = mysql-maria
project_name = MySQL/Maria
......@@ -280,7 +280,7 @@ dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CONFIGURE_PLUGINS
dnl
dnl SYNOPSIS
dnl MYSQL_PLUGIN_DEPENDS([name,name...])
dnl MYSQL_CONFIGURE_PLUGINS([name,name...])
dnl
dnl DESCRIPTION
dnl Used last, emits all required shell code to configure the plugins
......@@ -735,13 +735,13 @@ dnl Emits shell script for checking configure arguments
dnl Arguments to this macro is default value for selected plugins
AC_DEFUN([_MYSQL_CHECK_PLUGIN_ARGS],[
__MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [none]))
__MYSQL_CHECK_PLUGIN_ARGS(m4_default([$1], [default]))
])
AC_DEFUN([__MYSQL_CHECK_PLUGIN_ARGS],[
AC_ARG_WITH([plugins],
AS_HELP_STRING([--with-plugins=PLUGIN[[[[[,PLUGIN..]]]]]],
[Plugins to include in mysqld. (default is: $1) Must be a
[Plugins to include in mysqld. Must be a
configuration name or a comma separated list of plugins.])
AS_HELP_STRING([],
[Available configurations are:] dnl
......
......@@ -2387,7 +2387,7 @@ MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support],
dnl -- ndbcluster requires partition to be enabled
MYSQL_CONFIGURE_PLUGINS([none])
MYSQL_CONFIGURE_PLUGINS([default])
# Only build client code?
AC_ARG_WITH(server,
......
......@@ -156,9 +156,14 @@
#define __builtin_expect(x, expected_value) (x)
#endif
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
/**
The semantics of builtin_expect() are that
1) its two arguments are long
2) it's likely that they are ==
Those of our likely(x) are that x can be bool/int/longlong/pointer.
*/
#define likely(x) __builtin_expect(((x) != 0),1)
#define unlikely(x) __builtin_expect(((x) != 0),0)
/*
The macros below are useful in optimising places where it has been
......
......@@ -4,10 +4,10 @@
# API: set mel_keep_control_file=1 if want to keep control file;
# uses vardir, port and socket.
connection admin;
let $current_database= `select database()`;
connection default;
let $default_db=`select database()`;
connection admin;
-- echo * shut down mysqld, removed logs, restarted it
append_file $MYSQLTEST_VARDIR/tmp/master0.expect;
wait-maria_empty_logs.inc
......@@ -73,5 +73,5 @@ EOF
connection default;
# Restore current database as the effect of "use" was lost after restart
--disable_query_log
eval use $current_database;
eval use $default_db;
--enable_query_log
set global maria_log_file_size=4294967295;
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
set global maria_checkpoint_interval=0;
create table t2 (a varchar(100)) engine=myisam;
insert into t2 select repeat('z',100);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
* shut down mysqld, removed logs, restarted it
create table t1 (a varchar(100)) engine=maria transactional=1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(100) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
show engine maria logs;
Type Name Status
MARIA Size 16384 maria_log.00000001 unknown
insert into t1 values('a');
insert into t1 select * from t2;
show engine maria logs;
Type Name Status
MARIA Size 24576 maria_log.00000001 unknown
* shut down mysqld, removed logs, restarted it
truncate table t1;
insert into t1 select * from t2;
show engine maria logs;
Type Name Status
MARIA Size 16384 maria_log.00000001 unknown
drop table t1;
* shut down mysqld, removed logs, restarted it
create table t1 (a varchar(100)) engine=maria transactional=1;
insert into t1 values('a');
create table if not exists t1 select * from t2;
Warnings:
Note 1050 Table 't1' already exists
show engine maria logs;
Type Name Status
MARIA Size 24576 maria_log.00000001 unknown
* shut down mysqld, removed logs, restarted it
drop table t1;
create table t1 engine=maria transactional=1 select * from t2;
show engine maria logs;
Type Name Status
MARIA Size 16384 maria_log.00000001 unknown
drop database mysqltest;
......@@ -650,3 +650,291 @@ t1 CREATE TABLE `t1` (
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Page checksums are used
drop table t1;
# iteration 1
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 modify a bigint ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
drop table t1;
# iteration 2
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 3
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 4
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
drop table t1;
# iteration 5
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 6
create table t1(a int) engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
Crashsafe: yes
alter table t1 engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 7
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 modify a bigint ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 8
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 9
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 10
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 11
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 12
create table t1(a int) engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
alter table t1 engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 13
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 modify a bigint ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 14
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 15
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 16
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 engine=maria ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
# iteration 17
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 engine=maria transactional=0 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
Crashsafe: no
drop table t1;
# iteration 18
create table t1(a int) engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
alter table t1 engine=maria transactional=1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
Crashsafe: yes
drop table t1;
......@@ -24,7 +24,7 @@ select * from t_corrupted2;
a
ThursdayMorningsMarket
Warnings:
Error 145 Table './mysqltest/t_corrupted2' is marked as crashed and should be repaired
Error 145 Table '.t_corrupted2' is marked as crashed and should be repaired
Error 1194 Table 't_corrupted2' is marked as crashed and should be repaired
Error 1034 1 client is using or hasn't closed the table properly
Error 1034 Wrong base information on indexpage at page: 1
......
CREATE TABLE t1 (
line BLOB,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
) transactional=0 row_format=page engine=maria;
select count(*) from t1;
count(*)
810
delete from t1 limit 1000;
select count(*) from t1;
count(*)
0
select name from t1;
name
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
# test of cases where we can safely disable logging
--source include/have_maria.inc
set global maria_log_file_size=4294967295;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
connect (admin, 127.0.0.1, root,,mysqltest,,);
--enable_reconnect
connection default;
use mysqltest;
--enable_reconnect
# checkpoints can make log unrepeatable
let $def_checkinterval=`select @@global.maria_checkpoint_interval`;
set global maria_checkpoint_interval=0;
# Prepare table to help for big load
create table t2 (a varchar(100)) engine=myisam;
insert into t2 select repeat('z',100);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
# INSERT SELECT
# no optimization because table not empty
# SHOW ENGINE MARIA LOGS could be influenced by older logs
-- source include/maria_empty_logs.inc
create table t1 (a varchar(100)) engine=maria transactional=1;
show create table t1;
--replace_regex /; .+maria_log/maria_log/
show engine maria logs;
insert into t1 values('a');
insert into t1 select * from t2;
--replace_regex /; .+maria_log/maria_log/
show engine maria logs;
# optimization because table is empty
-- source include/maria_empty_logs.inc
truncate table t1;
insert into t1 select * from t2;
--replace_regex /; .+maria_log/maria_log/
show engine maria logs;
drop table t1;
# same for CREATE SELECT
# no optimization because table not empty
-- source include/maria_empty_logs.inc
create table t1 (a varchar(100)) engine=maria transactional=1;
insert into t1 values('a');
create table if not exists t1 select * from t2;
--replace_regex /; .+maria_log/maria_log/
show engine maria logs;
# optimization because table is empty
-- source include/maria_empty_logs.inc
drop table t1;
create table t1 engine=maria transactional=1 select * from t2;
--replace_regex /; .+maria_log/maria_log/
show engine maria logs;
drop database mysqltest;
--disable_result_log
--disable_query_log
eval set global maria_checkpoint_interval=$def_checkinterval;
--enable_result_log
--enable_query_log
This diff is collapsed.
-- source include/have_maria.inc
-- source include/big_test.inc
#
# Empty logs to get log file numbers repeatable
# pre-requisites for maria_empty_logs
connect (admin, 127.0.0.1, root,,test,,);
#
--enable_reconnect
connect (admin, localhost, root,,);
connection default;
--enable_reconnect
--source include/maria_empty_logs.inc
# end of pre-requisites
# SHOW ENGINE MARIA LOGS could be influenced by older logs
# Also, possibly automatic checkpoints (see if that happens in
# practice)
-- source include/maria_empty_logs.inc
let $default=`select @@global.storage_engine`;
set global storage_engine=maria;
......@@ -56,6 +61,7 @@ insert into t2 select * from t1;
insert into t1 select * from t2;
set global maria_log_file_size=16777216;
# force a checkpoint to allow log purge
eval set global maria_checkpoint_interval=$def_checkinterval;
--replace_regex /Size +[0-9]+ ; .+master-data/master-data/
SHOW ENGINE maria logs;
......
......@@ -48,6 +48,7 @@ EOF
# line below will be removed
disable_ps_protocol;
replace_regex /.mysqltest.t_corrupted2/t_corrupted2/ ;
select * from t_corrupted2; # should show corruption and repair messages
enable_ps_protocol;
select * from t_corrupted2; # should show just rows
......
--source include/have_maria.inc
# Test for BUG#36319
# "Maria: table is not empty but DELETE and SELECT find no rows"
CREATE TABLE t1 (
line BLOB,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
) transactional=0 row_format=page engine=maria;
let $query= 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)"));
--disable_query_log
let $1=90;
while($1)
{
eval $query;
dec $1;
}
let $1=90;
while($1)
{
delete from t1 limit 1;
delete from t1 limit 10;
delete from t1 limit 7;
delete from t1 limit 2;
dec $1;
}
--enable_query_log
select count(*) from t1;
delete from t1 limit 1000;
select count(*) from t1;
select name from t1;
check table t1 extended;
drop table t1;
......@@ -5229,6 +5229,7 @@ compare_tables(TABLE *table,
create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET ||
create_info->used_fields & HA_CREATE_USED_ROW_FORMAT ||
create_info->used_fields & HA_CREATE_USED_PAGE_CHECKSUM ||
create_info->used_fields & HA_CREATE_USED_TRANSACTIONAL ||
(alter_info->flags & (ALTER_RECREATE | ALTER_FOREIGN_KEY)) ||
order_num ||
!table->s->mysql_version ||
......
......@@ -24,7 +24,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
SET(MARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
ma_rnext.c ma_rnext_same.c
ma_search.c ma_page.c ma_key_recover.c ma_key.c
ma_locking.c
ma_locking.c ma_state.c
ma_rrnd.c ma_scan.c ma_cache.c
ma_statrec.c ma_packrec.c ma_dynrec.c
ma_blockrec.c ma_bitmap.c
......
......@@ -114,7 +114,8 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
{
uchar *doc=*start;
int ctype;
uint mwc, length, mbl;
uint mwc, length;
int mbl;
param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0);
param->weight_adjust= param->wasign= 0;
......@@ -122,7 +123,7 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
while (doc<end)
{
for (; doc < end; doc+= (mbl > 0 ? mbl : 1))
for (; doc < end; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
if (true_word_char(ctype, *doc))
......@@ -140,7 +141,8 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
{
/* param->prev=' '; */
*start=doc+1;
if (*doc == FTB_LQUOT) param->quot= (char *) *start;
if (*doc == FTB_LQUOT)
param->quot= (char *) *start;
param->type= (*doc == FTB_RBR ? FT_TOKEN_RIGHT_PAREN : FT_TOKEN_LEFT_PAREN);
goto ret;
}
......@@ -160,7 +162,8 @@ uchar maria_ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
}
mwc=length=0;
for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1))
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
if (true_word_char(ctype, *doc))
......@@ -205,13 +208,13 @@ uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
my_bool skip_stopwords)
{
uchar *doc= *start;
uint mwc, length, mbl;
int ctype;
uint mwc, length;
int ctype, mbl;
DBUG_ENTER("maria_ft_simple_get_word");
do
{
for (;; doc+= (mbl > 0 ? mbl : 1))
for (;; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
if (doc >= end)
DBUG_RETURN(0);
......@@ -221,7 +224,8 @@ uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
}
mwc= length= 0;
for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1))
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
......@@ -393,7 +397,9 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_call_initializer(MARIA_HA *info,
mysql_add_word == 0 - parser is not initialized
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word= (void *)1;
info->ftparser_param[ftparser_nr].mysql_add_word=
(int (*)(struct st_mysql_ftparser_param *, char *, int,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
......
This diff is collapsed.
......@@ -3063,7 +3063,8 @@ static LSN parse_checkpoint_record(LSN lsn)
Find LSN higher or equal to this TRANSLOG_ADDRESS, suitable for
translog_read_record() functions.
*/
checkpoint_start= translog_next_LSN(start_address, LSN_IMPOSSIBLE);
start_address= checkpoint_start=
translog_next_LSN(start_address, LSN_IMPOSSIBLE);
if (checkpoint_start == LSN_IMPOSSIBLE)
{
/*
......
......@@ -86,8 +86,9 @@ static double rt_data[]=
-1
};
static int silent= 0, testflag= 0, transactional= 0,
die_in_middle_of_transaction= 0, checkpoint= 0, create_flag= 0;
static int testflag, checkpoint, create_flag;
static my_bool silent, transactional, die_in_middle_of_transaction,
opt_versioning;
static enum data_file_type record_type= DYNAMIC_RECORD;
int main(int argc, char *argv[])
......@@ -141,7 +142,11 @@ static int run_test(const char *filename)
int upd= 10;
ha_rows hrows;
bzero((char*) recinfo,sizeof(recinfo));
bzero(&uniquedef, sizeof(uniquedef));
bzero(&create_info, sizeof(create_info));
bzero(recinfo, sizeof(recinfo));
bzero(keyinfo, sizeof(keyinfo));
bzero(keyseg, sizeof(keyseg));
/* Define a column for NULLs and DEL markers*/
......@@ -179,7 +184,6 @@ static int run_test(const char *filename)
if (!silent)
printf("- Creating isam-file\n");
bzero((char*) &create_info,sizeof(create_info));
create_info.max_rows=10000000;
create_info.transactional= transactional;
......@@ -197,6 +201,8 @@ static int run_test(const char *filename)
if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
goto err;
maria_begin(file);
if (opt_versioning)
maria_versioning(file, 1);
if (testflag == 1)
goto end;
if (checkpoint == 1 && ma_checkpoint_execute(CHECKPOINT_MEDIUM, FALSE))
......@@ -215,13 +221,19 @@ static int run_test(const char *filename)
}
else
{
printf("maria_write: %d\n", error);
fprintf(stderr, "maria_write: %d\n", error);
goto err;
}
}
if (maria_scan_init(file))
{
fprintf(stderr, "maria_scan_init failed\n");
goto err;
}
if ((error=read_with_pos(file)))
goto err;
maria_scan_end(file);
if (!silent)
printf("- Reading rows with key\n");
......@@ -236,7 +248,7 @@ static int run_test(const char *filename)
if (error && error!=HA_ERR_KEY_NOT_FOUND)
{
printf(" maria_rkey: %3d errno: %3d\n",error,my_errno);
fprintf(stderr," maria_rkey: %3d errno: %3d\n",error,my_errno);
goto err;
}
if (error == HA_ERR_KEY_NOT_FOUND)
......@@ -268,7 +280,8 @@ static int run_test(const char *filename)
error=maria_scan(file,read_record);
if (error)
{
printf("pos: %2d maria_rrnd: %3d errno: %3d\n",i,error,my_errno);
fprintf(stderr, "pos: %2d maria_rrnd: %3d errno: %3d\n", i, error,
my_errno);
goto err;
}
print_record(read_record,maria_position(file),"\n");
......@@ -276,7 +289,8 @@ static int run_test(const char *filename)
error=maria_delete(file,read_record);
if (error)
{
printf("pos: %2d maria_delete: %3d errno: %3d\n",i,error,my_errno);
fprintf(stderr, "pos: %2d maria_delete: %3d errno: %3d\n", i, error,
my_errno);
goto err;
}
}
......@@ -305,7 +319,8 @@ static int run_test(const char *filename)
{
if (error==HA_ERR_RECORD_DELETED)
{
printf("found deleted record\n");
if (!silent)
printf("found deleted record\n");
/*
In BLOCK_RECORD format, maria_scan() never returns deleted records,
while in DYNAMIC format it can. Don't count such record:
......@@ -313,17 +328,20 @@ static int run_test(const char *filename)
max_i++;
continue;
}
printf("pos: %2d maria_rrnd: %3d errno: %3d\n",i,error,my_errno);
fprintf(stderr, "pos: %2d maria_rrnd: %3d errno: %3d\n",i , error,
my_errno);
goto err;
}
print_record(read_record,maria_position(file),"");
create_record1(record,i+nrecords*upd);
printf("\t-> ");
if (!silent)
printf("\t-> ");
print_record(record,maria_position(file),"\n");
error=maria_update(file,read_record,record);
if (error)
{
printf("pos: %2d maria_update: %3d errno: %3d\n",i,error,my_errno);
fprintf(stderr, "pos: %2d maria_update: %3d errno: %3d\n",i, error,
my_errno);
goto err;
}
}
......@@ -351,7 +369,7 @@ static int run_test(const char *filename)
if ((error=maria_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,
HA_READ_MBR_INTERSECT)))
{
printf("maria_rkey: %3d errno: %3d\n",error,my_errno);
fprintf(stderr, "maria_rkey: %3d errno: %3d\n",error,my_errno);
goto err;
}
print_record(read_record,maria_position(file)," maria_rkey\n");
......@@ -363,13 +381,14 @@ static int run_test(const char *filename)
{
if (error==HA_ERR_END_OF_FILE)
break;
printf("maria_next: %3d errno: %3d\n",error,my_errno);
fprintf(stderr, "maria_next: %3d errno: %3d\n",error,my_errno);
goto err;
}
print_record(read_record,maria_position(file)," maria_rnext_same\n");
row_count++;
}
printf(" %d rows\n",row_count);
if (!silent)
printf(" %d rows\n",row_count);
if (!silent)
printf("- Test maria_rfirst then a sequence of maria_rnext\n");
......@@ -377,7 +396,7 @@ static int run_test(const char *filename)
error=maria_rfirst(file,read_record,0);
if (error)
{
printf("maria_rfirst: %3d errno: %3d\n",error,my_errno);
fprintf(stderr, "maria_rfirst: %3d errno: %3d\n",error,my_errno);
goto err;
}
row_count=1;
......@@ -389,13 +408,14 @@ static int run_test(const char *filename)
{
if (error==HA_ERR_END_OF_FILE)
break;
printf("maria_next: %3d errno: %3d\n",error,my_errno);
fprintf(stderr, "maria_next: %3d errno: %3d\n",error,my_errno);
goto err;
}
print_record(read_record,maria_position(file)," maria_rnext\n");
row_count++;
}
printf(" %d rows\n",row_count);
if (!silent)
printf(" %d rows\n",row_count);
if (!silent)
printf("- Test maria_records_in_range()\n");
......@@ -407,7 +427,8 @@ static int run_test(const char *filename)
range.length= 1000; /* Big enough */
range.flag= HA_READ_MBR_INTERSECT;
hrows= maria_records_in_range(file,0, &range, (key_range*) 0);
printf(" %ld rows\n", (long) hrows);
if (!silent)
printf(" %ld rows\n", (long) hrows);
end:
maria_scan_end(file);
......@@ -432,7 +453,8 @@ end:
goto err;
break;
}
printf("Dying on request without maria_commit()/maria_close()\n");
if (!silent)
printf("Dying on request without maria_commit()/maria_close()\n");
exit(0);
}
if (maria_commit(file))
......@@ -444,7 +466,7 @@ end:
return 0;
err:
printf("got error: %3d when using maria-database\n",my_errno);
fprintf(stderr, "got error: %3d when using maria-database\n",my_errno);
return 1; /* skip warning */
}
......@@ -469,7 +491,8 @@ static int read_with_pos (MARIA_HA * file)
break;
if (error==HA_ERR_RECORD_DELETED)
continue;
printf("pos: %2d maria_rrnd: %3d errno: %3d\n",i,error,my_errno);
fprintf(stderr, "pos: %2d maria_rrnd: %3d errno: %3d\n", i, error,
my_errno);
return error;
}
print_record(read_record,maria_position(file),"\n");
......@@ -485,6 +508,8 @@ static void bprint_record(char * record,
{
int i;
char * pos;
if (silent)
return;
i=(unsigned char)record[0];
printf("%02X ",i);
......@@ -505,6 +530,8 @@ static void print_record(uchar *record,
uchar *pos;
double c;
if (silent)
return;
printf(" rec=(%d)",(unsigned char)record[0]);
for ( pos=record+1, i=0; i<2*ndims; i++)
{
......@@ -605,6 +632,9 @@ static struct my_option my_long_options[] =
"Test in transactional mode. (Only works with block format)",
(uchar**) &transactional, (uchar**) &transactional, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"versioning", 'C', "Use row versioning (only works with block format)",
(uchar**) &opt_versioning, (uchar**) &opt_versioning, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
......
......@@ -28,9 +28,9 @@
10 ended transactions since last time it was called.
*/
#include <maria_def.h>
#include "maria_def.h"
#include "trnman.h"
#include <ma_blockrec.h>
#include "ma_blockrec.h"
/**
@brief Setup initial start-of-transaction state for a table
......
......@@ -36,24 +36,58 @@ else
my $force_after= 3;
my $corrupt_file= $corrupt_index ? "MAI" : "MAD";
my $corrupt_message=
"\\[ERROR\\] mysqld: Table '.\/test\/t1' is marked as crashed and should be repaired";
"\\[ERROR\\] mysqld(.exe)*: Table '..test.t1' is marked as crashed and should be repaired";
my $sql_name= "./var/tmp/create_table.sql";
my $error_log_name= "./var/log/master.err";
my @cmd_output;
my $whatever; # garbage data
my $base_server_cmd= "perl mysql-test-run.pl --mem --mysqld=--maria-force-start-after-recovery-failures=$force_after maria-recover";
my $base_server_cmd= "perl mysql-test-run.pl --mysqld=--maria-force-start-after-recovery-failures=$force_after maria-recover ";
if ($^O =~ /^mswin/i)
{
print <<EOF;
WARNING: with Activestate Perl, mysql-test-run.pl --start-and-exit has a bug:
it does not exit; cygwin perl recommended
EOF
}
my $iswindows= ( $^O =~ /win/i && $^O !~ /darwin/i );
$base_server_cmd.= ($iswindows ? "--mysqld=--console" : "--mem");
my $server_cmd;
my $client_cmd= "../client/mysql -u root -S var/tmp/master.sock test < $sql_name";
my $server_pid_name="./var/run/master.pid";
my $server_pid;
my $i; # count of server restarts
sub kill_server;
my $suffix= ($iswindows ? ".exe" : "");
my $client_exe_path= "../client/release";
# we use -f, sometimes -x is unexpectedly false in Cygwin
if ( ! -f "$client_exe_path/mysql$suffix" )
{
$client_exe_path= "../client/relwithdebinfo";
if ( ! -f "$client_exe_path/mysql$suffix" )
{
$client_exe_path= "../client/debug";
if ( ! -f "$client_exe_path/mysql$suffix" )
{
$client_exe_path= "../client";
if ( ! -f "$client_exe_path/mysql$suffix" )
{
die("Cannot find 'mysql' executable\n");
}
}
}
}
print "starting mysqld\n";
$server_cmd= $base_server_cmd . " --start-and-exit 2>&1";
@cmd_output=`$server_cmd`;
die if $?;
my $master_port= (grep (/Using MASTER_MYPORT .*= (\d+)$/, @cmd_output))[0];
$master_port =~ s/.*= //;
chomp $master_port;
die unless $master_port > 0;
my $client_cmd= "$client_exe_path/mysql -u root -h 127.0.0.1 -P $master_port test < $sql_name";
open(FILE, ">", $sql_name) or die;
......@@ -113,7 +147,7 @@ for($i= 1; $i <= $force_after; $i= $i + 1)
open(FILE, "<", $error_log_name) or die;
@cmd_output= <FILE>;
close FILE;
die unless grep(/\[ERROR\] mysqld: Maria engine: log initialization failed/, @cmd_output);
die unless grep(/\[ERROR\] mysqld(.exe)*: Maria engine: log initialization failed/, @cmd_output);
die unless grep(/\[ERROR\] Plugin 'MARIA' init function returned error./, @cmd_output);
print "failed - ok\n";
}
......@@ -125,8 +159,8 @@ die if $?;
open(FILE, "<", $error_log_name) or die;
@cmd_output= <FILE>;
close FILE;
die unless grep(/\[Warning\] mysqld: Maria engine: removed all logs after [\d]+ consecutive failures of recovery from logs/, @cmd_output);
die unless grep(/\[ERROR\] mysqld: File '..\/tmp\/maria_log.00000001' not found \(Errcode: 2\)/, @cmd_output);
die unless grep(/\[Warning\] mysqld(.exe)*: Maria engine: removed all logs after [\d]+ consecutive failures of recovery from logs/, @cmd_output);
die unless grep(/\[ERROR\] mysqld(.exe)*: File '...tmp.maria_log.00000001' not found \(Errcode: 2\)/, @cmd_output);
print "success - ok\n";
open(FILE, ">", $sql_name) or die;
......@@ -151,7 +185,7 @@ open(FILE, "<", $error_log_name) or die;
@cmd_output= <FILE>;
close FILE;
die unless grep(/$corrupt_message/, @cmd_output);
die unless grep(/\[Warning\] Recovering table: '.\/test\/t1'/, @cmd_output);
die unless grep(/\[Warning\] Recovering table: '..test.t1'/, @cmd_output);
print "was corrupted and automatically repaired - ok\n";
# remove our traces
......@@ -164,14 +198,38 @@ sub kill_server
{
my ($sig)= @_;
my $wait_count= 0;
my $kill_cmd;
my @kill_output;
open(FILE, "<", $server_pid_name) or die;
@cmd_output= <FILE>;
close FILE;
$server_pid= $cmd_output[0];
chomp $server_pid;
die unless $server_pid > 0;
kill($sig, $server_pid) or die;
while (kill (0, $server_pid))
if ($iswindows)
{
# On Windows, server_pid_name is not the "main" process id
# so perl's kill() does not see this process id.
# But taskkill works, though only with /F ("-9"-style kill).
$kill_cmd= "taskkill /F /PID $server_pid 2>&1";
@kill_output= `$kill_cmd`;
die unless grep(/has been terminated/, @kill_output);
}
else
{
kill($sig, $server_pid) or die;
}
while (1) # wait until mysqld process gone
{
if ($iswindows)
{
@kill_output= `$kill_cmd`;
last if grep(/not found/, @kill_output);
}
else
{
kill (0, $server_pid) or last;
}
print "waiting for mysqld to die\n" if ($wait_count > 30);
$wait_count= $wait_count + 1;
select(undef, undef, undef, 0.1);
......
MYSQL_STORAGE_ENGINE(maria,, [Maria Storage Engine],
[Crash-safe tables with MyISAM heritage], [max,max-no-ndb])
[Crash-safe tables with MyISAM heritage], [default,max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(maria, [storage/maria])
MYSQL_PLUGIN_STATIC(maria, [libmaria.a])
# Maria will probably go first into max builds, not all builds,
......
......@@ -22,7 +22,6 @@ LINK_LIBRARIES(maria myisam mytap mysys dbug strings wsock32 zlib)
ADD_EXECUTABLE(ma_control_file-t ma_control_file-t.c)
ADD_EXECUTABLE(trnman-t trnman-t.c)
ADD_EXECUTABLE(lockman2-t lockman2-t.c)
ADD_EXECUTABLE(ma_test_loghandler-t
ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c)
ADD_EXECUTABLE(ma_test_loghandler_multigroup-t
......
......@@ -27,7 +27,7 @@ LDADD= $(top_builddir)/unittest/mytap/libmytap.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
noinst_PROGRAMS = ma_control_file-t trnman-t \
ma_pagecache_single_1k-t ma_pagecache_single_8k-t \
ma_pagecache_single_64k-t \
ma_pagecache_consist_1k-t \
......@@ -42,6 +42,7 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler-t \
ma_test_loghandler_multigroup-t \
ma_test_loghandler_multithread-t \
ma_test_loghandler_multiflush-t \
ma_test_loghandler_pagecache-t \
ma_test_loghandler_long-t \
ma_test_loghandler_noflush-t \
......@@ -54,6 +55,8 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler_t_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multigroup_t_SOURCES = ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c sequence_storage.c sequence_storage.h
ma_test_loghandler_multithread_t_SOURCES = ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multiflush_t_SOURCES = ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multiflush_t_CPPFLAGS = -DMULTIFLUSH_TEST
ma_test_loghandler_pagecache_t_SOURCES = ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_long_t_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_long_t_CPPFLAGS = -DLONG_LOG_TEST
......@@ -100,7 +103,8 @@ ma_pagecache_rwconsist_1k_t_SOURCES = ma_pagecache_rwconsist.c
ma_pagecache_rwconsist_1k_t_CPPFLAGS = -DTEST_PAGE_SIZE=1024
# the generic lock manager may not be used in the end and lockman1-t crashes,
# so we don't build lockman-t and lockman1-t
# and lockman2-t takes at least quarter an hour,
# so we don't build lockman-t and lockman1-t and lockman2-t
CLEANFILES = maria_log_control page_cache_test_file_1 \
maria_log.????????
......
......@@ -266,12 +266,15 @@ sub run_check_tests
["-m10000 -e16384 -E16384 -K -L","-sm"],
["-L -K -W -P -b32768", "-se"],
["-c -b65000","-se"] );
my @ma_rt_test_opt= ( ); # (["--checksum", "-se"] );
if ($count)
{
$nr_tests= 2; # Number of tests outside loops
for ($i= 0; defined($ma_test1_opt[$i]); $i++) { $nr_tests+=2; }
for ($i= 0; defined($ma_test2_opt[$i]); $i++) { $nr_tests+=2; }
for ($i= 0; defined($ma_rt_test_opt[$i]); $i++) { $nr_tests+=2; }
return $nr_tests;
}
......@@ -298,6 +301,16 @@ sub run_check_tests
ok("$maria_exe_path/maria_chk$suffix $ma_test2_opt[$i][1] test2",
$verbose, $i + 1);
}
for ($i= 0; defined($ma_rt_test_opt[$i]); $i++)
{
unlink <maria_log_control maria_log.*>;
ok("$maria_exe_path/ma_rt_test$suffix $silent $ma_rt_test_opt[$i][0] $row_type",
$verbose, $i + 1);
ok("$maria_exe_path/maria_chk$suffix $ma_rt_test_opt[$i][1] rt_test",
$verbose, $i + 1);
}
unlink <maria_log_control maria_log.*>;
return 0;
......
......@@ -28,16 +28,35 @@ static const char *default_dbug_option;
#define PCACHE_SIZE (1024*1024*10)
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
/*#define LOG_FLAGS TRANSLOG_SECTOR_PROTECTION | TRANSLOG_PAGE_CRC */
#define LOG_FLAGS 0
/*#define LONG_BUFFER_SIZE (1024L*1024L*1024L + 1024L*1024L*512)*/
#ifdef MULTIFLUSH_TEST
#define LONG_BUFFER_SIZE (16384L)
#define MIN_REC_LENGTH 10
#define SHOW_DIVIDER 20
#define ITERATIONS 10000
#define FLUSH_ITERATIONS 1000
#define WRITERS 2
#define FLUSHERS 10
#else
#define LONG_BUFFER_SIZE (512L*1024L*1024L)
#define MIN_REC_LENGTH 30
#define SHOW_DIVIDER 10
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
#define ITERATIONS 3
#define FLUSH_ITERATIONS 0
#define WRITERS 3
#define FLUSHERS 0
#endif
static uint number_of_writers= WRITERS;
static uint number_of_flushers= FLUSHERS;
static pthread_cond_t COND_thread_count;
static pthread_mutex_t LOCK_thread_count;
......@@ -48,6 +67,9 @@ static LSN lsns1[WRITERS][ITERATIONS];
static LSN lsns2[WRITERS][ITERATIONS];
static uchar *long_buffer;
static LSN last_lsn; /* For test purposes the variable allow dirty read/write */
/*
Get pseudo-random length of the field in
limits [MIN_REC_LENGTH..LONG_BUFFER_SIZE]
......@@ -177,6 +199,7 @@ void writer(int num)
return;
}
lsns2[num][i]= lsn;
last_lsn= lsn;
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "write records");
pthread_mutex_unlock(&LOCK_thread_count);
......@@ -205,6 +228,33 @@ static void *test_thread_writer(void *arg)
}
static void *test_thread_flusher(void *arg)
{
int param= *((int*) arg);
int i;
my_thread_init();
for(i= 0; i < FLUSH_ITERATIONS; i++)
{
translog_flush(last_lsn);
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "-- flush %d", param);
pthread_mutex_unlock(&LOCK_thread_count);
}
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
ok(1, "flusher finished"); /* just to show progress */
VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are
ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
return(0);
}
int main(int argc __attribute__((unused)),
char **argv __attribute__ ((unused)))
{
......@@ -219,7 +269,8 @@ int main(int argc __attribute__((unused)),
int *param, error;
int rc;
plan(WRITERS + ITERATIONS * WRITERS * 3);
plan(WRITERS + FLUSHERS +
ITERATIONS * WRITERS * 3 + FLUSH_ITERATIONS * FLUSHERS );
bzero(&pagecache, sizeof(pagecache));
maria_data_root= (char *)".";
......@@ -329,19 +380,36 @@ int main(int argc __attribute__((unused)),
pthread_mutex_lock(&LOCK_thread_count);
while (number_of_writers != 0)
while (number_of_writers != 0 || number_of_flushers != 0)
{
param= (int*) malloc(sizeof(int));
*param= number_of_writers - 1;
if ((error= pthread_create(&tid, &thr_attr, test_thread_writer,
(void*) param)))
if (number_of_writers)
{
fprintf(stderr, "Got error: %d from pthread_create (errno: %d)\n",
error, errno);
exit(1);
param= (int*) malloc(sizeof(int));
*param= number_of_writers - 1;
if ((error= pthread_create(&tid, &thr_attr, test_thread_writer,
(void*) param)))
{
fprintf(stderr, "Got error: %d from pthread_create (errno: %d)\n",
error, errno);
exit(1);
}
thread_count++;
number_of_writers--;
}
if (number_of_flushers)
{
param= (int*) malloc(sizeof(int));
*param= number_of_flushers - 1;
if ((error= pthread_create(&tid, &thr_attr, test_thread_flusher,
(void*) param)))
{
fprintf(stderr, "Got error: %d from pthread_create (errno: %d)\n",
error, errno);
exit(1);
}
thread_count++;
number_of_flushers--;
}
thread_count++;
number_of_writers--;
}
pthread_mutex_unlock(&LOCK_thread_count);
......
......@@ -91,7 +91,9 @@ sub main
"ma_test2$suffix $silent -M -T -c -b65000",
"ma_test2$suffix $silent -M -T -c -b65000 -d800",
"ma_test1$suffix $silent -M -T -c -C",
"ma_test2$suffix $silent -L -K -W -P -M -T -c -d500 -C"
"ma_test2$suffix $silent -L -K -W -P -M -T -c -d500 -C",
#"ma_rt_test$suffix $silent -M -T -c -C",
# @todo: also add to @t2
);
foreach my $prog (@t)
......@@ -103,10 +105,14 @@ sub main
$res= my_exec("$maria_exe_path/$prog");
print MY_LOG $res;
# derive table's name from program's name
if ($prog =~ m/ma_(test[0-9]+).*/)
if ($prog =~ m/^ma_(\S+)\s.*/)
{
$table= $1;
}
else
{
die("can't guess table name");
}
$com= "$maria_exe_path/maria_chk$suffix -dvv $table ";
$com.= "| grep -v \"Creation time:\" | grep -v \"file length\" ";
$com.= "> $tmp/maria_chk_message.good.txt 2>&1";
......@@ -182,10 +188,14 @@ sub main
$res= my_exec("$maria_exe_path/$prog $commit_run_args");
print MY_LOG $res;
# derive table's name from program's name
if ($prog =~ m/ma_(test[0-9]+).*/)
if ($prog =~ m/^ma_(\S+)\s.*/)
{
$table= $1;
}
else
{
die("can't guess table name");
}
$com= "$maria_exe_path/maria_chk$suffix -dvv $table ";
$com.= "| grep -v \"Creation time:\" | grep -v \"file length\" ";
$com.= "> $tmp/maria_chk_message.good.txt 2>&1";
......
......@@ -112,7 +112,13 @@ static int run_test(const char *filename)
uchar read_record[MAX_REC_LENGTH];
int upd= 10;
ha_rows hrows;
bzero(&uniquedef, sizeof(uniquedef));
bzero(&create_info, sizeof(create_info));
bzero(recinfo, sizeof(recinfo));
bzero(keyinfo, sizeof(keyinfo));
bzero(keyseg, sizeof(keyseg));
/* Define a column for NULLs and DEL markers*/
recinfo[0].type=FIELD_NORMAL;
......@@ -147,7 +153,6 @@ static int run_test(const char *filename)
if (!silent)
printf("- Creating isam-file\n");
bzero((char*) &create_info,sizeof(create_info));
create_info.max_rows=10000000;
if (mi_create(filename,
......
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