List:Maria Storage Engine« Previous MessageNext Message »
From:Michael Widenius Date:October 10 2008 3:57pm
Subject:bzr commit into MySQL/Maria:mysql-maria branch (monty:2672)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/

 2672 Michael Widenius	2008-10-10 [merge]
      Merge with 5.1-maria
added:
  mysql-test/suite/maria/
  mysql-test/suite/maria/r/
  mysql-test/suite/maria/t/
renamed:
  mysql-test/r/maria-autozerofill.result => mysql-test/suite/maria/r/maria-autozerofill.result
  mysql-test/r/maria-big.result => mysql-test/suite/maria/r/maria-big.result
  mysql-test/r/maria-big2.result => mysql-test/suite/maria/r/maria-big2.result
  mysql-test/r/maria-connect.result => mysql-test/suite/maria/r/maria-connect.result
  mysql-test/r/maria-gis-rtree-dynamic.result => mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result
  mysql-test/r/maria-gis-rtree-trans.result => mysql-test/suite/maria/r/maria-gis-rtree-trans.result
  mysql-test/r/maria-gis-rtree.result => mysql-test/suite/maria/r/maria-gis-rtree.result
  mysql-test/r/maria-mvcc.result => mysql-test/suite/maria/r/maria-mvcc.result
  mysql-test/r/maria-no-logging.result => mysql-test/suite/maria/r/maria-no-logging.result
  mysql-test/r/maria-page-checksum.result => mysql-test/suite/maria/r/maria-page-checksum.result
  mysql-test/r/maria-preload.result => mysql-test/suite/maria/r/maria-preload.result
  mysql-test/r/maria-purge.result => mysql-test/suite/maria/r/maria-purge.result
  mysql-test/r/maria-recover.result => mysql-test/suite/maria/r/maria-recover.result
  mysql-test/r/maria-recovery-big.result => mysql-test/suite/maria/r/maria-recovery-big.result
  mysql-test/r/maria-recovery-bitmap.result => mysql-test/suite/maria/r/maria-recovery-bitmap.result
  mysql-test/r/maria-recovery-rtree-ft.result => mysql-test/suite/maria/r/maria-recovery-rtree-ft.result
  mysql-test/r/maria-recovery.result => mysql-test/suite/maria/r/maria-recovery.result
  mysql-test/r/maria-recovery2.result => mysql-test/suite/maria/r/maria-recovery2.result
  mysql-test/r/maria.result => mysql-test/suite/maria/r/maria.result
  mysql-test/r/maria2.result => mysql-test/suite/maria/r/maria2.result
  mysql-test/r/maria3.result => mysql-test/suite/maria/r/maria3.result
  mysql-test/r/maria_notembedded.result => mysql-test/suite/maria/r/maria_notembedded.result
  mysql-test/r/ps_maria.result => mysql-test/suite/maria/r/ps_maria.result
  mysql-test/t/maria-autozerofill.test => mysql-test/suite/maria/t/maria-autozerofill.test
  mysql-test/t/maria-big.test => mysql-test/suite/maria/t/maria-big.test
  mysql-test/t/maria-big2.test => mysql-test/suite/maria/t/maria-big2.test
  mysql-test/t/maria-connect.test => mysql-test/suite/maria/t/maria-connect.test
  mysql-test/t/maria-gis-rtree-dynamic.test => mysql-test/suite/maria/t/maria-gis-rtree-dynamic.test
  mysql-test/t/maria-gis-rtree-trans.test => mysql-test/suite/maria/t/maria-gis-rtree-trans.test
  mysql-test/t/maria-gis-rtree.test => mysql-test/suite/maria/t/maria-gis-rtree.test
  mysql-test/t/maria-mvcc.test => mysql-test/suite/maria/t/maria-mvcc.test
  mysql-test/t/maria-no-logging.test => mysql-test/suite/maria/t/maria-no-logging.test
  mysql-test/t/maria-page-checksum.test => mysql-test/suite/maria/t/maria-page-checksum.test
  mysql-test/t/maria-preload.test => mysql-test/suite/maria/t/maria-preload.test
  mysql-test/t/maria-purge.test => mysql-test/suite/maria/t/maria-purge.test
  mysql-test/t/maria-recover-master.opt => mysql-test/suite/maria/t/maria-recover-master.opt
  mysql-test/t/maria-recover.test => mysql-test/suite/maria/t/maria-recover.test
  mysql-test/t/maria-recovery-big-master.opt => mysql-test/suite/maria/t/maria-recovery-big-master.opt
  mysql-test/t/maria-recovery-big.test => mysql-test/suite/maria/t/maria-recovery-big.test
  mysql-test/t/maria-recovery-bitmap-master.opt => mysql-test/suite/maria/t/maria-recovery-bitmap-master.opt
  mysql-test/t/maria-recovery-bitmap.test => mysql-test/suite/maria/t/maria-recovery-bitmap.test
  mysql-test/t/maria-recovery-master.opt => mysql-test/suite/maria/t/maria-recovery-master.opt
  mysql-test/t/maria-recovery-rtree-ft-master.opt => mysql-test/suite/maria/t/maria-recovery-rtree-ft-master.opt
  mysql-test/t/maria-recovery-rtree-ft.test => mysql-test/suite/maria/t/maria-recovery-rtree-ft.test
  mysql-test/t/maria-recovery.test => mysql-test/suite/maria/t/maria-recovery.test
  mysql-test/t/maria-recovery2-master.opt => mysql-test/suite/maria/t/maria-recovery2-master.opt
  mysql-test/t/maria-recovery2.test => mysql-test/suite/maria/t/maria-recovery2.test
  mysql-test/t/maria.test => mysql-test/suite/maria/t/maria.test
  mysql-test/t/maria2.test => mysql-test/suite/maria/t/maria2.test
  mysql-test/t/maria3.test => mysql-test/suite/maria/t/maria3.test
  mysql-test/t/maria_notembedded.test => mysql-test/suite/maria/t/maria_notembedded.test
  mysql-test/t/ps_maria.test => mysql-test/suite/maria/t/ps_maria.test
