List:Commits« Previous MessageNext Message »
From:cpowers Date:November 16 2007 12:46am
Subject:bk commit into 6.0 tree (chris:1.2681) BUG#22173
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of cpowers. When cpowers does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-15 18:46:54-06:00, chris@stripped +5 -0
  Bug#22173, "TRUNCATE does not reset auto_increment counter"
  
  - Added multiclient testcase, falcon_bug_22173a.
  - Disabled falcon_bug_22173a until concurrency issues with TRUNCATE are resolved.
  - Enabled simple TRUNCATE testcase, falcon_bug_22173
  - Table::retireRecords() - ensure 'records' is non-null after acquiring scavenger lock

  mysql-test/suite/falcon/r/falcon_bug_22173a.result@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +43 -0
    New multi-client TRUNCATE testcase

  mysql-test/suite/falcon/r/falcon_bug_22173a.result@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +0 -0

  mysql-test/suite/falcon/t/disabled.def@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +1 -1
    Enable falcon_bug_22173
    Disable falcon_bug_22173a until concurrency issues resolved with TRUNCATE

  mysql-test/suite/falcon/t/falcon_bug_22173a.test@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +78 -0
    New multi-client TRUNCATE testcase

  mysql-test/suite/falcon/t/falcon_bug_22173a.test@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +0 -0

  storage/falcon/Table.cpp@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +4 -1
    - Use "system.tables" instead of "Tables" for updates to system tables.
    - Check that Table::records is non-null after acquiring scavenger lock in Table::retireRecords()

  storage/falcon/ha_falcon.cpp@stripped, 2007-11-15 18:46:52-06:00, chris@stripped +0 -1
    StorageInterface::delete_all_rows(): Remove compile warning 

diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_22173a.result b/mysql-test/suite/falcon/r/falcon_bug_22173a.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/falcon/r/falcon_bug_22173a.result	2007-11-15 18:46:52 -06:00
@@ -0,0 +1,43 @@
+SET STORAGE_ENGINE = Falcon;
+*** Bug #22173a ***
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+# Establish connection conn1 (user = root)
+SET @@autocommit = 1;
+# Switch to connection default
+SET @@autocommit = 1;
+CREATE TABLE t1 (a int(11), KEY a (a));
+CREATE PROCEDURE p1()
+begin declare v1 int default 0;
+declare v2 int;
+declare continue handler for 1020 begin end;
+declare continue handler for 1213 begin end;
+while v1 < 2500 do
+/* SELECT 'insert', v1; */
+INSERT INTO t1 VALUES (v1);
+SET v2 = rand() * 10000;
+UPDATE t1 SET a = v2 WHERE a = v1;
+/* SELECT ' update', v1; */
+SET v1 = v1 + 1;
+if v1 mod 50 = 0 then
+/* SELECT ' delete'; */
+/* DELETE FROM t1; */
+TRUNCATE t1;
+end if;
+end while;
+end//
+# Sent call p1() to the server but do not pull the results
+call p1();
+# Switch to connection conn1
+call p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+# Sent call p1() to the server but do not pull the results
+call p1();
+# Switch to connection conn1
+call p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+# Disconnect conn1
+DROP TABLE t1;
+DROP PROCEDURE p1;
diff -Nrup a/mysql-test/suite/falcon/t/disabled.def b/mysql-test/suite/falcon/t/disabled.def
--- a/mysql-test/suite/falcon/t/disabled.def	2007-11-01 15:46:58 -05:00
+++ b/mysql-test/suite/falcon/t/disabled.def	2007-11-15 18:46:52 -06:00
@@ -19,7 +19,7 @@ falcon_bug_22156    : Bug#22156 2006-11-
 falcon_bug_22165    : Bug#22165 2006-08-24 hakank (Get pushbuild green)
 falcon_bug_22166    : Bug#22166 2006-08-24 hakank (Get pushbuild green)
 falcon_bug_22169    : Bug#22169 2006-08-24 hakank Too long run time for PB
-falcon_bug_22173    : Bug#22173 2006-08-24 hakank (Get pushbuild green)
+falcon_bug_22173a   : Bug#22173 2007-11-15 cpowers (Fix concurrency issues)
 falcon_bug_22182    : Disabled until runtime team provides RENAME DATABASE replacement. See WL#4030
 falcon_bug_22187    : Bug#22187 2006-08-24 hakank (Get pushbuild green)
 falcon_bug_22189    : Bug#22189 2006-08-24 hakank (Get pushbuild green)
diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_22173a.test b/mysql-test/suite/falcon/t/falcon_bug_22173a.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/falcon/t/falcon_bug_22173a.test	2007-11-15 18:46:52 -06:00
@@ -0,0 +1,78 @@
+--source include/have_falcon.inc
+SET STORAGE_ENGINE = Falcon;
+#
+# Bug #22173: TRUNCATE does not reset auto_increment counter
+#   Adapted from falcon_bug_22150 to exercise TRUNCATE from
+#   multiple clients.
+#
+# Note: The actual test is to loop 1 million times. I reduced it 
+#   to 100000, but it takes still to much time on our internal
+#   servers. Therefore the loop is reduced to 2500. However, we
+#   should test it with 1 million from time to time.
+#
+--echo *** Bug #22173a ***
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+--echo # Establish connection conn1 (user = root)
+connect (conn1,localhost,root,,);
+SET @@autocommit = 1;
+
+--echo # Switch to connection default
+connection default;
+SET @@autocommit = 1;
+CREATE TABLE t1 (a int(11), KEY a (a));
+
+delimiter //;
+CREATE PROCEDURE p1()
+begin declare v1 int default 0;
+declare v2 int;
+declare continue handler for 1020 begin end;
+declare continue handler for 1213 begin end;
+while v1 < 2500 do
+  /* SELECT 'insert', v1; */
+  INSERT INTO t1 VALUES (v1);
+  SET v2 = rand() * 10000;
+  UPDATE t1 SET a = v2 WHERE a = v1;
+  /* SELECT ' update', v1; */
+  SET v1 = v1 + 1;
+  if v1 mod 50 = 0 then
+    /* SELECT ' delete'; */
+    /* DELETE FROM t1; */
+    TRUNCATE t1;
+  end if;
+  end while;
+end//
+delimiter ;//
+
+--echo # Sent call p1() to the server but do not pull the results
+--send call p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+--real_sleep 1
+call p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+reap;
+--echo # Sent call p1() to the server but do not pull the results
+--send call p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+call p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+reap;
+
+# Final cleanup.
+--echo # Disconnect conn1
+disconnect conn1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2007-11-15 16:41:59 -06:00
+++ b/storage/falcon/Table.cpp	2007-11-15 18:46:52 -06:00
@@ -1490,7 +1490,7 @@ void Table::truncate(Transaction *transa
 
 	// Update system.tables with new section ids
 	
-	PreparedStatement *statement = database->prepareStatement("update Tables set dataSection=?, blobSection=? where tableId=?");
+	PreparedStatement *statement = database->prepareStatement("update system.tables set dataSection=?, blobSection=? where tableId=?");
 	statement->setInt(1, dataSectionId);
 	statement->setInt(2, blobSectionId);
 	statement->setInt(3, tableId);
@@ -1684,6 +1684,9 @@ int Table::retireRecords(RecordScavenge 
 	Sync sync(&syncObject, "Table::retireRecords");
 	sync.lock(Shared);
 
+	if (!records)
+		return 0;
+	
 	activeVersions = false;
 	emptySections->clear();
 	int count = records->retireRecords(this, 0, recordScavenge);
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2007-11-14 17:24:43 -06:00
+++ b/storage/falcon/ha_falcon.cpp	2007-11-15 18:46:52 -06:00
@@ -874,7 +874,6 @@ int StorageInterface::delete_all_rows()
 
 	int ret = 0;
 	struct st_table_share *tableShare = table_share;
-	struct st_table *tableObj = table;
 	const char *tableName = tableShare->normalized_path.str;
 	
 	if (!storageShare)
Thread
bk commit into 6.0 tree (chris:1.2681) BUG#22173cpowers16 Nov