Merge lp:~paul-mccullagh/maria/maria-pbxt-rc2 into lp:~maria-captains/maria/5.1-converting

Proposed by Paul McCullagh on 2009-08-18
Status: Merged
Merged at revision: not available
Proposed branch: lp:~paul-mccullagh/maria/maria-pbxt-rc2
Merge into: lp:~maria-captains/maria/5.1-converting
Diff against target: None lines
To merge this branch: bzr merge lp:~paul-mccullagh/maria/maria-pbxt-rc2
Reviewer Review Type Date Requested Status
Maria-captains 2009-08-18 Pending
Review via email: mp+10303@code.launchpad.net
To post a comment you must log in.
Paul McCullagh (paul-mccullagh) wrote :

Updated the PBXT engine to RC2 (lp:pbxt/rc2), version 1.0.08c. All tests in the PBXT suite pass.

Note that this branch does not yet include the entire history of PBXT because attempts to do this have failed so far due to problems with bzr.

Kristian Nielsen (knielsen) wrote :

Paul McCullagh <email address hidden> writes:

> Paul McCullagh has proposed merging lp:~paul-mccullagh/maria/maria-pbxt-rc2 into lp:maria.
>
> Requested reviews:
> Maria-captains (maria-captains)
>
> Updated the PBXT engine to RC2 (lp:pbxt/rc2), version 1.0.08c. All tests in the PBXT suite pass.
>
> Note that this branch does not yet include the entire history of PBXT because attempts to do this have failed so far due to problems with bzr.

Thanks a lot for working on this.

I have been a bit busy last week due to meetings. But I plan to look into this
sometimes this week.

 - Kristian.

Kristian Nielsen (knielsen) wrote :
Download full text (4.0 KiB)

Paul McCullagh <email address hidden> writes:

> Paul McCullagh has proposed merging lp:~paul-mccullagh/maria/maria-pbxt-rc2 into lp:maria.
>
> Requested reviews:
> Maria-captains (maria-captains)
>
> Updated the PBXT engine to RC2 (lp:pbxt/rc2), version 1.0.08c. All tests in the PBXT suite pass.
>
> Note that this branch does not yet include the entire history of PBXT because attempts to do this have failed so far due to problems with bzr.

Thanks a lot Paul for preparing this.

I tried building your tree and running the test suite. I have a question, as I
got some build and test failures. I suspect that perhaps your tree is missing
a commit, or maybe has one too many.

Your tree has the following 3 commits in addition to lp:maria:

 2722 Paul McCullagh 2009-08-18
      Merged changes for bug fix update 1.0.08c RC2

 2721 Paul McCullagh 2009-08-17
      Updated all tests for RC2

 2720 Paul McCullagh 2009-08-17
      Updated PBXT to version 1.0.08 RC2

If I build revision 2721 (drop the last commit), things look good. I even have
zero failures in the test suite with a simple patch (attached), mostly some
simple fixes for case-sensitive file system.

But if I try the current tree, revision 2722, I get both build and test
failures, as detailed below.

So the basic question is, should I merge just revision 2721, or should I merge
2722 with some additional build (and test?) fixes?

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

So some more details.

First, I fixed all of the test failures in revision 2721 with a simple patch
(attached). The only problem was the *-master.opt files were not copied along
with test .test files from the main suite. This caused failures on
case-sensitive file systems (and also failure in udf.test due to wrong search
path for .so). You should of course check the patch, but I think it should be
ok.

Now, for the problems in revision 2722:

They might be related to the replacement of stream_xt with pbms_enabled. To
even build, I need this patch:

--- storage/pbxt/src/Makefile.am 2009-05-09 04:01:53 +0000
+++ storage/pbxt/src/Makefile.am 2009-08-28 10:11:41 +0000
@@ -19,7 +19,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
       datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \
       ha_pbxt.h heap_xt.h index_xt.h linklist_xt.h \
       memory_xt.h myxt_xt.h pthread_xt.h restart_xt.h \
- streaming_xt.h sortedlist_xt.h strutil_xt.h \
+ pbms_enabled.h sortedlist_xt.h strutil_xt.h \
       tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
       util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
       systab_xt.h ha_xtsys.h discover_xt.h \
@@ -30,7 +30,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache
       datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
       ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
       memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
- streaming_xt.cc sortedlist_xt.cc strutil_xt.cc \
+ pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
       tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
       systab_xt.cc ha_xtsys.cc discover_xt.cc \
       util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc...

Read more...

1=== modified file 'mysql-test/suite/pbxt/r/lowercase_view.result'
2--- mysql-test/suite/pbxt/r/lowercase_view.result 2009-04-02 20:36:52 +0000
3+++ mysql-test/suite/pbxt/r/lowercase_view.result 2009-08-28 11:19:59 +0000
4@@ -119,7 +119,7 @@ create table t1Aa (col1 int);
5 create view v1Aa as select col1 from t1Aa as AaA;
6 show create view v1AA;
7 View Create View character_set_client collation_connection
8-v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
9+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
10 drop view v1AA;
11 select Aaa.col1 from t1Aa as AaA;
12 col1
13@@ -128,7 +128,7 @@ drop view v1AA;
14 create view v1Aa as select AaA.col1 from t1Aa as AaA;
15 show create view v1AA;
16 View Create View character_set_client collation_connection
17-v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
18+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
19 drop view v1AA;
20 drop table t1Aa;
21 CREATE TABLE t1 (a int, b int);
22@@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS
23 select X.a from t1 AS X group by X.b having (X.a = 1);
24 SHOW CREATE VIEW v1;
25 View Create View character_set_client collation_connection
26-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `X`.`a` AS `a` from `t1` `X` group by `X`.`b` having (`X`.`a` = 1) latin1 latin1_swedish_ci
27+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci
28 SELECT * FROM v1;
29 a
30 DROP VIEW v1;
31
32=== added file 'mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt'
33--- mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 1970-01-01 00:00:00 +0000
34+++ mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 2009-08-28 11:13:02 +0000
35@@ -0,0 +1 @@
36+--lower_case_table_names
37
38=== added file 'mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt'
39--- mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 1970-01-01 00:00:00 +0000
40+++ mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 2009-08-28 11:22:29 +0000
41@@ -0,0 +1 @@
42+--lower_case_table_names
43
44=== added file 'mysql-test/suite/pbxt/t/lowercase_view-master.opt'
45--- mysql-test/suite/pbxt/t/lowercase_view-master.opt 1970-01-01 00:00:00 +0000
46+++ mysql-test/suite/pbxt/t/lowercase_view-master.opt 2009-08-28 11:10:22 +0000
47@@ -0,0 +1 @@
48+--lower_case_table_names=1
49
50=== added file 'mysql-test/suite/pbxt/t/udf-master.opt'
51--- mysql-test/suite/pbxt/t/udf-master.opt 1970-01-01 00:00:00 +0000
52+++ mysql-test/suite/pbxt/t/udf-master.opt 2009-08-28 11:24:08 +0000
53@@ -0,0 +1 @@
54+$UDF_EXAMPLE_LIB_OPT
Paul McCullagh (paul-mccullagh) wrote :
Download full text (8.4 KiB)

Hi Kristian,

The following error:

> mysqltest: At line 3: query 'alter table t1 rename mysqltest.t1'
> failed: 1025: Error on rename of './test/t1' to './mysqltest/
> t1' (errno: 16)

Occurs because the PBMS code is compiled in.

This can be disabled by commenting out:

#define PBMS_ENABLED

in xt_defs.h

This is, in fact, a bug in PBMS. I have already reported the bug here: https://bugs.launchpad.net/pbms/+bug/416969

So, if the PBMS_ENABLED code is disable (which should probably be the
default at the moment), then that test should run through.

The other problems seem to have to do with case-sensitivity. I will
see if I can repeat those errors on one of my machines.

Best regards,

Paul

On Aug 28, 2009, at 3:33 PM, Kristian Nielsen wrote:

> Paul McCullagh <email address hidden> writes:
>
>> Paul McCullagh has proposed merging lp:~paul-mccullagh/maria/maria-
>> pbxt-rc2 into lp:maria.
>>
>> Requested reviews:
>> Maria-captains (maria-captains)
>>
>> Updated the PBXT engine to RC2 (lp:pbxt/rc2), version 1.0.08c. All
>> tests in the PBXT suite pass.
>>
>> Note that this branch does not yet include the entire history of
>> PBXT because attempts to do this have failed so far due to problems
>> with bzr.
>
> Thanks a lot Paul for preparing this.
>
> I tried building your tree and running the test suite. I have a
> question, as I
> got some build and test failures. I suspect that perhaps your tree
> is missing
> a commit, or maybe has one too many.
>
> Your tree has the following 3 commits in addition to lp:maria:
>
> 2722 Paul McCullagh 2009-08-18
> Merged changes for bug fix update 1.0.08c RC2
>
> 2721 Paul McCullagh 2009-08-17
> Updated all tests for RC2
>
> 2720 Paul McCullagh 2009-08-17
> Updated PBXT to version 1.0.08 RC2
>
> If I build revision 2721 (drop the last commit), things look good. I
> even have
> zero failures in the test suite with a simple patch (attached),
> mostly some
> simple fixes for case-sensitive file system.
>
> But if I try the current tree, revision 2722, I get both build and
> test
> failures, as detailed below.
>
> So the basic question is, should I merge just revision 2721, or
> should I merge
> 2722 with some additional build (and test?) fixes?
>
> -----------------------------------------------------------------------
>
> So some more details.
>
> First, I fixed all of the test failures in revision 2721 with a
> simple patch
> (attached). The only problem was the *-master.opt files were not
> copied along
> with test .test files from the main suite. This caused failures on
> case-sensitive file systems (and also failure in udf.test due to
> wrong search
> path for .so). You should of course check the patch, but I think it
> should be
> ok.
>
> Now, for the problems in revision 2722:
>
> They might be related to the replacement of stream_xt with
> pbms_enabled. To
> even build, I need this patch:
>
> --- storage/pbxt/src/Makefile.am 2009-05-09 04:01:53 +0000
> +++ storage/pbxt/src/Makefile.am 2009-08-28 10:11:41 +0000
> @@ -19,7 +19,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
> datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \
...

Read more...

Kristian Nielsen (knielsen) wrote :

Paul McCullagh <email address hidden> writes:

>> mysqltest: At line 3: query 'alter table t1 rename mysqltest.t1'
>> failed: 1025: Error on rename of './test/t1' to './mysqltest/
>> t1' (errno: 16)
>
>
> Occurs because the PBMS code is compiled in.
>
> This can be disabled by commenting out:
>
> #define PBMS_ENABLED
>
> in xt_defs.h

[xt_config.h actually]

> This is, in fact, a bug in PBMS. I have already reported the bug here: https://bugs.launchpad.net/pbms/+bug/416969
>
> So, if the PBMS_ENABLED code is disable (which should probably be the
> default at the moment), then that test should run through.

Ok, thanks, that solved 3 of the 4 remaining failures.

And the last one is just a missing result file update for test
pbxt.ps_1general. You have this diff in the last commit for ha_pbxt.cc:

- stats.data_file_length = ot->ot_table->tab_rec_eof_id;
+ stats.data_file_length = xt_rec_id_to_rec_offset(ot->ot_table, ot->ot_table->tab_rec_eof_id);

So the data file length output of show table status was fixed from units of
records to units of bytes. I just updated the result file accordingly, from 1
to 1024.

> The other problems seem to have to do with case-sensitivity. I will
> see if I can repeat those errors on one of my machines.

Yes, they are case sensitivity issues (except udf maybe). As I said, they all
pass with the patch I gave, which just adds missing *-master.opt files that
are in the main test suite, but where not copied into the pbxt suite along
with the *.test files.

So I will merge this into MariaDB with attached patch to disable PBMS and fix
test failures.

I really want to also enable the PBXT test suite in our
Buildbot. Unfortunately I am really pressed for time do do this now. For one,
I see a number of Valgrind errors when running the suite that I need to
investigate. But one of these days,

Thanks,

 - Kristian.

1=== modified file 'mysql-test/suite/pbxt/r/lowercase_view.result'
2--- mysql-test/suite/pbxt/r/lowercase_view.result 2009-04-02 20:36:52 +0000
3+++ mysql-test/suite/pbxt/r/lowercase_view.result 2009-08-31 11:07:44 +0000
4@@ -119,7 +119,7 @@ create table t1Aa (col1 int);
5 create view v1Aa as select col1 from t1Aa as AaA;
6 show create view v1AA;
7 View Create View character_set_client collation_connection
8-v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
9+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
10 drop view v1AA;
11 select Aaa.col1 from t1Aa as AaA;
12 col1
13@@ -128,7 +128,7 @@ drop view v1AA;
14 create view v1Aa as select AaA.col1 from t1Aa as AaA;
15 show create view v1AA;
16 View Create View character_set_client collation_connection
17-v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
18+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
19 drop view v1AA;
20 drop table t1Aa;
21 CREATE TABLE t1 (a int, b int);
22@@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS
23 select X.a from t1 AS X group by X.b having (X.a = 1);
24 SHOW CREATE VIEW v1;
25 View Create View character_set_client collation_connection
26-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `X`.`a` AS `a` from `t1` `X` group by `X`.`b` having (`X`.`a` = 1) latin1 latin1_swedish_ci
27+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci
28 SELECT * FROM v1;
29 a
30 DROP VIEW v1;
31
32=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
33--- mysql-test/suite/pbxt/r/ps_1general.result 2009-08-17 15:57:58 +0000
34+++ mysql-test/suite/pbxt/r/ps_1general.result 2009-08-31 11:07:44 +0000
35@@ -293,7 +293,7 @@ t2 1 t2_idx 1 b A 0 NULL NULL YES BTREE
36 prepare stmt4 from ' show table status from test like ''t2%'' ';
37 execute stmt4;
38 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
39-t2 PBXT 10 Fixed 0 29 1 # 4096 0 NULL # # # latin1_swedish_ci NULL
40+t2 PBXT 10 Fixed 0 29 1024 # 4096 0 NULL # # # latin1_swedish_ci NULL
41 prepare stmt4 from ' show table status from test like ''t9%'' ';
42 execute stmt4;
43 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
44
45=== added file 'mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt'
46--- mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 1970-01-01 00:00:00 +0000
47+++ mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 2009-08-31 11:07:44 +0000
48@@ -0,0 +1 @@
49+--lower_case_table_names
50
51=== added file 'mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt'
52--- mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 1970-01-01 00:00:00 +0000
53+++ mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 2009-08-31 11:07:44 +0000
54@@ -0,0 +1 @@
55+--lower_case_table_names
56
57=== added file 'mysql-test/suite/pbxt/t/lowercase_view-master.opt'
58--- mysql-test/suite/pbxt/t/lowercase_view-master.opt 1970-01-01 00:00:00 +0000
59+++ mysql-test/suite/pbxt/t/lowercase_view-master.opt 2009-08-31 11:07:44 +0000
60@@ -0,0 +1 @@
61+--lower_case_table_names=1
62
63=== added file 'mysql-test/suite/pbxt/t/udf-master.opt'
64--- mysql-test/suite/pbxt/t/udf-master.opt 1970-01-01 00:00:00 +0000
65+++ mysql-test/suite/pbxt/t/udf-master.opt 2009-08-31 11:07:44 +0000
66@@ -0,0 +1 @@
67+$UDF_EXAMPLE_LIB_OPT
68
69=== modified file 'storage/pbxt/src/Makefile.am'
70--- storage/pbxt/src/Makefile.am 2009-05-09 04:01:53 +0000
71+++ storage/pbxt/src/Makefile.am 2009-08-31 11:07:44 +0000
72@@ -19,7 +19,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
73 datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \
74 ha_pbxt.h heap_xt.h index_xt.h linklist_xt.h \
75 memory_xt.h myxt_xt.h pthread_xt.h restart_xt.h \
76- streaming_xt.h sortedlist_xt.h strutil_xt.h \
77+ pbms_enabled.h sortedlist_xt.h strutil_xt.h \
78 tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
79 util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
80 systab_xt.h ha_xtsys.h discover_xt.h \
81@@ -30,7 +30,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache
82 datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
83 ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
84 memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
85- streaming_xt.cc sortedlist_xt.cc strutil_xt.cc \
86+ pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
87 tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
88 systab_xt.cc ha_xtsys.cc discover_xt.cc \
89 util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
90
91=== modified file 'storage/pbxt/src/xt_config.h'
92--- storage/pbxt/src/xt_config.h 2009-08-18 07:46:53 +0000
93+++ storage/pbxt/src/xt_config.h 2009-08-31 11:07:44 +0000
94@@ -81,7 +81,8 @@ const int max_connections = 500;
95 #define DEBUG
96 #endif // _DEBUG
97 #else
98-#define PBMS_ENABLED
99+// Paul suggested to disable PBMS in MariaDB for now.
100+// #define PBMS_ENABLED
101 #endif
102
103 #ifdef __FreeBSD__
Greg Stark (stark-mit) wrote :

I'm not too familiar with launchpad so I'm a bit puzzled how you
generated this email. The headers are really messed up.

1) It has a bogus reply-to header (but this seems to be standard
launchpad bogosity)
2) The mailing list doesn't appear in the To or Cc headers (ie, it's "bcc"ed)
3) There is no List-Id or other headers to indicate what list it was sent to
4) The envelope sender is a generic "<email address hidden>"

Basically it resists any attempt to filter it intelligently or to
conform to any sane mailing list practices. If this is a symptom of
launchpad design could it be addressed?

--
greg
http://mit.edu/~gsstark/resume.pdf

Paul McCullagh (paul-mccullagh) wrote :

Hi Kristian,

On Aug 31, 2009, at 1:27 PM, Kristian Nielsen wrote:

> Paul McCullagh <email address hidden> writes:
>
>>> mysqltest: At line 3: query 'alter table t1 rename mysqltest.t1'
>>> failed: 1025: Error on rename of './test/t1' to './mysqltest/
>>> t1' (errno: 16)
>>
>>
>> Occurs because the PBMS code is compiled in.
>>
>> This can be disabled by commenting out:
>>
>> #define PBMS_ENABLED
>>
>> in xt_defs.h
>
> [xt_config.h actually]

Oops, sorry. It has been moved to xt_defs.h (where it belongs), in a
later release.

>> This is, in fact, a bug in PBMS. I have already reported the bug
>> here: https://bugs.launchpad.net/pbms/+bug/416969
>>
>> So, if the PBMS_ENABLED code is disable (which should probably be the
>> default at the moment), then that test should run through.
>
> Ok, thanks, that solved 3 of the 4 remaining failures.
>
> And the last one is just a missing result file update for test
> pbxt.ps_1general. You have this diff in the last commit for
> ha_pbxt.cc:
>
> - stats.data_file_length = ot->ot_table->tab_rec_eof_id;
> + stats.data_file_length = xt_rec_id_to_rec_offset(ot->ot_table,
> ot->ot_table->tab_rec_eof_id);
>
> So the data file length output of show table status was fixed from
> units of
> records to units of bytes. I just updated the result file
> accordingly, from 1
> to 1024.

Yup. That is correct.

>> The other problems seem to have to do with case-sensitivity. I will
>> see if I can repeat those errors on one of my machines.
>
> Yes, they are case sensitivity issues (except udf maybe). As I said,
> they all
> pass with the patch I gave, which just adds missing *-master.opt
> files that
> are in the main test suite, but where not copied into the pbxt suite
> along
> with the *.test files.
>
> So I will merge this into MariaDB with attached patch to disable
> PBMS and fix
> test failures.

OK, Great! Thanks.

In general, we will always take care that all patches you (or anyone
else) make to PBXT in MariaDB will find there way back into the PBXT
trunk.

> I really want to also enable the PBXT test suite in our
> Buildbot. Unfortunately I am really pressed for time do do this now.
> For one,
> I see a number of Valgrind errors when running the suite that I need
> to
> investigate. But one of these days,

Yup. Valgrind will be great to have.

There is still work to done on our side. Current status is that when
we run it we get warnings but we have not understood why there is a
problem.

Of course, when you have time, any help there would be greatly
appreciated. But of course, there are higher priorities at the moment.

Best regards,

Paul