modified:
  configure.in
  mysql-test/mysql-test-run.pl
  mysys/Makefile.am
  mysys/lf_alloc-pin.c
  sql/mysqld.cc
  storage/maria/ha_maria.cc
  storage/maria/ma_blockrec.c
  storage/maria/ma_commit.c
  storage/maria/ma_init.c
  storage/maria/ma_open.c
  storage/maria/ma_write.c
  storage/maria/maria_def.h
  unittest/mysys/waiting_threads-t.c
  mysql-test/suite/maria/r/maria.result
  mysql-test/suite/maria/r/maria3.result
  mysql-test/suite/maria/t/maria.test
  mysql-test/suite/maria/t/maria3.test

=== modified file 'configure.in'
--- a/configure.in	2008-07-29 14:10:24 +0000
+++ b/configure.in	2008-10-01 20:55:23 +0000
@@ -2701,14 +2701,12 @@ if test "$with_server" = "yes" -o "$THRE
 then
   AC_DEFINE([THREAD], [1],
             [Define if you want to have threaded code. This may be undef on client code])
-  # Avoid _PROGRAMS names
-  THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o waiting_threads.o"
-  AC_SUBST(THREAD_LOBJECTS)
   server_scripts="mysqld_safe mysql_install_db"
   sql_server_dirs="strings mysys dbug extra regex"
 
   sql_server="vio sql"
 fi
+AM_CONDITIONAL(THREAD, test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no")
 
 # IMPORTANT - do not modify LIBS past this line - this hack is the only way
 # I know to add the static NSS magic if we have static NSS libraries with

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-08-24 13:29:34 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-10-01 12:13:39 +0000
@@ -134,7 +134,7 @@ our $default_vardir;
 
 our $opt_usage;
 our $opt_suites;
-our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
+our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run
 our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
 our $opt_verbose= 0;  # Verbose output, enable with --verbose
 

=== added directory 'mysql-test/suite/maria'
=== added directory 'mysql-test/suite/maria/r'
=== renamed file 'mysql-test/r/maria-autozerofill.result' => 'mysql-test/suite/maria/r/maria-autozerofill.result'
=== renamed file 'mysql-test/r/maria-big.result' => 'mysql-test/suite/maria/r/maria-big.result'
=== renamed file 'mysql-test/r/maria-big2.result' => 'mysql-test/suite/maria/r/maria-big2.result'
=== renamed file 'mysql-test/r/maria-connect.result' => 'mysql-test/suite/maria/r/maria-connect.result'
=== renamed file 'mysql-test/r/maria-gis-rtree-dynamic.result' => 'mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result'
=== renamed file 'mysql-test/r/maria-gis-rtree-trans.result' => 'mysql-test/suite/maria/r/maria-gis-rtree-trans.result'
=== renamed file 'mysql-test/r/maria-gis-rtree.result' => 'mysql-test/suite/maria/r/maria-gis-rtree.result'
=== renamed file 'mysql-test/r/maria-mvcc.result' => 'mysql-test/suite/maria/r/maria-mvcc.result'
=== renamed file 'mysql-test/r/maria-no-logging.result' => 'mysql-test/suite/maria/r/maria-no-logging.result'
=== renamed file 'mysql-test/r/maria-page-checksum.result' => 'mysql-test/suite/maria/r/maria-page-checksum.result'
=== renamed file 'mysql-test/r/maria-preload.result' => 'mysql-test/suite/maria/r/maria-preload.result'
=== renamed file 'mysql-test/r/maria-purge.result' => 'mysql-test/suite/maria/r/maria-purge.result'
=== renamed file 'mysql-test/r/maria-recover.result' => 'mysql-test/suite/maria/r/maria-recover.result'
=== renamed file 'mysql-test/r/maria-recovery-big.result' => 'mysql-test/suite/maria/r/maria-recovery-big.result'
=== renamed file 'mysql-test/r/maria-recovery-bitmap.result' => 'mysql-test/suite/maria/r/maria-recovery-bitmap.result'
=== renamed file 'mysql-test/r/maria-recovery-rtree-ft.result' => 'mysql-test/suite/maria/r/maria-recovery-rtree-ft.result'
=== renamed file 'mysql-test/r/maria-recovery.result' => 'mysql-test/suite/maria/r/maria-recovery.result'
=== renamed file 'mysql-test/r/maria-recovery2.result' => 'mysql-test/suite/maria/r/maria-recovery2.result'
=== renamed file 'mysql-test/r/maria.result' => 'mysql-test/suite/maria/r/maria.result'
--- a/mysql-test/r/maria.result	2008-10-10 14:14:39 +0000
+++ b/mysql-test/suite/maria/r/maria.result	2008-10-10 15:57:37 +0000
@@ -1901,12 +1901,10 @@ check table t2 extended;
 Table	Op	Msg_type	Msg_text
 test.t2	check	status	OK
 drop table t2;
-set session  deadlock_timeout_long=60000000;
 create table t1 (a int unique) transactional=1;
 insert t1 values (1);
 lock table t1 write concurrent;
 insert t1 values (2);
-set session  deadlock_timeout_long=60000000;
 lock table t1 write concurrent;
 insert t1 values (3);
 insert t1 values (2);
@@ -2284,6 +2282,12 @@ insert into v1 (f1) values (3) on duplic
 insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
 drop table t1,t2;
 drop view v1;
+CREATE TABLE t1 (id int, c varchar(10)) engine=maria;
+INSERT INTO t1 VALUES (1,"1");
+ALTER TABLE t1 CHANGE c d varchar(10);
+affected rows: 0
+info: Records: 0  Duplicates: 0  Warnings: 0
+drop table t1;
 create table t1 (s1 int);
 insert into t1 values (1);
 alter table t1 partition by list (s1) (partition p1 values in (2));

=== renamed file 'mysql-test/r/maria2.result' => 'mysql-test/suite/maria/r/maria2.result'
=== renamed file 'mysql-test/r/maria3.result' => 'mysql-test/suite/maria/r/maria3.result'
--- a/mysql-test/r/maria3.result	2008-07-01 20:47:09 +0000
+++ b/mysql-test/suite/maria/r/maria3.result	2008-10-09 20:03:54 +0000
@@ -506,7 +506,7 @@ count(*)
 select count(*) from t1 where a >= 4;
 count(*)
 1
-drop table t1;
+drop table t1, t2;
 create table t1 (i int auto_increment not null primary key) transactional=0;
 check table t1 extended;
 Table	Op	Msg_type	Msg_text
@@ -540,3 +540,14 @@ TABLE_SCHEMA='test' and TABLE_NAME='t1';
 CREATE_OPTIONS
 transactional=1
 drop table t1;
+create table t1 (a int, unique(a)) engine=maria transactional=1;
+insert into t1 values(1);
+insert into t1 values(2),(2);
+ERROR 23000: Duplicate entry '2' for key 'a'
+create table t2 (a int, unique(a)) engine=maria transactional=0 row_format=dynamic;
+insert into t2 values(1);
+insert into t2 values(2),(2);
+ERROR 23000: Duplicate entry '2' for key 'a'
+insert into t1 values(3);
+insert into t2 values(3);
+drop table t1, t2;

=== renamed file 'mysql-test/r/maria_notembedded.result' => 'mysql-test/suite/maria/r/maria_notembedded.result'
=== renamed file 'mysql-test/r/ps_maria.result' => 'mysql-test/suite/maria/r/ps_maria.result'
=== added directory 'mysql-test/suite/maria/t'
=== renamed file 'mysql-test/t/maria-autozerofill.test' => 'mysql-test/suite/maria/t/maria-autozerofill.test'
=== renamed file 'mysql-test/t/maria-big.test' => 'mysql-test/suite/maria/t/maria-big.test'
=== renamed file 'mysql-test/t/maria-big2.test' => 'mysql-test/suite/maria/t/maria-big2.test'
=== renamed file 'mysql-test/t/maria-connect.test' => 'mysql-test/suite/maria/t/maria-connect.test'
=== renamed file 'mysql-test/t/maria-gis-rtree-dynamic.test' => 'mysql-test/suite/maria/t/maria-gis-rtree-dynamic.test'
=== renamed file 'mysql-test/t/maria-gis-rtree-trans.test' => 'mysql-test/suite/maria/t/maria-gis-rtree-trans.test'
=== renamed file 'mysql-test/t/maria-gis-rtree.test' => 'mysql-test/suite/maria/t/maria-gis-rtree.test'
=== renamed file 'mysql-test/t/maria-mvcc.test' => 'mysql-test/suite/maria/t/maria-mvcc.test'
=== renamed file 'mysql-test/t/maria-no-logging.test' => 'mysql-test/suite/maria/t/maria-no-logging.test'
=== renamed file 'mysql-test/t/maria-page-checksum.test' => 'mysql-test/suite/maria/t/maria-page-checksum.test'
=== renamed file 'mysql-test/t/maria-preload.test' => 'mysql-test/suite/maria/t/maria-preload.test'
=== renamed file 'mysql-test/t/maria-purge.test' => 'mysql-test/suite/maria/t/maria-purge.test'
=== renamed file 'mysql-test/t/maria-recover-master.opt' => 'mysql-test/suite/maria/t/maria-recover-master.opt'
=== renamed file 'mysql-test/t/maria-recover.test' => 'mysql-test/suite/maria/t/maria-recover.test'
=== renamed file 'mysql-test/t/maria-recovery-big-master.opt' => 'mysql-test/suite/maria/t/maria-recovery-big-master.opt'
=== renamed file 'mysql-test/t/maria-recovery-big.test' => 'mysql-test/suite/maria/t/maria-recovery-big.test'
=== renamed file 'mysql-test/t/maria-recovery-bitmap-master.opt' => 'mysql-test/suite/maria/t/maria-recovery-bitmap-master.opt'
=== renamed file 'mysql-test/t/maria-recovery-bitmap.test' => 'mysql-test/suite/maria/t/maria-recovery-bitmap.test'
=== renamed file 'mysql-test/t/maria-recovery-master.opt' => 'mysql-test/suite/maria/t/maria-recovery-master.opt'
=== renamed file 'mysql-test/t/maria-recovery-rtree-ft-master.opt' => 'mysql-test/suite/maria/t/maria-recovery-rtree-ft-master.opt'
=== renamed file 'mysql-test/t/maria-recovery-rtree-ft.test' => 'mysql-test/suite/maria/t/maria-recovery-rtree-ft.test'
=== renamed file 'mysql-test/t/maria-recovery.test' => 'mysql-test/suite/maria/t/maria-recovery.test'
=== renamed file 'mysql-test/t/maria-recovery2-master.opt' => 'mysql-test/suite/maria/t/maria-recovery2-master.opt'
=== renamed file 'mysql-test/t/maria-recovery2.test' => 'mysql-test/suite/maria/t/maria-recovery2.test'
=== renamed file 'mysql-test/t/maria.test' => 'mysql-test/suite/maria/t/maria.test'
--- a/mysql-test/t/maria.test	2008-10-10 14:14:39 +0000
+++ b/mysql-test/suite/maria/t/maria.test	2008-10-10 15:57:37 +0000
@@ -1190,13 +1190,11 @@ drop table t2;
 #
 # an example of a deadlock
 #
-set session  deadlock_timeout_long=60000000;
 create table t1 (a int unique) transactional=1;
 insert t1 values (1);
 lock table t1 write concurrent;
 insert t1 values (2);
 connect(con_d,localhost,root,,);
-set session  deadlock_timeout_long=60000000;
 lock table t1 write concurrent;
 insert t1 values (3);
 send insert t1 values (2);
@@ -1577,6 +1575,17 @@ drop table t1,t2;
 drop view v1;
 
 #
+# BUG#39399 ALTER TABLE renaming column: affected_rows > 0
+#
+
+CREATE TABLE t1 (id int, c varchar(10)) engine=maria;
+INSERT INTO t1 VALUES (1,"1");
+--enable_info
+ALTER TABLE t1 CHANGE c d varchar(10);
+--disable_info
+drop table t1;
+
+#
 # Bug #39227 Maria: crash with ALTER TABLE PARTITION
 #
 

=== renamed file 'mysql-test/t/maria2.test' => 'mysql-test/suite/maria/t/maria2.test'
=== renamed file 'mysql-test/t/maria3.test' => 'mysql-test/suite/maria/t/maria3.test'
--- a/mysql-test/t/maria3.test	2008-07-01 20:47:09 +0000
+++ b/mysql-test/suite/maria/t/maria3.test	2008-10-09 20:03:54 +0000
@@ -406,7 +406,7 @@ insert into t2 select * from t1;
 insert into t1 select NULL from t2;
 select count(*) from t1;
 select count(*) from t1 where a >= 4;
-drop table t1;
+drop table t1, t2;
 
 #
 # Test problems with small rows and row_type=page 
@@ -461,6 +461,24 @@ select CREATE_OPTIONS from information_s
 TABLE_SCHEMA='test' and TABLE_NAME='t1';
 drop table t1;
 
+#
+# BUG#39697 - Maria: hang when failing to insert due to UNIQUE
+#
+create table t1 (a int, unique(a)) engine=maria transactional=1;
+insert into t1 values(1);
+--error 1062
+insert into t1 values(2),(2);
+create table t2 (a int, unique(a)) engine=maria transactional=0 row_format=dynamic;
+insert into t2 values(1);
+--error 1062
+insert into t2 values(2),(2);
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection root;
+insert into t1 values(3);
+insert into t2 values(3);
+connection default;
+drop table t1, t2;
+
 # End of 5.1 tests
 
 --disable_result_log

=== renamed file 'mysql-test/t/maria_notembedded.test' => 'mysql-test/suite/maria/t/maria_notembedded.test'
=== renamed file 'mysql-test/t/ps_maria.test' => 'mysql-test/suite/maria/t/ps_maria.test'
=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am	2008-07-29 14:10:24 +0000
+++ b/mysys/Makefile.am	2008-10-01 20:55:23 +0000
@@ -57,11 +57,12 @@ libmysys_a_SOURCES =    my_init.c my_get
 			my_memmem.c \
 			my_windac.c my_access.c base64.c my_libwrap.c \
 		        wqueue.c
-EXTRA_DIST =		thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
-			thr_mutex.c thr_rwlock.c waiting_threads.c \
-			CMakeLists.txt mf_soundex.c \
+if THREAD
+libmysys_a_SOURCES+=	thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
+			thr_mutex.c thr_rwlock.c waiting_threads.c
+endif
+EXTRA_DIST =		CMakeLists.txt mf_soundex.c \
 			my_conio.c my_wincond.c my_winthread.c
-libmysys_a_LIBADD =	@THREAD_LOBJECTS@
 # test_dir_DEPENDENCIES=	$(LIBRARIES)
 # testhash_DEPENDENCIES=	$(LIBRARIES)
 # test_charset_DEPENDENCIES=	$(LIBRARIES)
@@ -75,8 +76,6 @@ DEFS =			-DDEFAULT_BASEDIR=\"$(prefix)\"
 			-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
                         @DEFS@
 
-libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
-
 # I hope this always does the right thing. Otherwise this is only test programs
 FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
 

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	2008-07-29 14:10:24 +0000
+++ b/mysys/lf_alloc-pin.c	2008-10-07 16:49:01 +0000
@@ -320,7 +320,7 @@ static int match_pins(LF_PINS *el, void 
 #define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR))
 #endif
 
-#define next_node(P, X) (*((uchar **)(((uchar *)(X)) + (P)->free_ptr_offset)))
+#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset)))
 #define anext_node(X) next_node(&allocator->pinbox, (X))
 
 /*

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-08-28 12:43:44 +0000
+++ b/sql/mysqld.cc	2008-09-11 13:16:44 +0000
@@ -5714,12 +5714,12 @@ struct my_option my_long_options[] =
    "Short timeout for the two-step deadlock detection (in microseconds)",
    (uchar**) &global_system_variables.wt_timeout_short,
    (uchar**) &max_system_variables.wt_timeout_short,
-   0, GET_ULONG, REQUIRED_ARG, 100, 0, ULONG_MAX, 0, 0, 0},
+   0, GET_ULONG, REQUIRED_ARG, 10000, 0, ULONG_MAX, 0, 0, 0},
   {"deadlock-timeout-long", OPT_DEADLOCK_TIMEOUT_LONG,
    "Long timeout for the two-step deadlock detection (in microseconds)",
    (uchar**) &global_system_variables.wt_timeout_long,
    (uchar**) &max_system_variables.wt_timeout_long,
-   0, GET_ULONG, REQUIRED_ARG, 10000, 0, ULONG_MAX, 0, 0, 0},
+   0, GET_ULONG, REQUIRED_ARG, 50000000, 0, ULONG_MAX, 0, 0, 0},
 #ifndef DBUG_OFF
   {"debug", '#', "Debug log.", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2008-08-28 18:52:23 +0000
+++ b/storage/maria/ha_maria.cc	2008-10-09 20:03:54 +0000
@@ -2223,7 +2223,8 @@ int ha_maria::extra(enum ha_extra_functi
        operation == HA_EXTRA_PREPARE_FOR_RENAME))
   {
     THD *thd= table->in_use;
-    file->trn= THD_TRN;
+    TRN *trn= THD_TRN;
+    _ma_set_trn_for_table(file, trn);
   }
   return maria_extra(file, operation, 0);
 }
@@ -2296,7 +2297,7 @@ int ha_maria::external_lock(THD *thd, in
         if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
           trans_register_ha(thd, TRUE, maria_hton);
       }
-      file->trn= trn;
+      _ma_set_trn_for_table(file, trn);
       if (!trnman_increment_locked_tables(trn))
       {
         trans_register_ha(thd, FALSE, maria_hton);
@@ -2352,7 +2353,7 @@ int ha_maria::external_lock(THD *thd, in
       if (_ma_reenable_logging_for_table(file, TRUE))
         DBUG_RETURN(1);
       /** @todo zero file->trn also in commit and rollback */
-      file->trn= 0;                             // Safety
+      _ma_set_trn_for_table(file, NULL);        // Safety
       /*
         Ensure that file->state points to the current number of rows. This
         is needed if someone calls maria_info() without first doing an
@@ -2409,7 +2410,7 @@ int ha_maria::start_stmt(THD *thd, thr_l
       different ha_maria than 'this' then this->file->trn is a stale
       pointer. We fix it:
     */
-    file->trn= trn;
+    _ma_set_trn_for_table(file, trn);
     /*
       As external_lock() was already called, don't increment locked_tables.
       Note that we call the function below possibly several times when
@@ -2501,7 +2502,7 @@ int ha_maria::implicit_commit(THD *thd, 
         MARIA_HA *handler= ((ha_maria*) table->file)->file;
         if (handler->s->base.born_transactional)
         {
-          handler->trn= trn;
+          _ma_set_trn_for_table(handler, trn);
           if (handler->s->lock.get_status)
           {
             if (_ma_setup_live_state(handler))
@@ -2605,10 +2606,9 @@ enum row_type ha_maria::get_row_type() c
 }
 
 
-static enum data_file_type maria_row_type(HA_CREATE_INFO *info,
-                                          my_bool ignore_transactional)
+static enum data_file_type maria_row_type(HA_CREATE_INFO *info)
 {
-  if (info->transactional == HA_CHOICE_YES && ! ignore_transactional)
+  if (info->transactional == HA_CHOICE_YES)
     return BLOCK_RECORD;
   switch (info->row_type) {
   case ROW_TYPE_FIXED:   return STATIC_RECORD;
@@ -2641,7 +2641,7 @@ int ha_maria::create(const char *name, r
     }
   }
   /* Note: BLOCK_RECORD is used if table is transactional */
-  row_type= maria_row_type(ha_create_info, 0);
+  row_type= maria_row_type(ha_create_info);
   if (ha_create_info->transactional == HA_CHOICE_YES &&
       ha_create_info->row_type != ROW_TYPE_PAGE &&
       ha_create_info->row_type != ROW_TYPE_NOT_USED &&
@@ -2825,15 +2825,15 @@ bool ha_maria::check_if_incompatible_dat
   if (create_info->auto_increment_value != stats.auto_increment_value ||
       create_info->data_file_name != data_file_name ||
       create_info->index_file_name != index_file_name ||
-      (maria_row_type(create_info,  1) != data_file_type &&
+      (maria_row_type(create_info) != data_file_type &&
        create_info->row_type != ROW_TYPE_DEFAULT) ||
       table_changes == IS_EQUAL_NO ||
       table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
     return COMPATIBLE_DATA_NO;
 
-  if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
+  if ((options & (HA_OPTION_CHECKSUM |
                   HA_OPTION_DELAY_KEY_WRITE)) !=
-      (create_info->table_options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |
+      (create_info->table_options & (HA_OPTION_CHECKSUM |
                               HA_OPTION_DELAY_KEY_WRITE)))
     return COMPATIBLE_DATA_NO;
   return COMPATIBLE_DATA_YES;

=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c	2008-08-28 18:52:23 +0000
+++ b/storage/maria/ma_blockrec.c	2008-10-09 20:03:54 +0000
@@ -7081,7 +7081,7 @@ void maria_ignore_trids(MARIA_HA *info)
   if (info->s->base.born_transactional)
   {
     if (!info->trn)
-      info->trn= &dummy_transaction_object;
+      _ma_set_trn_for_table(info, &dummy_transaction_object);
     /* Ignore transaction id when row is read */
     info->trn->min_read_from= ~(TrID) 0;
   }

=== modified file 'storage/maria/ma_commit.c'
--- a/storage/maria/ma_commit.c	2008-08-07 20:57:25 +0000
+++ b/storage/maria/ma_commit.c	2008-10-09 20:03:54 +0000
@@ -111,7 +111,7 @@ int maria_begin(MARIA_HA *info)
       DBUG_RETURN(HA_ERR_OUT_OF_MEM);
 
     DBUG_PRINT("info", ("TRN set to 0x%lx", (ulong) trn));
-    info->trn= trn;
+    _ma_set_trn_for_table(info, trn);
   }
   DBUG_RETURN(0);
 }

=== modified file 'storage/maria/ma_init.c'
--- a/storage/maria/ma_init.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_init.c	2008-10-09 20:03:54 +0000
@@ -68,6 +68,8 @@ int maria_init(void)
   }
   hash_init(&maria_stored_state, &my_charset_bin, 32,
             0, sizeof(LSN), 0, (hash_free_key) history_state_free, 0);
+  DBUG_PRINT("info",("dummy_transaction_object: %p",
+                     &dummy_transaction_object));
   return 0;
 }
 

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2008-08-26 12:34:57 +0000
+++ b/storage/maria/ma_open.c	2008-10-09 20:03:54 +0000
@@ -178,7 +178,8 @@ static MARIA_HA *maria_clone_internal(MA
 
   if (!share->base.born_transactional)   /* For transactional ones ... */
   {
-    info.trn= &dummy_transaction_object; /* ... force crash if no trn given */
+    /* ... force crash if no trn given */
+    _ma_set_trn_for_table(&info, &dummy_transaction_object);
     info.state= &share->state.state;	/* Change global values by default */
   }
   else

=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c	2008-09-01 19:43:11 +0000
+++ b/storage/maria/ma_write.c	2008-10-09 20:03:54 +0000
@@ -194,8 +194,23 @@ int maria_write(MARIA_HA *info, uchar *r
             Also, filter out non-thread maria use, and table modified in
             the same transaction.
           */
-          if (!local_lock_tree || info->dup_key_trid == info->trn->trid)
+          if (!local_lock_tree)
             goto err;
+          if (info->dup_key_trid == info->trn->trid)
+          {
+	    rw_unlock(&keyinfo->root_lock);
+            goto err;
+          }
+          /* Different TrIDs: table must be transactional */
+          DBUG_ASSERT(share->base.born_transactional);
+          /*
+            If transactions are disabled, and dup_key_trid is different from
+            our TrID, it must be ALTER TABLE with dup_key_trid==0 (no
+            transaction). ALTER TABLE does have MARIA_HA::TRN not dummy but
+            puts TrID=0 in rows/keys.
+          */
+          DBUG_ASSERT(share->now_transactional ||
+                      (info->dup_key_trid == 0));
           blocker= trnman_trid_to_trn(info->trn, info->dup_key_trid);
           /*
             if blocker TRN was not found, it means that the conflicting

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2008-08-28 18:52:23 +0000
+++ b/storage/maria/maria_def.h	2008-10-09 20:03:54 +0000
@@ -698,6 +698,19 @@ struct st_maria_handler
 #define get_pack_length(length) ((length) >= 255 ? 3 : 1)
 #define _ma_have_versioning(info) ((info)->row_flag & ROW_FLAG_TRANSID)
 
+/**
+   Sets table's trn and prints debug information
+   @param tbl              MARIA_HA of table
+   @param newtrn           what to put into tbl->trn
+   @note cast of newtrn is because %p of NULL gives warning (NULL is int)
+*/
+#define _ma_set_trn_for_table(tbl, newtrn) do {                         \
+    DBUG_PRINT("info",("table: %p trn: %p -> %p",                       \
+                       (tbl), (tbl)->trn, (void *)(newtrn)));           \
+    (tbl)->trn= (newtrn);                                               \
+  } while (0)
+
+
 #define MARIA_MIN_BLOCK_LENGTH	20		/* Because of delete-link */
 /* Don't use to small record-blocks */
 #define MARIA_EXTEND_BLOCK_LENGTH	20

=== modified file 'unittest/mysys/waiting_threads-t.c'
--- a/unittest/mysys/waiting_threads-t.c	2008-09-01 19:43:11 +0000
+++ b/unittest/mysys/waiting_threads-t.c	2008-10-07 18:14:50 +0000
@@ -54,7 +54,7 @@ pthread_handler_t test_wt(void *arg)
 
   my_rnd_init(&rand, (ulong)(intptr)&m, id);
   if (kill_strategy == YOUNGEST)
-    thds[id].thd.weight= ~my_getsystime();
+    thds[id].thd.weight= (ulong volatile)~my_getsystime();
   if (kill_strategy == LOCKS)
     thds[id].thd.weight= 0;
 
@@ -104,7 +104,7 @@ retry:
       if (kill_strategy == LOCKS)
         thds[id].thd.weight= 0;
       if (kill_strategy == YOUNGEST)
-        thds[id].thd.weight= ~my_getsystime();
+        thds[id].thd.weight= (ulong volatile)~my_getsystime();
     }
     else if (kill_strategy == LOCKS)
       thds[id].thd.weight++;

Thread
bzr commit into MySQL/Maria:mysql-maria branch (monty:2672) Michael Widenius10 Oct