Commit 75e52671 authored by unknown's avatar unknown

maria cannot rollback yet

parent 3dee3847
...@@ -2,6 +2,25 @@ set global storage_engine=maria; ...@@ -2,6 +2,25 @@ set global storage_engine=maria;
set session storage_engine=maria; set session storage_engine=maria;
drop table if exists t1,t2; drop table if exists t1,t2;
SET SQL_WARNINGS=1; SET SQL_WARNINGS=1;
RESET MASTER;
set binlog_format=statement;
CREATE TABLE t1 (a int primary key);
insert t1 values (1),(2),(3);
insert t1 values (4),(2),(5);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select * from t1;
a
1
2
3
4
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 200 use `test`; CREATE TABLE t1 (a int primary key)
master-bin.000001 200 Query 1 291 use `test`; insert t1 values (1),(2),(3)
master-bin.000001 291 Query 1 382 use `test`; insert t1 values (4),(2),(5)
drop table t1;
set binlog_format=default;
CREATE TABLE t1 ( CREATE TABLE t1 (
STRING_DATA char(255) default NULL, STRING_DATA char(255) default NULL,
KEY string_data (STRING_DATA) KEY string_data (STRING_DATA)
......
...@@ -15,6 +15,22 @@ drop table if exists t1,t2; ...@@ -15,6 +15,22 @@ drop table if exists t1,t2;
--enable_warnings --enable_warnings
SET SQL_WARNINGS=1; SET SQL_WARNINGS=1;
#
# UNIQUE key test
#
# as long as maria cannot rollback, binlog should contain both inserts
#
RESET MASTER;
set binlog_format=statement;
CREATE TABLE t1 (a int primary key);
insert t1 values (1),(2),(3);
--error 1582
insert t1 values (4),(2),(5);
select * from t1;
SHOW BINLOG EVENTS FROM 102;
drop table t1;
set binlog_format=default;
# #
# Test problem with CHECK TABLE; # Test problem with CHECK TABLE;
# #
......
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
#include "ma_rt_index.h" #include "ma_rt_index.h"
#include "ma_blockrec.h" #include "ma_blockrec.h"
#define MARIA_CANNOT_ROLLBACK HA_NO_TRANSACTIONS
#ifdef MARIA_CANNOT_ROLLBACK
#define trans_register_ha(A, B, C) do { /* nothing */ } while(0)
#endif
ulong maria_recover_options= HA_RECOVER_NONE; ulong maria_recover_options= HA_RECOVER_NONE;
static handlerton *maria_hton; static handlerton *maria_hton;
...@@ -466,7 +471,7 @@ ha_maria::ha_maria(handlerton *hton, TABLE_SHARE *table_arg): ...@@ -466,7 +471,7 @@ ha_maria::ha_maria(handlerton *hton, TABLE_SHARE *table_arg):
handler(hton, table_arg), file(0), handler(hton, table_arg), file(0),
int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_FILE_BASED | HA_CAN_GEOMETRY | MARIA_CANNOT_ROLLBACK |
HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS | HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS |
HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT), HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT),
can_enable_indexes(1) can_enable_indexes(1)
...@@ -1885,12 +1890,17 @@ int ha_maria::external_lock(THD *thd, int lock_type) ...@@ -1885,12 +1890,17 @@ int ha_maria::external_lock(THD *thd, int lock_type)
if (!trnman_decrement_locked_tables(trn)) if (!trnman_decrement_locked_tables(trn))
{ {
/* autocommit ? rollback a transaction */ /* autocommit ? rollback a transaction */
#ifdef MARIA_CANNOT_ROLLBACK
trnman_commit_trn(trn);
THD_TRN= 0;
#else
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{ {
trnman_rollback_trn(trn); trnman_rollback_trn(trn);
DBUG_PRINT("info", ("THD_TRN set to 0x0")); DBUG_PRINT("info", ("THD_TRN set to 0x0"));
THD_TRN= 0; THD_TRN= 0;
} }
#endif
} }
} }
} }
......
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