--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mysql-test/suite/pbxt/r/alter_table.result'
2--- mysql-test/suite/pbxt/r/alter_table.result 2009-04-02 10:03:14 +0000
3+++ mysql-test/suite/pbxt/r/alter_table.result 2009-08-17 11:12:36 +0000
4@@ -126,23 +126,23 @@
5 alter table t1 disable keys;
6 show keys from t1;
7 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
8-t1 0 n1 1 n1 NULL 0 NULL NULL BTREE
9-t1 1 n1_2 1 n1 NULL NULL NULL NULL BTREE
10-t1 1 n1_2 2 n2 NULL NULL NULL NULL YES BTREE
11-t1 1 n1_2 3 n3 NULL NULL NULL NULL YES BTREE
12-t1 1 n1_2 4 n4 NULL NULL NULL NULL YES BTREE
13-t1 1 n2 1 n2 NULL NULL NULL NULL YES BTREE
14-t1 1 n2 2 n3 NULL NULL NULL NULL YES BTREE
15-t1 1 n2 3 n4 NULL NULL NULL NULL YES BTREE
16-t1 1 n2 4 n1 NULL NULL NULL NULL BTREE
17-t1 1 n3 1 n3 NULL NULL NULL NULL YES BTREE
18-t1 1 n3 2 n4 NULL NULL NULL NULL YES BTREE
19-t1 1 n3 3 n1 NULL NULL NULL NULL BTREE
20-t1 1 n3 4 n2 NULL NULL NULL NULL YES BTREE
21-t1 1 n4 1 n4 NULL NULL NULL NULL YES BTREE
22-t1 1 n4 2 n1 NULL NULL NULL NULL BTREE
23-t1 1 n4 3 n2 NULL NULL NULL NULL YES BTREE
24-t1 1 n4 4 n3 NULL NULL NULL NULL YES BTREE
25+t1 0 n1 1 n1 A 0 NULL NULL BTREE
26+t1 1 n1_2 1 n1 A 0 NULL NULL BTREE
27+t1 1 n1_2 2 n2 A 0 NULL NULL YES BTREE
28+t1 1 n1_2 3 n3 A 0 NULL NULL YES BTREE
29+t1 1 n1_2 4 n4 A 0 NULL NULL YES BTREE
30+t1 1 n2 1 n2 A 0 NULL NULL YES BTREE
31+t1 1 n2 2 n3 A 0 NULL NULL YES BTREE
32+t1 1 n2 3 n4 A 0 NULL NULL YES BTREE
33+t1 1 n2 4 n1 A 0 NULL NULL BTREE
34+t1 1 n3 1 n3 A 0 NULL NULL YES BTREE
35+t1 1 n3 2 n4 A 0 NULL NULL YES BTREE
36+t1 1 n3 3 n1 A 0 NULL NULL BTREE
37+t1 1 n3 4 n2 A 0 NULL NULL YES BTREE
38+t1 1 n4 1 n4 A 0 NULL NULL YES BTREE
39+t1 1 n4 2 n1 A 0 NULL NULL BTREE
40+t1 1 n4 3 n2 A 0 NULL NULL YES BTREE
41+t1 1 n4 4 n3 A 0 NULL NULL YES BTREE
42 insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
43 insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
44 insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
45@@ -156,23 +156,23 @@
46 alter table t1 enable keys;
47 show keys from t1;
48 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
49-t1 0 n1 1 n1 NULL 10 NULL NULL BTREE
50-t1 1 n1_2 1 n1 NULL NULL NULL NULL BTREE
51-t1 1 n1_2 2 n2 NULL NULL NULL NULL YES BTREE
52-t1 1 n1_2 3 n3 NULL NULL NULL NULL YES BTREE
53-t1 1 n1_2 4 n4 NULL NULL NULL NULL YES BTREE
54-t1 1 n2 1 n2 NULL NULL NULL NULL YES BTREE
55-t1 1 n2 2 n3 NULL NULL NULL NULL YES BTREE
56-t1 1 n2 3 n4 NULL NULL NULL NULL YES BTREE
57-t1 1 n2 4 n1 NULL NULL NULL NULL BTREE
58-t1 1 n3 1 n3 NULL NULL NULL NULL YES BTREE
59-t1 1 n3 2 n4 NULL NULL NULL NULL YES BTREE
60-t1 1 n3 3 n1 NULL NULL NULL NULL BTREE
61-t1 1 n3 4 n2 NULL NULL NULL NULL YES BTREE
62-t1 1 n4 1 n4 NULL NULL NULL NULL YES BTREE
63-t1 1 n4 2 n1 NULL NULL NULL NULL BTREE
64-t1 1 n4 3 n2 NULL NULL NULL NULL YES BTREE
65-t1 1 n4 4 n3 NULL NULL NULL NULL YES BTREE
66+t1 0 n1 1 n1 A 10 NULL NULL BTREE
67+t1 1 n1_2 1 n1 A 10 NULL NULL BTREE
68+t1 1 n1_2 2 n2 A 10 NULL NULL YES BTREE
69+t1 1 n1_2 3 n3 A 10 NULL NULL YES BTREE
70+t1 1 n1_2 4 n4 A 10 NULL NULL YES BTREE
71+t1 1 n2 1 n2 A 10 NULL NULL YES BTREE
72+t1 1 n2 2 n3 A 10 NULL NULL YES BTREE
73+t1 1 n2 3 n4 A 10 NULL NULL YES BTREE
74+t1 1 n2 4 n1 A 10 NULL NULL BTREE
75+t1 1 n3 1 n3 A 10 NULL NULL YES BTREE
76+t1 1 n3 2 n4 A 10 NULL NULL YES BTREE
77+t1 1 n3 3 n1 A 10 NULL NULL BTREE
78+t1 1 n3 4 n2 A 10 NULL NULL YES BTREE
79+t1 1 n4 1 n4 A 10 NULL NULL YES BTREE
80+t1 1 n4 2 n1 A 10 NULL NULL BTREE
81+t1 1 n4 3 n2 A 10 NULL NULL YES BTREE
82+t1 1 n4 4 n3 A 10 NULL NULL YES BTREE
83 drop table t1;
84 create table t1 (i int unsigned not null auto_increment primary key);
85 alter table t1 rename t2;
86@@ -286,17 +286,17 @@
87 alter table t1 add unique (a,b), add key (b);
88 show keys from t1;
89 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
90-t1 0 a 1 a A NULL NULL NULL YES BTREE
91-t1 0 a 2 b A NULL NULL NULL YES BTREE
92-t1 1 b 1 b A NULL NULL NULL YES BTREE
93+t1 0 a 1 a A 300 NULL NULL YES BTREE
94+t1 0 a 2 b A 300 NULL NULL YES BTREE
95+t1 1 b 1 b A 300 NULL NULL YES BTREE
96 analyze table t1;
97 Table Op Msg_type Msg_text
98 test.t1 analyze status OK
99 show keys from t1;
100 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
101-t1 0 a 1 a A NULL NULL NULL YES BTREE
102-t1 0 a 2 b A NULL NULL NULL YES BTREE
103-t1 1 b 1 b A NULL NULL NULL YES BTREE
104+t1 0 a 1 a A 300 NULL NULL YES BTREE
105+t1 0 a 2 b A 300 NULL NULL YES BTREE
106+t1 1 b 1 b A 300 NULL NULL YES BTREE
107 drop table t1;
108 CREATE TABLE t1 (i int(10), index(i) );
109 ALTER TABLE t1 DISABLE KEYS;
110@@ -545,37 +545,37 @@
111 create table t1 (a int, key(a));
112 show indexes from t1;
113 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
114-t1 1 a 1 a A NULL NULL NULL YES BTREE
115+t1 1 a 1 a A 0 NULL NULL YES BTREE
116 "this used not to disable the index"
117 alter table t1 modify a int, disable keys;
118 show indexes from t1;
119 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
120-t1 1 a 1 a A NULL NULL NULL YES BTREE
121+t1 1 a 1 a A 0 NULL NULL YES BTREE
122 alter table t1 enable keys;
123 show indexes from t1;
124 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
125-t1 1 a 1 a NULL NULL NULL NULL YES BTREE
126+t1 1 a 1 a A 0 NULL NULL YES BTREE
127 alter table t1 modify a bigint, disable keys;
128 show indexes from t1;
129 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
130-t1 1 a 1 a A NULL NULL NULL YES BTREE
131+t1 1 a 1 a A 0 NULL NULL YES BTREE
132 alter table t1 enable keys;
133 show indexes from t1;
134 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
135-t1 1 a 1 a NULL NULL NULL NULL YES BTREE
136+t1 1 a 1 a A 0 NULL NULL YES BTREE
137 alter table t1 add b char(10), disable keys;
138 show indexes from t1;
139 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
140-t1 1 a 1 a A NULL NULL NULL YES BTREE
141+t1 1 a 1 a A 0 NULL NULL YES BTREE
142 alter table t1 add c decimal(10,2), enable keys;
143 show indexes from t1;
144 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
145-t1 1 a 1 a A NULL NULL NULL YES BTREE
146+t1 1 a 1 a A 0 NULL NULL YES BTREE
147 "this however did"
148 alter table t1 disable keys;
149 show indexes from t1;
150 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
151-t1 1 a 1 a NULL NULL NULL NULL YES BTREE
152+t1 1 a 1 a A 0 NULL NULL YES BTREE
153 desc t1;
154 Field Type Null Key Default Extra
155 a bigint(20) YES MUL NULL
156@@ -585,7 +585,7 @@
157 "The key should still be disabled"
158 show indexes from t1;
159 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
160-t1 1 a 1 a A NULL NULL NULL YES BTREE
161+t1 1 a 1 a A 0 NULL NULL YES BTREE
162 drop table t1;
163 "Now will test with one unique index"
164 create table t1(a int, b char(10), unique(a));
165@@ -595,7 +595,7 @@
166 alter table t1 disable keys;
167 show indexes from t1;
168 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
169-t1 0 a 1 a NULL 0 NULL NULL YES BTREE
170+t1 0 a 1 a A 0 NULL NULL YES BTREE
171 alter table t1 enable keys;
172 "If no copy on noop change, this won't touch the data file"
173 "Unique index, no change"
174@@ -623,12 +623,12 @@
175 show indexes from t1;
176 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
177 t1 0 a 1 a A 0 NULL NULL YES BTREE
178-t1 1 b 1 b A NULL NULL NULL YES BTREE
179+t1 1 b 1 b A 0 NULL NULL YES BTREE
180 alter table t1 disable keys;
181 show indexes from t1;
182 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
183-t1 0 a 1 a NULL 0 NULL NULL YES BTREE
184-t1 1 b 1 b NULL NULL NULL NULL YES BTREE
185+t1 0 a 1 a A 0 NULL NULL YES BTREE
186+t1 1 b 1 b A 0 NULL NULL YES BTREE
187 alter table t1 enable keys;
188 "If no copy on noop change, this won't touch the data file"
189 "The non-unique index will be disabled"
190@@ -636,31 +636,31 @@
191 show indexes from t1;
192 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
193 t1 0 a 1 a A 0 NULL NULL YES BTREE
194-t1 1 b 1 b A NULL NULL NULL YES BTREE
195+t1 1 b 1 b A 0 NULL NULL YES BTREE
196 alter table t1 enable keys;
197 show indexes from t1;
198 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
199-t1 0 a 1 a NULL 0 NULL NULL YES BTREE
200-t1 1 b 1 b NULL NULL NULL NULL YES BTREE
201+t1 0 a 1 a A 0 NULL NULL YES BTREE
202+t1 1 b 1 b A 0 NULL NULL YES BTREE
203 "Change the type implying data copy"
204 "The non-unique index will be disabled"
205 alter table t1 modify a bigint, disable keys;
206 show indexes from t1;
207 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
208 t1 0 a 1 a A 0 NULL NULL YES BTREE
209-t1 1 b 1 b A NULL NULL NULL YES BTREE
210+t1 1 b 1 b A 0 NULL NULL YES BTREE
211 "Change again the type, but leave the indexes as_is"
212 alter table t1 modify a int;
213 show indexes from t1;
214 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
215 t1 0 a 1 a A 0 NULL NULL YES BTREE
216-t1 1 b 1 b A NULL NULL NULL YES BTREE
217+t1 1 b 1 b A 0 NULL NULL YES BTREE
218 "Try the same. When data is no copied on similar tables, this is noop"
219 alter table t1 modify a int;
220 show indexes from t1;
221 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
222 t1 0 a 1 a A 0 NULL NULL YES BTREE
223-t1 1 b 1 b A NULL NULL NULL YES BTREE
224+t1 1 b 1 b A 0 NULL NULL YES BTREE
225 drop table t1;
226 create database mysqltest;
227 create table t1 (c1 int);
228@@ -697,11 +697,11 @@
229 CREATE TABLE bug24219 (a INT, INDEX(a));
230 SHOW INDEX FROM bug24219;
231 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
232-bug24219 1 a 1 a A NULL NULL NULL YES BTREE
233+bug24219 1 a 1 a A 0 NULL NULL YES BTREE
234 ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
235 SHOW INDEX FROM bug24219_2;
236 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
237-bug24219_2 1 a 1 a A NULL NULL NULL YES BTREE
238+bug24219_2 1 a 1 a A 0 NULL NULL YES BTREE
239 DROP TABLE bug24219_2;
240 create table t1 (mycol int(10) not null);
241 alter table t1 alter column mycol set default 0;
242@@ -882,7 +882,7 @@
243 char_field char(10) YES NULL
244 SHOW INDEXES FROM t1;
245 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
246-t1 1 int_field 1 int_field A NULL NULL NULL BTREE
247+t1 1 int_field 1 int_field A 0 NULL NULL BTREE
248 INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
249 "Non-copy data change - new frm, but old data and index files"
250 ALTER TABLE t1
251
252=== modified file 'mysql-test/suite/pbxt/r/analyze.result'
253--- mysql-test/suite/pbxt/r/analyze.result 2009-04-02 10:03:14 +0000
254+++ mysql-test/suite/pbxt/r/analyze.result 2009-08-17 15:57:58 +0000
255@@ -56,5 +56,5 @@
256 test.t1 analyze status OK
257 show index from t1;
258 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
259-t1 1 a 1 a A NULL NULL NULL YES BTREE
260+t1 1 a 1 a A 5 NULL NULL YES BTREE
261 drop table t1;
262
263=== modified file 'mysql-test/suite/pbxt/r/auto_increment.result'
264--- mysql-test/suite/pbxt/r/auto_increment.result 2009-04-02 10:03:14 +0000
265+++ mysql-test/suite/pbxt/r/auto_increment.result 2009-08-17 15:57:58 +0000
266@@ -229,7 +229,8 @@
267 204 7
268 delete from t1 where a=0;
269 update t1 set a=NULL where b=6;
270-ERROR 23000: Column 'a' cannot be null
271+Warnings:
272+Warning 1048 Column 'a' cannot be null
273 update t1 set a=300 where b=7;
274 SET SQL_MODE='';
275 insert into t1(a,b)values(NULL,8);
276@@ -244,7 +245,7 @@
277 1 1
278 200 2
279 201 4
280-203 6
281+0 6
282 300 7
283 301 8
284 400 9
285@@ -260,7 +261,6 @@
286 1 1
287 200 2
288 201 4
289-203 6
290 300 7
291 301 8
292 400 9
293@@ -271,20 +271,20 @@
294 405 14
295 delete from t1 where a=0;
296 update t1 set a=NULL where b=13;
297-ERROR 23000: Column 'a' cannot be null
298+Warnings:
299+Warning 1048 Column 'a' cannot be null
300 update t1 set a=500 where b=14;
301 select * from t1 order by b;
302 a b
303 1 1
304 200 2
305 201 4
306-203 6
307 300 7
308 301 8
309 400 9
310 401 10
311 402 11
312-404 13
313+0 13
314 500 14
315 drop table t1;
316 create table t1 (a bigint);
317
318=== modified file 'mysql-test/suite/pbxt/r/delete.result'
319--- mysql-test/suite/pbxt/r/delete.result 2009-04-02 10:03:14 +0000
320+++ mysql-test/suite/pbxt/r/delete.result 2009-08-17 15:57:58 +0000
321@@ -125,18 +125,19 @@
322 0 11
323 2 12
324 delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
325-Warnings:
326-Error 1242 Subquery returns more than 1 row
327-Error 1242 Subquery returns more than 1 row
328+ERROR 21000: Subquery returns more than 1 row
329 select * from t11;
330 a b
331 0 10
332 1 11
333+2 12
334 select * from t12;
335 a b
336 33 10
337 0 11
338+2 12
339 insert into t11 values (2, 12);
340+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
341 delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
342 ERROR 21000: Subquery returns more than 1 row
343 select * from t11;
344@@ -145,13 +146,12 @@
345 1 11
346 2 12
347 delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
348-Warnings:
349-Error 1242 Subquery returns more than 1 row
350-Error 1242 Subquery returns more than 1 row
351+ERROR 21000: Subquery returns more than 1 row
352 select * from t11;
353 a b
354 0 10
355 1 11
356+2 12
357 drop table t11, t12, t2;
358 create table t1 (a int, b int, unique key (a), key (b));
359 insert into t1 values (3, 3), (7, 7);
360
361=== modified file 'mysql-test/suite/pbxt/r/distinct.result'
362--- mysql-test/suite/pbxt/r/distinct.result 2009-04-02 10:03:14 +0000
363+++ mysql-test/suite/pbxt/r/distinct.result 2009-08-17 15:57:58 +0000
364@@ -174,8 +174,8 @@
365 explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
366 id select_type table type possible_keys key key_len ref rows Extra
367 1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
368-1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
369-1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct; Using join buffer
370+1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index
371+1 SIMPLE t3 ref a a 5 test.t1.b 1 Using where; Using index
372 SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
373 a
374 1
375@@ -190,7 +190,7 @@
376 explain select distinct t1.a from t1,t3 where t1.a=t3.a;
377 id select_type table type possible_keys key key_len ref rows Extra
378 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
379-1 SIMPLE t3 ref a a 5 test.t1.a 11 Using where; Using index; Distinct
380+1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using index; Distinct
381 select distinct t1.a from t1,t3 where t1.a=t3.a;
382 a
383 1
384@@ -212,7 +212,7 @@
385 1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
386 explain SELECT distinct a from t3 order by a desc limit 2;
387 id select_type table type possible_keys key key_len ref rows Extra
388-1 SIMPLE t3 index NULL a 5 NULL 40 Using index
389+1 SIMPLE t3 index NULL a 5 NULL 2 Using index
390 explain SELECT distinct a,b from t3 order by a+1;
391 id select_type table type possible_keys key key_len ref rows Extra
392 1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
393
394=== modified file 'mysql-test/suite/pbxt/r/func_group.result'
395--- mysql-test/suite/pbxt/r/func_group.result 2009-04-02 10:03:14 +0000
396+++ mysql-test/suite/pbxt/r/func_group.result 2009-08-17 15:57:58 +0000
397@@ -61,7 +61,7 @@
398 NULL NULL
399 1 7
400 2 20.25
401-3 45.483163247594
402+3 45.4831632475944
403 create table t2 (grp int, a bigint unsigned, c char(10));
404 insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
405 replace into t2 select grp, a, c from t1 limit 2,1;
406@@ -613,8 +613,8 @@
407 explain
408 select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
409 id select_type table type possible_keys key key_len ref rows Extra
410-1 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index
411-1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index; Using join buffer
412+1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index
413+1 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index; Using join buffer
414 explain
415 select min(a4 - 0.01) from t1;
416 id select_type table type possible_keys key key_len ref rows Extra
417@@ -1186,7 +1186,7 @@
418 0.21325764
419 select std(o1/o2) from bug22555;
420 std(o1/o2)
421-0.21325763586649
422+0.213257635866493
423 select std(e1/e2) from bug22555;
424 std(e1/e2)
425 0.21325764
426@@ -1212,7 +1212,7 @@
427 0.21325763586649341
428 select std(o1/o2) from bug22555;
429 std(o1/o2)
430-0.21325763586649
431+0.213257635866493
432 select round(std(e1/e2), 17) from bug22555;
433 round(std(e1/e2), 17)
434 0.21325763586649341
435@@ -1237,7 +1237,7 @@
436 0.21325763586649341
437 select std(o1/o2) from bug22555;
438 std(o1/o2)
439-0.21325763586649
440+0.213257635866493
441 select round(std(e1/e2), 17) from bug22555;
442 round(std(e1/e2), 17)
443 0.21325763586649341
444
445=== modified file 'mysql-test/suite/pbxt/r/func_math.result'
446--- mysql-test/suite/pbxt/r/func_math.result 2009-04-02 10:03:14 +0000
447+++ mysql-test/suite/pbxt/r/func_math.result 2009-08-17 15:57:58 +0000
448@@ -60,7 +60,7 @@
449 Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
450 select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
451 log2(8) log2(15) log2(-2) log2(0) log2(NULL)
452-3 3.9068905956085 NULL NULL NULL
453+3 3.90689059560852 NULL NULL NULL
454 explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
455 id select_type table type possible_keys key key_len ref rows filtered Extra
456 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
457@@ -68,7 +68,7 @@
458 Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
459 select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
460 log10(100) log10(18) log10(-4) log10(0) log10(NULL)
461-2 1.2552725051033 NULL NULL NULL
462+2 1.25527250510331 NULL NULL NULL
463 explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
464 id select_type table type possible_keys key key_len ref rows filtered Extra
465 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
466@@ -85,7 +85,7 @@
467 set @@rand_seed1=10000000,@@rand_seed2=1000000;
468 select rand(999999),rand();
469 rand(999999) rand()
470-0.014231365187309 0.028870999839968
471+0.0142313651873091 0.028870999839968
472 explain extended select rand(999999),rand();
473 id select_type table type possible_keys key key_len ref rows filtered Extra
474 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
475@@ -101,7 +101,7 @@
476 Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
477 select degrees(pi()),radians(360);
478 degrees(pi()) radians(360)
479-180 6.2831853071796
480+180 6.28318530717959
481 select format(atan(-2, 2), 6);
482 format(atan(-2, 2), 6)
483 -0.785398
484
485=== modified file 'mysql-test/suite/pbxt/r/func_str.result'
486--- mysql-test/suite/pbxt/r/func_str.result 2009-04-02 10:03:14 +0000
487+++ mysql-test/suite/pbxt/r/func_str.result 2009-08-17 15:57:58 +0000
488@@ -1327,10 +1327,10 @@
489 20.06
490 select conv("18383815659218730760",10,10) + 0;
491 conv("18383815659218730760",10,10) + 0
492-1.8383815659219e+19
493+1.83838156592187e+19
494 select "18383815659218730760" + 0;
495 "18383815659218730760" + 0
496-1.8383815659219e+19
497+1.83838156592187e+19
498 CREATE TABLE t1 (code varchar(10));
499 INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
500 SELECT ASCII(code), code FROM t1 WHERE code='A12';
501
502=== modified file 'mysql-test/suite/pbxt/r/grant.result'
503--- mysql-test/suite/pbxt/r/grant.result 2009-04-02 10:03:14 +0000
504+++ mysql-test/suite/pbxt/r/grant.result 2009-08-17 15:57:58 +0000
505@@ -457,7 +457,7 @@
506 Alter Tables To alter the table
507 Alter routine Functions,Procedures To alter or drop stored functions/procedures
508 Create Databases,Tables,Indexes To create new databases and tables
509-Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE
510+Create routine Databases To use CREATE FUNCTION/PROCEDURE
511 Create temporary tables Databases To use CREATE TEMPORARY TABLE
512 Create view Tables To create new views
513 Create user Server Admin To create new users
514
515=== modified file 'mysql-test/suite/pbxt/r/group_min_max.result'
516--- mysql-test/suite/pbxt/r/group_min_max.result 2009-04-02 10:03:14 +0000
517+++ mysql-test/suite/pbxt/r/group_min_max.result 2009-08-17 15:57:58 +0000
518@@ -133,34 +133,34 @@
519 test.t3 analyze status OK
520 explain select a1, min(a2) from t1 group by a1;
521 id select_type table type possible_keys key key_len ref rows Extra
522-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by
523+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
524 explain select a1, max(a2) from t1 group by a1;
525 id select_type table type possible_keys key key_len ref rows Extra
526-1 SIMPLE t1 range NULL idx_t1_1 65 NULL 10 Using index for group-by
527+1 SIMPLE t1 range NULL idx_t1_1 65 NULL 129 Using index for group-by
528 explain select a1, min(a2), max(a2) from t1 group by a1;
529 id select_type table type possible_keys key key_len ref rows Extra
530-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by
531+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
532 explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
533 id select_type table type possible_keys key key_len ref rows Extra
534-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
535+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
536 explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
537 id select_type table type possible_keys key key_len ref rows Extra
538-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
539+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
540 explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
541 id select_type table type possible_keys key key_len ref rows Extra
542 1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by
543 explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
544 id select_type table type possible_keys key key_len ref rows Extra
545-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by
546+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
547 explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
548 id select_type table type possible_keys key key_len ref rows Extra
549-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
550+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
551 explain select min(a2) from t1 group by a1;
552 id select_type table type possible_keys key key_len ref rows Extra
553-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by
554+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
555 explain select a2, min(c), max(c) from t1 group by a1,a2,b;
556 id select_type table type possible_keys key key_len ref rows Extra
557-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
558+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
559 select a1, min(a2) from t1 group by a1;
560 a1 min(a2)
561 a a
562@@ -293,13 +293,13 @@
563 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
564 explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
565 id select_type table type possible_keys key key_len ref rows Extra
566-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 1 Using where; Using index for group-by
567+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 2 Using where; Using index for group-by
568 explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
569 id select_type table type possible_keys key key_len ref rows Extra
570-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 1 Using where; Using index for group-by
571+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 2 Using where; Using index for group-by
572 explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
573 id select_type table type possible_keys key key_len ref rows Extra
574-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
575+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 129 Using where; Using index for group-by
576 explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
577 id select_type table type possible_keys key key_len ref rows Extra
578 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 65 NULL 3 Using where; Using index
579@@ -669,40 +669,40 @@
580 d p422
581 explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
582 id select_type table type possible_keys key key_len ref rows Extra
583-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
584+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
585 explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
586 id select_type table type possible_keys key key_len ref rows Extra
587-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
588+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
589 explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
590 id select_type table type possible_keys key key_len ref rows Extra
591-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
592+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
593 explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
594 id select_type table type possible_keys key key_len ref rows Extra
595-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
596+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
597 explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
598 id select_type table type possible_keys key key_len ref rows Extra
599-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
600+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
601 explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
602 id select_type table type possible_keys key key_len ref rows Extra
603-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
604+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
605 explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
606 id select_type table type possible_keys key key_len ref rows Extra
607-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
608+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
609 explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
610 id select_type table type possible_keys key key_len ref rows Extra
611-1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
612+1 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
613 explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
614 id select_type table type possible_keys key key_len ref rows Extra
615-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
616+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
617 explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
618 id select_type table type possible_keys key key_len ref rows Extra
619-1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
620+1 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
621 explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
622 id select_type table type possible_keys key key_len ref rows Extra
623-1 SIMPLE t3 range NULL idx_t3_1 6 NULL 10 Using where; Using index for group-by
624+1 SIMPLE t3 range NULL idx_t3_1 6 NULL 193 Using where; Using index for group-by
625 explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
626 id select_type table type possible_keys key key_len ref rows Extra
627-1 SIMPLE t3 range NULL idx_t3_1 6 NULL 10 Using where; Using index for group-by
628+1 SIMPLE t3 range NULL idx_t3_1 6 NULL 193 Using where; Using index for group-by
629 select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
630 a1 a2 b max(c) min(c)
631 a a b h112 e112
632@@ -804,22 +804,22 @@
633 c h312 e312
634 explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
635 id select_type table type possible_keys key key_len ref rows Extra
636-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
637+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
638 explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
639 id select_type table type possible_keys key key_len ref rows Extra
640-1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
641+1 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
642 explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
643 id select_type table type possible_keys key key_len ref rows Extra
644-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
645+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
646 explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
647 id select_type table type possible_keys key key_len ref rows Extra
648-1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
649-explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
650-id select_type table type possible_keys key key_len ref rows Extra
651-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
652-explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
653-id select_type table type possible_keys key key_len ref rows Extra
654-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
655+1 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
656+explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
657+id select_type table type possible_keys key key_len ref rows Extra
658+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
659+explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
660+id select_type table type possible_keys key key_len ref rows Extra
661+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
662 select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
663 a1 a2 b min(c)
664 a a NULL a777
665@@ -849,49 +849,49 @@
666 1 SIMPLE t1 range NULL idx_t1_1 147 NULL # Using where; Using index for group-by
667 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
668 id select_type table type possible_keys key key_len ref rows Extra
669-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
670+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
671 explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
672 id select_type table type possible_keys key key_len ref rows Extra
673-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
674+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
675 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
676 id select_type table type possible_keys key key_len ref rows Extra
677-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
678+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
679 explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
680 id select_type table type possible_keys key key_len ref rows Extra
681-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
682+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
683 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
684 id select_type table type possible_keys key key_len ref rows Extra
685-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
686+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
687 explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
688 id select_type table type possible_keys key key_len ref rows Extra
689-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
690+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
691 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
692 id select_type table type possible_keys key key_len ref rows Extra
693-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
694+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
695 explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
696 id select_type table type possible_keys key key_len ref rows Extra
697-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
698+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
699 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
700 id select_type table type possible_keys key key_len ref rows Extra
701-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
702+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
703 explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
704 id select_type table type possible_keys key key_len ref rows Extra
705-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
706+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
707 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
708 id select_type table type possible_keys key key_len ref rows Extra
709-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
710+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
711 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
712 id select_type table type possible_keys key key_len ref rows Extra
713-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
714+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
715 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
716 id select_type table type possible_keys key key_len ref rows Extra
717-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
718+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
719 explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
720 id select_type table type possible_keys key key_len ref rows Extra
721-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
722+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
723 explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
724 id select_type table type possible_keys key key_len ref rows Extra
725-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
726+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
727 explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
728 id select_type table type possible_keys key key_len ref rows Extra
729 1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
730@@ -1364,29 +1364,29 @@
731 where exists ( select * from t2 where t2.c > 'b1' )
732 group by a1,a2,b;
733 id select_type table type possible_keys key key_len ref rows Extra
734-1 PRIMARY t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
735+1 PRIMARY t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
736 2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
737 explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
738 id select_type table type possible_keys key key_len ref rows Extra
739-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
740+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 129 Using where; Using index for group-by
741 explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
742 id select_type table type possible_keys key key_len ref rows Extra
743-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 10 Using where; Using index for group-by
744+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 129 Using where; Using index for group-by
745 explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
746 id select_type table type possible_keys key key_len ref rows Extra
747-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
748+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
749 explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
750 id select_type table type possible_keys key key_len ref rows Extra
751-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 1 Using where; Using index for group-by
752+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 2 Using where; Using index for group-by
753 explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
754 id select_type table type possible_keys key key_len ref rows Extra
755-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 1 Using where; Using index for group-by
756+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 2 Using where; Using index for group-by
757 explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
758 id select_type table type possible_keys key key_len ref rows Extra
759 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
760 explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
761 id select_type table type possible_keys key key_len ref rows Extra
762-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
763+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
764 explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
765 id select_type table type possible_keys key key_len ref rows Extra
766 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
767@@ -1491,13 +1491,13 @@
768 a1 a2 b min(c)
769 explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
770 id select_type table type possible_keys key key_len ref rows Extra
771-1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
772+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 129 Using where; Using index for group-by
773 explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
774 id select_type table type possible_keys key key_len ref rows Extra
775-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
776+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
777 explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
778 id select_type table type possible_keys key key_len ref rows Extra
779-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
780+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
781 explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
782 id select_type table type possible_keys key key_len ref rows Extra
783 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where
784@@ -1554,13 +1554,13 @@
785 a1 a2 b
786 explain select distinct a1,a2,b from t1;
787 id select_type table type possible_keys key key_len ref rows Extra
788-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
789+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
790 explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
791 id select_type table type possible_keys key key_len ref rows Extra
792-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
793+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
794 explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
795 id select_type table type possible_keys key key_len ref rows filtered Extra
796-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 100.00 Using where; Using index for group-by
797+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 99.22 Using where; Using index for group-by
798 Warnings:
799 Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b'))
800 explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
801@@ -1577,7 +1577,7 @@
802 1 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using where; Using index for group-by
803 explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
804 id select_type table type possible_keys key key_len ref rows filtered Extra
805-1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 100.00 Using where; Using index for group-by
806+1 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 99.39 Using where; Using index for group-by
807 Warnings:
808 Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b'))
809 explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
810@@ -1702,19 +1702,19 @@
811 d e
812 explain select distinct a1,a2,b from t1;
813 id select_type table type possible_keys key key_len ref rows Extra
814-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
815+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
816 explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
817 id select_type table type possible_keys key key_len ref rows Extra
818-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by
819+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
820 explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
821 id select_type table type possible_keys key key_len ref rows Extra
822-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by
823+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
824 explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
825 id select_type table type possible_keys key key_len ref rows Extra
826 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where
827 explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
828 id select_type table type possible_keys key key_len ref rows Extra
829-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by; Using temporary; Using filesort
830+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by; Using temporary; Using filesort
831 explain select distinct a1,a2,b from t2;
832 id select_type table type possible_keys key key_len ref rows Extra
833 1 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using index for group-by
834@@ -1846,7 +1846,7 @@
835 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
836 explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
837 id select_type table type possible_keys key key_len ref rows Extra
838-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by
839+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
840 select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
841 a1 a2 b concat(min(c), max(c))
842 a a a a111d111
843@@ -1985,7 +1985,7 @@
844 d
845 explain select a1 from t1 where a2 = 'b' group by a1;
846 id select_type table type possible_keys key key_len ref rows Extra
847-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using where; Using index for group-by
848+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using where; Using index for group-by
849 select a1 from t1 where a2 = 'b' group by a1;
850 a1
851 a
852@@ -1994,7 +1994,7 @@
853 d
854 explain select distinct a1 from t1 where a2 = 'b';
855 id select_type table type possible_keys key key_len ref rows Extra
856-1 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using where; Using index for group-by
857+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using where; Using index for group-by
858 select distinct a1 from t1 where a2 = 'b';
859 a1
860 a
861@@ -2188,7 +2188,7 @@
862 (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
863 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
864 id select_type table type possible_keys key key_len ref rows Extra
865-1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by
866+1 SIMPLE t1 index NULL a 10 NULL 15 Using index
867 FLUSH STATUS;
868 SELECT max(b), a FROM t1 GROUP BY a;
869 max(b) a
870@@ -2202,7 +2202,7 @@
871 Handler_read_next 0
872 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
873 id select_type table type possible_keys key key_len ref rows Extra
874-1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by
875+1 SIMPLE t1 index NULL a 10 NULL 15 Using index
876 FLUSH STATUS;
877 CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
878 SHOW STATUS LIKE 'handler_read__e%';
879@@ -2235,14 +2235,14 @@
880 EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
881 (SELECT max(b), a FROM t1 GROUP BY a);
882 id select_type table type possible_keys key key_len ref rows Extra
883-1 PRIMARY t1 range NULL a 5 NULL 8 Using index for group-by
884-2 UNION t1 range NULL a 5 NULL 8 Using index for group-by
885+1 PRIMARY t1 index NULL a 10 NULL 15 Using index
886+2 UNION t1 index NULL a 10 NULL 15 Using index
887 NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
888 EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
889 FROM t1 AS t1_outer;
890 id select_type table type possible_keys key key_len ref rows Extra
891 1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
892-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
893+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
894 EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
895 (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
896 id select_type table type possible_keys key key_len ref rows Extra
897@@ -2252,7 +2252,7 @@
898 (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
899 id select_type table type possible_keys key key_len ref rows Extra
900 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
901-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
902+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
903 EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
904 a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
905 id select_type table type possible_keys key key_len ref rows Extra
906@@ -2261,21 +2261,21 @@
907 EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
908 a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
909 id select_type table type possible_keys key key_len ref rows Extra
910-1 PRIMARY t1_outer range NULL a 5 NULL 8 Using index for group-by
911-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
912+1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
913+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
914 EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
915 ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
916 AND t1_outer1.b = t1_outer2.b;
917 id select_type table type possible_keys key key_len ref rows Extra
918 1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
919 1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer
920-2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
921+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
922 EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
923 FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
924 id select_type table type possible_keys key key_len ref rows Extra
925 1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
926 2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
927-3 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
928+3 SUBQUERY t1 index NULL a 10 NULL 15 Using index
929 CREATE TABLE t3 LIKE t1;
930 FLUSH STATUS;
931 INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
932@@ -2312,7 +2312,7 @@
933 (4), (2), (1), (2), (2), (4), (1), (4);
934 EXPLAIN SELECT DISTINCT(a) FROM t1;
935 id select_type table type possible_keys key key_len ref rows Extra
936-1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
937+1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
938 SELECT DISTINCT(a) FROM t1;
939 a
940 1
941@@ -2320,7 +2320,7 @@
942 4
943 EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
944 id select_type table type possible_keys key key_len ref rows Extra
945-1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
946+1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
947 SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
948 a
949 1
950@@ -2345,7 +2345,7 @@
951 EXPLAIN
952 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
953 id select_type table type possible_keys key key_len ref rows Extra
954-1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by
955+1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
956 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
957 a MIN(b) MAX(b)
958 1 1 3
959@@ -2355,7 +2355,7 @@
960 EXPLAIN
961 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
962 id select_type table type possible_keys key key_len ref rows Extra
963-1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by; Using temporary; Using filesort
964+1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
965 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
966 a MIN(b) MAX(b)
967 4 1 3
968
969=== modified file 'mysql-test/suite/pbxt/r/join.result'
970--- mysql-test/suite/pbxt/r/join.result 2009-04-02 10:03:14 +0000
971+++ mysql-test/suite/pbxt/r/join.result 2009-08-17 15:57:58 +0000
972@@ -774,7 +774,7 @@
973 explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
974 id select_type table type possible_keys key key_len ref rows Extra
975 1 SIMPLE t2 range a,b a 5 NULL 1 Using where
976-1 SIMPLE t3 ref b b 5 test.t2.b 11 Using where
977+1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where
978 drop table t1, t2, t3;
979 create table t1 (a int);
980 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
981
982=== modified file 'mysql-test/suite/pbxt/r/join_nested.result'
983--- mysql-test/suite/pbxt/r/join_nested.result 2009-04-02 10:03:14 +0000
984+++ mysql-test/suite/pbxt/r/join_nested.result 2009-08-17 15:57:58 +0000
985@@ -851,7 +851,7 @@
986 id select_type table type possible_keys key key_len ref rows filtered Extra
987 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
988 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
989-1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00
990+1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00
991 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
992 Warnings:
993 Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1
994@@ -958,15 +958,15 @@
995 1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
996 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
997 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
998+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
999 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1000-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
1001 1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1002 1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1003 1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1004 1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
1005 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1006 Warnings:
1007-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1008+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1009 CREATE INDEX idx_b ON t8(b);
1010 EXPLAIN EXTENDED
1011 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1012@@ -1008,14 +1008,14 @@
1013 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1014 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1015 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1016-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
1017+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1018 1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1019+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1020 1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1021-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1022-1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
1023+1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1024 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1025+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1026 Warnings:
1027-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1028 CREATE INDEX idx_b ON t1(b);
1029 CREATE INDEX idx_a ON t0(a);
1030 EXPLAIN EXTENDED
1031@@ -1055,17 +1055,17 @@
1032 (t9.a=1);
1033 id select_type table type possible_keys key key_len ref rows filtered Extra
1034 1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where
1035-1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00 Using where
1036+1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where
1037 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1038 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1039-1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
1040+1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1041 1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1042+1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1043 1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1044-1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1045-1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
1046+1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1047 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1048+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1049 Warnings:
1050-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
1051 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1052 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1053 FROM t0,t1
1054@@ -1102,21 +1102,21 @@
1055 (t9.a=1);
1056 a b a b a b a b a b a b a b a b a b a b
1057 1 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 1
1058+1 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 2
1059+1 2 3 2 4 2 1 2 3 2 2 2 6 2 2 2 0 2 1 2
1060 1 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 1
1061+1 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 2
1062 1 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 1
1063+1 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
1064+1 2 3 2 4 2 1 2 4 2 2 2 6 2 2 2 0 2 1 2
1065 1 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 1
1066+1 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 2
1067 1 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 1
1068+1 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
1069+1 2 3 2 5 3 NULL NULL NULL NULL 2 2 6 2 2 2 0 2 1 2
1070 1 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 1
1071+1 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 2
1072 1 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 1
1073-1 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 2
1074-1 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 2
1075-1 2 3 2 4 2 1 2 3 2 2 2 6 2 2 2 0 2 1 2
1076-1 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
1077-1 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 2
1078-1 2 3 2 4 2 1 2 4 2 2 2 6 2 2 2 0 2 1 2
1079-1 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
1080-1 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 2
1081-1 2 3 2 5 3 NULL NULL NULL NULL 2 2 6 2 2 2 0 2 1 2
1082 1 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 2
1083 SELECT t2.a,t2.b
1084 FROM t2;
1085@@ -1203,7 +1203,7 @@
1086 id select_type table type possible_keys key key_len ref rows Extra
1087 1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1088 1 SIMPLE t3 index c c 5 NULL 6 Using index
1089-1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
1090+1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
1091 EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1092 id select_type table type possible_keys key key_len ref rows Extra
1093 1 SIMPLE t1 index NULL a 5 NULL # Using index
1094@@ -1484,8 +1484,8 @@
1095 on (t1.a = t2.a);
1096 id select_type table type possible_keys key key_len ref rows Extra
1097 1 SIMPLE t1 ALL NULL NULL NULL NULL 10
1098-1 SIMPLE t2 ref a a 5 test.t1.a 11
1099-1 SIMPLE t3 ref a a 5 test.t2.a 11
1100+1 SIMPLE t2 ref a a 5 test.t1.a 1
1101+1 SIMPLE t3 ref a a 5 test.t2.a 1
1102 drop table t1, t2, t3;
1103 CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10));
1104 CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10));
1105
1106=== modified file 'mysql-test/suite/pbxt/r/key.result'
1107--- mysql-test/suite/pbxt/r/key.result 2009-04-02 10:03:14 +0000
1108+++ mysql-test/suite/pbxt/r/key.result 2009-08-17 15:57:58 +0000
1109@@ -153,7 +153,7 @@
1110 t1 0 a 1 a A 0 NULL NULL BTREE
1111 t1 0 e 1 e A 0 NULL NULL BTREE
1112 t1 0 b 1 b A 0 NULL NULL YES BTREE
1113-t1 1 c 1 c A NULL NULL NULL YES BTREE
1114+t1 1 c 1 c A 0 NULL NULL YES BTREE
1115 drop table t1;
1116 CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
1117 UNIQUE (c,i));
1118
1119=== modified file 'mysql-test/suite/pbxt/r/key_cache.result'
1120--- mysql-test/suite/pbxt/r/key_cache.result 2009-04-02 10:03:14 +0000
1121+++ mysql-test/suite/pbxt/r/key_cache.result 2009-08-17 15:57:58 +0000
1122@@ -122,7 +122,7 @@
1123 explain select count(*) from t1, t2 where t1.p = t2.i;
1124 id select_type table type possible_keys key key_len ref rows Extra
1125 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
1126-1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using where; Using index
1127+1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using where; Using index
1128 select count(*) from t1, t2 where t1.p = t2.i;
1129 count(*)
1130 3
1131@@ -257,8 +257,6 @@
1132 drop table t1,t2,t3;
1133 set global keycache2.key_buffer_size=0;
1134 set global keycache3.key_buffer_size=100;
1135-Warnings:
1136-Warning 1292 Truncated incorrect key_buffer_size value: '100'
1137 set global keycache3.key_buffer_size=0;
1138 create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;
1139 insert t1 values ('aaabbb');
1140
1141=== modified file 'mysql-test/suite/pbxt/r/key_diff.result'
1142--- mysql-test/suite/pbxt/r/key_diff.result 2009-04-02 10:03:14 +0000
1143+++ mysql-test/suite/pbxt/r/key_diff.result 2009-08-17 15:57:58 +0000
1144@@ -36,7 +36,7 @@
1145 explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
1146 id select_type table type possible_keys key key_len ref rows Extra
1147 1 SIMPLE t1 ALL a NULL NULL NULL 5
1148-1 SIMPLE t2 ALL b NULL NULL NULL 5 Using where; Using join buffer
1149+1 SIMPLE t2 ref b b 4 test.t1.a 1 Using where
1150 select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
1151 a b a b
1152 A B a a
1153
1154=== modified file 'mysql-test/suite/pbxt/r/mysqlshow.result'
1155--- mysql-test/suite/pbxt/r/mysqlshow.result 2009-04-02 10:03:14 +0000
1156+++ mysql-test/suite/pbxt/r/mysqlshow.result 2009-08-17 15:57:58 +0000
1157@@ -107,7 +107,21 @@
1158 | TRIGGERS |
1159 | USER_PRIVILEGES |
1160 | VIEWS |
1161+| INNODB_BUFFER_POOL_PAGES |
1162 | PBXT_STATISTICS |
1163+| INNODB_CMP |
1164+| INNODB_RSEG |
1165+| XTRADB_ENHANCEMENTS |
1166+| INNODB_BUFFER_POOL_PAGES_INDEX |
1167+| INNODB_INDEX_STATS |
1168+| INNODB_TRX |
1169+| INNODB_CMP_RESET |
1170+| INNODB_LOCK_WAITS |
1171+| INNODB_CMPMEM_RESET |
1172+| INNODB_LOCKS |
1173+| INNODB_CMPMEM |
1174+| INNODB_TABLE_STATS |
1175+| INNODB_BUFFER_POOL_PAGES_BLOB |
1176 +---------------------------------------+
1177 Database: INFORMATION_SCHEMA
1178 +---------------------------------------+
1179@@ -141,7 +155,21 @@
1180 | TRIGGERS |
1181 | USER_PRIVILEGES |
1182 | VIEWS |
1183+| INNODB_BUFFER_POOL_PAGES |
1184 | PBXT_STATISTICS |
1185+| INNODB_CMP |
1186+| INNODB_RSEG |
1187+| XTRADB_ENHANCEMENTS |
1188+| INNODB_BUFFER_POOL_PAGES_INDEX |
1189+| INNODB_INDEX_STATS |
1190+| INNODB_TRX |
1191+| INNODB_CMP_RESET |
1192+| INNODB_LOCK_WAITS |
1193+| INNODB_CMPMEM_RESET |
1194+| INNODB_LOCKS |
1195+| INNODB_CMPMEM |
1196+| INNODB_TABLE_STATS |
1197+| INNODB_BUFFER_POOL_PAGES_BLOB |
1198 +---------------------------------------+
1199 Wildcard: inf_rmation_schema
1200 +--------------------+
1201
1202=== modified file 'mysql-test/suite/pbxt/r/null.result'
1203--- mysql-test/suite/pbxt/r/null.result 2009-04-02 10:03:14 +0000
1204+++ mysql-test/suite/pbxt/r/null.result 2009-08-17 15:57:58 +0000
1205@@ -93,9 +93,11 @@
1206 Warnings:
1207 Warning 1265 Data truncated for column 'd' at row 1
1208 UPDATE t1 SET d=1/NULL;
1209-ERROR 23000: Column 'd' cannot be null
1210+Warnings:
1211+Warning 1265 Data truncated for column 'd' at row 1
1212 UPDATE t1 SET d=NULL;
1213-ERROR 23000: Column 'd' cannot be null
1214+Warnings:
1215+Warning 1048 Column 'd' cannot be null
1216 INSERT INTO t1 (a) values (null);
1217 ERROR 23000: Column 'a' cannot be null
1218 INSERT INTO t1 (a) values (1/null);
1219@@ -130,7 +132,7 @@
1220 Warning 1048 Column 'd' cannot be null
1221 select * from t1;
1222 a b c d
1223- 0 0000-00-00 00:00:00 2003
1224+ 0 0000-00-00 00:00:00 0
1225 0 0000-00-00 00:00:00 0
1226 0 0000-00-00 00:00:00 0
1227 0 0000-00-00 00:00:00 0
1228
1229=== modified file 'mysql-test/suite/pbxt/r/null_key.result'
1230--- mysql-test/suite/pbxt/r/null_key.result 2009-04-02 10:03:14 +0000
1231+++ mysql-test/suite/pbxt/r/null_key.result 2009-08-17 15:57:58 +0000
1232@@ -407,8 +407,8 @@
1233 LEFT JOIN t3 ON t2.b=t3.b;
1234 id select_type table type possible_keys key key_len ref rows Extra
1235 1 SIMPLE t1 ALL NULL NULL NULL NULL 4
1236-1 SIMPLE t2 ref idx idx 5 test.t1.a 2
1237-1 SIMPLE t3 ref idx idx 5 test.t2.b 186 Using index
1238+1 SIMPLE t2 ref idx idx 5 test.t1.a 1
1239+1 SIMPLE t3 ref idx idx 5 test.t2.b 1 Using index
1240 FLUSH STATUS ;
1241 SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
1242 LEFT JOIN t3 ON t2.b=t3.b;
1243
1244=== modified file 'mysql-test/suite/pbxt/r/partition_pruning.result'
1245--- mysql-test/suite/pbxt/r/partition_pruning.result 2009-04-02 10:03:14 +0000
1246+++ mysql-test/suite/pbxt/r/partition_pruning.result 2009-08-17 15:57:58 +0000
1247@@ -338,12 +338,12 @@
1248 where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
1249 id select_type table partitions type possible_keys key key_len ref rows Extra
1250 1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 2 Using where
1251-1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
1252+1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 1 Using where
1253 explain partitions
1254 select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
1255 id select_type table partitions type possible_keys key key_len ref rows Extra
1256 1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
1257-1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
1258+1 SIMPLE Y p1,p2 ref a a 4 test.X.a 1
1259 drop table t1;
1260 create table t1 (a int) partition by hash(a) partitions 20;
1261 insert into t1 values (1),(2),(3);
1262
1263=== modified file 'mysql-test/suite/pbxt/r/pbxt_bugs.result'
1264--- mysql-test/suite/pbxt/r/pbxt_bugs.result 2009-04-02 20:36:52 +0000
1265+++ mysql-test/suite/pbxt/r/pbxt_bugs.result 2009-08-17 15:57:58 +0000
1266@@ -1218,3 +1218,59 @@
1267 0 opq
1268 1 jkl
1269 DROP TABLE t1;
1270+create table parent (id int primary key);
1271+create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
1272+insert into parent values (2), (3), (4);
1273+insert into child values (3), (4);
1274+delete ignore from parent;
1275+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (Constraint: `FOREIGN_1`)
1276+select * from parent;
1277+id
1278+2
1279+3
1280+4
1281+drop table child, parent;
1282+create schema test378222;
1283+use test378222;
1284+create table t1 (id int primary key);
1285+create table t2 (id int primary key);
1286+alter table t1 add constraint foreign key (id) references t2 (id);
1287+alter table t2 add constraint foreign key (id) references t1 (id);
1288+drop schema test378222;
1289+create schema test378222a;
1290+create schema test378222b;
1291+create table test378222a.t1 (id int primary key);
1292+create table test378222b.t2 (id int primary key);
1293+alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
1294+alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
1295+set foreign_key_checks = 1;
1296+drop schema test378222a;
1297+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
1298+drop schema test378222b;
1299+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
1300+set foreign_key_checks = 0;
1301+drop schema test378222a;
1302+drop schema test378222b;
1303+set foreign_key_checks = 1;
1304+use test;
1305+CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
1306+SHOW CREATE TABLE t1;
1307+Table Create Table
1308+t1 CREATE TABLE `t1` (
1309+ `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
1310+ PRIMARY KEY (`c1`)
1311+) ENGINE=PBXT AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
1312+INSERT INTO t1 VALUES(null);
1313+INSERT INTO t1 VALUES(null);
1314+INSERT INTO t1 VALUES(null);
1315+SELECT * FROM t1;
1316+c1
1317+10
1318+11
1319+12
1320+TRUNCATE TABLE t1;
1321+INSERT INTO t1 VALUES(null);
1322+SELECT * FROM t1;
1323+c1
1324+1
1325+DROP TABLE t1;
1326
1327=== modified file 'mysql-test/suite/pbxt/r/pbxt_ref_int.result'
1328--- mysql-test/suite/pbxt/r/pbxt_ref_int.result 2009-04-02 10:03:14 +0000
1329+++ mysql-test/suite/pbxt/r/pbxt_ref_int.result 2009-08-17 15:57:58 +0000
1330@@ -166,7 +166,7 @@
1331 `parent_id` int(11) DEFAULT NULL,
1332 KEY `par_ind` (`parent_id`),
1333 KEY `child_ind` (`id`),
1334- CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
1335+ CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
1336 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1337 drop index child_ind on child;
1338 show create table child;
1339@@ -175,7 +175,7 @@
1340 `id` int(11) DEFAULT NULL,
1341 `parent_id` int(11) DEFAULT NULL,
1342 KEY `par_ind` (`parent_id`),
1343- CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
1344+ CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
1345 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1346 alter table parent add column c1 varchar(40);
1347 insert child values(2000, 2);
1348@@ -243,7 +243,7 @@
1349 `id` int(11) DEFAULT NULL,
1350 `parent_id` int(11) DEFAULT NULL,
1351 KEY `par_ind` (`parent_id`),
1352- CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
1353+ CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
1354 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1355 alter table child add column c1 varchar(40);
1356 insert child values(400, 1, "asd");
1357@@ -284,7 +284,7 @@
1358 `id` int(11) DEFAULT NULL,
1359 `parent_id` int(11) DEFAULT NULL,
1360 KEY `par_ind` (`parent_id`),
1361- CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
1362+ CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE
1363 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1364 insert parent values(1);
1365 insert child values(100, 1);
1366
1367=== modified file 'mysql-test/suite/pbxt/r/preload.result'
1368--- mysql-test/suite/pbxt/r/preload.result 2009-04-02 10:03:14 +0000
1369+++ mysql-test/suite/pbxt/r/preload.result 2009-08-17 15:57:58 +0000
1370@@ -144,7 +144,7 @@
1371 load index into cache t3, t2 key (primary,b) ;
1372 Table Op Msg_type Msg_text
1373 test.t3 preload_keys Error Table 'test.t3' doesn't exist
1374-test.t3 preload_keys error Corrupt
1375+test.t3 preload_keys status Operation failed
1376 test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
1377 show status like "key_read%";
1378 Variable_name Value
1379@@ -159,7 +159,7 @@
1380 load index into cache t3 key (b), t2 key (c) ;
1381 Table Op Msg_type Msg_text
1382 test.t3 preload_keys Error Table 'test.t3' doesn't exist
1383-test.t3 preload_keys error Corrupt
1384+test.t3 preload_keys status Operation failed
1385 test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
1386 show status like "key_read%";
1387 Variable_name Value
1388
1389=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
1390--- mysql-test/suite/pbxt/r/ps_1general.result 2009-04-02 10:03:14 +0000
1391+++ mysql-test/suite/pbxt/r/ps_1general.result 2009-08-17 15:57:58 +0000
1392@@ -289,7 +289,7 @@
1393 execute stmt4;
1394 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
1395 t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
1396-t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE
1397+t2 1 t2_idx 1 b A 0 NULL NULL YES BTREE
1398 prepare stmt4 from ' show table status from test like ''t2%'' ';
1399 execute stmt4;
1400 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
1401@@ -447,7 +447,7 @@
1402 def possible_keys 253 4096 0 Y 0 31 8
1403 def key 253 64 0 Y 0 31 8
1404 def key_len 253 4096 0 Y 0 31 8
1405-def ref 253 1024 0 Y 0 31 8
1406+def ref 253 2048 0 Y 0 31 8
1407 def rows 8 10 1 Y 32928 0 63
1408 def Extra 253 255 14 N 1 31 8
1409 id select_type table type possible_keys key key_len ref rows Extra
1410@@ -463,7 +463,7 @@
1411 def possible_keys 253 4096 7 Y 0 31 8
1412 def key 253 64 7 Y 0 31 8
1413 def key_len 253 4096 1 Y 0 31 8
1414-def ref 253 1024 0 Y 0 31 8
1415+def ref 253 2048 0 Y 0 31 8
1416 def rows 8 10 1 Y 32928 0 63
1417 def Extra 253 255 27 N 1 31 8
1418 id select_type table type possible_keys key key_len ref rows Extra
1419
1420=== modified file 'mysql-test/suite/pbxt/r/range.result'
1421--- mysql-test/suite/pbxt/r/range.result 2009-04-02 10:03:14 +0000
1422+++ mysql-test/suite/pbxt/r/range.result 2009-08-17 15:57:58 +0000
1423@@ -423,19 +423,19 @@
1424 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
1425 id select_type table type possible_keys key key_len ref rows Extra
1426 1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
1427-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1428+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
1429 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
1430 id select_type table type possible_keys key key_len ref rows Extra
1431 1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
1432-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1433+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
1434 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
1435 id select_type table type possible_keys key key_len ref rows Extra
1436 1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
1437-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1438+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
1439 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
1440 id select_type table type possible_keys key key_len ref rows Extra
1441 1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
1442-1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1443+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
1444 select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
1445 id name uid id name uid
1446 1001 A 1 1001 A 1
1447
1448=== modified file 'mysql-test/suite/pbxt/r/schema.result'
1449--- mysql-test/suite/pbxt/r/schema.result 2009-04-02 10:03:14 +0000
1450+++ mysql-test/suite/pbxt/r/schema.result 2009-08-17 15:57:58 +0000
1451@@ -3,11 +3,13 @@
1452 show create schema foo;
1453 Database Create Database
1454 foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
1455+create table t1 (id int) engine=pbxt;
1456 show schemas;
1457 Database
1458 information_schema
1459 foo
1460 mtr
1461 mysql
1462+pbxt
1463 test
1464 drop schema foo;
1465
1466=== modified file 'mysql-test/suite/pbxt/r/select.result'
1467--- mysql-test/suite/pbxt/r/select.result 2009-04-02 10:03:14 +0000
1468+++ mysql-test/suite/pbxt/r/select.result 2009-08-17 15:57:58 +0000
1469@@ -604,15 +604,15 @@
1470 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
1471 id select_type table type possible_keys key key_len ref rows Extra
1472 1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
1473-1 SIMPLE t3 ref period period 4 test.t1.period 18
1474+1 SIMPLE t3 ref period period 4 test.t1.period 1
1475 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
1476 id select_type table type possible_keys key key_len ref rows Extra
1477-1 SIMPLE t3 index period period 4 NULL 1
1478-1 SIMPLE t1 ref period period 4 test.t3.period 18
1479+1 SIMPLE t3 index period period 4 NULL 10
1480+1 SIMPLE t1 ref period period 4 test.t3.period 1
1481 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
1482 id select_type table type possible_keys key key_len ref rows Extra
1483-1 SIMPLE t1 index period period 4 NULL 1
1484-1 SIMPLE t3 ref period period 4 test.t1.period 18
1485+1 SIMPLE t1 index period period 4 NULL 10
1486+1 SIMPLE t3 ref period period 4 test.t1.period 1
1487 select period from t1;
1488 period
1489 9410
1490@@ -2095,7 +2095,7 @@
1491 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
1492 t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
1493 t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
1494-t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
1495+t2 1 fld3 1 fld3 A 1199 NULL NULL BTREE
1496 drop table t4, t3, t2, t1;
1497 DO 1;
1498 DO benchmark(100,1+1),1,1;
1499@@ -2369,7 +2369,7 @@
1500 explain select * from t1 left join t2 on a=c where d in (4);
1501 id select_type table type possible_keys key key_len ref rows Extra
1502 1 SIMPLE t2 ref c,d d 5 const 1 Using where
1503-1 SIMPLE t1 ref a a 5 test.t2.c 2 Using where
1504+1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
1505 select * from t1 left join t2 on a=c where d in (4);
1506 a b c d
1507 3 2 3 4
1508@@ -2377,7 +2377,7 @@
1509 explain select * from t1 left join t2 on a=c where d = 4;
1510 id select_type table type possible_keys key key_len ref rows Extra
1511 1 SIMPLE t2 ref c,d d 5 const 1 Using where
1512-1 SIMPLE t1 ref a a 5 test.t2.c 2 Using where
1513+1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
1514 select * from t1 left join t2 on a=c where d = 4;
1515 a b c d
1516 3 2 3 4
1517@@ -2403,11 +2403,11 @@
1518 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
1519 id select_type table type possible_keys key key_len ref rows Extra
1520 1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1521-1 SIMPLE t2 ref a a 23 test.t1.a 2
1522+1 SIMPLE t2 ref a a 23 test.t1.a 1
1523 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
1524 id select_type table type possible_keys key key_len ref rows Extra
1525 1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1526-1 SIMPLE t2 ref a a 23 test.t1.a 2
1527+1 SIMPLE t2 ref a a 23 test.t1.a 1
1528 DROP TABLE t1, t2;
1529 CREATE TABLE t1 ( city char(30) );
1530 INSERT INTO t1 VALUES ('London');
1531@@ -2792,26 +2792,26 @@
1532 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1533 select max(key1) from t1 where key1 <= 0.6158;
1534 max(key1)
1535-0.61580002307892
1536+0.615800023078918
1537 select max(key2) from t2 where key2 <= 1.6158;
1538 max(key2)
1539-1.6158000230789
1540+1.61580002307892
1541 select min(key1) from t1 where key1 >= 0.3762;
1542 min(key1)
1543-0.37619999051094
1544+0.376199990510941
1545 select min(key2) from t2 where key2 >= 1.3762;
1546 min(key2)
1547-1.3761999607086
1548+1.37619996070862
1549 select max(key1), min(key2) from t1, t2
1550 where key1 <= 0.6158 and key2 >= 1.3762;
1551 max(key1) min(key2)
1552-0.61580002307892 1.3761999607086
1553+0.615800023078918 1.37619996070862
1554 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
1555 max(key1)
1556-0.61580002307892
1557+0.615800023078918
1558 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
1559 min(key1)
1560-0.37619999051094
1561+0.376199990510941
1562 DROP TABLE t1,t2;
1563 CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
1564 INSERT INTO t1 VALUES (10);
1565@@ -3454,7 +3454,7 @@
1566 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
1567 id select_type table type possible_keys key key_len ref rows Extra
1568 1 SIMPLE A range PRIMARY PRIMARY 12 NULL 1 Using where
1569-1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 11
1570+1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 1
1571 drop table t1, t2;
1572 CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
1573 INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
1574@@ -3468,12 +3468,12 @@
1575 SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
1576 id select_type table type possible_keys key key_len ref rows Extra
1577 1 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where
1578-1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
1579+1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
1580 EXPLAIN
1581 SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
1582 id select_type table type possible_keys key key_len ref rows Extra
1583 1 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where
1584-1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
1585+1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
1586 DROP TABLE t1, t2;
1587 create table t1 (
1588 a int unsigned not null auto_increment primary key,
1589
1590=== modified file 'mysql-test/suite/pbxt/r/select_safe.result'
1591--- mysql-test/suite/pbxt/r/select_safe.result 2009-04-02 10:03:14 +0000
1592+++ mysql-test/suite/pbxt/r/select_safe.result 2009-08-17 15:57:58 +0000
1593@@ -70,12 +70,12 @@
1594 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
1595 id select_type table type possible_keys key key_len ref rows Extra
1596 1 SIMPLE t1 ALL b NULL NULL NULL 21
1597-1 SIMPLE t2 ref b b 21 test.t1.b 2 Using where
1598+1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
1599 set MAX_SEEKS_FOR_KEY=1;
1600 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
1601 id select_type table type possible_keys key key_len ref rows Extra
1602 1 SIMPLE t1 ALL b NULL NULL NULL 21
1603-1 SIMPLE t2 ref b b 21 test.t1.b 2 Using where
1604+1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
1605 SET MAX_SEEKS_FOR_KEY=DEFAULT;
1606 drop table t1;
1607 create table t1 (a int);
1608
1609=== modified file 'mysql-test/suite/pbxt/r/subselect.result'
1610--- mysql-test/suite/pbxt/r/subselect.result 2009-04-02 10:03:14 +0000
1611+++ mysql-test/suite/pbxt/r/subselect.result 2009-08-17 15:57:58 +0000
1612@@ -1333,7 +1333,7 @@
1613 explain extended select * from t2 where t2.a in (select a from t1);
1614 id select_type table type possible_keys key key_len ref rows filtered Extra
1615 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
1616-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
1617+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1618 Warnings:
1619 Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
1620 select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1621@@ -1343,7 +1343,7 @@
1622 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1623 id select_type table type possible_keys key key_len ref rows filtered Extra
1624 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
1625-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
1626+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1627 Warnings:
1628 Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
1629 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1630@@ -1353,8 +1353,8 @@
1631 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1632 id select_type table type possible_keys key key_len ref rows filtered Extra
1633 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
1634-2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index
1635-2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer
1636+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using where; Using index
1637+2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using where; Using index
1638 Warnings:
1639 Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
1640 insert into t1 values (3,31);
1641@@ -1370,7 +1370,7 @@
1642 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1643 id select_type table type possible_keys key key_len ref rows filtered Extra
1644 1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
1645-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
1646+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1647 Warnings:
1648 Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
1649 drop table t1, t2, t3;
1650@@ -3546,7 +3546,7 @@
1651 id select_type table type possible_keys key key_len ref rows Extra
1652 1 PRIMARY t2 ALL NULL NULL NULL NULL 1
1653 1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index; Using join buffer
1654-2 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 2 Using where; Using index; Using filesort
1655+2 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 1 Using where; Using index; Using filesort
1656 SELECT * FROM t1,t2
1657 WHERE t1.t = (SELECT t1.t FROM t1
1658 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
1659@@ -4214,7 +4214,7 @@
1660 EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
1661 id select_type table type possible_keys key key_len ref rows Extra
1662 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1663-2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
1664+2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
1665 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
1666 a b
1667 CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
1668@@ -4224,14 +4224,14 @@
1669 EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
1670 id select_type table type possible_keys key key_len ref rows Extra
1671 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
1672-2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where
1673+2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 1 Using index; Using where
1674 SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
1675 a b
1676 EXPLAIN
1677 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
1678 id select_type table type possible_keys key key_len ref rows Extra
1679 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1680-2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
1681+2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
1682 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
1683 a b
1684 DROP TABLE t1,t2;
1685
1686=== modified file 'mysql-test/suite/pbxt/r/type_enum.result'
1687--- mysql-test/suite/pbxt/r/type_enum.result 2009-04-02 10:03:14 +0000
1688+++ mysql-test/suite/pbxt/r/type_enum.result 2009-08-17 15:57:58 +0000
1689@@ -1776,8 +1776,14 @@
1690 `russian_deviant` enum('E','F','EÿF','F,E') NOT NULL DEFAULT 'E'
1691 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1692 drop table t1;
1693+select @@SESSION.sql_mode;
1694+@@SESSION.sql_mode
1695+
1696+select @@GLOBAL.sql_mode;
1697+@@GLOBAL.sql_mode
1698+
1699 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
1700
1701
1702
1703 
1704
1705
1706 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
1707-ERROR HY000: Can't create table 'test.t1' (errno: -1)
1708+drop table t1;
1709 End of 5.1 tests
1710
1711=== modified file 'mysql-test/suite/pbxt/r/type_ranges.result'
1712--- mysql-test/suite/pbxt/r/type_ranges.result 2009-04-02 10:03:14 +0000
1713+++ mysql-test/suite/pbxt/r/type_ranges.result 2009-08-17 15:57:58 +0000
1714@@ -70,19 +70,19 @@
1715 show keys from t1;
1716 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
1717 t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
1718-t1 1 utiny 1 utiny A NULL NULL NULL BTREE
1719-t1 1 tiny 1 tiny A NULL NULL NULL BTREE
1720-t1 1 short 1 short A NULL NULL NULL BTREE
1721-t1 1 any_name 1 medium A NULL NULL NULL BTREE
1722-t1 1 longlong 1 longlong A NULL NULL NULL BTREE
1723-t1 1 real_float 1 real_float A NULL NULL NULL BTREE
1724-t1 1 ushort 1 ushort A NULL NULL NULL BTREE
1725-t1 1 umedium 1 umedium A NULL NULL NULL BTREE
1726-t1 1 ulong 1 ulong A NULL NULL NULL BTREE
1727-t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE
1728-t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE
1729-t1 1 options 1 options A NULL NULL NULL BTREE
1730-t1 1 options 2 flags A NULL NULL NULL BTREE
1731+t1 1 utiny 1 utiny A 0 NULL NULL BTREE
1732+t1 1 tiny 1 tiny A 0 NULL NULL BTREE
1733+t1 1 short 1 short A 0 NULL NULL BTREE
1734+t1 1 any_name 1 medium A 0 NULL NULL BTREE
1735+t1 1 longlong 1 longlong A 0 NULL NULL BTREE
1736+t1 1 real_float 1 real_float A 0 NULL NULL BTREE
1737+t1 1 ushort 1 ushort A 0 NULL NULL BTREE
1738+t1 1 umedium 1 umedium A 0 NULL NULL BTREE
1739+t1 1 ulong 1 ulong A 0 NULL NULL BTREE
1740+t1 1 ulonglong 1 ulonglong A 0 NULL NULL BTREE
1741+t1 1 ulonglong 2 ulong A 0 NULL NULL BTREE
1742+t1 1 options 1 options A 0 NULL NULL BTREE
1743+t1 1 options 2 flags A 0 NULL NULL BTREE
1744 CREATE UNIQUE INDEX test on t1 ( auto ) ;
1745 CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
1746 CREATE INDEX test3 on t1 ( medium ) ;
1747
1748=== modified file 'mysql-test/suite/pbxt/r/type_timestamp.result'
1749--- mysql-test/suite/pbxt/r/type_timestamp.result 2009-04-02 10:03:14 +0000
1750+++ mysql-test/suite/pbxt/r/type_timestamp.result 2009-08-17 15:57:58 +0000
1751@@ -101,13 +101,13 @@
1752 t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
1753 t14 timestamp(14));
1754 Warnings:
1755-Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1756-Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1757-Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1758-Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1759-Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1760-Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1761-Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
1762+Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1763+Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1764+Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1765+Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1766+Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1767+Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1768+Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
1769 insert t1 values (0,0,0,0,0,0,0),
1770 ("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
1771 "1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
1772
1773=== modified file 'mysql-test/suite/pbxt/r/union.result'
1774--- mysql-test/suite/pbxt/r/union.result 2009-04-02 10:03:14 +0000
1775+++ mysql-test/suite/pbxt/r/union.result 2009-08-17 15:57:58 +0000
1776@@ -1301,12 +1301,14 @@
1777 `left(a,100000000)` longtext
1778 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1779 drop tables t1,t2,t3;
1780+SELECT @tmp_max:= @@global.max_allowed_packet;
1781+@tmp_max:= @@global.max_allowed_packet
1782+1048576
1783+SET @@global.max_allowed_packet=25000000;
1784 CREATE TABLE t1 (a mediumtext);
1785 CREATE TABLE t2 (b varchar(20));
1786 INSERT INTO t1 VALUES ('a');
1787 CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
1788-Warnings:
1789-Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1790 SHOW CREATE TABLE t3;
1791 Table Create Table
1792 t3 CREATE TABLE `t3` (
1793@@ -1340,6 +1342,7 @@
1794 `a` varbinary(510) DEFAULT NULL
1795 ) ENGINE=PBXT DEFAULT CHARSET=latin1
1796 DROP TABLES t1,t2,t3;
1797+SET @@global.max_allowed_packet:= @tmp_max;
1798 create table t1 ( id int not null auto_increment, primary key (id), col1 int);
1799 insert into t1 (col1) values (2),(3),(4),(5),(6);
1800 select 99 union all select id from t1 order by 1;
1801
1802=== modified file 'mysql-test/suite/pbxt/r/view_grant.result'
1803--- mysql-test/suite/pbxt/r/view_grant.result 2009-04-02 10:03:14 +0000
1804+++ mysql-test/suite/pbxt/r/view_grant.result 2009-08-17 15:57:58 +0000
1805@@ -28,7 +28,7 @@
1806 ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
1807 show create view v1;
1808 View Create View character_set_client collation_connection
1809-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
1810+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
1811 grant create view,drop,select on test.* to mysqltest_1@localhost;
1812 use test;
1813 alter view v1 as select * from mysqltest.t1;
1814@@ -309,7 +309,7 @@
1815 create view v1 as select * from mysqltest.t1;
1816 show create view v1;
1817 View Create View character_set_client collation_connection
1818-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
1819+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
1820 revoke select on mysqltest.t1 from mysqltest_1@localhost;
1821 select * from v1;
1822 ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
1823
1824=== modified file 'mysql-test/suite/pbxt/t/auto_increment.test'
1825--- mysql-test/suite/pbxt/t/auto_increment.test 2009-04-02 10:03:14 +0000
1826+++ mysql-test/suite/pbxt/t/auto_increment.test 2009-08-17 15:57:58 +0000
1827@@ -150,7 +150,6 @@
1828 update t1 set a=0 where b=5;
1829 select * from t1 order by b;
1830 delete from t1 where a=0;
1831---error 1048
1832 update t1 set a=NULL where b=6;
1833 update t1 set a=300 where b=7;
1834 SET SQL_MODE='';
1835@@ -166,7 +165,6 @@
1836 update t1 set a=0 where b=12;
1837 select * from t1 order by b;
1838 delete from t1 where a=0;
1839---error 1048
1840 update t1 set a=NULL where b=13;
1841 update t1 set a=500 where b=14;
1842 select * from t1 order by b;
1843
1844=== modified file 'mysql-test/suite/pbxt/t/delete.test'
1845--- mysql-test/suite/pbxt/t/delete.test 2009-04-02 10:03:14 +0000
1846+++ mysql-test/suite/pbxt/t/delete.test 2009-08-17 15:57:58 +0000
1847@@ -120,13 +120,16 @@
1848 delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
1849 select * from t11;
1850 select * from t12;
1851+--error 1242
1852 delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
1853 select * from t11;
1854 select * from t12;
1855+--error 1062
1856 insert into t11 values (2, 12);
1857 -- error 1242
1858 delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
1859 select * from t11;
1860+--error 1242
1861 delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
1862 select * from t11;
1863 drop table t11, t12, t2;
1864
1865=== modified file 'mysql-test/suite/pbxt/t/join_nested.test'
1866--- mysql-test/suite/pbxt/t/join_nested.test 2009-04-02 10:03:14 +0000
1867+++ mysql-test/suite/pbxt/t/join_nested.test 2009-08-17 15:57:58 +0000
1868@@ -546,6 +546,7 @@
1869
1870 CREATE INDEX idx_b ON t8(b);
1871
1872+--sorted_result
1873 EXPLAIN EXTENDED
1874 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1875 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1876@@ -585,6 +586,7 @@
1877 CREATE INDEX idx_b ON t1(b);
1878 CREATE INDEX idx_a ON t0(a);
1879
1880+--sorted_result
1881 EXPLAIN EXTENDED
1882 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1883 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1884@@ -621,6 +623,7 @@
1885 (t8.b=t9.b OR t8.c IS NULL) AND
1886 (t9.a=1);
1887
1888+--sorted_result
1889 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1890 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1891 FROM t0,t1
1892
1893=== modified file 'mysql-test/suite/pbxt/t/null.test'
1894--- mysql-test/suite/pbxt/t/null.test 2009-04-02 20:36:52 +0000
1895+++ mysql-test/suite/pbxt/t/null.test 2009-08-17 15:57:58 +0000
1896@@ -61,9 +61,7 @@
1897 #
1898 CREATE TABLE t1 (a varchar(16) NOT NULL default '', b smallint(6) NOT NULL default 0, c datetime NOT NULL default '0000-00-00 00:00:00', d smallint(6) NOT NULL default 0);
1899 INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
1900---error 1048
1901 UPDATE t1 SET d=1/NULL;
1902---error 1048
1903 UPDATE t1 SET d=NULL;
1904 --error 1048
1905 INSERT INTO t1 (a) values (null);
1906
1907=== modified file 'mysql-test/suite/pbxt/t/pbxt_bugs.test'
1908--- mysql-test/suite/pbxt/t/pbxt_bugs.test 2009-04-02 20:36:52 +0000
1909+++ mysql-test/suite/pbxt/t/pbxt_bugs.test 2009-08-17 15:57:58 +0000
1910@@ -926,7 +926,59 @@
1911 SELECT * FROM t1 ORDER BY c1;
1912 DROP TABLE t1;
1913
1914+create table parent (id int primary key);
1915+create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
1916+insert into parent values (2), (3), (4);
1917+insert into child values (3), (4);
1918+
1919+--error 1451
1920+delete ignore from parent;
1921+--sorted_result
1922+select * from parent;
1923+
1924+drop table child, parent;
1925+
1926+# bug 378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
1927+
1928+create schema test378222;
1929+use test378222;
1930+create table t1 (id int primary key);
1931+create table t2 (id int primary key);
1932+alter table t1 add constraint foreign key (id) references t2 (id);
1933+alter table t2 add constraint foreign key (id) references t1 (id);
1934+drop schema test378222;
1935+
1936+create schema test378222a;
1937+create schema test378222b;
1938+create table test378222a.t1 (id int primary key);
1939+create table test378222b.t2 (id int primary key);
1940+alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
1941+alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
1942+set foreign_key_checks = 1;
1943+--error 1217
1944+drop schema test378222a;
1945+--error 1217
1946+drop schema test378222b;
1947+set foreign_key_checks = 0;
1948+drop schema test378222a;
1949+drop schema test378222b;
1950+set foreign_key_checks = 1;
1951+use test;
1952+
1953+# bug 369086: Incosistent/Incorrect Truncate behavior
1954+CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
1955+SHOW CREATE TABLE t1;
1956+INSERT INTO t1 VALUES(null);
1957+INSERT INTO t1 VALUES(null);
1958+INSERT INTO t1 VALUES(null);
1959+SELECT * FROM t1;
1960+TRUNCATE TABLE t1;
1961+INSERT INTO t1 VALUES(null);
1962+SELECT * FROM t1;
1963+DROP TABLE t1;
1964+
1965 --disable_query_log
1966+
1967 DROP TABLE t2, t5;
1968 drop database pbxt;
1969 --enable_query_log
1970
1971=== modified file 'mysql-test/suite/pbxt/t/rename.test'
1972--- mysql-test/suite/pbxt/t/rename.test 2009-04-02 10:03:14 +0000
1973+++ mysql-test/suite/pbxt/t/rename.test 2009-08-17 15:57:58 +0000
1974@@ -63,7 +63,28 @@
1975 # Wait for the the tables to be renamed
1976 # i.e the query below succeds
1977 let $query= select * from t2, t4;
1978-source include/wait_for_query_to_suceed.inc;
1979+# source include/wait_for_query_to_suceed.inc;
1980+let $counter= 100;
1981+
1982+disable_abort_on_error;
1983+disable_query_log;
1984+disable_result_log;
1985+eval $query;
1986+while ($mysql_errno)
1987+{
1988+ eval $query;
1989+ sleep 0.1;
1990+ dec $counter;
1991+
1992+ if (!$counter)
1993+ {
1994+ die("Waited too long for query to suceed");
1995+ }
1996+}
1997+enable_abort_on_error;
1998+enable_query_log;
1999+enable_result_log;
2000+
2001
2002 show tables;
2003
2004
2005=== modified file 'mysql-test/suite/pbxt/t/schema.test'
2006--- mysql-test/suite/pbxt/t/schema.test 2009-04-02 10:03:14 +0000
2007+++ mysql-test/suite/pbxt/t/schema.test 2009-08-17 15:57:58 +0000
2008@@ -10,5 +10,12 @@
2009
2010 create schema foo;
2011 show create schema foo;
2012+# force PBXT schema to be created
2013+create table t1 (id int) engine=pbxt;
2014 show schemas;
2015 drop schema foo;
2016+
2017+--disable_query_log
2018+drop table if exists t1;
2019+drop database pbxt;
2020+--enable_query_log
2021
2022=== modified file 'mysql-test/suite/pbxt/t/type_enum.test'
2023--- mysql-test/suite/pbxt/t/type_enum.test 2009-04-02 10:03:14 +0000
2024+++ mysql-test/suite/pbxt/t/type_enum.test 2009-08-17 15:57:58 +0000
2025@@ -153,12 +153,19 @@
2026 show create table t1;
2027 drop table t1;
2028
2029-# ER_WRONG_FIELD_TERMINATORS
2030---error 1005
2031+# the following create statement sometimes fails like it would if NO_BACKSLASH_ESCAPES sql mode was on,
2032+# we check sql mode here
2033+select @@SESSION.sql_mode;
2034+select @@GLOBAL.sql_mode;
2035+
2036+## ER_WRONG_FIELD_TERMINATORS
2037+#--error 1005
2038 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
2039
2040
2041
2042 
2043
2044
2045 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
2046
2047+drop table t1;
2048+
2049 --disable_query_log
2050 drop database pbxt;
2051 --enable_query_log
2052
2053=== modified file 'mysql-test/suite/pbxt/t/union.test'
2054--- mysql-test/suite/pbxt/t/union.test 2009-04-02 10:03:14 +0000
2055+++ mysql-test/suite/pbxt/t/union.test 2009-08-17 15:57:58 +0000
2056@@ -802,6 +802,10 @@
2057 # exceeds mediumtext maximum length
2058 #
2059
2060+SELECT @tmp_max:= @@global.max_allowed_packet;
2061+SET @@global.max_allowed_packet=25000000;
2062+# switching connection to allow the new max_allowed_packet take effect
2063+--connect (newconn, localhost, root,,)
2064 CREATE TABLE t1 (a mediumtext);
2065 CREATE TABLE t2 (b varchar(20));
2066 INSERT INTO t1 VALUES ('a');
2067@@ -823,6 +827,9 @@
2068 CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
2069 SHOW CREATE TABLE t3;
2070 DROP TABLES t1,t2,t3;
2071+--connection default
2072+SET @@global.max_allowed_packet:= @tmp_max;
2073+--disconnect newconn
2074
2075 #
2076 # Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
2077
2078=== modified file 'storage/pbxt/ChangeLog'
2079--- storage/pbxt/ChangeLog 2009-04-02 11:49:57 +0000
2080+++ storage/pbxt/ChangeLog 2009-08-18 07:46:53 +0000
2081@@ -1,7 +1,75 @@
2082 PBXT Release Notes
2083 ==================
2084
2085-------- 1.0.08 RC - Not yet released
2086+------- 1.0.08c RC2 - 2009-08-18
2087+
2088+RN266: Updated BLOB streaming glue, used with the PBMS engine. The glue code is now identical to the version of "1.0.08-rc-pbms" version of PBXT available from http://blobstreaming.org/download.
2089+
2090+RN265: Changes the sequential reading of data log files to skip gaps, instead of returning EOF. This ensures that extended data records are preserved even when something goes wrong with the way the file is written.
2091+
2092+RN264: Fixed a bug that cased an "Data log not found" error after an out of disk space error on a log file. This bug is similar to RN262 in that it allows "gaps" to appear in the data logs.
2093+
2094+RN263: Updated xtstat to compile on Windows/MS Visual C++.
2095+
2096+RN262: Merged changes for PBMS version 0.5.09.
2097+
2098+RN261: Concerning bug #377788: Cannot find index for FK. Fixed buffer overflow which occurred when the error was reported.
2099+
2100+RN260: Fixed bug #377788: Cannot find index for FK. PBXT now correctly uses prefix of an index to support FK references (e.g. if key = (c1, c2) then an index on (c1, c2, c3) will work). Also fixed buffer overflow, which occurred when reporting the error.
2101+
2102+RN259: Fixed bug #309424: xtstat doesn't use my.cnf. You can now add an [xtstat] section to my.cnf, for use with xtstat.
2103+
2104+RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started
2105+
2106+RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled
2107+
2108+RN256: Update datalog eof pointer only if write opearions were sucessful
2109+
2110+RN255: Added re-allocation of of filemap if allocating the of the new map failed. This often happens if there's not enough space on disk.
2111+
2112+RN254: When a table with a corrupted index is detected, PBXT creates a file called 'repair-pending' in the pbxt directory, with the name of the table in it. Each table in the file is listed on a line by itself (the last line has no trailing \n). When the table is repaired (using the REPAIR TABLE command), this entry is removed from the file.
2113+
2114+RN253: Use fcntl(F_FULLFSYNC) instead of fsync on platforms that support it. Improper fsync operation was presumably the reason of index corruption on Mac OS X.
2115+
2116+RN252: Fixed bug #368692: PBXT not reporting data size correctly in information_schema.
2117+
2118+------- 1.0.08 RC2 - 2009-06-30
2119+
2120+RN251: A Windows-specific test update, also removed false assertion that failed on Windows.
2121+
2122+RN250: Fixed a bug that caused recovery to fail when the transaction log ID exceeded 255. The problem was a checksum failed in the log record.
2123+
2124+RN249: Fixed bug #313176: Test case timeout. This happened because record cache pages where not properly freed and as soon as cache filled up the performacne degraded.
2125+
2126+RN248: PBXT now compiles and runs with MySQL 5.1.35. All tests pass.
2127+
2128+RN247: Fixed bug #369086: Incosistent/Incorrect Truncate behavior
2129+
2130+RN246: Fixed bug #378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
2131+
2132+RN245: Fixed bug #379315: Inconsistent behavior of DELETE IGNORE and FK constraint.
2133+
2134+RN244: Fixed a recovery problem: during the recovery of "record modified" action the table was updated before the old index entries were removed; then the xres_remove_index_entries was supplied the new record which lead to incorrect index update.
2135+
2136+RN243: Fixed a bug that caused a recovery failure if partitioned pbxt tables where present. This happended because the recovery used a MySQL function to open tables and the PBXT handler was not yet registered
2137+
2138+RN242: Fixed a bug that caused a deadlock if pbxt initialization failed. This happened because pbxt ceanup was done from pbxt_init() with PLUGIN_lock being held by MySQL which lead to a deadlock in the freeer thread
2139+
2140+RN241: Fixed a heap corruption bug (writing to a freed memory location). It happened only when memory mapped files were used leading to heap inconsistency and program crash or termination by heap checker. Likely to happen right after or during DROP TABLE but possible in other cases too.
2141+
2142+RN240: Load the record cache on read when no using memory mapped files.
2143+
2144+RN239: Added PBXT variable pbxt_max_threads. This is the maximum number of threads that can be created PBXT. By default this value is set to 0 which means the number of threads is derived from the MySQL variable max_connections. The value used is max_connections+7. Under Drizzle the default value is 500.
2145+
2146+RN238: Added an option to wait for the sweeper to clean up old transactions on a particular connection. This prevents the sweeper from getting too far behind.
2147+
2148+RN237: Added an option to lazy delete fixed length index entries. This means the index entries are just marked for deletion, instead of removing the items from the index page. This has the advantage that an exclusive lock is not always required for deletion.
2149+
2150+RN236: Fixed bug #349177: a bug in configure.in script.
2151+
2152+RN235: Fixed bug 349176: a compiler warning.
2153+
2154+RN234: Completed Drizzle integration. All Drizzle tests now run with PBXT.
2155
2156 RN233: Fixed bugs which occur when PBXT is used together with PBMS (BLOB Streaming engine).
2157
2158
2159=== modified file 'storage/pbxt/src/cache_xt.cc'
2160--- storage/pbxt/src/cache_xt.cc 2009-03-26 12:18:01 +0000
2161+++ storage/pbxt/src/cache_xt.cc 2009-08-17 11:12:36 +0000
2162@@ -23,6 +23,10 @@
2163
2164 #include "xt_config.h"
2165
2166+#ifdef DRIZZLED
2167+#include <bitset>
2168+#endif
2169+
2170 #ifndef XT_WIN
2171 #include <unistd.h>
2172 #endif
2173@@ -51,17 +55,22 @@
2174 #define IDX_CAC_SEGMENT_COUNT ((off_t) 1 << XT_INDEX_CACHE_SEGMENT_SHIFTS)
2175 #define IDX_CAC_SEGMENT_MASK (IDX_CAC_SEGMENT_COUNT - 1)
2176
2177-//#define IDX_USE_SPINRWLOCK
2178-#define IDX_USE_RWMUTEX
2179+#ifdef XT_NO_ATOMICS
2180+#define IDX_CAC_USE_PTHREAD_RW
2181+#else
2182+//#define IDX_CAC_USE_RWMUTEX
2183 //#define IDX_CAC_USE_PTHREAD_RW
2184+//#define IDX_USE_SPINXSLOCK
2185+#define IDX_CAC_USE_XSMUTEX
2186+#endif
2187
2188-#ifdef IDX_CAC_USE_FASTWRLOCK
2189-#define IDX_CAC_LOCK_TYPE XTFastRWLockRec
2190-#define IDX_CAC_INIT_LOCK(s, i) xt_fastrwlock_init(s, &(i)->cs_lock)
2191-#define IDX_CAC_FREE_LOCK(s, i) xt_fastrwlock_free(s, &(i)->cs_lock)
2192-#define IDX_CAC_READ_LOCK(i, o) xt_fastrwlock_slock(&(i)->cs_lock, (o))
2193-#define IDX_CAC_WRITE_LOCK(i, o) xt_fastrwlock_xlock(&(i)->cs_lock, (o))
2194-#define IDX_CAC_UNLOCK(i, o) xt_fastrwlock_unlock(&(i)->cs_lock, (o))
2195+#ifdef IDX_CAC_USE_XSMUTEX
2196+#define IDX_CAC_LOCK_TYPE XTXSMutexRec
2197+#define IDX_CAC_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, &(i)->cs_lock)
2198+#define IDX_CAC_FREE_LOCK(s, i) xt_xsmutex_free(s, &(i)->cs_lock)
2199+#define IDX_CAC_READ_LOCK(i, o) xt_xsmutex_slock(&(i)->cs_lock, (o)->t_id)
2200+#define IDX_CAC_WRITE_LOCK(i, o) xt_xsmutex_xlock(&(i)->cs_lock, (o)->t_id)
2201+#define IDX_CAC_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->cs_lock, (o)->t_id)
2202 #elif defined(IDX_CAC_USE_PTHREAD_RW)
2203 #define IDX_CAC_LOCK_TYPE xt_rwlock_type
2204 #define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)
2205@@ -69,13 +78,20 @@
2206 #define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
2207 #define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
2208 #define IDX_CAC_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->cs_lock)
2209-#elif defined(IDX_USE_RWMUTEX)
2210+#elif defined(IDX_CAC_USE_RWMUTEX)
2211 #define IDX_CAC_LOCK_TYPE XTRWMutexRec
2212 #define IDX_CAC_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, &(i)->cs_lock)
2213 #define IDX_CAC_FREE_LOCK(s, i) xt_rwmutex_free(s, &(i)->cs_lock)
2214 #define IDX_CAC_READ_LOCK(i, o) xt_rwmutex_slock(&(i)->cs_lock, (o)->t_id)
2215 #define IDX_CAC_WRITE_LOCK(i, o) xt_rwmutex_xlock(&(i)->cs_lock, (o)->t_id)
2216 #define IDX_CAC_UNLOCK(i, o) xt_rwmutex_unlock(&(i)->cs_lock, (o)->t_id)
2217+#elif defined(IDX_CAC_USE_SPINXSLOCK)
2218+#define IDX_CAC_LOCK_TYPE XTSpinXSLockRec
2219+#define IDX_CAC_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, &(i)->cs_lock)
2220+#define IDX_CAC_FREE_LOCK(s, i) xt_spinxslock_free(s, &(i)->cs_lock)
2221+#define IDX_CAC_READ_LOCK(i, s) xt_spinxslock_slock(&(i)->cs_lock, (s)->t_id)
2222+#define IDX_CAC_WRITE_LOCK(i, s) xt_spinxslock_xlock(&(i)->cs_lock, (s)->t_id)
2223+#define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id)
2224 #endif
2225
2226 #define ID_HANDLE_USE_SPINLOCK
2227@@ -308,7 +324,8 @@
2228
2229 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];
2230
2231- ASSERT_NS(iref->ir_ulock == XT_UNLOCK_READ);
2232+ ASSERT_NS(iref->ir_xlock == FALSE);
2233+ ASSERT_NS(iref->ir_updated == FALSE);
2234 ID_HANDLE_LOCK(&hs->hs_handles_lock);
2235 #ifdef CHECK_HANDLE_STRUCTS
2236 ic_check_handle_structs();
2237@@ -337,10 +354,10 @@
2238 * at least an Slock on the index.
2239 * So this excludes anyone who is reading
2240 * cb_handle_count in the index.
2241- * (all cache block writers, and a freeer).
2242+ * (all cache block writers, and the freeer).
2243 *
2244 * The increment is safe because I have the list
2245- * lock, which is required by anyone else
2246+ * lock (hs_handles_lock), which is required by anyone else
2247 * who increments or decrements this value.
2248 */
2249 iref->ir_block->cb_handle_count++;
2250@@ -396,8 +413,11 @@
2251 xblock = seg->cs_hash_table[hash_idx];
2252 while (xblock) {
2253 if (block == xblock) {
2254- /* Found the block... */
2255- xt_atomicrwlock_xlock(&block->cb_lock, thread->t_id);
2256+ /* Found the block...
2257+ * {HANDLE-COUNT-SLOCK}
2258+ * 04.05.2009, changed to slock.
2259+ */
2260+ XT_IPAGE_READ_LOCK(&block->cb_lock);
2261 goto block_found;
2262 }
2263 xblock = xblock->cb_next;
2264@@ -431,7 +451,18 @@
2265 /* {HANDLE-COUNT-USAGE}
2266 * This is safe here because I have excluded
2267 * all readers by taking an Xlock on the
2268- * cache block.
2269+ * cache block (CHANGED - see below).
2270+ *
2271+ * {HANDLE-COUNT-SLOCK}
2272+ * 04.05.2009, changed to slock.
2273+ * Should be OK, because:
2274+ * A have a lock on the list lock (hs_handles_lock),
2275+ * which prevents concurrent updates to cb_handle_count.
2276+ *
2277+ * I have also have a read lock on the cache block
2278+ * but not a lock on the index. As a result, we cannot
2279+ * excluded all index writers (and readers of
2280+ * cb_handle_count.
2281 */
2282 block->cb_handle_count--;
2283 }
2284@@ -466,7 +497,7 @@
2285 ID_HANDLE_UNLOCK(&hs->hs_handles_lock);
2286
2287 if (block)
2288- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2289+ XT_IPAGE_UNLOCK(&block->cb_lock, FALSE);
2290 }
2291
2292 /* Call this function before a referenced cache block is modified!
2293@@ -482,17 +513,28 @@
2294
2295 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];
2296
2297+ ID_HANDLE_LOCK(&hs->hs_handles_lock);
2298+
2299 /* {HANDLE-COUNT-USAGE}
2300 * This is only called by updaters of this index block, or
2301 * the free which holds an Xlock on the index block.
2302- *
2303 * These are all mutually exclusive for the index block.
2304+ *
2305+ * {HANDLE-COUNT-SLOCK}
2306+ * Do this check again, after we have the list lock (hs_handles_lock).
2307+ * There is a small chance that the count has changed, since we last
2308+ * checked because xt_ind_release_handle() only holds
2309+ * an slock on the index page.
2310+ *
2311+ * An updater can sometimes have a XLOCK on the index and an slock
2312+ * on the cache block. In this case xt_ind_release_handle()
2313+ * could have run through.
2314 */
2315- ASSERT_NS(iref->ir_block->cb_handle_count);
2316- if (!iref->ir_block->cb_handle_count)
2317+ if (!iref->ir_block->cb_handle_count) {
2318+ ID_HANDLE_UNLOCK(&hs->hs_handles_lock);
2319 return OK;
2320+ }
2321
2322- ID_HANDLE_LOCK(&hs->hs_handles_lock);
2323 #ifdef CHECK_HANDLE_STRUCTS
2324 ic_check_handle_structs();
2325 #endif
2326@@ -609,7 +651,7 @@
2327 #endif
2328
2329 for (u_int i=0; i<ind_cac_globals.cg_block_count; i++) {
2330- xt_atomicrwlock_init_with_autoname(self, &block->cb_lock);
2331+ XT_IPAGE_INIT_LOCK(self, &block->cb_lock);
2332 block->cb_state = IDX_CAC_BLOCK_FREE;
2333 block->cb_next = ind_cac_globals.cg_free_list;
2334 #ifdef XT_USE_DIRECT_IO_ON_INDEX
2335@@ -836,10 +878,10 @@
2336 while (xblock) {
2337 if (block == xblock) {
2338 /* Found the block... */
2339- xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);
2340+ XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
2341 if (block->cb_state != IDX_CAC_BLOCK_CLEAN) {
2342 /* This block cannot be freeed: */
2343- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2344+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2345 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2346 #ifdef DEBUG_CHECK_IND_CACHE
2347 xt_ind_check_cache(NULL);
2348@@ -878,11 +920,12 @@
2349 if (block->cb_handle_count) {
2350 XTIndReferenceRec iref;
2351
2352- iref.ir_ulock = XT_UNLOCK_WRITE;
2353+ iref.ir_xlock = TRUE;
2354+ iref.ir_updated = FALSE;
2355 iref.ir_block = block;
2356 iref.ir_branch = (XTIdxBranchDPtr) block->cb_data;
2357 if (!xt_ind_copy_on_write(&iref)) {
2358- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2359+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2360 return FALSE;
2361 }
2362 }
2363@@ -918,7 +961,7 @@
2364 IDX_TRACE("%d- f%x\n", (int) XT_NODE_ID(address), (int) XT_GET_DISK_2(block->cb_data));
2365
2366 /* Unlock BEFORE the block is reused! */
2367- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2368+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2369
2370 xt_unlock_mutex_ns(&ind_cac_globals.cg_lock);
2371
2372@@ -1001,7 +1044,7 @@
2373 * Fetch the block. Note, if we are about to write the block
2374 * then there is no need to read it from disk!
2375 */
2376-static XTIndBlockPtr ind_cac_fetch(XTOpenTablePtr ot, xtIndexNodeID address, DcSegmentPtr *ret_seg, xtBool read_data)
2377+static XTIndBlockPtr ind_cac_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, DcSegmentPtr *ret_seg, xtBool read_data)
2378 {
2379 register XTOpenFilePtr file = ot->ot_ind_file;
2380 register XTIndBlockPtr block, new_block;
2381@@ -1110,6 +1153,7 @@
2382 new_block->cb_state = IDX_CAC_BLOCK_CLEAN;
2383 new_block->cb_handle_count = 0;
2384 new_block->cp_flush_seq = 0;
2385+ new_block->cp_del_count = 0;
2386 new_block->cb_dirty_next = NULL;
2387 new_block->cb_dirty_prev = NULL;
2388
2389@@ -1172,6 +1216,13 @@
2390 #endif
2391 xt_unlock_mutex_ns(&dcg->cg_lock);
2392
2393+ /* {LAZY-DEL-INDEX-ITEMS}
2394+ * Conditionally count the number of deleted entries in the index:
2395+ * We do this before other threads can read the block.
2396+ */
2397+ if (ind->mi_lazy_delete && read_data)
2398+ xt_ind_count_deleted_items(ot->ot_table, ind, block);
2399+
2400 /* Add to the hash table: */
2401 block->cb_next = seg->cs_hash_table[hash_idx];
2402 seg->cs_hash_table[hash_idx] = block;
2403@@ -1221,10 +1272,10 @@
2404 XTIndBlockPtr block;
2405 DcSegmentPtr seg;
2406
2407- if (!(block = ind_cac_fetch(ot, address, &seg, FALSE)))
2408+ if (!(block = ind_cac_fetch(ot, ind, address, &seg, FALSE)))
2409 return FAILED;
2410
2411- xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);
2412+ XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
2413 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
2414 memcpy(block->cb_data, data, size);
2415 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;
2416@@ -1239,7 +1290,7 @@
2417 xt_spinlock_unlock(&ind->mi_dirty_lock);
2418 block->cb_state = IDX_CAC_BLOCK_DIRTY;
2419 }
2420- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2421+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2422 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2423 #ifdef XT_TRACK_INDEX_UPDATES
2424 ot->ot_ind_changed++;
2425@@ -1259,10 +1310,10 @@
2426 return FAILED;
2427
2428 if (block) {
2429- xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);
2430+ XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
2431 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
2432 memcpy(block->cb_data, data, size);
2433- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2434+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2435 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2436 }
2437
2438@@ -1277,7 +1328,7 @@
2439 if (!ind_cac_get(ot, address, &seg, &block))
2440 return FAILED;
2441 if (block) {
2442- xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);
2443+ XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
2444 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
2445
2446 if (block->cb_state == IDX_CAC_BLOCK_DIRTY) {
2447@@ -1293,7 +1344,7 @@
2448 xt_spinlock_unlock(&ind->mi_dirty_lock);
2449 block->cb_state = IDX_CAC_BLOCK_CLEAN;
2450 }
2451- xt_atomicrwlock_unlock(&block->cb_lock, TRUE);
2452+ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
2453
2454 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2455 }
2456@@ -1301,29 +1352,33 @@
2457 return OK;
2458 }
2459
2460-xtPublic xtBool xt_ind_read_bytes(XTOpenTablePtr ot, xtIndexNodeID address, size_t size, xtWord1 *data)
2461+xtPublic xtBool xt_ind_read_bytes(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, size_t size, xtWord1 *data)
2462 {
2463 XTIndBlockPtr block;
2464 DcSegmentPtr seg;
2465
2466- if (!(block = ind_cac_fetch(ot, address, &seg, TRUE)))
2467+ if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
2468 return FAILED;
2469
2470- xt_atomicrwlock_slock(&block->cb_lock);
2471+ XT_IPAGE_READ_LOCK(&block->cb_lock);
2472 memcpy(data, block->cb_data, size);
2473- xt_atomicrwlock_unlock(&block->cb_lock, FALSE);
2474+ XT_IPAGE_UNLOCK(&block->cb_lock, FALSE);
2475 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2476 return OK;
2477 }
2478
2479-xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, xtIndexNodeID address, XTPageLockType ltype, XTIndReferencePtr iref)
2480+xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTPageLockType ltype, XTIndReferencePtr iref)
2481 {
2482 register XTIndBlockPtr block;
2483 DcSegmentPtr seg;
2484 xtWord2 branch_size;
2485+ xtBool xlock = FALSE;
2486
2487- ASSERT_NS(iref->ir_ulock == XT_UNLOCK_NONE);
2488- if (!(block = ind_cac_fetch(ot, address, &seg, TRUE)))
2489+#ifdef DEBUG
2490+ ASSERT_NS(iref->ir_xlock == 2);
2491+ ASSERT_NS(iref->ir_xlock == 2);
2492+#endif
2493+ if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
2494 return NULL;
2495
2496 branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);
2497@@ -1333,21 +1388,50 @@
2498 return FAILED;
2499 }
2500
2501- if (ltype == XT_XLOCK_LEAF) {
2502- if (XT_IS_NODE(branch_size))
2503- ltype = XT_LOCK_READ;
2504- else
2505- ltype = XT_LOCK_WRITE;
2506+ switch (ltype) {
2507+ case XT_LOCK_READ:
2508+ break;
2509+ case XT_LOCK_WRITE:
2510+ xlock = TRUE;
2511+ break;
2512+ case XT_XLOCK_LEAF:
2513+ if (!XT_IS_NODE(branch_size))
2514+ xlock = TRUE;
2515+ break;
2516+ case XT_XLOCK_DEL_LEAF:
2517+ if (!XT_IS_NODE(branch_size)) {
2518+ if (ot->ot_table->tab_dic.dic_no_lazy_delete)
2519+ xlock = TRUE;
2520+ else {
2521+ /*
2522+ * {LAZY-DEL-INDEX-ITEMS}
2523+ *
2524+ * We are fetch a page for delete purpose.
2525+ * we decide here if we plan to do a lazy delete,
2526+ * Or if we plan to compact the node.
2527+ *
2528+ * A lazy delete just requires a shared lock.
2529+ *
2530+ */
2531+ if (ind->mi_lazy_delete) {
2532+ /* If the number of deleted items is greater than
2533+ * half of the number of times that can fit in the
2534+ * page, then we will compact the node.
2535+ */
2536+ if (!xt_idx_lazy_delete_on_leaf(ind, block, XT_GET_INDEX_BLOCK_LEN(branch_size)))
2537+ xlock = TRUE;
2538+ }
2539+ else
2540+ xlock = TRUE;
2541+ }
2542+ }
2543+ break;
2544 }
2545
2546- if (ltype == XT_LOCK_WRITE) {
2547- xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);
2548- iref->ir_ulock = XT_UNLOCK_WRITE;
2549- }
2550- else {
2551- xt_atomicrwlock_slock(&block->cb_lock);
2552- iref->ir_ulock = XT_UNLOCK_READ;
2553- }
2554+ if ((iref->ir_xlock = xlock))
2555+ XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
2556+ else
2557+ XT_IPAGE_READ_LOCK(&block->cb_lock);
2558
2559 IDX_CAC_UNLOCK(seg, ot->ot_thread);
2560
2561@@ -1358,18 +1442,31 @@
2562 * As a result, we need to pass a pointer to both the
2563 * cache block and the cache block data:
2564 */
2565+ iref->ir_updated = FALSE;
2566 iref->ir_block = block;
2567 iref->ir_branch = (XTIdxBranchDPtr) block->cb_data;
2568 return OK;
2569 }
2570
2571-xtPublic xtBool xt_ind_release(XTOpenTablePtr ot, XTIndexPtr ind, XTPageUnlockType XT_UNUSED(utype), XTIndReferencePtr iref)
2572+xtPublic xtBool xt_ind_release(XTOpenTablePtr ot, XTIndexPtr ind, XTPageUnlockType XT_NDEBUG_UNUSED(utype), XTIndReferencePtr iref)
2573 {
2574 register XTIndBlockPtr block;
2575
2576 block = iref->ir_block;
2577
2578- if (utype == XT_UNLOCK_R_UPDATE || utype == XT_UNLOCK_W_UPDATE) {
2579+#ifdef DEBUG
2580+ ASSERT_NS(iref->ir_xlock != 2);
2581+ ASSERT_NS(iref->ir_updated != 2);
2582+ if (iref->ir_updated)
2583+ ASSERT_NS(utype == XT_UNLOCK_R_UPDATE || utype == XT_UNLOCK_W_UPDATE);
2584+ else
2585+ ASSERT_NS(utype == XT_UNLOCK_READ || utype == XT_UNLOCK_WRITE);
2586+ if (iref->ir_xlock)
2587+ ASSERT_NS(utype == XT_UNLOCK_WRITE || utype == XT_UNLOCK_W_UPDATE);
2588+ else
2589+ ASSERT_NS(utype == XT_UNLOCK_READ || utype == XT_UNLOCK_R_UPDATE);
2590+#endif
2591+ if (iref->ir_updated) {
2592 /* The page was update: */
2593 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
2594 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;
2595@@ -1386,16 +1483,10 @@
2596 }
2597 }
2598
2599-#ifdef DEBUG
2600- if (utype == XT_UNLOCK_W_UPDATE)
2601- utype = XT_UNLOCK_WRITE;
2602- else if (utype == XT_UNLOCK_R_UPDATE)
2603- utype = XT_UNLOCK_READ;
2604- ASSERT_NS(iref->ir_ulock == utype);
2605-#endif
2606- xt_atomicrwlock_unlock(&block->cb_lock, iref->ir_ulock == XT_UNLOCK_WRITE ? TRUE : FALSE);
2607-#ifdef DEBUG
2608- iref->ir_ulock = XT_UNLOCK_NONE;
2609+ XT_IPAGE_UNLOCK(&block->cb_lock, iref->ir_xlock);
2610+#ifdef DEBUG
2611+ iref->ir_xlock = 2;
2612+ iref->ir_updated = 2;
2613 #endif
2614 return OK;
2615 }
2616@@ -1484,24 +1575,3 @@
2617 xt_ind_free_reserved(ot);
2618 }
2619
2620-xtPublic void xt_load_indices(XTThreadPtr self, XTOpenTablePtr ot)
2621-{
2622- register XTTableHPtr tab = ot->ot_table;
2623- register XTIndBlockPtr block;
2624- DcSegmentPtr seg;
2625- xtIndexNodeID id;
2626-
2627- xt_lock_mutex_ns(&tab->tab_ind_flush_lock);
2628-
2629- for (id=1; id < XT_NODE_ID(tab->tab_ind_eof); id++) {
2630- if (!(block = ind_cac_fetch(ot, id, &seg, TRUE))) {
2631- xt_unlock_mutex_ns(&tab->tab_ind_flush_lock);
2632- xt_throw(self);
2633- }
2634- IDX_CAC_UNLOCK(seg, ot->ot_thread);
2635- }
2636-
2637- xt_unlock_mutex_ns(&tab->tab_ind_flush_lock);
2638-}
2639-
2640-
2641
2642=== modified file 'storage/pbxt/src/cache_xt.h'
2643--- storage/pbxt/src/cache_xt.h 2009-03-26 12:18:01 +0000
2644+++ storage/pbxt/src/cache_xt.h 2009-08-17 11:12:36 +0000
2645@@ -45,8 +45,46 @@
2646 #define IDX_CAC_BLOCK_CLEAN 1
2647 #define IDX_CAC_BLOCK_DIRTY 2
2648
2649-typedef enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF };
2650-typedef enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
2651+#ifdef XT_NO_ATOMICS
2652+#define XT_IPAGE_USE_PTHREAD_RW
2653+#else
2654+//#define XT_IPAGE_USE_ATOMIC_RW
2655+#define XT_IPAGE_USE_SPINXSLOCK
2656+//#define XT_IPAGE_USE_SKEW_RW
2657+#endif
2658+
2659+#ifdef XT_IPAGE_USE_ATOMIC_RW
2660+#define XT_IPAGE_LOCK_TYPE XTAtomicRWLockRec
2661+#define XT_IPAGE_INIT_LOCK(s, i) xt_atomicrwlock_init_with_autoname(s, i)
2662+#define XT_IPAGE_FREE_LOCK(s, i) xt_atomicrwlock_free(s, i)
2663+#define XT_IPAGE_READ_LOCK(i) xt_atomicrwlock_slock(i)
2664+#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, o)
2665+#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
2666+#elif defined(XT_IPAGE_USE_PTHREAD_RW)
2667+#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
2668+#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
2669+#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
2670+#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
2671+#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
2672+#define XT_IPAGE_UNLOCK(i, x) xt_unlock_rwlock_ns(i)
2673+#elif defined(XT_IPAGE_USE_SPINXSLOCK)
2674+#define XT_IPAGE_LOCK_TYPE XTSpinXSLockRec
2675+#define XT_IPAGE_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
2676+#define XT_IPAGE_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
2677+#define XT_IPAGE_READ_LOCK(i) xt_spinxslock_slock(i)
2678+#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
2679+#define XT_IPAGE_UNLOCK(i, x) xt_spinxslock_unlock(i, x)
2680+#else // XT_IPAGE_USE_SKEW_RW
2681+#define XT_IPAGE_LOCK_TYPE XTSkewRWLockRec
2682+#define XT_IPAGE_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i)
2683+#define XT_IPAGE_FREE_LOCK(s, i) xt_skewrwlock_free(s, i)
2684+#define XT_IPAGE_READ_LOCK(i) xt_skewrwlock_slock(i)
2685+#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, o)
2686+#define XT_IPAGE_UNLOCK(i, x) xt_skewrwlock_unlock(i, x)
2687+#endif
2688+
2689+enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF, XT_XLOCK_DEL_LEAF };
2690+enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
2691
2692 /* A block is X locked if it is being changed or freed.
2693 * A block is S locked if it is being read.
2694@@ -64,10 +102,11 @@
2695 struct XTIndBlock *cb_mr_used; /* More recently used blocks. */
2696 struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */
2697 /* Protected by cb_lock: */
2698- XTAtomicRWLockRec cb_lock;
2699+ XT_IPAGE_LOCK_TYPE cb_lock;
2700 xtWord1 cb_state; /* Block status. */
2701 xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */
2702 xtWord2 cp_flush_seq;
2703+ xtWord2 cp_del_count; /* Number of deleted entries. */
2704 #ifdef XT_USE_DIRECT_IO_ON_INDEX
2705 xtWord1 *cb_data;
2706 #else
2707@@ -76,16 +115,18 @@
2708 } XTIndBlockRec, *XTIndBlockPtr;
2709
2710 typedef struct XTIndReference {
2711- XTPageUnlockType ir_ulock;
2712+ xtBool ir_xlock; /* Set to TRUE if the cache block is X locked. */
2713+ xtBool ir_updated; /* Set to TRUE if the cache block is updated. */
2714 XTIndBlockPtr ir_block;
2715 XTIdxBranchDPtr ir_branch;
2716 } XTIndReferenceRec, *XTIndReferencePtr;
2717
2718 typedef struct XTIndFreeBlock {
2719+ XTDiskValue1 if_zero1_1; /* Must be set to zero. */
2720+ XTDiskValue1 if_zero2_1; /* Must be set to zero. */
2721 XTDiskValue1 if_status_1;
2722 XTDiskValue1 if_unused1_1;
2723- XTDiskValue2 if_unused2_2;
2724- XTDiskValue4 if_unused3_4;
2725+ XTDiskValue4 if_unused2_4;
2726 XTDiskValue8 if_next_block_8;
2727 } XTIndFreeBlockRec, *XTIndFreeBlockPtr;
2728
2729@@ -116,14 +157,13 @@
2730 xtBool xt_ind_write(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
2731 xtBool xt_ind_write_cache(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
2732 xtBool xt_ind_clean(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset);
2733-xtBool xt_ind_read_bytes(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
2734+xtBool xt_ind_read_bytes(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
2735 void xt_ind_check_cache(XTIndexPtr ind);
2736 xtBool xt_ind_reserve(struct XTOpenTable *ot, u_int count, XTIdxBranchDPtr not_this);
2737 void xt_ind_free_reserved(struct XTOpenTable *ot);
2738 void xt_ind_unreserve(struct XTOpenTable *ot);
2739-void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
2740
2741-xtBool xt_ind_fetch(struct XTOpenTable *ot, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
2742+xtBool xt_ind_fetch(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
2743 xtBool xt_ind_release(struct XTOpenTable *ot, XTIndexPtr ind, XTPageUnlockType utype, XTIndReferencePtr iref);
2744
2745 void xt_ind_lock_handle(XTIndHandlePtr handle);
2746
2747=== modified file 'storage/pbxt/src/ccutils_xt.cc'
2748--- storage/pbxt/src/ccutils_xt.cc 2009-03-26 12:18:01 +0000
2749+++ storage/pbxt/src/ccutils_xt.cc 2009-08-17 11:12:36 +0000
2750@@ -29,7 +29,7 @@
2751 #include "ccutils_xt.h"
2752 #include "bsearch_xt.h"
2753
2754-static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
2755+static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
2756 {
2757 XTObject *obj_ptr = (XTObject *) b;
2758
2759
2760=== modified file 'storage/pbxt/src/database_xt.cc'
2761--- storage/pbxt/src/database_xt.cc 2009-04-02 10:03:14 +0000
2762+++ storage/pbxt/src/database_xt.cc 2009-08-17 11:12:36 +0000
2763@@ -23,6 +23,10 @@
2764
2765 #include "xt_config.h"
2766
2767+#ifdef DRIZZLED
2768+#include <bitset>
2769+#endif
2770+
2771 #include <string.h>
2772 #include <stdio.h>
2773
2774@@ -240,7 +244,7 @@
2775 xt_heap_release(self, (XTDatabaseHPtr) data);
2776 }
2777
2778-static int db_cmp_db_id(struct XTThread XT_UNUSED(*self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
2779+static int db_cmp_db_id(struct XTThread *XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
2780 {
2781 xtDatabaseID db_id = *((xtDatabaseID *) a);
2782 XTDatabaseHPtr *db_ptr = (XTDatabaseHPtr *) b;
2783@@ -346,7 +350,7 @@
2784 }
2785 }
2786
2787-static void db_onrelease(XTThreadPtr self, void XT_UNUSED(*x))
2788+static void db_onrelease(XTThreadPtr self, void *XT_UNUSED(x))
2789 {
2790 /* Signal threads waiting for exclusive use of the database: */
2791 if (xt_db_open_databases) // The database may already be closed.
2792@@ -612,7 +616,7 @@
2793 xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool multi_path)
2794 {
2795 XTDatabaseHPtr db;
2796-
2797+
2798 /* We cannot get a database, without unusing the current
2799 * first. The reason is that the restart process will
2800 * partially set the current database!
2801@@ -621,7 +625,7 @@
2802 db = xt_get_database(self, path, multi_path);
2803 pushr_(xt_heap_release, db);
2804 xt_use_database(self, db, XT_FOR_USER);
2805- freer_(); // xt_heap_release(self, db);
2806+ freer_(); // xt_heap_release(self, db);
2807 }
2808
2809 /* This function can only be called if you do not already have a database in
2810@@ -638,6 +642,12 @@
2811
2812 xt_heap_reference(self, db);
2813 self->st_database = db;
2814+#ifdef XT_WAIT_FOR_CLEANUP
2815+ self->st_last_xact = 0;
2816+ for (int i=0; i<XT_MAX_XACT_BEHIND; i++) {
2817+ self->st_prev_xact[i] = db->db_xn_curr_id;
2818+ }
2819+#endif
2820 xt_xn_init_thread(self, what_for);
2821 }
2822
2823@@ -1117,15 +1127,18 @@
2824 XTDatabaseHPtr db = ot->ot_table->tab_db;
2825 xtBool flush_table = TRUE;
2826
2827+ /* No open table returned to the pool should still
2828+ * have a cache handle!
2829+ */
2830+ ASSERT_NS(!ot->ot_ind_rhandle);
2831 xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
2832
2833 if (!(table_pool = db_get_open_table_pool(db, ot->ot_table->tab_id)))
2834 goto failed;
2835
2836 if (table_pool->opt_locked && !table_pool->opt_flushing) {
2837- table_pool->opt_total_open--;
2838 /* Table will be closed below: */
2839- if (table_pool->opt_total_open > 0)
2840+ if (table_pool->opt_total_open > 1)
2841 flush_table = FALSE;
2842 }
2843 else {
2844@@ -1151,14 +1164,21 @@
2845 ot = NULL;
2846 }
2847
2848+ if (ot) {
2849+ xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
2850+ xt_close_table(ot, flush_table, FALSE);
2851+
2852+ /* assume that table_pool cannot be invalidated in between as we have table_pool->opt_total_open > 0 */
2853+ xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
2854+ table_pool->opt_total_open--;
2855+ }
2856+
2857 db_free_open_table_pool(NULL, table_pool);
2858
2859 if (!xt_broadcast_cond_ns(&db->db_ot_pool.opt_cond))
2860 goto failed;
2861 xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
2862- if (ot)
2863- xt_close_table(ot, flush_table, FALSE);
2864-
2865+
2866 return;
2867
2868 failed:
2869
2870=== modified file 'storage/pbxt/src/datadic_xt.cc'
2871--- storage/pbxt/src/datadic_xt.cc 2009-03-26 12:18:01 +0000
2872+++ storage/pbxt/src/datadic_xt.cc 2009-08-18 07:46:53 +0000
2873@@ -26,6 +26,10 @@
2874
2875 #include "xt_config.h"
2876
2877+#ifdef DRIZZLED
2878+#include <bitset>
2879+#endif
2880+
2881 #include <ctype.h>
2882 #include <errno.h>
2883
2884@@ -433,7 +437,7 @@
2885 XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);
2886 };
2887
2888-void ri_free_token(XTThreadPtr self __attribute__((unused)), XTToken *tk)
2889+void ri_free_token(XTThreadPtr XT_UNUSED(self), XTToken *tk)
2890 {
2891 delete tk;
2892 }
2893@@ -524,6 +528,13 @@
2894 break;
2895 tkn_curr_pos++;
2896 }
2897+ /* TODO: Unless sql_mode == 'NO_BACKSLASH_ESCAPES'!!! */
2898+ if (*tkn_curr_pos == '\\') {
2899+ if (*(tkn_curr_pos+1) == quote) {
2900+ if (quote == '"' || quote == '\'')
2901+ tkn_curr_pos++;
2902+ }
2903+ }
2904 tkn_curr_pos++;
2905 }
2906
2907@@ -639,7 +650,7 @@
2908 int parseKeyAction(XTThreadPtr self);
2909 void parseCreateTable(XTThreadPtr self);
2910 void parseAddTableItem(XTThreadPtr self);
2911- void parseQualifiedName(XTThreadPtr self, char *name);
2912+ void parseQualifiedName(XTThreadPtr self, char *parent_name, char *name);
2913 void parseTableName(XTThreadPtr self, bool alterTable);
2914 void parseExpression(XTThreadPtr self, bool allow_reserved);
2915 void parseBrackets(XTThreadPtr self);
2916@@ -667,53 +678,53 @@
2917 memset(&pt_sbuffer, 0, sizeof(XTStringBufferRec));
2918 }
2919
2920- virtual void finalize(XTThreadPtr self __attribute__((unused))) {
2921+ virtual void finalize(XTThreadPtr XT_UNUSED(self)) {
2922 if (pt_tokenizer)
2923 delete pt_tokenizer;
2924 xt_sb_set_size(NULL, &pt_sbuffer, 0);
2925 }
2926
2927 // Hooks to receive output from the parser:
2928- virtual void setTableName(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), bool alterTable __attribute__((unused))) {
2929+ virtual void setTableName(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), bool XT_UNUSED(alterTable)) {
2930 }
2931- virtual void addColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused)), char *old_col_name __attribute__((unused))) {
2932+ virtual void addColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name), char *XT_UNUSED(old_col_name)) {
2933 }
2934 virtual void setDataType(XTThreadPtr self, char *cstring) {
2935 if (cstring)
2936 xt_free(self, cstring);
2937 }
2938- virtual void setNull(XTThreadPtr self __attribute__((unused)), bool nullOK __attribute__((unused))) {
2939+ virtual void setNull(XTThreadPtr XT_UNUSED(self), bool XT_UNUSED(nullOK)) {
2940 }
2941- virtual void setAutoInc(XTThreadPtr self __attribute__((unused)), bool autoInc __attribute__((unused))) {
2942+ virtual void setAutoInc(XTThreadPtr XT_UNUSED(self), bool XT_UNUSED(autoInc)) {
2943 }
2944
2945 /* Add a contraint. If lastColumn is TRUE then add the contraint
2946 * to the last column. If not, expect addListedColumn() to be called.
2947 */
2948- virtual void addConstraint(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), u_int type __attribute__((unused)), bool lastColumn __attribute__((unused))) {
2949+ virtual void addConstraint(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), u_int XT_UNUSED(type), bool XT_UNUSED(lastColumn)) {
2950 }
2951
2952 /* Move the last column created. If symbol is NULL then move the column to the
2953 * first position, else move it to the position just after the given column.
2954 */
2955- virtual void moveColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused))) {
2956- }
2957-
2958- virtual void dropColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused))) {
2959- }
2960-
2961- virtual void dropConstraint(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), u_int type __attribute__((unused))) {
2962- }
2963-
2964- virtual void setIndexName(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused))) {
2965- }
2966- virtual void addListedColumn(XTThreadPtr self __attribute__((unused)), char *index_col_name __attribute__((unused))) {
2967- }
2968- virtual void setReferencedTable(XTThreadPtr self __attribute__((unused)), char *ref_table __attribute__((unused))) {
2969- }
2970- virtual void addReferencedColumn(XTThreadPtr self __attribute__((unused)), char *index_col_name __attribute__((unused))) {
2971- }
2972- virtual void setActions(XTThreadPtr self __attribute__((unused)), int on_delete __attribute__((unused)), int on_update __attribute__((unused))) {
2973+ virtual void moveColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name)) {
2974+ }
2975+
2976+ virtual void dropColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name)) {
2977+ }
2978+
2979+ virtual void dropConstraint(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), u_int XT_UNUSED(type)) {
2980+ }
2981+
2982+ virtual void setIndexName(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name)) {
2983+ }
2984+ virtual void addListedColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(index_col_name)) {
2985+ }
2986+ virtual void setReferencedTable(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(ref_schema), char *XT_UNUSED(ref_table)) {
2987+ }
2988+ virtual void addReferencedColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(index_col_name)) {
2989+ }
2990+ virtual void setActions(XTThreadPtr XT_UNUSED(self), int XT_UNUSED(on_delete), int XT_UNUSED(on_update)) {
2991 }
2992
2993 virtual void parseTable(XTThreadPtr self, bool convert, char *sql);
2994@@ -859,7 +870,7 @@
2995 if (pt_current->isKeyWord("CONSTRAINT")) {
2996 pt_current = pt_tokenizer->nextToken(self);
2997 if (pt_current->isIdentifier())
2998- parseQualifiedName(self, name);
2999+ parseQualifiedName(self, NULL, name);
3000 }
3001
3002 if (pt_current->isReservedWord(XT_TK_PRIMARY)) {
3003@@ -974,13 +985,15 @@
3004 char name[XT_IDENTIFIER_NAME_SIZE];
3005
3006 pt_current = pt_tokenizer->nextToken(self);
3007- parseQualifiedName(self, name);
3008+ parseQualifiedName(self, NULL, name);
3009 moveColumn(self, name);
3010 }
3011 }
3012
3013-void XTParseTable::parseQualifiedName(XTThreadPtr self, char *name)
3014+void XTParseTable::parseQualifiedName(XTThreadPtr self, char *parent_name, char *name)
3015 {
3016+ if (parent_name)
3017+ parent_name[0] = '\0';
3018 /* Should be an identifier by I have this example:
3019 * CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default '' ) CHARSET=latin5;
3020 *
3021@@ -990,6 +1003,8 @@
3022 raiseError(self, pt_current, XT_ERR_ID_TOO_LONG);
3023 pt_current = pt_tokenizer->nextToken(self);
3024 while (pt_current->isKeyWord(".")) {
3025+ if (parent_name)
3026+ xt_strcpy(XT_IDENTIFIER_NAME_SIZE,parent_name, name);
3027 pt_current = pt_tokenizer->nextToken(self);
3028 /* Accept anything after the DOT! */
3029 if (pt_current->getString(name, XT_IDENTIFIER_NAME_SIZE) >= XT_IDENTIFIER_NAME_SIZE)
3030@@ -1002,7 +1017,7 @@
3031 {
3032 char name[XT_IDENTIFIER_NAME_SIZE];
3033
3034- parseQualifiedName(self, name);
3035+ parseQualifiedName(self, NULL, name);
3036 setTableName(self, name, alterTable);
3037 }
3038
3039@@ -1011,7 +1026,7 @@
3040 char col_name[XT_IDENTIFIER_NAME_SIZE];
3041
3042 // column_definition
3043- parseQualifiedName(self, col_name);
3044+ parseQualifiedName(self, NULL, col_name);
3045 addColumn(self, col_name, old_col_name);
3046 parseDataType(self);
3047
3048@@ -1111,7 +1126,7 @@
3049 pt_current->expectKeyWord(self, "(");
3050 do {
3051 pt_current = pt_tokenizer->nextToken(self);
3052- parseQualifiedName(self, name);
3053+ parseQualifiedName(self, NULL, name);
3054 addListedColumn(self, name);
3055 cols++;
3056 if (index_cols) {
3057@@ -1135,19 +1150,20 @@
3058 int on_delete = XT_KEY_ACTION_DEFAULT;
3059 int on_update = XT_KEY_ACTION_DEFAULT;
3060 char name[XT_IDENTIFIER_NAME_SIZE];
3061+ char parent_name[XT_IDENTIFIER_NAME_SIZE];
3062 u_int cols = 0;
3063
3064 // REFERENCES tbl_name
3065 pt_current = pt_tokenizer->nextToken(self, "REFERENCES", pt_current);
3066- parseQualifiedName(self, name);
3067- setReferencedTable(self, name);
3068+ parseQualifiedName(self, parent_name, name);
3069+ setReferencedTable(self, parent_name[0] ? parent_name : NULL, name);
3070
3071 // [ (index_col_name,...) ]
3072 if (pt_current->isKeyWord("(")) {
3073 pt_current->expectKeyWord(self, "(");
3074 do {
3075 pt_current = pt_tokenizer->nextToken(self);
3076- parseQualifiedName(self, name);
3077+ parseQualifiedName(self, NULL, name);
3078 addReferencedColumn(self, name);
3079 cols++;
3080 if (cols > req_cols)
3081@@ -1219,7 +1235,7 @@
3082 if (pt_current->isReservedWord(XT_TK_COLUMN))
3083 pt_current = pt_tokenizer->nextToken(self);
3084
3085- parseQualifiedName(self, old_col_name);
3086+ parseQualifiedName(self, NULL, old_col_name);
3087 parseColumnDefinition(self, old_col_name);
3088 parseMoveColumn(self);
3089 }
3090@@ -1251,7 +1267,7 @@
3091 else {
3092 if (pt_current->isReservedWord(XT_TK_COLUMN))
3093 pt_current = pt_tokenizer->nextToken(self);
3094- parseQualifiedName(self, name);
3095+ parseQualifiedName(self, NULL, name);
3096 dropColumn(self, name);
3097 }
3098 }
3099@@ -1259,7 +1275,7 @@
3100 pt_current = pt_tokenizer->nextToken(self);
3101 if (pt_current->isKeyWord("TO"))
3102 pt_current = pt_tokenizer->nextToken(self);
3103- parseQualifiedName(self, name);
3104+ parseQualifiedName(self, NULL, name);
3105 }
3106 else
3107 /* Just ignore the syntax until the next , */
3108@@ -1284,7 +1300,7 @@
3109 else if (pt_current->isKeyWord("SPACIAL"))
3110 pt_current = pt_tokenizer->nextToken(self);
3111 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);
3112- parseQualifiedName(self, name);
3113+ parseQualifiedName(self, NULL, name);
3114 optionalIndexType(self);
3115 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);
3116 parseTableName(self, true);
3117@@ -1299,7 +1315,7 @@
3118
3119 pt_current = pt_tokenizer->nextToken(self, "DROP", pt_current);
3120 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);
3121- parseQualifiedName(self, name);
3122+ parseQualifiedName(self, NULL, name);
3123 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);
3124 parseTableName(self, true);
3125 dropConstraint(self, name, XT_DD_INDEX);
3126@@ -1340,7 +1356,7 @@
3127 virtual void addConstraint(XTThreadPtr self, char *name, u_int type, bool lastColumn);
3128 virtual void dropConstraint(XTThreadPtr self, char *name, u_int type);
3129 virtual void addListedColumn(XTThreadPtr self, char *index_col_name);
3130- virtual void setReferencedTable(XTThreadPtr self, char *ref_table);
3131+ virtual void setReferencedTable(XTThreadPtr self, char *ref_schema, char *ref_table);
3132 virtual void addReferencedColumn(XTThreadPtr self, char *index_col_name);
3133 virtual void setActions(XTThreadPtr self, int on_delete, int on_update);
3134
3135@@ -1535,23 +1551,31 @@
3136 }
3137 }
3138
3139-void XTCreateTable::setReferencedTable(XTThreadPtr self, char *ref_table)
3140+void XTCreateTable::setReferencedTable(XTThreadPtr self, char *ref_schema, char *ref_table)
3141 {
3142 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;
3143 char path[PATH_MAX];
3144
3145- xt_strcpy(PATH_MAX, path, ct_tab_path->ps_path);
3146- xt_remove_last_name_of_path(path);
3147- if (ct_convert) {
3148- char buffer[XT_IDENTIFIER_NAME_SIZE];
3149- size_t len;
3150-
3151- myxt_static_convert_identifier(self, ct_charset, ref_table, buffer, XT_IDENTIFIER_NAME_SIZE);
3152- len = strlen(path);
3153- myxt_static_convert_table_name(self, buffer, &path[len], PATH_MAX - len);
3154- }
3155- else
3156+ if (ref_schema) {
3157+ xt_strcpy(PATH_MAX,path, ".");
3158+ xt_add_dir_char(PATH_MAX, path);
3159+ xt_strcat(PATH_MAX, path, ref_schema);
3160+ xt_add_dir_char(PATH_MAX, path);
3161 xt_strcat(PATH_MAX, path, ref_table);
3162+ } else {
3163+ xt_strcpy(PATH_MAX, path, ct_tab_path->ps_path);
3164+ xt_remove_last_name_of_path(path);
3165+ if (ct_convert) {
3166+ char buffer[XT_IDENTIFIER_NAME_SIZE];
3167+ size_t len;
3168+
3169+ myxt_static_convert_identifier(self, ct_charset, ref_table, buffer, XT_IDENTIFIER_NAME_SIZE);
3170+ len = strlen(path);
3171+ myxt_static_convert_table_name(self, buffer, &path[len], PATH_MAX - len);
3172+ }
3173+ else
3174+ xt_strcat(PATH_MAX, path, ref_table);
3175+ }
3176
3177 fk->fk_ref_tab_name = (XTPathStrPtr) xt_dup_string(self, path);
3178 }
3179@@ -1578,7 +1602,7 @@
3180 fk->fk_ref_cols.clone(self, &fk->co_cols);
3181 }
3182
3183-void XTCreateTable::setActions(XTThreadPtr self __attribute__((unused)), int on_delete, int on_update)
3184+void XTCreateTable::setActions(XTThreadPtr XT_UNUSED(self), int on_delete, int on_update)
3185 {
3186 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;
3187
3188@@ -1711,8 +1735,8 @@
3189 void XTDDConstraint::getColumnList(char *buffer, size_t size)
3190 {
3191 if (co_table->dt_table) {
3192- xt_strcat(size, buffer, "`");
3193- xt_strcpy(size, buffer, co_table->dt_table->tab_name->ps_path);
3194+ xt_strcpy(size, buffer, "`");
3195+ xt_strcat(size, buffer, co_table->dt_table->tab_name->ps_path);
3196 xt_strcat(size, buffer, "` (`");
3197 }
3198 else
3199@@ -1739,6 +1763,20 @@
3200 return OK;
3201 }
3202
3203+bool XTDDConstraint::samePrefixColumns(XTDDConstraint *co)
3204+{
3205+ u_int i = 0;
3206+
3207+ if (co_cols.size() > co->co_cols.size())
3208+ return false;
3209+ while (i<co_cols.size()) {
3210+ if (myxt_strcasecmp(co_cols.itemAt(i)->cr_col_name, co->co_cols.itemAt(i)->cr_col_name) != 0)
3211+ return false;
3212+ i++;
3213+ }
3214+ return OK;
3215+}
3216+
3217 bool XTDDConstraint::attachColumns()
3218 {
3219 XTDDColumn *col;
3220@@ -1773,6 +1811,7 @@
3221 XTIdxSearchKeyRec search_key;
3222 xtXactID xn_id;
3223 XTXactWaitRec xw;
3224+ bool ok = false;
3225
3226 if (!(loc_ind = tr_fkey->getReferenceIndexPtr()))
3227 return false;
3228@@ -1792,40 +1831,42 @@
3229
3230 /* Search for the key in the child (referencing) table: */
3231 if (!(ot = xt_db_open_table_using_tab(tr_fkey->co_table->dt_table, thread)))
3232- goto failed;
3233+ return false;
3234
3235 retry:
3236 if (!xt_idx_search(ot, ind, &search_key))
3237- goto failed;
3238+ goto done;
3239
3240 while (ot->ot_curr_rec_id && search_key.sk_on_key) {
3241 switch (xt_tab_maybe_committed(ot, ot->ot_curr_rec_id, &xn_id, &ot->ot_curr_row_id, &ot->ot_curr_updated)) {
3242 case XT_MAYBE:
3243 xw.xw_xn_id = xn_id;
3244 if (!xt_xn_wait_for_xact(thread, &xw, NULL))
3245- goto failed;
3246+ goto done;
3247 goto retry;
3248 case XT_ERR:
3249- goto failed;
3250+ goto done;
3251 case TRUE:
3252 /* We found a matching child: */
3253 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_ROW_IS_REFERENCED, tr_fkey->co_name);
3254- goto failed;
3255- break;
3256+ goto done;
3257 case FALSE:
3258 if (!xt_idx_next(ot, ind, &search_key))
3259- goto failed;
3260+ goto done;
3261 break;
3262 }
3263 }
3264
3265 /* No matching children, all OK: */
3266- xt_db_return_table_to_pool_ns(ot);
3267- return true;
3268+ ok = true;
3269
3270- failed:
3271+ done:
3272+ if (ot->ot_ind_rhandle) {
3273+ xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
3274+ ot->ot_ind_rhandle = NULL;
3275+ }
3276 xt_db_return_table_to_pool_ns(ot);
3277- return false;
3278+ return ok;
3279 }
3280
3281 /*
3282@@ -1962,6 +2003,10 @@
3283 }
3284
3285 /* No matching children, all OK: */
3286+ if (ot->ot_ind_rhandle) {
3287+ xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
3288+ ot->ot_ind_rhandle = NULL;
3289+ }
3290 xt_db_return_table_to_pool_ns(ot);
3291
3292 success:
3293@@ -1971,6 +2016,10 @@
3294 return true;
3295
3296 failed_2:
3297+ if (ot->ot_ind_rhandle) {
3298+ xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
3299+ ot->ot_ind_rhandle = NULL;
3300+ }
3301 xt_db_return_table_to_pool_ns(ot);
3302
3303 failed:
3304@@ -2055,8 +2104,13 @@
3305
3306 void XTDDForeignKey::loadString(XTThreadPtr self, XTStringBufferPtr sb)
3307 {
3308+ char schema_name[XT_IDENTIFIER_NAME_SIZE];
3309+
3310 XTDDConstraint::loadString(self, sb);
3311 xt_sb_concat(self, sb, " REFERENCES `");
3312+ xt_2nd_last_name_of_path(XT_IDENTIFIER_NAME_SIZE, schema_name, fk_ref_tab_name->ps_path);
3313+ xt_sb_concat(self, sb, schema_name);
3314+ xt_sb_concat(self, sb, "`.`");
3315 xt_sb_concat(self, sb, xt_last_name_of_path(fk_ref_tab_name->ps_path));
3316 xt_sb_concat(self, sb, "` ");
3317
3318@@ -2136,6 +2190,20 @@
3319 return OK;
3320 }
3321
3322+bool XTDDForeignKey::samePrefixReferenceColumns(XTDDConstraint *co)
3323+{
3324+ u_int i = 0;
3325+
3326+ if (fk_ref_cols.size() > co->co_cols.size())
3327+ return false;
3328+ while (i<fk_ref_cols.size()) {
3329+ if (myxt_strcasecmp(fk_ref_cols.itemAt(i)->cr_col_name, co->co_cols.itemAt(i)->cr_col_name) != 0)
3330+ return false;
3331+ i++;
3332+ }
3333+ return OK;
3334+}
3335+
3336 bool XTDDForeignKey::checkReferencedTypes(XTDDTable *dt)
3337 {
3338 XTDDColumn *col, *ref_col;
3339@@ -2288,6 +2356,10 @@
3340 goto failed_2;
3341 case TRUE:
3342 /* We found a matching parent: */
3343+ if (ot->ot_ind_rhandle) {
3344+ xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
3345+ ot->ot_ind_rhandle = NULL;
3346+ }
3347 xt_db_return_table_to_pool_ns(ot);
3348 goto success;
3349 case FALSE:
3350@@ -2300,6 +2372,10 @@
3351 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_REFERENCED_ROW, co_name);
3352
3353 failed_2:
3354+ if (ot->ot_ind_rhandle) {
3355+ xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
3356+ ot->ot_ind_rhandle = NULL;
3357+ }
3358 xt_db_return_table_to_pool_ns(ot);
3359
3360 failed:
3361@@ -2672,16 +2748,24 @@
3362
3363 XTDDIndex *XTDDTable::findIndex(XTDDConstraint *co)
3364 {
3365- XTDDIndex *ind;
3366+ XTDDIndex *ind = NULL;
3367+ XTDDIndex *cur_ind;
3368+ u_int index_size = UINT_MAX;
3369
3370 for (u_int i=0; i<dt_indexes.size(); i++) {
3371- ind = dt_indexes.itemAt(i);
3372- if (co->sameColumns(ind))
3373- return ind;
3374+ cur_ind = dt_indexes.itemAt(i);
3375+ u_int sz = cur_ind->getIndexPtr()->mi_key_size;
3376+ if (sz < index_size && co->samePrefixColumns(cur_ind)) {
3377+ ind = cur_ind;
3378+ index_size = sz;
3379+ }
3380 }
3381+
3382+ if (ind)
3383+ return ind;
3384+
3385 {
3386 char buffer[XT_ERR_MSG_SIZE - 200];
3387-
3388 co->getColumnList(buffer, XT_ERR_MSG_SIZE - 200);
3389 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_MATCHING_INDEX, buffer);
3390 }
3391@@ -2690,16 +2774,24 @@
3392
3393 XTDDIndex *XTDDTable::findReferenceIndex(XTDDForeignKey *fk)
3394 {
3395- XTDDIndex *ind;
3396+ XTDDIndex *ind = NULL;
3397+ XTDDIndex *cur_ind;
3398 XTDDColumnRef *cr;
3399 u_int i;
3400+ u_int index_size = UINT_MAX;
3401
3402 for (i=0; i<dt_indexes.size(); i++) {
3403- ind = dt_indexes.itemAt(i);
3404- if (fk->sameReferenceColumns(ind))
3405- return ind;
3406+ cur_ind = dt_indexes.itemAt(i);
3407+ u_int sz = cur_ind->getIndexPtr()->mi_key_size;
3408+ if (sz < index_size && fk->samePrefixReferenceColumns(cur_ind)) {
3409+ ind = cur_ind;
3410+ index_size = sz;
3411+ }
3412 }
3413
3414+ if (ind)
3415+ return ind;
3416+
3417 /* If the index does not exist, maybe the columns do not exist?! */
3418 for (i=0; i<fk->fk_ref_cols.size(); i++) {
3419 cr = fk->fk_ref_cols.itemAt(i);
3420@@ -2867,9 +2959,33 @@
3421 return ok;
3422 }
3423
3424-xtBool XTDDTable::checkCanDrop()
3425+/*
3426+ * drop_db parameter is TRUE if we are dropping the schema of this table. In this case
3427+ * we return TRUE if the table has only refs to the tables from its own schema
3428+ */
3429+xtBool XTDDTable::checkCanDrop(xtBool drop_db)
3430 {
3431 /* no refs or references only itself */
3432- return (dt_trefs == NULL) ||
3433- (dt_trefs->tr_next == NULL) && (dt_trefs->tr_fkey->co_table == this);
3434+ if ((dt_trefs == NULL) || ((dt_trefs->tr_next == NULL) && (dt_trefs->tr_fkey->co_table == this)))
3435+ return TRUE;
3436+
3437+ if (!drop_db)
3438+ return FALSE;
3439+
3440+ const char *this_schema = xt_last_2_names_of_path(dt_table->tab_name->ps_path);
3441+ size_t this_schema_sz = xt_last_name_of_path(dt_table->tab_name->ps_path) - this_schema;
3442+ XTDDTableRef *tr = dt_trefs;
3443+
3444+ while (tr) {
3445+ const char *tab_path = tr->tr_fkey->co_table->dt_table->tab_name->ps_path;
3446+ const char *tab_schema = xt_last_2_names_of_path(tab_path);
3447+ size_t tab_schema_sz = xt_last_name_of_path(tab_path) - tab_schema;
3448+
3449+ if (this_schema_sz != tab_schema_sz || strncmp(this_schema, tab_schema, tab_schema_sz))
3450+ return FALSE;
3451+
3452+ tr = tr->tr_next;
3453+ }
3454+
3455+ return TRUE;
3456 }
3457
3458=== modified file 'storage/pbxt/src/datadic_xt.h'
3459--- storage/pbxt/src/datadic_xt.h 2009-03-26 12:18:01 +0000
3460+++ storage/pbxt/src/datadic_xt.h 2009-08-18 07:46:53 +0000
3461@@ -137,6 +137,7 @@
3462 return new_obj;
3463 }
3464
3465+ virtual void init(XTThreadPtr self) { XTObject::init(self); }
3466 virtual void init(XTThreadPtr self, XTObject *obj);
3467 virtual void finalize(XTThreadPtr self);
3468 };
3469@@ -156,6 +157,7 @@
3470 co_ind_name(NULL) {
3471 }
3472
3473+ virtual void init(XTThreadPtr self) { XTObject::init(self); }
3474 virtual void init(XTThreadPtr self, XTObject *obj);
3475 virtual void finalize(XTThreadPtr self) {
3476 if (co_name)
3477@@ -169,6 +171,7 @@
3478 virtual void alterColumnName(XTThreadPtr self, char *from_name, char *to_name);
3479 void getColumnList(char *buffer, size_t size);
3480 bool sameColumns(XTDDConstraint *co);
3481+ bool samePrefixColumns(XTDDConstraint *co);
3482 bool attachColumns();
3483 };
3484
3485@@ -198,6 +201,7 @@
3486 return new_obj;
3487 }
3488
3489+ virtual void init(XTThreadPtr self) { XTDDConstraint::init(self); };
3490 virtual void init(XTThreadPtr self, XTObject *obj);
3491 struct XTIndex *getIndexPtr();
3492 };
3493@@ -230,12 +234,14 @@
3494 return new_obj;
3495 }
3496
3497+ virtual void init(XTThreadPtr self) { XTDDIndex::init(self); }
3498 virtual void init(XTThreadPtr self, XTObject *obj);
3499 virtual void finalize(XTThreadPtr self);
3500 virtual void loadString(XTThreadPtr self, XTStringBufferPtr sb);
3501 void getReferenceList(char *buffer, size_t size);
3502 struct XTIndex *getReferenceIndexPtr();
3503 bool sameReferenceColumns(XTDDConstraint *co);
3504+ bool samePrefixReferenceColumns(XTDDConstraint *co);
3505 bool checkReferencedTypes(XTDDTable *dt);
3506 void removeReference(XTThreadPtr self);
3507 bool insertRow(xtWord1 *before, xtWord1 *after, XTThreadPtr thread);
3508@@ -284,7 +290,7 @@
3509 XTDDIndex *findReferenceIndex(XTDDForeignKey *fk);
3510 bool insertRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
3511 bool checkNoAction(struct XTOpenTable *ot, xtRecordID rec_id);
3512- xtBool checkCanDrop();
3513+ xtBool checkCanDrop(xtBool drop_db);
3514 bool deleteRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
3515 void deleteAllRows(XTThreadPtr self);
3516 bool updateRow(struct XTOpenTable *rec_ot, xtWord1 *before, xtWord1 *after);
3517
3518=== modified file 'storage/pbxt/src/datalog_xt.cc'
3519--- storage/pbxt/src/datalog_xt.cc 2009-03-26 12:18:01 +0000
3520+++ storage/pbxt/src/datalog_xt.cc 2009-08-18 07:46:53 +0000
3521@@ -69,6 +69,7 @@
3522 sl_rec_log_id = 0;
3523 sl_rec_log_offset = 0;
3524 sl_record_len = 0;
3525+ sl_extra_garbage = 0;
3526
3527 return sl_buffer != NULL;
3528 }
3529@@ -130,8 +131,25 @@
3530 /*
3531 * Unlike the transaction log sequential reader, this function only returns
3532 * the header of a record.
3533+ *
3534+ * {SKIP-GAPS}
3535+ * This function now skips gaps. This should not be required, because in normal
3536+ * operation, no gaps should be created.
3537+ *
3538+ * However, if his happens there is a danger that a valid record after the
3539+ * gap will be lost.
3540+ *
3541+ * So, if we find an invalid record, we scan through the log to find the next
3542+ * valid record. Note, that there is still a danger that will will find
3543+ * data that looks like a valid record, but is not.
3544+ *
3545+ * In this case, this "pseudo record" may cause the function to actually skip
3546+ * valid records.
3547+ *
3548+ * Note, any such malfunction will eventually cause the record to be lost forever
3549+ * after the garbage collector has run.
3550 */
3551-xtBool XTDataSeqRead::sl_seq_next(XTXactLogBufferDPtr *ret_entry, xtBool verify, struct XTThread *thread)
3552+xtBool XTDataSeqRead::sl_seq_next(XTXactLogBufferDPtr *ret_entry, struct XTThread *thread)
3553 {
3554 XTXactLogBufferDPtr record;
3555 size_t tfer;
3556@@ -140,10 +158,12 @@
3557 size_t max_rec_len;
3558 xtBool reread_from_buffer;
3559 xtWord4 size;
3560+ xtLogOffset gap_start = 0;
3561
3562 /* Go to the next record (xseq_record_len must be initialized
3563 * to 0 for this to work.
3564 */
3565+ retry:
3566 sl_rec_log_offset += sl_record_len;
3567 sl_record_len = 0;
3568
3569@@ -174,6 +194,8 @@
3570 record = (XTXactLogBufferDPtr) (sl_buffer + rec_offset);
3571 switch (record->xl.xl_status_1) {
3572 case XT_LOG_ENT_HEADER:
3573+ if (sl_rec_log_offset != 0)
3574+ goto scan_to_next_record;
3575 if (offsetof(XTXactLogHeaderDRec, xh_size_4) + 4 > max_rec_len) {
3576 reread_from_buffer = TRUE;
3577 goto read_more;
3578@@ -183,33 +205,42 @@
3579 reread_from_buffer = TRUE;
3580 goto read_more;
3581 }
3582- if (verify) {
3583- if (record->xh.xh_checksum_1 != XT_CHECKSUM_1(sl_rec_log_id))
3584- goto return_empty;
3585- if (XT_LOG_HEAD_MAGIC(record, len) != XT_LOG_FILE_MAGIC)
3586- goto return_empty;
3587- if (len > offsetof(XTXactLogHeaderDRec, xh_log_id_4) + 4) {
3588- if (XT_GET_DISK_4(record->xh.xh_log_id_4) != sl_rec_log_id)
3589- goto return_empty;
3590- }
3591+
3592+ if (record->xh.xh_checksum_1 != XT_CHECKSUM_1(sl_rec_log_id))
3593+ goto return_empty;
3594+ if (XT_LOG_HEAD_MAGIC(record, len) != XT_LOG_FILE_MAGIC)
3595+ goto return_empty;
3596+ if (len > offsetof(XTXactLogHeaderDRec, xh_log_id_4) + 4) {
3597+ if (XT_GET_DISK_4(record->xh.xh_log_id_4) != sl_rec_log_id)
3598+ goto return_empty;
3599 }
3600 break;
3601 case XT_LOG_ENT_EXT_REC_OK:
3602 case XT_LOG_ENT_EXT_REC_DEL:
3603+ if (gap_start) {
3604+ xt_logf(XT_NS_CONTEXT, XT_LOG_WARNING, "Gap in data log %lu, start: %llu, size: %llu\n", (u_long) sl_rec_log_id, (u_llong) gap_start, (u_llong) (sl_rec_log_offset - gap_start));
3605+ gap_start = 0;
3606+ }
3607 len = offsetof(XTactExtRecEntryDRec, er_data);
3608 if (len > max_rec_len) {
3609 reread_from_buffer = TRUE;
3610 goto read_more;
3611 }
3612 size = XT_GET_DISK_4(record->er.er_data_size_4);
3613- if (verify) {
3614- if (sl_rec_log_offset + (xtLogOffset) offsetof(XTactExtRecEntryDRec, er_data) + size > sl_log_eof)
3615- goto return_empty;
3616- }
3617+ /* Verify the record as good as we can! */
3618+ if (!size)
3619+ goto scan_to_next_record;
3620+ if (sl_rec_log_offset + (xtLogOffset) offsetof(XTactExtRecEntryDRec, er_data) + size > sl_log_eof)
3621+ goto scan_to_next_record;
3622+ if (!XT_GET_DISK_4(record->er.er_tab_id_4))
3623+ goto scan_to_next_record;
3624+ if (!XT_GET_DISK_4(record->er.er_rec_id_4))
3625+ goto scan_to_next_record;
3626 break;
3627 default:
3628- ASSERT_NS(FALSE);
3629- goto return_empty;
3630+ /* Note, we no longer assume EOF.
3631+ * Instead, we skip to the next value record. */
3632+ goto scan_to_next_record;
3633 }
3634
3635 if (len <= max_rec_len) {
3636@@ -243,7 +274,20 @@
3637 *ret_entry = (XTXactLogBufferDPtr) sl_buffer;
3638 return OK;
3639
3640+ scan_to_next_record:
3641+ if (!gap_start) {
3642+ gap_start = sl_rec_log_offset;
3643+ xt_logf(XT_NS_CONTEXT, XT_LOG_WARNING, "Gap found in data log %lu, starting at offset %llu\n", (u_long) sl_rec_log_id, (u_llong) gap_start);
3644+ }
3645+ sl_record_len = 1;
3646+ sl_extra_garbage++;
3647+ goto retry;
3648+
3649 return_empty:
3650+ if (gap_start) {
3651+ xt_logf(XT_NS_CONTEXT, XT_LOG_WARNING, "Gap in data log %lu, start: %llu, size: %llu\n", (u_long) sl_rec_log_id, (u_llong) gap_start, (u_llong) (sl_rec_log_offset - gap_start));
3652+ gap_start = 0;
3653+ }
3654 *ret_entry = NULL;
3655 return OK;
3656 }
3657@@ -285,18 +329,50 @@
3658 return OK;
3659 }
3660
3661-static xtBool dl_write_log_header(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtBool flush, XTThreadPtr thread)
3662+static xtBool dl_write_garbage_level(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtBool flush, XTThreadPtr thread)
3663 {
3664 XTXactLogHeaderDRec header;
3665
3666 /* The header was not completely written, so write a new one: */
3667 XT_SET_DISK_8(header.xh_free_space_8, data_log->dlf_garbage_count);
3668+ if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 8, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))
3669+ return FAILED;
3670+ if (flush && !xt_flush_file(of, &thread->st_statistics.st_data, thread))
3671+ return FAILED;
3672+ return OK;
3673+}
3674+
3675+/*
3676+ * {SKIP-GAPS}
3677+ * Extra garbage is the amount of space skipped during recovery of the data
3678+ * log file. We assume this space has not be counted as garbage,
3679+ * and add it to the garbage count.
3680+ *
3681+ * This may mean that our estimate of garbaged is higher than it should
3682+ * be, but that is better than the other way around.
3683+ *
3684+ * The fact is, there should not be any gaps in the data log files, so
3685+ * this is actually an exeption which should not occur.
3686+ */
3687+static xtBool dl_write_log_header(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtLogOffset extra_garbage, XTThreadPtr thread)
3688+{
3689+ XTXactLogHeaderDRec header;
3690+
3691 XT_SET_DISK_8(header.xh_file_len_8, data_log->dlf_log_eof);
3692- XT_SET_DISK_8(header.xh_comp_pos_8, data_log->dlf_start_offset);
3693
3694- if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 24, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))
3695- return FAILED;
3696- if (flush && !xt_flush_file(of, &thread->st_statistics.st_data, thread))
3697+ if (extra_garbage) {
3698+ data_log->dlf_garbage_count += extra_garbage;
3699+ if (data_log->dlf_garbage_count > data_log->dlf_log_eof)
3700+ data_log->dlf_garbage_count = data_log->dlf_log_eof;
3701+ XT_SET_DISK_8(header.xh_free_space_8, data_log->dlf_garbage_count);
3702+ if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 16, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))
3703+ return FAILED;
3704+ }
3705+ else {
3706+ if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_file_len_8), 8, (xtWord1 *) &header.xh_file_len_8, &thread->st_statistics.st_data, thread))
3707+ return FAILED;
3708+ }
3709+ if (!xt_flush_file(of, &thread->st_statistics.st_data, thread))
3710 return FAILED;
3711 return OK;
3712 }
3713@@ -318,7 +394,7 @@
3714 seq_read.sl_seq_start(data_log->dlf_log_id, 0, FALSE);
3715
3716 for (;;) {
3717- if (!seq_read.sl_seq_next(&record, TRUE, self))
3718+ if (!seq_read.sl_seq_next(&record, self))
3719 xt_throw(self);
3720 if (!record)
3721 break;
3722@@ -331,13 +407,18 @@
3723 }
3724 }
3725
3726- if (!(data_log->dlf_log_eof = seq_read.sl_rec_log_offset)) {
3727+ ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
3728+ data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
3729+
3730+ if (data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
3731 data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
3732 if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
3733 xt_throw(self);
3734 }
3735- if (!dl_write_log_header(data_log, seq_read.sl_log_file, TRUE, self))
3736- xt_throw(self);
3737+ else {
3738+ if (!dl_write_log_header(data_log, seq_read.sl_log_file, seq_read.sl_extra_garbage, self))
3739+ xt_throw(self);
3740+ }
3741
3742 freer_(); // dl_free_seq_read(&seq_read)
3743 }
3744@@ -452,7 +533,7 @@
3745 return FAILED;
3746 }
3747
3748-static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
3749+static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
3750 {
3751 xtLogID log_id_a = *((xtLogID *) a);
3752 xtLogID log_id_b = *((xtLogID *) b);
3753@@ -1110,7 +1191,6 @@
3754
3755 *log_id = dlb_data_log->dlf_log_id;
3756 *out_offset = dlb_data_log->dlf_log_eof;
3757- dlb_data_log->dlf_log_eof += req_size;
3758 return OK;
3759 }
3760
3761@@ -1149,7 +1229,7 @@
3762 return OK;
3763 }
3764
3765-xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
3766+xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
3767 {
3768 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
3769
3770@@ -1158,6 +1238,11 @@
3771
3772 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread))
3773 return FAILED;
3774+ /* Increment of dlb_data_log->dlf_log_eof was moved here from dlb_get_log_offset()
3775+ * to ensure it is done after a successful update of the log, otherwise otherwise a
3776+ * gap occurs in the log which cause eof to be detected in middle of the log
3777+ */
3778+ dlb_data_log->dlf_log_eof += size;
3779 #ifdef DEBUG
3780 if (log_offset + size > dlb_max_write_offset)
3781 dlb_max_write_offset = log_offset + size;
3782@@ -1166,7 +1251,7 @@
3783 return OK;
3784 }
3785
3786-xtBool XTDataLogBuffer::dlb_append_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
3787+xtBool XTDataLogBuffer::dlb_append_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
3788 {
3789 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
3790
3791@@ -1179,10 +1264,12 @@
3792 if (dlb_buffer_size >= dlb_buffer_len + size) {
3793 memcpy(dlb_log_buffer + dlb_buffer_len, data, size);
3794 dlb_buffer_len += size;
3795+ dlb_data_log->dlf_log_eof += size;
3796 return OK;
3797 }
3798 }
3799- dlb_flush_log(FALSE, thread);
3800+ if (dlb_flush_log(FALSE, thread) != OK)
3801+ return FAILED;
3802 }
3803
3804 ASSERT_NS(dlb_buffer_len == 0);
3805@@ -1191,6 +1278,7 @@
3806 dlb_buffer_offset = log_offset;
3807 dlb_buffer_len = size;
3808 memcpy(dlb_log_buffer, data, size);
3809+ dlb_data_log->dlf_log_eof += size;
3810 return OK;
3811 }
3812
3813@@ -1202,6 +1290,7 @@
3814 dlb_max_write_offset = log_offset + size;
3815 #endif
3816 dlb_flush_required = TRUE;
3817+ dlb_data_log->dlf_log_eof += size;
3818 return OK;
3819 }
3820
3821@@ -1306,7 +1395,7 @@
3822 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
3823 dlb_data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;
3824 ASSERT_NS(dlb_data_log->dlf_garbage_count < dlb_data_log->dlf_log_eof);
3825- if (!dl_write_log_header(dlb_data_log, dlb_data_log->dlf_log_file, FALSE, thread)) {
3826+ if (!dl_write_garbage_level(dlb_data_log, dlb_data_log->dlf_log_file, FALSE, thread)) {
3827 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
3828 return FAILED;
3829 }
3830@@ -1329,7 +1418,7 @@
3831 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
3832 data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;
3833 ASSERT_NS(data_log->dlf_garbage_count < data_log->dlf_log_eof);
3834- if (!dl_write_log_header(data_log, open_log->odl_log_file, FALSE, thread)) {
3835+ if (!dl_write_garbage_level(data_log, open_log->odl_log_file, FALSE, thread)) {
3836 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
3837 goto failed;
3838 }
3839@@ -1357,7 +1446,7 @@
3840 * Delete all the extended data belonging to a particular
3841 * table.
3842 */
3843-xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool missing_ok __attribute__((unused)), xtBool have_table_lock)
3844+xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool XT_UNUSED(missing_ok), xtBool have_table_lock)
3845 {
3846 XTOpenTablePtr ot;
3847 xtRecordID page_rec_id, offs_rec_id;
3848@@ -1674,7 +1763,7 @@
3849 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
3850 data_log->dlf_garbage_count += garbage_count;
3851 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);
3852- if (!dl_write_log_header(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
3853+ if (!dl_write_garbage_level(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
3854 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);
3855 xt_throw(self);
3856 }
3857@@ -1683,7 +1772,7 @@
3858 freer_(); // dl_free_compactor_state(&cs)
3859 return FAILED;
3860 }
3861- if (!cs.cs_seqread->sl_seq_next(&record, TRUE, self))
3862+ if (!cs.cs_seqread->sl_seq_next(&record, self))
3863 xt_throw(self);
3864 cs.cs_seqread->sl_seq_pos(&curr_log_id, &curr_log_offset);
3865 if (!record) {
3866@@ -1809,7 +1898,7 @@
3867 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
3868 data_log->dlf_garbage_count += garbage_count;
3869 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);
3870- if (!dl_write_log_header(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
3871+ if (!dl_write_garbage_level(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
3872 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);
3873 xt_throw(self);
3874 }
3875
3876=== modified file 'storage/pbxt/src/datalog_xt.h'
3877--- storage/pbxt/src/datalog_xt.h 2009-03-26 12:18:01 +0000
3878+++ storage/pbxt/src/datalog_xt.h 2009-08-18 07:46:53 +0000
3879@@ -183,8 +183,8 @@
3880 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread) {
3881 (void) log_offset; (void) size; (void) data; (void) read; (void) thread; return OK;
3882 };
3883- virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread) {
3884- (void) entry; (void) verify; (void) thread; return OK;
3885+ virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread) {
3886+ (void) entry; (void) thread; return OK;
3887 };
3888 virtual void sl_seq_skip(size_t size) { (void) size; }
3889 } XTSeqLogReadRec, *XTSeqLogReadPtr;
3890@@ -195,6 +195,7 @@
3891 xtLogOffset sl_rec_log_offset; /* The current log read position. */
3892 size_t sl_record_len; /* The length of the current record. */
3893 xtLogOffset sl_log_eof;
3894+ xtLogOffset sl_extra_garbage; /* Garbage found during a scan. */
3895
3896 size_t sl_buffer_size; /* Size of the buffer. */
3897 xtLogOffset sl_buf_log_offset; /* File offset of the buffer. */
3898@@ -208,7 +209,7 @@
3899 virtual void sl_seq_pos(xtLogID *log_id, xtLogOffset *log_offset);
3900 virtual xtBool sl_seq_start(xtLogID log_id, xtLogOffset log_offset, xtBool missing_ok);
3901 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread);
3902- virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread);
3903+ virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread);
3904 virtual void sl_seq_skip(size_t size);
3905 virtual void sl_seq_skip_to(off_t offset);
3906 } XTDataSeqReadRec, *XTDataSeqReadPtr;
3907
3908=== modified file 'storage/pbxt/src/discover_xt.cc'
3909--- storage/pbxt/src/discover_xt.cc 2009-03-26 12:18:01 +0000
3910+++ storage/pbxt/src/discover_xt.cc 2009-08-17 11:12:36 +0000
3911@@ -1282,9 +1282,11 @@
3912 #endif // LOCK_OPEN_HACK_REQUIRED
3913
3914 //------------------------------
3915-int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys __attribute__((unused)), xtBool skip_existing)
3916+int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
3917 {
3918 #ifdef DRIZZLED
3919+ drizzled::message::Table table_proto;
3920+
3921 static const char *ext = ".dfe";
3922 static const int ext_len = 4;
3923 #else
3924@@ -1329,8 +1331,7 @@
3925 info->field_flags,
3926 COLUMN_FORMAT_TYPE_FIXED,
3927 NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
3928- NULL /*interval_list*/, info->field_charset,
3929- NULL /*vcol_info*/))
3930+ NULL /*interval_list*/, info->field_charset))
3931 #else
3932 if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
3933 info->field_flags,
3934@@ -1365,7 +1366,10 @@
3935
3936 /* Create an internal temp table */
3937 #ifdef DRIZZLED
3938- if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0, false))
3939+ table_proto.set_name(name);
3940+ table_proto.set_type(drizzled::message::Table::STANDARD);
3941+
3942+ if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
3943 goto error;
3944 #else
3945 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
3946
3947=== modified file 'storage/pbxt/src/filesys_xt.cc'
3948--- storage/pbxt/src/filesys_xt.cc 2009-03-26 12:18:01 +0000
3949+++ storage/pbxt/src/filesys_xt.cc 2009-08-18 07:46:53 +0000
3950@@ -23,6 +23,10 @@
3951
3952 #include "xt_config.h"
3953
3954+#ifdef DRIZZLED
3955+#include <bitset>
3956+#endif
3957+
3958 #ifndef XT_WIN
3959 #include <unistd.h>
3960 #include <dirent.h>
3961@@ -50,6 +54,7 @@
3962 //#define DEBUG_TRACE_IO
3963 //#define DEBUG_TRACE_MAP_IO
3964 //#define DEBUG_TRACE_FILES
3965+//#define INJECT_WRITE_REMAP_ERROR
3966 #endif
3967
3968 #ifdef DEBUG_TRACE_FILES
3969@@ -57,6 +62,11 @@
3970 #define PRINTF xt_trace
3971 #endif
3972
3973+#ifdef INJECT_WRITE_REMAP_ERROR
3974+#define INJECT_REMAP_FILE_SIZE 1000000
3975+#define INJECT_REMAP_FILE_TYPE "xtd"
3976+#endif
3977+
3978 /* ----------------------------------------------------------------------
3979 * Globals
3980 */
3981@@ -127,11 +137,11 @@
3982 mm->mm_start = NULL;
3983 }
3984 #endif
3985- xt_rwmutex_free(self, &mm->mm_lock);
3986+ FILE_MAP_FREE_LOCK(self, &mm->mm_lock);
3987 xt_free(self, mm);
3988 }
3989
3990-static void fs_free_file(XTThreadPtr self, void *thunk __attribute__((unused)), void *item)
3991+static void fs_free_file(XTThreadPtr self, void *XT_UNUSED(thunk), void *item)
3992 {
3993 XTFilePtr file_ptr = *((XTFilePtr *) item);
3994
3995@@ -148,17 +158,13 @@
3996 file_ptr->fil_filedes = XT_NULL_FD;
3997 }
3998
3999- if (file_ptr->fil_memmap) {
4000- fs_close_fmap(self, file_ptr->fil_memmap);
4001- file_ptr->fil_memmap = NULL;
4002- }
4003-
4004 #ifdef DEBUG_TRACE_FILES
4005 PRINTF("%s: free file: (%d) %s\n", self->t_name, (int) file_ptr->fil_id,
4006 file_ptr->fil_path ? xt_last_2_names_of_path(file_ptr->fil_path) : "?");
4007 #endif
4008
4009 if (!file_ptr->fil_ref_count) {
4010+ ASSERT_NS(!file_ptr->fil_handle_count);
4011 /* Flush any cache before this file is invalid: */
4012 if (file_ptr->fil_path) {
4013 xt_free(self, file_ptr->fil_path);
4014@@ -169,7 +175,7 @@
4015 }
4016 }
4017
4018-static int fs_comp_file(XTThreadPtr self __attribute__((unused)), register const void *thunk __attribute__((unused)), register const void *a, register const void *b)
4019+static int fs_comp_file(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
4020 {
4021 char *file_name = (char *) a;
4022 XTFilePtr file_ptr = *((XTFilePtr *) b);
4023@@ -177,7 +183,7 @@
4024 return strcmp(file_name, file_ptr->fil_path);
4025 }
4026
4027-static int fs_comp_file_ci(XTThreadPtr self __attribute__((unused)), register const void *thunk __attribute__((unused)), register const void *a, register const void *b)
4028+static int fs_comp_file_ci(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
4029 {
4030 char *file_name = (char *) a;
4031 XTFilePtr file_ptr = *((XTFilePtr *) b);
4032@@ -868,11 +874,22 @@
4033 goto failed;
4034 }
4035 #else
4036+ /* Mac OS X has problems with fsync. We had several cases of index corruption presumably because
4037+ * fsync didn't really flush index pages to disk. fcntl(F_FULLFSYNC) is considered more effective
4038+ * in such case.
4039+ */
4040+#ifdef F_FULLFSYNC
4041+ if (fcntl(of->of_filedes, F_FULLFSYNC, 0) == -1) {
4042+ xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
4043+ goto failed;
4044+ }
4045+#else
4046 if (fsync(of->of_filedes) == -1) {
4047 xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
4048 goto failed;
4049 }
4050 #endif
4051+#endif
4052 #ifdef DEBUG_TRACE_IO
4053 xt_trace("/* %s */ pbxt_file_sync(\"%s\");\n", xt_trace_clock_diff(timef, start), of->fr_file->fil_path);
4054 #endif
4055@@ -938,6 +955,29 @@
4056 return OK;
4057 }
4058
4059+xtPublic xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr thread)
4060+{
4061+ size_t red_size;
4062+
4063+ if (!*data) {
4064+ if (!(*data = (xtWord1 *) xt_malloc_ns(size)))
4065+ return FAILED;
4066+ }
4067+
4068+ if (!xt_pread_file(of, offset, size, 0, *data, &red_size, stat, thread))
4069+ return FAILED;
4070+
4071+ //if (red_size < size)
4072+ // memset();
4073+ return OK;
4074+}
4075+
4076+xtPublic void xt_unlock_file_ptr(XTOpenFilePtr XT_UNUSED(of), xtWord1 *data, XTThreadPtr XT_UNUSED(thread))
4077+{
4078+ if (data)
4079+ xt_free_ns(data);
4080+}
4081+
4082 /* ----------------------------------------------------------------------
4083 * Directory operations
4084 */
4085@@ -949,7 +989,13 @@
4086 {
4087 XTOpenDirPtr od;
4088
4089- pushsr_(od, xt_dir_close, (XTOpenDirPtr) xt_calloc(self, sizeof(XTOpenDirRec)));
4090+#ifdef XT_SOLARIS
4091+ /* see the comment in filesys_xt.h */
4092+ size_t sz = pathconf(path, _PC_NAME_MAX) + sizeof(XTOpenDirRec) + 1;
4093+#else
4094+ size_t sz = sizeof(XTOpenDirRec);
4095+#endif
4096+ pushsr_(od, xt_dir_close, (XTOpenDirPtr) xt_calloc(self, sz));
4097
4098 #ifdef XT_WIN
4099 size_t len;
4100@@ -976,7 +1022,6 @@
4101 if (!od->od_dir)
4102 xt_throw_ferrno(XT_CONTEXT, errno, path);
4103 #endif
4104-
4105 popr_(); // Discard xt_dir_close(od)
4106 return od;
4107 }
4108@@ -1097,7 +1142,7 @@
4109 }
4110 #endif
4111
4112-char *xt_dir_name(XTThreadPtr self __attribute__((unused)), XTOpenDirPtr od)
4113+char *xt_dir_name(XTThreadPtr XT_UNUSED(self), XTOpenDirPtr od)
4114 {
4115 #ifdef XT_WIN
4116 return od->od_data.cFileName;
4117@@ -1106,8 +1151,9 @@
4118 #endif
4119 }
4120
4121-xtBool xt_dir_is_file(XTThreadPtr self __attribute__((unused)), XTOpenDirPtr od)
4122+xtBool xt_dir_is_file(XTThreadPtr self, XTOpenDirPtr od)
4123 {
4124+ (void) self;
4125 #ifdef XT_WIN
4126 if (od->od_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
4127 return FALSE;
4128@@ -1156,6 +1202,15 @@
4129
4130 static xtBool fs_map_file(XTFileMemMapPtr mm, XTFilePtr file, xtBool grow)
4131 {
4132+#ifdef INJECT_WRITE_REMAP_ERROR
4133+ if (xt_is_extension(file->fil_path, INJECT_REMAP_FILE_TYPE)) {
4134+ if (mm->mm_length > INJECT_REMAP_FILE_SIZE) {
4135+ xt_register_ferrno(XT_REG_CONTEXT, 30, file->fil_path);
4136+ return FAILED;
4137+ }
4138+ }
4139+#endif
4140+
4141 ASSERT_NS(!mm->mm_start);
4142 #ifdef XT_WIN
4143 /* This will grow the file to the given size: */
4144@@ -1228,7 +1283,7 @@
4145 /* NULL is the value returned on error! */
4146 mm->mm_mapdes = NULL;
4147 #endif
4148- xt_rwmutex_init_with_autoname(self, &mm->mm_lock);
4149+ FILE_MAP_INIT_LOCK(self, &mm->mm_lock);
4150 mm->mm_length = fs_seek_eof(self, map->fr_file->fil_filedes, map->fr_file);
4151 if (sizeof(size_t) == 4 && mm->mm_length >= (off_t) 0xFFFFFFFF)
4152 xt_throw_ixterr(XT_CONTEXT, XT_ERR_FILE_TOO_LONG, map->fr_file->fil_path);
4153@@ -1257,21 +1312,19 @@
4154
4155 xtPublic void xt_close_fmap(XTThreadPtr self, XTMapFilePtr map)
4156 {
4157+ ASSERT_NS(!map->mf_slock_count);
4158 if (map->fr_file) {
4159- xt_fs_release_file(self, map->fr_file);
4160-
4161 xt_sl_lock(self, fs_globals.fsg_open_files);
4162- pushr_(xt_sl_unlock, fs_globals.fsg_open_files);
4163-
4164+ pushr_(xt_sl_unlock, fs_globals.fsg_open_files);
4165 map->fr_file->fil_handle_count--;
4166- if (!map->fr_file->fil_handle_count)
4167- fs_free_file(self, NULL, &map->fr_file);
4168-
4169+ if (!map->fr_file->fil_handle_count) {
4170+ fs_close_fmap(self, map->fr_file->fil_memmap);
4171+ map->fr_file->fil_memmap = NULL;
4172+ }
4173 freer_();
4174-
4175+
4176+ xt_fs_release_file(self, map->fr_file);
4177 map->fr_file = NULL;
4178-
4179-
4180 }
4181 map->mf_memmap = NULL;
4182 xt_free(self, map);
4183@@ -1346,14 +1399,23 @@
4184 }
4185 mm->mm_start = NULL;
4186 #ifdef XT_WIN
4187- if (!CloseHandle(mm->mm_mapdes))
4188+ /* It is possible that a previous remap attempt has failed: the map was closed
4189+ * but the new map was not allocated (e.g. because of insufficient disk space).
4190+ * In this case mm->mm_mapdes will be NULL.
4191+ */
4192+ if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes))
4193 return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map));
4194 mm->mm_mapdes = NULL;
4195 #endif
4196+ off_t old_size = mm->mm_length;
4197 mm->mm_length = new_size;
4198
4199- if (!fs_map_file(mm, map->fr_file, TRUE))
4200+ if (!fs_map_file(mm, map->fr_file, TRUE)) {
4201+ /* Try to restore old mapping */
4202+ mm->mm_length = old_size;
4203+ fs_map_file(mm, map->fr_file, FALSE);
4204 return FAILED;
4205+ }
4206 }
4207 return OK;
4208
4209@@ -1367,16 +1429,19 @@
4210 xtPublic xtBool xt_pwrite_fmap(XTMapFilePtr map, off_t offset, size_t size, void *data, XTIOStatsPtr stat, XTThreadPtr thread)
4211 {
4212 XTFileMemMapPtr mm = map->mf_memmap;
4213+#ifndef FILE_MAP_USE_PTHREAD_RW
4214 xtThreadID thd_id = thread->t_id;
4215+#endif
4216
4217 #ifdef DEBUG_TRACE_MAP_IO
4218 xt_trace("/* %s */ pbxt_fmap_writ(\"%s\", %lu, %lu);\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path, (u_long) offset, (u_long) size);
4219 #endif
4220- xt_rwmutex_slock(&mm->mm_lock, thd_id);
4221+ ASSERT_NS(!map->mf_slock_count);
4222+ FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
4223 if (!mm->mm_start || offset + (off_t) size > mm->mm_length) {
4224- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4225+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4226
4227- xt_rwmutex_xlock(&mm->mm_lock, thd_id);
4228+ FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
4229 if (!fs_remap_file(map, offset, size, stat))
4230 goto failed;
4231 }
4232@@ -1396,29 +1461,32 @@
4233 memcpy(mm->mm_start + offset, data, size);
4234 #endif
4235
4236- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4237+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4238 stat->ts_write += size;
4239 return OK;
4240
4241 failed:
4242- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4243+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4244 return FAILED;
4245 }
4246
4247 xtPublic xtBool xt_pread_fmap_4(XTMapFilePtr map, off_t offset, xtWord4 *value, XTIOStatsPtr stat, XTThreadPtr thread)
4248 {
4249 XTFileMemMapPtr mm = map->mf_memmap;
4250+#ifndef FILE_MAP_USE_PTHREAD_RW
4251 xtThreadID thd_id = thread->t_id;
4252+#endif
4253
4254 #ifdef DEBUG_TRACE_MAP_IO
4255 xt_trace("/* %s */ pbxt_fmap_read_4(\"%s\", %lu, 4);\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path, (u_long) offset);
4256 #endif
4257- xt_rwmutex_slock(&mm->mm_lock, thd_id);
4258+ if (!map->mf_slock_count)
4259+ FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
4260 if (!mm->mm_start) {
4261- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4262- xt_rwmutex_xlock(&mm->mm_lock, thd_id);
4263+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4264+ FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
4265 if (!fs_remap_file(map, 0, 0, stat)) {
4266- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4267+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4268 return FAILED;
4269 }
4270 }
4271@@ -1436,7 +1504,7 @@
4272 }
4273 __except(EXCEPTION_EXECUTE_HANDLER)
4274 {
4275- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4276+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4277 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));
4278 }
4279 #else
4280@@ -1444,7 +1512,8 @@
4281 #endif
4282 }
4283
4284- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4285+ if (!map->mf_slock_count)
4286+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4287 stat->ts_read += 4;
4288 return OK;
4289 }
4290@@ -1452,7 +1521,9 @@
4291 xtPublic xtBool xt_pread_fmap(XTMapFilePtr map, off_t offset, size_t size, size_t min_size, void *data, size_t *red_size, XTIOStatsPtr stat, XTThreadPtr thread)
4292 {
4293 XTFileMemMapPtr mm = map->mf_memmap;
4294+#ifndef FILE_MAP_USE_PTHREAD_RW
4295 xtThreadID thd_id = thread->t_id;
4296+#endif
4297 size_t tfer;
4298
4299 #ifdef DEBUG_TRACE_MAP_IO
4300@@ -1461,6 +1532,8 @@
4301 /* NOTE!! The file map may already be locked,
4302 * by a call to xt_lock_fmap_ptr()!
4303 *
4304+ * 20.05.2009: This problem should be fixed now with mf_slock_count!
4305+ *
4306 * This can occur during a sequential scan:
4307 * xt_pread_fmap() Line 1330
4308 * XTTabCache::tc_read_direct() Line 361
4309@@ -1491,13 +1564,16 @@
4310 * As a result, the slock must be able to handle
4311 * nested calls to lock/unlock.
4312 */
4313- xt_rwmutex_slock(&mm->mm_lock, thd_id);
4314+ if (!map->mf_slock_count)
4315+ FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
4316 tfer = size;
4317 if (!mm->mm_start) {
4318- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4319- xt_rwmutex_xlock(&mm->mm_lock, thd_id);
4320+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4321+ ASSERT_NS(!map->mf_slock_count);
4322+ FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
4323 if (!fs_remap_file(map, 0, 0, stat)) {
4324- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4325+ if (!map->mf_slock_count)
4326+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4327 return FAILED;
4328 }
4329 }
4330@@ -1514,7 +1590,8 @@
4331 }
4332 __except(EXCEPTION_EXECUTE_HANDLER)
4333 {
4334- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4335+ if (!map->mf_slock_count)
4336+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4337 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));
4338 }
4339 #else
4340@@ -1522,7 +1599,8 @@
4341 #endif
4342 }
4343
4344- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4345+ if (!map->mf_slock_count)
4346+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4347 if (tfer < min_size)
4348 return xt_register_ferrno(XT_REG_CONTEXT, ESPIPE, xt_file_path(map));
4349
4350@@ -1535,18 +1613,23 @@
4351 xtPublic xtBool xt_flush_fmap(XTMapFilePtr map, XTIOStatsPtr stat, XTThreadPtr thread)
4352 {
4353 XTFileMemMapPtr mm = map->mf_memmap;
4354+#ifndef FILE_MAP_USE_PTHREAD_RW
4355 xtThreadID thd_id = thread->t_id;
4356+#endif
4357 xtWord8 s;
4358
4359 #ifdef DEBUG_TRACE_MAP_IO
4360 xt_trace("/* %s */ pbxt_fmap_sync(\"%s\");\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path);
4361 #endif
4362- xt_rwmutex_slock(&mm->mm_lock, thd_id);
4363+ if (!map->mf_slock_count)
4364+ FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
4365 if (!mm->mm_start) {
4366- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4367- xt_rwmutex_xlock(&mm->mm_lock, thd_id);
4368+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4369+ ASSERT_NS(!map->mf_slock_count);
4370+ FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
4371 if (!fs_remap_file(map, 0, 0, stat)) {
4372- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4373+ if (!map->mf_slock_count)
4374+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4375 return FAILED;
4376 }
4377 }
4378@@ -1562,7 +1645,8 @@
4379 goto failed;
4380 }
4381 #endif
4382- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4383+ if (!map->mf_slock_count)
4384+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4385 s = stat->ts_flush_start;
4386 stat->ts_flush_start = 0;
4387 stat->ts_flush_time += xt_trace_clock() - s;
4388@@ -1570,22 +1654,27 @@
4389 return OK;
4390
4391 failed:
4392- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4393+ if (!map->mf_slock_count)
4394+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4395 s = stat->ts_flush_start;
4396 stat->ts_flush_start = 0;
4397 stat->ts_flush_time += xt_trace_clock() - s;
4398 return FAILED;
4399 }
4400
4401-xtPublic xtWord1 *xt_lock_fmap_ptr(XTMapFilePtr map, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr XT_UNUSED(thread))
4402+xtPublic xtWord1 *xt_lock_fmap_ptr(XTMapFilePtr map, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr thread)
4403 {
4404 XTFileMemMapPtr mm = map->mf_memmap;
4405+#ifndef FILE_MAP_USE_PTHREAD_RW
4406 xtThreadID thd_id = thread->t_id;
4407+#endif
4408
4409- xt_rwmutex_slock(&mm->mm_lock, thd_id);
4410+ if (!map->mf_slock_count)
4411+ FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
4412+ map->mf_slock_count++;
4413 if (!mm->mm_start) {
4414- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4415- xt_rwmutex_xlock(&mm->mm_lock, thd_id);
4416+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4417+ FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
4418 if (!fs_remap_file(map, 0, 0, stat))
4419 goto failed;
4420 }
4421@@ -1599,13 +1688,17 @@
4422 return mm->mm_start + offset;
4423
4424 failed:
4425- xt_rwmutex_unlock(&mm->mm_lock, thd_id);
4426+ map->mf_slock_count--;
4427+ if (!map->mf_slock_count)
4428+ FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
4429 return NULL;
4430 }
4431
4432 xtPublic void xt_unlock_fmap_ptr(XTMapFilePtr map, XTThreadPtr thread)
4433 {
4434- xt_rwmutex_unlock(&map->mf_memmap->mm_lock, thread->t_id);
4435+ map->mf_slock_count--;
4436+ if (!map->mf_slock_count)
4437+ FILE_MAP_UNLOCK(&map->mf_memmap->mm_lock, thread->t_id);
4438 }
4439
4440 /* ----------------------------------------------------------------------
4441
4442=== modified file 'storage/pbxt/src/filesys_xt.h'
4443--- storage/pbxt/src/filesys_xt.h 2009-03-26 12:18:01 +0000
4444+++ storage/pbxt/src/filesys_xt.h 2009-08-17 11:12:36 +0000
4445@@ -76,13 +76,60 @@
4446 #define XT_NULL_FD (-1)
4447 #endif
4448
4449+/* Note, this lock must be re-entrant,
4450+ * The only lock that satifies this is
4451+ * FILE_MAP_USE_RWMUTEX!
4452+ *
4453+ * 20.05.2009: This problem should be fixed now with mf_slock_count!
4454+ *
4455+ * The lock need no longer be re-entrant
4456+ */
4457+#ifdef XT_NO_ATOMICS
4458+#define FILE_MAP_USE_PTHREAD_RW
4459+#else
4460+//#define FILE_MAP_USE_RWMUTEX
4461+//#define FILE_MAP_USE_PTHREAD_RW
4462+//#define IDX_USE_SPINXSLOCK
4463+#define FILE_MAP_USE_XSMUTEX
4464+#endif
4465+
4466+#ifdef FILE_MAP_USE_XSMUTEX
4467+#define FILE_MAP_LOCK_TYPE XTXSMutexRec
4468+#define FILE_MAP_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, i)
4469+#define FILE_MAP_FREE_LOCK(s, i) xt_xsmutex_free(s, i)
4470+#define FILE_MAP_READ_LOCK(i, o) xt_xsmutex_slock(i, o)
4471+#define FILE_MAP_WRITE_LOCK(i, o) xt_xsmutex_xlock(i, o)
4472+#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
4473+#elif defined(FILE_MAP_USE_PTHREAD_RW)
4474+#define FILE_MAP_LOCK_TYPE xt_rwlock_type
4475+#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
4476+#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
4477+#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
4478+#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
4479+#define FILE_MAP_UNLOCK(i, o) xt_unlock_rwlock_ns(i)
4480+#elif defined(FILE_MAP_USE_RWMUTEX)
4481+#define FILE_MAP_LOCK_TYPE XTRWMutexRec
4482+#define FILE_MAP_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, i)
4483+#define FILE_MAP_FREE_LOCK(s, i) xt_rwmutex_free(s, i)
4484+#define FILE_MAP_READ_LOCK(i, o) xt_rwmutex_slock(i, o)
4485+#define FILE_MAP_WRITE_LOCK(i, o) xt_rwmutex_xlock(i, o)
4486+#define FILE_MAP_UNLOCK(i, o) xt_rwmutex_unlock(i, o)
4487+#elif defined(FILE_MAP_USE_SPINXSLOCK)
4488+#define FILE_MAP_LOCK_TYPE XTSpinXSLockRec
4489+#define FILE_MAP_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
4490+#define FILE_MAP_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
4491+#define FILE_MAP_READ_LOCK(i, o) xt_spinxslock_slock(i, o)
4492+#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
4493+#define FILE_MAP_UNLOCK(i, o) xt_spinxslock_unlock(i, o)
4494+#endif
4495+
4496 typedef struct XTFileMemMap {
4497 xtWord1 *mm_start; /* The in-memory start of the map. */
4498 #ifdef XT_WIN
4499 HANDLE mm_mapdes;
4500 #endif
4501 off_t mm_length; /* The length of the file map. */
4502- XTRWMutexRec mm_lock; /* The file map R/W lock. */
4503+ FILE_MAP_LOCK_TYPE mm_lock; /* The file map R/W lock. */
4504 size_t mm_grow_size; /* The amount by which the map file is increased. */
4505 } XTFileMemMapRec, *XTFileMemMapPtr;
4506
4507@@ -127,6 +174,9 @@
4508 xtBool xt_pread_file(XTOpenFilePtr of, off_t offset, size_t size, size_t min_size, void *data, size_t *red_size, struct XTIOStats *timer, struct XTThread *thread);
4509 xtBool xt_flush_file(XTOpenFilePtr of, struct XTIOStats *timer, struct XTThread *thread);
4510
4511+xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, struct XTIOStats *timer, struct XTThread *thread);
4512+void xt_unlock_file_ptr(XTOpenFilePtr of, xtWord1 *data, struct XTThread *thread);
4513+
4514 typedef struct XTOpenDir {
4515 char *od_path;
4516 #ifdef XT_WIN
4517@@ -134,8 +184,14 @@
4518 WIN32_FIND_DATA od_data;
4519 #else
4520 char *od_filter;
4521+ DIR *od_dir;
4522+ /* WARNING: Solaris requires od_entry.d_name member to have size at least as returned
4523+ * by pathconf() function on per-directory basis. This makes it impossible to statically
4524+ * pre-set the size. So xt_dir_open on Solaris dynamically allocates space as needed.
4525+ *
4526+ * This also means that the od_entry member should always be last in the XTOpenDir structure.
4527+ */
4528 struct dirent od_entry;
4529- DIR *od_dir;
4530 #endif
4531 } XTOpenDirRec, *XTOpenDirPtr;
4532
4533@@ -147,6 +203,7 @@
4534 off_t xt_dir_file_size(struct XTThread *self, XTOpenDirPtr od);
4535
4536 typedef struct XTMapFile : public XTFileRef {
4537+ u_int mf_slock_count;
4538 XTFileMemMapPtr mf_memmap;
4539 } XTMapFileRec, *XTMapFilePtr;
4540
4541
4542=== modified file 'storage/pbxt/src/ha_pbxt.cc'
4543--- storage/pbxt/src/ha_pbxt.cc 2009-04-02 11:49:57 +0000
4544+++ storage/pbxt/src/ha_pbxt.cc 2009-08-18 07:46:53 +0000
4545@@ -65,8 +65,8 @@
4546 #include "heap_xt.h"
4547 #include "myxt_xt.h"
4548 #include "datadic_xt.h"
4549-#ifdef XT_STREAMING
4550-#include "streaming_xt.h"
4551+#ifdef PBMS_ENABLED
4552+#include "pbms_enabled.h"
4553 #endif
4554 #include "tabcache_xt.h"
4555 #include "systab_xt.h"
4556@@ -91,20 +91,22 @@
4557 //#define PRINT_STATEMENTS
4558 #endif
4559
4560+#ifndef DRIZZLED
4561 static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root);
4562 static int pbxt_init(void *p);
4563 static int pbxt_end(void *p);
4564-#ifndef DRIZZLED
4565 static int pbxt_panic(handlerton *hton, enum ha_panic_function flag);
4566-#endif
4567 static void pbxt_drop_database(handlerton *hton, char *path);
4568 static int pbxt_close_connection(handlerton *hton, THD* thd);
4569 static int pbxt_commit(handlerton *hton, THD *thd, bool all);
4570 static int pbxt_rollback(handlerton *hton, THD *thd, bool all);
4571+#endif
4572 static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
4573 static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
4574 static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
4575
4576+extern void xt_xres_start_database_recovery(XTThreadPtr self);
4577+
4578 #ifdef TRACE_STATEMENTS
4579
4580 #ifdef PRINT_STATEMENTS
4581@@ -167,7 +169,7 @@
4582 /* Variables for pbxt share methods */
4583 static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped
4584 static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables
4585-static XTDatabaseHPtr pbxt_database = NULL; // The global open database
4586+XTDatabaseHPtr pbxt_database = NULL; // The global open database
4587 static char *pbxt_index_cache_size;
4588 static char *pbxt_record_cache_size;
4589 static char *pbxt_log_cache_size;
4590@@ -178,6 +180,7 @@
4591 static char *pbxt_data_log_threshold;
4592 static char *pbxt_data_file_grow_size;
4593 static char *pbxt_row_file_grow_size;
4594+static int pbxt_max_threads;
4595
4596 #ifdef DEBUG
4597 #define XT_SHARE_LOCK_WAIT 5000
4598@@ -454,7 +457,7 @@
4599 * operation to make sure it does not occur while
4600 * some other thread is doing a "closeall".
4601 */
4602-xtPublic void xt_ha_open_database_of_table(XTThreadPtr self, XTPathStrPtr table_path __attribute__((unused)))
4603+xtPublic void xt_ha_open_database_of_table(XTThreadPtr self, XTPathStrPtr XT_UNUSED(table_path))
4604 {
4605 #ifdef XT_USE_GLOBAL_DB
4606 if (!self->st_database) {
4607@@ -574,7 +577,7 @@
4608 }
4609
4610 /* The first bit is 1. */
4611-static u_int ha_get_max_bit(MY_BITMAP *map)
4612+static u_int ha_get_max_bit(MX_BITMAP *map)
4613 {
4614 my_bitmap_map *data_ptr = map->bitmap;
4615 my_bitmap_map *end_ptr = map->last_word_ptr;
4616@@ -676,7 +679,7 @@
4617 return(-1); // Unknown error
4618 }
4619
4620-xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *thd __attribute__((unused)), const XTThreadPtr self, int ignore_dup_key)
4621+xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *XT_UNUSED(thd), const XTThreadPtr self, int ignore_dup_key)
4622 {
4623 int xt_err = self->t_exception.e_xt_err;
4624
4625@@ -965,8 +968,8 @@
4626 /* This may cause the streaming engine to cleanup connections and
4627 * tables belonging to this engine. This in turn may require some of
4628 * the stuff below (like xt_create_thread() called from pbxt_close_table()! */
4629-#ifdef XT_STREAMING
4630- xt_exit_streaming();
4631+#ifdef PBMS_ENABLED
4632+ pbms_finalize();
4633 #endif
4634 pbxt_call_exit(self);
4635 xt_exit_threading(self);
4636@@ -979,9 +982,13 @@
4637 /*
4638 * Outout the PBXT status. Return FALSE on error.
4639 */
4640-static bool pbxt_show_status(handlerton *hton __attribute__((unused)), THD* thd,
4641+#ifdef DRIZZLED
4642+bool PBXTStorageEngine::show_status(Session *thd, stat_print_fn *stat_print, enum ha_stat_type)
4643+#else
4644+static bool pbxt_show_status(handlerton *XT_UNUSED(hton), THD* thd,
4645 stat_print_fn* stat_print,
4646- enum ha_stat_type stat_type __attribute__((unused)))
4647+ enum ha_stat_type XT_UNUSED(stat_type))
4648+#endif
4649 {
4650 XTThreadPtr self;
4651 int err = 0;
4652@@ -997,6 +1004,9 @@
4653 xt_trace("// %s - dump\n", xt_trace_clock_diff(NULL));
4654 xt_dump_trace();
4655 #endif
4656+#ifdef XT_TRACK_CONNECTIONS
4657+ xt_dump_conn_tracking();
4658+#endif
4659
4660 try_(a) {
4661 myxt_get_status(self, &strbuf);
4662@@ -1020,14 +1030,18 @@
4663 *
4664 * return 1 on error, else 0.
4665 */
4666+#ifdef DRIZZLED
4667+static int pbxt_init(PluginRegistry &registry)
4668+#else
4669 static int pbxt_init(void *p)
4670+#endif
4671 {
4672 int init_err = 0;
4673
4674 XT_TRACE_CALL();
4675
4676 if (sizeof(xtWordPS) != sizeof(void *)) {
4677- printf("PBXT: This won't work, I require that sizeof(xtWordPS) != sizeof(void *)!\n");
4678+ printf("PBXT: This won't work, I require that sizeof(xtWordPS) == sizeof(void *)!\n");
4679 XT_RETURN(1);
4680 }
4681
4682@@ -1045,28 +1059,31 @@
4683
4684 xt_p_mutex_init_with_autoname(&pbxt_database_mutex, NULL);
4685
4686+#ifdef DRIZZLED
4687+ pbxt_hton= new PBXTStorageEngine(std::string("PBXT"));
4688+ registry.add(pbxt_hton);
4689+#else
4690 pbxt_hton = (handlerton *) p;
4691 pbxt_hton->state = SHOW_OPTION_YES;
4692-#ifndef DRIZZLED
4693 pbxt_hton->db_type = DB_TYPE_PBXT; // Wow! I have my own!
4694-#endif
4695 pbxt_hton->close_connection = pbxt_close_connection; /* close_connection, cleanup thread related data. */
4696 pbxt_hton->commit = pbxt_commit; /* commit */
4697 pbxt_hton->rollback = pbxt_rollback; /* rollback */
4698 pbxt_hton->create = pbxt_create_handler; /* Create a new handler */
4699 pbxt_hton->drop_database = pbxt_drop_database; /* Drop a database */
4700-#ifndef DRIZZLED
4701 pbxt_hton->panic = pbxt_panic; /* Panic call */
4702-#endif
4703 pbxt_hton->show_status = pbxt_show_status;
4704 pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */
4705-
4706+#endif
4707 if (!xt_init_logging()) /* Initialize logging */
4708 goto error_1;
4709
4710-#ifdef XT_STREAMING
4711- if (!xt_init_streaming())
4712+#ifdef PBMS_ENABLED
4713+ PBMSResultRec result;
4714+ if (!pbms_initialize("PBXT", false, &result)) {
4715+ xt_logf(XT_NT_ERROR, "pbms_initialize() Error: %s", result.mr_message);
4716 goto error_2;
4717+ }
4718 #endif
4719
4720 if (!xt_init_memory()) /* Initialize memory */
4721@@ -1082,9 +1099,13 @@
4722 * +1 Free'er thread
4723 * +1 Temporary thread (e.g. TempForClose, TempForEnd)
4724 */
4725- self = xt_init_threading(max_connections + 7); /* Create the main self: */
4726+#ifndef DRIZZLED
4727+ if (pbxt_max_threads == 0)
4728+ pbxt_max_threads = max_connections + 7;
4729+#endif
4730+ self = xt_init_threading(pbxt_max_threads); /* Create the main self: */
4731 if (!self)
4732- goto error_4;
4733+ goto error_3;
4734
4735 pbxt_inited = true;
4736
4737@@ -1111,7 +1132,7 @@
4738 ASSERT(!pbxt_database);
4739 {
4740 THD *curr_thd = current_thd;
4741- THD *thd = curr_thd;
4742+ THD *thd = NULL;
4743
4744 #ifndef DRIZZLED
4745 extern myxt_mutex_t LOCK_plugin;
4746@@ -1148,21 +1169,23 @@
4747 xt_throw(self);
4748 }
4749
4750- xt_open_database(self, mysql_real_data_home, TRUE);
4751- pbxt_database = self->st_database;
4752- xt_heap_reference(self, pbxt_database);
4753+ xt_xres_start_database_recovery(self);
4754 }
4755 catch_(b) {
4756- if (!curr_thd && thd)
4757- myxt_destroy_thread(thd, FALSE);
4758-#ifndef DRIZZLED
4759- myxt_mutex_lock(&LOCK_plugin);
4760-#endif
4761- xt_throw(self);
4762+ /* It is possible that the error was reset by cleanup code.
4763+ * Set a generic error code in that case.
4764+ */
4765+ /* PMC - This is not necessary in because exceptions are
4766+ * now preserved, in exception handler cleanup.
4767+ */
4768+ if (!self->t_exception.e_xt_err)
4769+ xt_register_error(XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed");
4770+ xt_log_exception(self, &self->t_exception, XT_LOG_DEFAULT);
4771+ init_err = 1;
4772 }
4773 cont_(b);
4774
4775- if (!curr_thd)
4776+ if (thd)
4777 myxt_destroy_thread(thd, FALSE);
4778 #ifndef DRIZZLED
4779 myxt_mutex_lock(&LOCK_plugin);
4780@@ -1205,32 +1228,37 @@
4781 * I have to stop the freeer here because it was
4782 * started before opening the database.
4783 */
4784- pbxt_call_exit(self);
4785- pbxt_inited = FALSE;
4786- xt_exit_threading(self);
4787- goto error_4;
4788+
4789+ /* {FREEER-HANG-ON-INIT-ERROR}
4790+ * pbxt_init is called with LOCK_plugin and if it fails and tries to exit
4791+ * the freeer here it hangs because the freeer calls THD::~THD which tries
4792+ * to aquire the same lock and hangs. OTOH MySQL calls pbxt_end() after
4793+ * an unsuccessful call to pbxt_init, so we defer cleaup, except
4794+ * releasing 'self'
4795+ */
4796+ xt_free_thread(self);
4797+ goto error_3;
4798 }
4799 xt_free_thread(self);
4800 }
4801 XT_RETURN(init_err);
4802
4803- error_4:
4804- xt_exit_memory();
4805-
4806 error_3:
4807-#ifdef XT_STREAMING
4808- xt_exit_streaming();
4809+#ifdef PBMS_ENABLED
4810+ pbms_finalize();
4811
4812 error_2:
4813 #endif
4814- xt_exit_logging();
4815
4816 error_1:
4817- xt_p_mutex_destroy(&pbxt_database_mutex);
4818 XT_RETURN(1);
4819 }
4820
4821-static int pbxt_end(void *p __attribute__((unused)))
4822+#ifdef DRIZZLED
4823+static int pbxt_end(PluginRegistry &registry)
4824+#else
4825+static int pbxt_end(void *)
4826+#endif
4827 {
4828 XTThreadPtr self;
4829 int err = 0;
4830@@ -1241,7 +1269,7 @@
4831 XTExceptionRec e;
4832
4833 /* This flag also means "shutting down". */
4834- pbxt_inited = FALSE;
4835+ pbxt_inited = FALSE;
4836 self = xt_create_thread("TempForEnd", FALSE, TRUE, &e);
4837 if (self) {
4838 self->t_main = TRUE;
4839@@ -1249,6 +1277,9 @@
4840 }
4841 }
4842
4843+#ifdef DRIZZLED
4844+ registry.remove(pbxt_hton);
4845+#endif
4846 XT_RETURN(err);
4847 }
4848
4849@@ -1262,12 +1293,15 @@
4850 /*
4851 * Kill the PBXT thread associated with the MySQL thread.
4852 */
4853+#ifdef DRIZZLED
4854+int PBXTStorageEngine::close_connection(Session *thd)
4855+{
4856+ PBXTStorageEngine * const hton = this;
4857+#else
4858 static int pbxt_close_connection(handlerton *hton, THD* thd)
4859 {
4860+#endif
4861 XTThreadPtr self;
4862-#ifdef XT_STREAMING
4863- XTExceptionRec e;
4864-#endif
4865
4866 XT_TRACE_CALL();
4867 if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
4868@@ -1278,10 +1312,6 @@
4869 xt_set_self(self);
4870 xt_free_thread(self);
4871 }
4872-#ifdef XT_STREAMING
4873- if (!xt_pbms_close_connection((void *) thd, &e))
4874- xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
4875-#endif
4876 return 0;
4877 }
4878
4879@@ -1290,7 +1320,11 @@
4880 * when the last PBXT table was removed from the
4881 * database.
4882 */
4883-static void pbxt_drop_database(handlerton *hton __attribute__((unused)), char *path __attribute__((unused)))
4884+#ifdef DRIZZLED
4885+void PBXTStorageEngine::drop_database(char *)
4886+#else
4887+static void pbxt_drop_database(handlerton *XT_UNUSED(hton), char *XT_UNUSED(path))
4888+#endif
4889 {
4890 XT_TRACE_CALL();
4891 }
4892@@ -1317,8 +1351,14 @@
4893 * pbxt_thr is a pointer the the PBXT thread structure.
4894 *
4895 */
4896+#ifdef DRIZZLED
4897+int PBXTStorageEngine::commit(Session *thd, bool all)
4898+{
4899+ PBXTStorageEngine * const hton = this;
4900+#else
4901 static int pbxt_commit(handlerton *hton, THD *thd, bool all)
4902 {
4903+#endif
4904 int err = 0;
4905 XTThreadPtr self;
4906
4907@@ -1343,8 +1383,14 @@
4908 return err;
4909 }
4910
4911+#ifdef DRIZZLED
4912+int PBXTStorageEngine::rollback(Session *thd, bool all)
4913+{
4914+ PBXTStorageEngine * const hton = this;
4915+#else
4916 static int pbxt_rollback(handlerton *hton, THD *thd, bool all)
4917 {
4918+#endif
4919 int err = 0;
4920 XTThreadPtr self;
4921
4922@@ -1377,8 +1423,14 @@
4923 return 0;
4924 }
4925
4926+#ifdef DRIZZLED
4927+handler *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
4928+{
4929+ PBXTStorageEngine * const hton = this;
4930+#else
4931 static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root)
4932 {
4933+#endif
4934 if (table && XTSystemTableShare::isSystemTable(table->path.str))
4935 return new (mem_root) ha_xtsys(hton, table);
4936 else
4937@@ -1513,7 +1565,11 @@
4938 freer_(); // xt_unlock_mutex(share->sh_ex_mutex)
4939 }
4940
4941-static void ha_release_exclusive_use(XTThreadPtr self __attribute__((unused)), XTSharePtr share)
4942+#ifdef PBXT_ALLOW_PRINTING
4943+static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share)
4944+#else
4945+static void ha_release_exclusive_use(XTThreadPtr XT_UNUSED(self), XTSharePtr share)
4946+#endif
4947 {
4948 XT_PRINT1(self, "ha_release_exclusive_use %s PBXT X UNLOCK\n", share->sh_table_path->ps_path);
4949 xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
4950@@ -1629,11 +1685,23 @@
4951 { 0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
4952 };
4953
4954+#ifdef DRIZZLED
4955+static InfoSchemaTable *pbxt_statistics_table;
4956+
4957+int pbxt_init_statitics(PluginRegistry &registry)
4958+#else
4959 int pbxt_init_statitics(void *p)
4960+#endif
4961 {
4962- ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
4963- schema->fields_info = pbxt_statistics_fields_info;
4964- schema->fill_table = pbxt_statistics_fill_table;
4965+#ifdef DRIZZLED
4966+ pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
4967+ pbxt_statistics_table->table_name= "PBXT_STATISTICS";
4968+ registry.add(pbxt_statistics_table);
4969+#else
4970+ ST_SCHEMA_TABLE *pbxt_statistics_table = (ST_SCHEMA_TABLE *) p;
4971+#endif
4972+ pbxt_statistics_table->fields_info = pbxt_statistics_fields_info;
4973+ pbxt_statistics_table->fill_table = pbxt_statistics_fill_table;
4974
4975 #if defined(XT_WIN) && defined(XT_COREDUMP)
4976 void register_crash_filter();
4977@@ -1645,8 +1713,16 @@
4978 return 0;
4979 }
4980
4981-int pbxt_exit_statitics(void *p __attribute__((unused)))
4982+#ifdef DRIZZLED
4983+int pbxt_exit_statitics(PluginRegistry &registry)
4984+#else
4985+int pbxt_exit_statitics(void *XT_UNUSED(p))
4986+#endif
4987 {
4988+#ifdef DRIZZLED
4989+ registry.remove(pbxt_statistics_table);
4990+ xt_free_ns(pbxt_statistics_table);
4991+#endif
4992 return(0);
4993 }
4994
4995@@ -1765,7 +1841,7 @@
4996 */
4997 #define FLAGS_ARE_READ_DYNAMICALLY
4998
4999-MX_ULONG_T ha_pbxt::index_flags(uint inx __attribute__((unused)), uint part __attribute__((unused)), bool all_parts __attribute__((unused))) const
5000+MX_ULONG_T ha_pbxt::index_flags(uint XT_UNUSED(inx), uint XT_UNUSED(part), bool XT_UNUSED(all_parts)) const
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches