← Back to team overview

maria-developers team mailing list archive

Patch for PBXT to fix warnings when running test suite

 

Hi!

Here is a set of fixes I just applied to pbxt in MariaDB 5.1.

The full commit message should already have been sent to the list.

Fixes:

Detect temporary tables by checking if that path for the table is in
the mysql data directory.  The database for temporary tables is after
this patch, from PBXT point of view, "" This is needed to stop PBXT
from calling filename_to_tablename() with the base directory as an
argument, which caused ERROR: Invalid (old?) table or database name
'mysqld.1'" in the log when running the test suite.

The above was a hard problem to fix (took me 3 hours to come up
with the above solution that seams to work (have run all tests)).

The problem is that MySQL for

CREATE TEMPORARY TABLE test.t (a int))

Tells the engine that:

database is 'test'
table name is 't'
path is:  'mysql_tmpdir/#sqlxxxxxxx'

As pbxt only remmebers the path and uses this to generate database
names, it confused mysql when the mysql_tmpdir above when run from
mysqltest is /long-path..../mysqld.1' and gave a warning about
pbxt using a database name of 'mysqld.1'

MyISAM doesn't have a problem with this as it only works with path
names and doesn't care about databases.

Other things:

- The new my.cnf file helps that you don't have to use the option
  mysqld=--default-storage-engine=pbxt when running pbx tests
- Speedup for some tests that caused timeouts in buildbot

I also added more fixes to MariaDB 5.1, so that now all tests should work
fine when pbxt is enabled. (Some test results had to be updated as
PBXT is now in by default)

Questions or suggestions welcome.

Regards,
Monty
(PS, all code below is of course given to you under the new BSD
license, so feel free to use them in any way you want. Same thing will
apply for any other patch we do to the files in the pbxt directory or
the pbxt related test files)


=== added file 'mysql-test/suite/pbxt/my.cnf'
--- mysql-test/suite/pbxt/my.cnf	1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/my.cnf	2009-10-25 20:03:55 +0000
@@ -0,0 +1,9 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+default-storage-engine=pbxt
+
+[ENV]
+MASTER_MYSOCK=                 @mysqld.1.socket
+MASTER_MYPORT=                 @mysqld.1.port

=== modified file 'mysql-test/suite/pbxt/t/subselect.test'
--- mysql-test/suite/pbxt/t/subselect.test	2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/subselect.test	2009-10-26 10:19:54 +0000
@@ -814,12 +814,14 @@ create table t3 (a int, b int, index a (
 insert into t1 values (1,10), (2,20), (3,30), (4,40);
 disable_query_log;
 # making table large enough
+begin;
 let $1 = 10000;
 while ($1)
  {
   eval insert into t1 values (rand()*100000+200,rand()*100000); 
   dec $1;
  }
+commit;
 enable_query_log;
 insert into t2 values (2), (3), (4), (5);
 insert into t3 values (10,3), (20,4), (30,5);
@@ -2557,6 +2559,7 @@ CREATE TABLE t2 (x int auto_increment, y
                  PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
 
 disable_query_log;
+begin;
 let $1=3000;
 while ($1)
 {
@@ -2570,6 +2573,7 @@ while ($1)
   } 
   dec $1;
 }
+commit;
 enable_query_log;
 
 SET SESSION sort_buffer_size = 32 * 1024;
@@ -3156,11 +3160,13 @@ insert into t1 values(1,1),(2,2), (3, 3)
 let $i=10000;
 --disable_query_log
 --disable_warnings
+begin;
 while ($i)
 {
   eval insert into t2 values (-1 , $i/5000 + 1, '$i');
   dec $i;
 }
+commit;
 --enable_warnings
 --enable_query_log
 set session sort_buffer_size= 33*1024;

=== modified file 'storage/pbxt/src/strutil_xt.cc'
--- storage/pbxt/src/strutil_xt.cc	2009-09-03 06:15:03 +0000
+++ storage/pbxt/src/strutil_xt.cc	2009-10-25 19:29:19 +0000
@@ -21,10 +21,8 @@
  * H&G2JCtL
  */
 
+#include "mysql_priv.h"
 #include "xt_config.h"
-
-#include <stdio.h>
-#include <string.h>
 #include <ctype.h>
 
 #include "strutil_xt.h"
@@ -109,6 +107,14 @@ xtPublic void xt_2nd_last_name_of_path(s
 		*dest = 0;
 		return;
 	}
+        /* If temporary file */
+        if (!is_prefix(path, mysql_data_home) &&
+            !is_prefix(path, mysql_real_data_home))
+        {
+          *dest= 0;
+          return;
+        }
+
 	ptr = path + len - 1;
 	while (ptr != path && !XT_IS_DIR_CHAR(*ptr))
 		ptr--;

--------------