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

Proposed by Paul McCullagh
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 Pending
Review via email: mp+10303@code.launchpad.net
To post a comment you must log in.
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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...

=== modified file 'mysql-test/suite/pbxt/r/lowercase_view.result'
--- mysql-test/suite/pbxt/r/lowercase_view.result 2009-04-02 20:36:52 +0000
+++ mysql-test/suite/pbxt/r/lowercase_view.result 2009-08-28 11:19:59 +0000
@@ -119,7 +119,7 @@ create table t1Aa (col1 int);
119create view v1Aa as select col1 from t1Aa as AaA;119create view v1Aa as select col1 from t1Aa as AaA;
120show create view v1AA;120show create view v1AA;
121View Create View character_set_client collation_connection121View Create View character_set_client collation_connection
122v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci122v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
123drop view v1AA;123drop view v1AA;
124select Aaa.col1 from t1Aa as AaA;124select Aaa.col1 from t1Aa as AaA;
125col1125col1
@@ -128,7 +128,7 @@ drop view v1AA;
128create view v1Aa as select AaA.col1 from t1Aa as AaA;128create view v1Aa as select AaA.col1 from t1Aa as AaA;
129show create view v1AA;129show create view v1AA;
130View Create View character_set_client collation_connection130View Create View character_set_client collation_connection
131v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci131v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
132drop view v1AA;132drop view v1AA;
133drop table t1Aa;133drop table t1Aa;
134CREATE TABLE t1 (a int, b int);134CREATE TABLE t1 (a int, b int);
@@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS
142select X.a from t1 AS X group by X.b having (X.a = 1);142select X.a from t1 AS X group by X.b having (X.a = 1);
143SHOW CREATE VIEW v1;143SHOW CREATE VIEW v1;
144View Create View character_set_client collation_connection144View Create View character_set_client collation_connection
145v1 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_ci145v1 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
146SELECT * FROM v1;146SELECT * FROM v1;
147a147a
148DROP VIEW v1;148DROP VIEW v1;
149149
=== added file 'mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 2009-08-28 11:13:02 +0000
@@ -0,0 +1 @@
1--lower_case_table_names
02
=== added file 'mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 2009-08-28 11:22:29 +0000
@@ -0,0 +1 @@
1--lower_case_table_names
02
=== added file 'mysql-test/suite/pbxt/t/lowercase_view-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_view-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_view-master.opt 2009-08-28 11:10:22 +0000
@@ -0,0 +1 @@
1--lower_case_table_names=1
02
=== added file 'mysql-test/suite/pbxt/t/udf-master.opt'
--- mysql-test/suite/pbxt/t/udf-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/udf-master.opt 2009-08-28 11:24:08 +0000
@@ -0,0 +1 @@
1$UDF_EXAMPLE_LIB_OPT
Revision history for this message
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...

Revision history for this message
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.

=== modified file 'mysql-test/suite/pbxt/r/lowercase_view.result'
--- mysql-test/suite/pbxt/r/lowercase_view.result 2009-04-02 20:36:52 +0000
+++ mysql-test/suite/pbxt/r/lowercase_view.result 2009-08-31 11:07:44 +0000
@@ -119,7 +119,7 @@ create table t1Aa (col1 int);
119create view v1Aa as select col1 from t1Aa as AaA;119create view v1Aa as select col1 from t1Aa as AaA;
120show create view v1AA;120show create view v1AA;
121View Create View character_set_client collation_connection121View Create View character_set_client collation_connection
122v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci122v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
123drop view v1AA;123drop view v1AA;
124select Aaa.col1 from t1Aa as AaA;124select Aaa.col1 from t1Aa as AaA;
125col1125col1
@@ -128,7 +128,7 @@ drop view v1AA;
128create view v1Aa as select AaA.col1 from t1Aa as AaA;128create view v1Aa as select AaA.col1 from t1Aa as AaA;
129show create view v1AA;129show create view v1AA;
130View Create View character_set_client collation_connection130View Create View character_set_client collation_connection
131v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci131v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
132drop view v1AA;132drop view v1AA;
133drop table t1Aa;133drop table t1Aa;
134CREATE TABLE t1 (a int, b int);134CREATE TABLE t1 (a int, b int);
@@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS
142select X.a from t1 AS X group by X.b having (X.a = 1);142select X.a from t1 AS X group by X.b having (X.a = 1);
143SHOW CREATE VIEW v1;143SHOW CREATE VIEW v1;
144View Create View character_set_client collation_connection144View Create View character_set_client collation_connection
145v1 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_ci145v1 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
146SELECT * FROM v1;146SELECT * FROM v1;
147a147a
148DROP VIEW v1;148DROP VIEW v1;
149149
=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
--- mysql-test/suite/pbxt/r/ps_1general.result 2009-08-17 15:57:58 +0000
+++ mysql-test/suite/pbxt/r/ps_1general.result 2009-08-31 11:07:44 +0000
@@ -293,7 +293,7 @@ t2 1 t2_idx 1 b A 0 NULL NULL YES BTREE
293prepare stmt4 from ' show table status from test like ''t2%'' ';293prepare stmt4 from ' show table status from test like ''t2%'' ';
294execute stmt4;294execute stmt4;
295Name 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 Comment295Name 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
296t2 PBXT 10 Fixed 0 29 1 # 4096 0 NULL # # # latin1_swedish_ci NULL 296t2 PBXT 10 Fixed 0 29 1024 # 4096 0 NULL # # # latin1_swedish_ci NULL
297prepare stmt4 from ' show table status from test like ''t9%'' ';297prepare stmt4 from ' show table status from test like ''t9%'' ';
298execute stmt4;298execute stmt4;
299Name 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 Comment299Name 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
300300
=== added file 'mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_table_grant-master.opt 2009-08-31 11:07:44 +0000
@@ -0,0 +1 @@
1--lower_case_table_names
02
=== added file 'mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_table_qcache-master.opt 2009-08-31 11:07:44 +0000
@@ -0,0 +1 @@
1--lower_case_table_names
02
=== added file 'mysql-test/suite/pbxt/t/lowercase_view-master.opt'
--- mysql-test/suite/pbxt/t/lowercase_view-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/lowercase_view-master.opt 2009-08-31 11:07:44 +0000
@@ -0,0 +1 @@
1--lower_case_table_names=1
02
=== added file 'mysql-test/suite/pbxt/t/udf-master.opt'
--- mysql-test/suite/pbxt/t/udf-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/pbxt/t/udf-master.opt 2009-08-31 11:07:44 +0000
@@ -0,0 +1 @@
1$UDF_EXAMPLE_LIB_OPT
02
=== modified file 'storage/pbxt/src/Makefile.am'
--- storage/pbxt/src/Makefile.am 2009-05-09 04:01:53 +0000
+++ storage/pbxt/src/Makefile.am 2009-08-31 11:07:44 +0000
@@ -19,7 +19,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.
19 datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \19 datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \
20 ha_pbxt.h heap_xt.h index_xt.h linklist_xt.h \20 ha_pbxt.h heap_xt.h index_xt.h linklist_xt.h \
21 memory_xt.h myxt_xt.h pthread_xt.h restart_xt.h \21 memory_xt.h myxt_xt.h pthread_xt.h restart_xt.h \
22 streaming_xt.h sortedlist_xt.h strutil_xt.h \22 pbms_enabled.h sortedlist_xt.h strutil_xt.h \
23 tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \23 tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
24 util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \24 util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
25 systab_xt.h ha_xtsys.h discover_xt.h \25 systab_xt.h ha_xtsys.h discover_xt.h \
@@ -30,7 +30,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache
30 datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \30 datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
31 ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \31 ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
32 memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \32 memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
33 streaming_xt.cc sortedlist_xt.cc strutil_xt.cc \33 pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
34 tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \34 tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
35 systab_xt.cc ha_xtsys.cc discover_xt.cc \35 systab_xt.cc ha_xtsys.cc discover_xt.cc \
36 util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc36 util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
3737
=== modified file 'storage/pbxt/src/xt_config.h'
--- storage/pbxt/src/xt_config.h 2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/xt_config.h 2009-08-31 11:07:44 +0000
@@ -81,7 +81,8 @@ const int max_connections = 500;
81#define DEBUG81#define DEBUG
82#endif // _DEBUG82#endif // _DEBUG
83#else83#else
84#define PBMS_ENABLED84// Paul suggested to disable PBMS in MariaDB for now.
85// #define PBMS_ENABLED
85#endif86#endif
8687
87#ifdef __FreeBSD__88#ifdef __FreeBSD__
Revision history for this message
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

Revision history for this message
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
=== modified file 'mysql-test/suite/pbxt/r/alter_table.result'
--- mysql-test/suite/pbxt/r/alter_table.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/alter_table.result 2009-08-17 11:12:36 +0000
@@ -126,23 +126,23 @@
126alter table t1 disable keys;126alter table t1 disable keys;
127show keys from t1;127show keys from t1;
128Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment128Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
129t1 0 n1 1 n1 NULL 0 NULL NULL BTREE 129t1 0 n1 1 n1 A 0 NULL NULL BTREE
130t1 1 n1_2 1 n1 NULL NULL NULL NULL BTREE 130t1 1 n1_2 1 n1 A 0 NULL NULL BTREE
131t1 1 n1_2 2 n2 NULL NULL NULL NULL YES BTREE 131t1 1 n1_2 2 n2 A 0 NULL NULL YES BTREE
132t1 1 n1_2 3 n3 NULL NULL NULL NULL YES BTREE 132t1 1 n1_2 3 n3 A 0 NULL NULL YES BTREE
133t1 1 n1_2 4 n4 NULL NULL NULL NULL YES BTREE 133t1 1 n1_2 4 n4 A 0 NULL NULL YES BTREE
134t1 1 n2 1 n2 NULL NULL NULL NULL YES BTREE 134t1 1 n2 1 n2 A 0 NULL NULL YES BTREE
135t1 1 n2 2 n3 NULL NULL NULL NULL YES BTREE 135t1 1 n2 2 n3 A 0 NULL NULL YES BTREE
136t1 1 n2 3 n4 NULL NULL NULL NULL YES BTREE 136t1 1 n2 3 n4 A 0 NULL NULL YES BTREE
137t1 1 n2 4 n1 NULL NULL NULL NULL BTREE 137t1 1 n2 4 n1 A 0 NULL NULL BTREE
138t1 1 n3 1 n3 NULL NULL NULL NULL YES BTREE 138t1 1 n3 1 n3 A 0 NULL NULL YES BTREE
139t1 1 n3 2 n4 NULL NULL NULL NULL YES BTREE 139t1 1 n3 2 n4 A 0 NULL NULL YES BTREE
140t1 1 n3 3 n1 NULL NULL NULL NULL BTREE 140t1 1 n3 3 n1 A 0 NULL NULL BTREE
141t1 1 n3 4 n2 NULL NULL NULL NULL YES BTREE 141t1 1 n3 4 n2 A 0 NULL NULL YES BTREE
142t1 1 n4 1 n4 NULL NULL NULL NULL YES BTREE 142t1 1 n4 1 n4 A 0 NULL NULL YES BTREE
143t1 1 n4 2 n1 NULL NULL NULL NULL BTREE 143t1 1 n4 2 n1 A 0 NULL NULL BTREE
144t1 1 n4 3 n2 NULL NULL NULL NULL YES BTREE 144t1 1 n4 3 n2 A 0 NULL NULL YES BTREE
145t1 1 n4 4 n3 NULL NULL NULL NULL YES BTREE 145t1 1 n4 4 n3 A 0 NULL NULL YES BTREE
146insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());146insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
147insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());147insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
148insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());148insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
@@ -156,23 +156,23 @@
156alter table t1 enable keys;156alter table t1 enable keys;
157show keys from t1;157show keys from t1;
158Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment158Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
159t1 0 n1 1 n1 NULL 10 NULL NULL BTREE 159t1 0 n1 1 n1 A 10 NULL NULL BTREE
160t1 1 n1_2 1 n1 NULL NULL NULL NULL BTREE 160t1 1 n1_2 1 n1 A 10 NULL NULL BTREE
161t1 1 n1_2 2 n2 NULL NULL NULL NULL YES BTREE 161t1 1 n1_2 2 n2 A 10 NULL NULL YES BTREE
162t1 1 n1_2 3 n3 NULL NULL NULL NULL YES BTREE 162t1 1 n1_2 3 n3 A 10 NULL NULL YES BTREE
163t1 1 n1_2 4 n4 NULL NULL NULL NULL YES BTREE 163t1 1 n1_2 4 n4 A 10 NULL NULL YES BTREE
164t1 1 n2 1 n2 NULL NULL NULL NULL YES BTREE 164t1 1 n2 1 n2 A 10 NULL NULL YES BTREE
165t1 1 n2 2 n3 NULL NULL NULL NULL YES BTREE 165t1 1 n2 2 n3 A 10 NULL NULL YES BTREE
166t1 1 n2 3 n4 NULL NULL NULL NULL YES BTREE 166t1 1 n2 3 n4 A 10 NULL NULL YES BTREE
167t1 1 n2 4 n1 NULL NULL NULL NULL BTREE 167t1 1 n2 4 n1 A 10 NULL NULL BTREE
168t1 1 n3 1 n3 NULL NULL NULL NULL YES BTREE 168t1 1 n3 1 n3 A 10 NULL NULL YES BTREE
169t1 1 n3 2 n4 NULL NULL NULL NULL YES BTREE 169t1 1 n3 2 n4 A 10 NULL NULL YES BTREE
170t1 1 n3 3 n1 NULL NULL NULL NULL BTREE 170t1 1 n3 3 n1 A 10 NULL NULL BTREE
171t1 1 n3 4 n2 NULL NULL NULL NULL YES BTREE 171t1 1 n3 4 n2 A 10 NULL NULL YES BTREE
172t1 1 n4 1 n4 NULL NULL NULL NULL YES BTREE 172t1 1 n4 1 n4 A 10 NULL NULL YES BTREE
173t1 1 n4 2 n1 NULL NULL NULL NULL BTREE 173t1 1 n4 2 n1 A 10 NULL NULL BTREE
174t1 1 n4 3 n2 NULL NULL NULL NULL YES BTREE 174t1 1 n4 3 n2 A 10 NULL NULL YES BTREE
175t1 1 n4 4 n3 NULL NULL NULL NULL YES BTREE 175t1 1 n4 4 n3 A 10 NULL NULL YES BTREE
176drop table t1;176drop table t1;
177create table t1 (i int unsigned not null auto_increment primary key);177create table t1 (i int unsigned not null auto_increment primary key);
178alter table t1 rename t2;178alter table t1 rename t2;
@@ -286,17 +286,17 @@
286alter table t1 add unique (a,b), add key (b);286alter table t1 add unique (a,b), add key (b);
287show keys from t1;287show keys from t1;
288Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment288Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
289t1 0 a 1 a A NULL NULL NULL YES BTREE 289t1 0 a 1 a A 300 NULL NULL YES BTREE
290t1 0 a 2 b A NULL NULL NULL YES BTREE 290t1 0 a 2 b A 300 NULL NULL YES BTREE
291t1 1 b 1 b A NULL NULL NULL YES BTREE 291t1 1 b 1 b A 300 NULL NULL YES BTREE
292analyze table t1;292analyze table t1;
293Table Op Msg_type Msg_text293Table Op Msg_type Msg_text
294test.t1 analyze status OK294test.t1 analyze status OK
295show keys from t1;295show keys from t1;
296Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment296Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
297t1 0 a 1 a A NULL NULL NULL YES BTREE 297t1 0 a 1 a A 300 NULL NULL YES BTREE
298t1 0 a 2 b A NULL NULL NULL YES BTREE 298t1 0 a 2 b A 300 NULL NULL YES BTREE
299t1 1 b 1 b A NULL NULL NULL YES BTREE 299t1 1 b 1 b A 300 NULL NULL YES BTREE
300drop table t1;300drop table t1;
301CREATE TABLE t1 (i int(10), index(i) );301CREATE TABLE t1 (i int(10), index(i) );
302ALTER TABLE t1 DISABLE KEYS;302ALTER TABLE t1 DISABLE KEYS;
@@ -545,37 +545,37 @@
545create table t1 (a int, key(a));545create table t1 (a int, key(a));
546show indexes from t1;546show indexes from t1;
547Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment547Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
548t1 1 a 1 a A NULL NULL NULL YES BTREE 548t1 1 a 1 a A 0 NULL NULL YES BTREE
549"this used not to disable the index"549"this used not to disable the index"
550alter table t1 modify a int, disable keys;550alter table t1 modify a int, disable keys;
551show indexes from t1;551show indexes from t1;
552Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment552Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
553t1 1 a 1 a A NULL NULL NULL YES BTREE 553t1 1 a 1 a A 0 NULL NULL YES BTREE
554alter table t1 enable keys;554alter table t1 enable keys;
555show indexes from t1;555show indexes from t1;
556Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment556Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
557t1 1 a 1 a NULL NULL NULL NULL YES BTREE 557t1 1 a 1 a A 0 NULL NULL YES BTREE
558alter table t1 modify a bigint, disable keys;558alter table t1 modify a bigint, disable keys;
559show indexes from t1;559show indexes from t1;
560Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment560Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
561t1 1 a 1 a A NULL NULL NULL YES BTREE 561t1 1 a 1 a A 0 NULL NULL YES BTREE
562alter table t1 enable keys;562alter table t1 enable keys;
563show indexes from t1;563show indexes from t1;
564Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment564Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
565t1 1 a 1 a NULL NULL NULL NULL YES BTREE 565t1 1 a 1 a A 0 NULL NULL YES BTREE
566alter table t1 add b char(10), disable keys;566alter table t1 add b char(10), disable keys;
567show indexes from t1;567show indexes from t1;
568Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment568Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
569t1 1 a 1 a A NULL NULL NULL YES BTREE 569t1 1 a 1 a A 0 NULL NULL YES BTREE
570alter table t1 add c decimal(10,2), enable keys;570alter table t1 add c decimal(10,2), enable keys;
571show indexes from t1;571show indexes from t1;
572Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment572Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
573t1 1 a 1 a A NULL NULL NULL YES BTREE 573t1 1 a 1 a A 0 NULL NULL YES BTREE
574"this however did"574"this however did"
575alter table t1 disable keys;575alter table t1 disable keys;
576show indexes from t1;576show indexes from t1;
577Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment577Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
578t1 1 a 1 a NULL NULL NULL NULL YES BTREE 578t1 1 a 1 a A 0 NULL NULL YES BTREE
579desc t1;579desc t1;
580Field Type Null Key Default Extra580Field Type Null Key Default Extra
581a bigint(20) YES MUL NULL 581a bigint(20) YES MUL NULL
@@ -585,7 +585,7 @@
585"The key should still be disabled"585"The key should still be disabled"
586show indexes from t1;586show indexes from t1;
587Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment587Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
588t1 1 a 1 a A NULL NULL NULL YES BTREE 588t1 1 a 1 a A 0 NULL NULL YES BTREE
589drop table t1;589drop table t1;
590"Now will test with one unique index"590"Now will test with one unique index"
591create table t1(a int, b char(10), unique(a));591create table t1(a int, b char(10), unique(a));
@@ -595,7 +595,7 @@
595alter table t1 disable keys;595alter table t1 disable keys;
596show indexes from t1;596show indexes from t1;
597Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment597Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
598t1 0 a 1 a NULL 0 NULL NULL YES BTREE 598t1 0 a 1 a A 0 NULL NULL YES BTREE
599alter table t1 enable keys;599alter table t1 enable keys;
600"If no copy on noop change, this won't touch the data file"600"If no copy on noop change, this won't touch the data file"
601"Unique index, no change"601"Unique index, no change"
@@ -623,12 +623,12 @@
623show indexes from t1;623show indexes from t1;
624Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment624Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
625t1 0 a 1 a A 0 NULL NULL YES BTREE 625t1 0 a 1 a A 0 NULL NULL YES BTREE
626t1 1 b 1 b A NULL NULL NULL YES BTREE 626t1 1 b 1 b A 0 NULL NULL YES BTREE
627alter table t1 disable keys;627alter table t1 disable keys;
628show indexes from t1;628show indexes from t1;
629Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment629Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
630t1 0 a 1 a NULL 0 NULL NULL YES BTREE 630t1 0 a 1 a A 0 NULL NULL YES BTREE
631t1 1 b 1 b NULL NULL NULL NULL YES BTREE 631t1 1 b 1 b A 0 NULL NULL YES BTREE
632alter table t1 enable keys;632alter table t1 enable keys;
633"If no copy on noop change, this won't touch the data file"633"If no copy on noop change, this won't touch the data file"
634"The non-unique index will be disabled"634"The non-unique index will be disabled"
@@ -636,31 +636,31 @@
636show indexes from t1;636show indexes from t1;
637Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment637Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
638t1 0 a 1 a A 0 NULL NULL YES BTREE 638t1 0 a 1 a A 0 NULL NULL YES BTREE
639t1 1 b 1 b A NULL NULL NULL YES BTREE 639t1 1 b 1 b A 0 NULL NULL YES BTREE
640alter table t1 enable keys;640alter table t1 enable keys;
641show indexes from t1;641show indexes from t1;
642Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment642Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
643t1 0 a 1 a NULL 0 NULL NULL YES BTREE 643t1 0 a 1 a A 0 NULL NULL YES BTREE
644t1 1 b 1 b NULL NULL NULL NULL YES BTREE 644t1 1 b 1 b A 0 NULL NULL YES BTREE
645"Change the type implying data copy"645"Change the type implying data copy"
646"The non-unique index will be disabled"646"The non-unique index will be disabled"
647alter table t1 modify a bigint, disable keys;647alter table t1 modify a bigint, disable keys;
648show indexes from t1;648show indexes from t1;
649Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment649Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
650t1 0 a 1 a A 0 NULL NULL YES BTREE 650t1 0 a 1 a A 0 NULL NULL YES BTREE
651t1 1 b 1 b A NULL NULL NULL YES BTREE 651t1 1 b 1 b A 0 NULL NULL YES BTREE
652"Change again the type, but leave the indexes as_is"652"Change again the type, but leave the indexes as_is"
653alter table t1 modify a int;653alter table t1 modify a int;
654show indexes from t1;654show indexes from t1;
655Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment655Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
656t1 0 a 1 a A 0 NULL NULL YES BTREE 656t1 0 a 1 a A 0 NULL NULL YES BTREE
657t1 1 b 1 b A NULL NULL NULL YES BTREE 657t1 1 b 1 b A 0 NULL NULL YES BTREE
658"Try the same. When data is no copied on similar tables, this is noop"658"Try the same. When data is no copied on similar tables, this is noop"
659alter table t1 modify a int;659alter table t1 modify a int;
660show indexes from t1;660show indexes from t1;
661Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment661Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
662t1 0 a 1 a A 0 NULL NULL YES BTREE 662t1 0 a 1 a A 0 NULL NULL YES BTREE
663t1 1 b 1 b A NULL NULL NULL YES BTREE 663t1 1 b 1 b A 0 NULL NULL YES BTREE
664drop table t1;664drop table t1;
665create database mysqltest;665create database mysqltest;
666create table t1 (c1 int);666create table t1 (c1 int);
@@ -697,11 +697,11 @@
697CREATE TABLE bug24219 (a INT, INDEX(a));697CREATE TABLE bug24219 (a INT, INDEX(a));
698SHOW INDEX FROM bug24219;698SHOW INDEX FROM bug24219;
699Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment699Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
700bug24219 1 a 1 a A NULL NULL NULL YES BTREE 700bug24219 1 a 1 a A 0 NULL NULL YES BTREE
701ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;701ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
702SHOW INDEX FROM bug24219_2;702SHOW INDEX FROM bug24219_2;
703Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment703Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
704bug24219_2 1 a 1 a A NULL NULL NULL YES BTREE 704bug24219_2 1 a 1 a A 0 NULL NULL YES BTREE
705DROP TABLE bug24219_2;705DROP TABLE bug24219_2;
706create table t1 (mycol int(10) not null);706create table t1 (mycol int(10) not null);
707alter table t1 alter column mycol set default 0;707alter table t1 alter column mycol set default 0;
@@ -882,7 +882,7 @@
882char_field char(10) YES NULL 882char_field char(10) YES NULL
883SHOW INDEXES FROM t1;883SHOW INDEXES FROM t1;
884Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment884Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
885t1 1 int_field 1 int_field A NULL NULL NULL BTREE 885t1 1 int_field 1 int_field A 0 NULL NULL BTREE
886INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");886INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
887"Non-copy data change - new frm, but old data and index files"887"Non-copy data change - new frm, but old data and index files"
888ALTER TABLE t1888ALTER TABLE t1
889889
=== modified file 'mysql-test/suite/pbxt/r/analyze.result'
--- mysql-test/suite/pbxt/r/analyze.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/analyze.result 2009-08-17 15:57:58 +0000
@@ -56,5 +56,5 @@
56test.t1 analyze status OK56test.t1 analyze status OK
57show index from t1;57show index from t1;
58Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment58Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
59t1 1 a 1 a A NULL NULL NULL YES BTREE 59t1 1 a 1 a A 5 NULL NULL YES BTREE
60drop table t1;60drop table t1;
6161
=== modified file 'mysql-test/suite/pbxt/r/auto_increment.result'
--- mysql-test/suite/pbxt/r/auto_increment.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/auto_increment.result 2009-08-17 15:57:58 +0000
@@ -229,7 +229,8 @@
229204 7229204 7
230delete from t1 where a=0;230delete from t1 where a=0;
231update t1 set a=NULL where b=6;231update t1 set a=NULL where b=6;
232ERROR 23000: Column 'a' cannot be null232Warnings:
233Warning 1048 Column 'a' cannot be null
233update t1 set a=300 where b=7;234update t1 set a=300 where b=7;
234SET SQL_MODE='';235SET SQL_MODE='';
235insert into t1(a,b)values(NULL,8);236insert into t1(a,b)values(NULL,8);
@@ -244,7 +245,7 @@
2441 12451 1
245200 2246200 2
246201 4247201 4
247203 62480 6
248300 7249300 7
249301 8250301 8
250400 9251400 9
@@ -260,7 +261,6 @@
2601 12611 1
261200 2262200 2
262201 4263201 4
263203 6
264300 7264300 7
265301 8265301 8
266400 9266400 9
@@ -271,20 +271,20 @@
271405 14271405 14
272delete from t1 where a=0;272delete from t1 where a=0;
273update t1 set a=NULL where b=13;273update t1 set a=NULL where b=13;
274ERROR 23000: Column 'a' cannot be null274Warnings:
275Warning 1048 Column 'a' cannot be null
275update t1 set a=500 where b=14;276update t1 set a=500 where b=14;
276select * from t1 order by b;277select * from t1 order by b;
277a b278a b
2781 12791 1
279200 2280200 2
280201 4281201 4
281203 6
282300 7282300 7
283301 8283301 8
284400 9284400 9
285401 10285401 10
286402 11286402 11
287404 132870 13
288500 14288500 14
289drop table t1;289drop table t1;
290create table t1 (a bigint);290create table t1 (a bigint);
291291
=== modified file 'mysql-test/suite/pbxt/r/delete.result'
--- mysql-test/suite/pbxt/r/delete.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/delete.result 2009-08-17 15:57:58 +0000
@@ -125,18 +125,19 @@
1250 111250 11
1262 121262 12
127delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);127delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
128Warnings:128ERROR 21000: Subquery returns more than 1 row
129Error 1242 Subquery returns more than 1 row
130Error 1242 Subquery returns more than 1 row
131select * from t11;129select * from t11;
132a b130a b
1330 101310 10
1341 111321 11
1332 12
135select * from t12;134select * from t12;
136a b135a b
13733 1013633 10
1380 111370 11
1382 12
139insert into t11 values (2, 12);139insert into t11 values (2, 12);
140ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
140delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);141delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
141ERROR 21000: Subquery returns more than 1 row142ERROR 21000: Subquery returns more than 1 row
142select * from t11;143select * from t11;
@@ -145,13 +146,12 @@
1451 111461 11
1462 121472 12
147delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);148delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
148Warnings:149ERROR 21000: Subquery returns more than 1 row
149Error 1242 Subquery returns more than 1 row
150Error 1242 Subquery returns more than 1 row
151select * from t11;150select * from t11;
152a b151a b
1530 101520 10
1541 111531 11
1542 12
155drop table t11, t12, t2;155drop table t11, t12, t2;
156create table t1 (a int, b int, unique key (a), key (b));156create table t1 (a int, b int, unique key (a), key (b));
157insert into t1 values (3, 3), (7, 7);157insert into t1 values (3, 3), (7, 7);
158158
=== modified file 'mysql-test/suite/pbxt/r/distinct.result'
--- mysql-test/suite/pbxt/r/distinct.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/distinct.result 2009-08-17 15:57:58 +0000
@@ -174,8 +174,8 @@
174explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;174explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
175id select_type table type possible_keys key key_len ref rows Extra175id select_type table type possible_keys key key_len ref rows Extra
1761 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary1761 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
1771 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index1771 SIMPLE t2 ref a a 4 test.t1.a 1 Using index
1781 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct; Using join buffer1781 SIMPLE t3 ref a a 5 test.t1.b 1 Using where; Using index
179SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;179SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
180a180a
18111811
@@ -190,7 +190,7 @@
190explain select distinct t1.a from t1,t3 where t1.a=t3.a;190explain select distinct t1.a from t1,t3 where t1.a=t3.a;
191id select_type table type possible_keys key key_len ref rows Extra191id select_type table type possible_keys key key_len ref rows Extra
1921 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary1921 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1931 SIMPLE t3 ref a a 5 test.t1.a 11 Using where; Using index; Distinct1931 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using index; Distinct
194select distinct t1.a from t1,t3 where t1.a=t3.a;194select distinct t1.a from t1,t3 where t1.a=t3.a;
195a195a
19611961
@@ -212,7 +212,7 @@
2121 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index2121 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
213explain SELECT distinct a from t3 order by a desc limit 2;213explain SELECT distinct a from t3 order by a desc limit 2;
214id select_type table type possible_keys key key_len ref rows Extra214id select_type table type possible_keys key key_len ref rows Extra
2151 SIMPLE t3 index NULL a 5 NULL 40 Using index2151 SIMPLE t3 index NULL a 5 NULL 2 Using index
216explain SELECT distinct a,b from t3 order by a+1;216explain SELECT distinct a,b from t3 order by a+1;
217id select_type table type possible_keys key key_len ref rows Extra217id select_type table type possible_keys key key_len ref rows Extra
2181 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort2181 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
219219
=== modified file 'mysql-test/suite/pbxt/r/func_group.result'
--- mysql-test/suite/pbxt/r/func_group.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/func_group.result 2009-08-17 15:57:58 +0000
@@ -61,7 +61,7 @@
61NULL NULL61NULL NULL
621 7621 7
632 20.25632 20.25
643 45.483163247594643 45.4831632475944
65create table t2 (grp int, a bigint unsigned, c char(10));65create table t2 (grp int, a bigint unsigned, c char(10));
66insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;66insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
67replace into t2 select grp, a, c from t1 limit 2,1;67replace into t2 select grp, a, c from t1 limit 2,1;
@@ -613,8 +613,8 @@
613explain613explain
614select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';614select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
615id select_type table type possible_keys key key_len ref rows Extra615id select_type table type possible_keys key key_len ref rows Extra
6161 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index6161 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index
6171 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index; Using join buffer6171 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index; Using join buffer
618explain618explain
619select min(a4 - 0.01) from t1;619select min(a4 - 0.01) from t1;
620id select_type table type possible_keys key key_len ref rows Extra620id select_type table type possible_keys key key_len ref rows Extra
@@ -1186,7 +1186,7 @@
11860.2132576411860.21325764
1187select std(o1/o2) from bug22555;1187select std(o1/o2) from bug22555;
1188std(o1/o2)1188std(o1/o2)
11890.2132576358664911890.213257635866493
1190select std(e1/e2) from bug22555;1190select std(e1/e2) from bug22555;
1191std(e1/e2)1191std(e1/e2)
11920.2132576411920.21325764
@@ -1212,7 +1212,7 @@
12120.2132576358664934112120.21325763586649341
1213select std(o1/o2) from bug22555;1213select std(o1/o2) from bug22555;
1214std(o1/o2)1214std(o1/o2)
12150.2132576358664912150.213257635866493
1216select round(std(e1/e2), 17) from bug22555;1216select round(std(e1/e2), 17) from bug22555;
1217round(std(e1/e2), 17)1217round(std(e1/e2), 17)
12180.2132576358664934112180.21325763586649341
@@ -1237,7 +1237,7 @@
12370.2132576358664934112370.21325763586649341
1238select std(o1/o2) from bug22555;1238select std(o1/o2) from bug22555;
1239std(o1/o2)1239std(o1/o2)
12400.2132576358664912400.213257635866493
1241select round(std(e1/e2), 17) from bug22555;1241select round(std(e1/e2), 17) from bug22555;
1242round(std(e1/e2), 17)1242round(std(e1/e2), 17)
12430.2132576358664934112430.21325763586649341
12441244
=== modified file 'mysql-test/suite/pbxt/r/func_math.result'
--- mysql-test/suite/pbxt/r/func_math.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/func_math.result 2009-08-17 15:57:58 +0000
@@ -60,7 +60,7 @@
60Note 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)`60Note 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)`
61select log2(8),log2(15),log2(-2),log2(0),log2(NULL);61select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
62log2(8) log2(15) log2(-2) log2(0) log2(NULL)62log2(8) log2(15) log2(-2) log2(0) log2(NULL)
633 3.9068905956085 NULL NULL NULL633 3.90689059560852 NULL NULL NULL
64explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);64explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
65id select_type table type possible_keys key key_len ref rows filtered Extra65id select_type table type possible_keys key key_len ref rows filtered Extra
661 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used661 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -68,7 +68,7 @@
68Note 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)`68Note 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)`
69select log10(100),log10(18),log10(-4),log10(0),log10(NULL);69select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
70log10(100) log10(18) log10(-4) log10(0) log10(NULL)70log10(100) log10(18) log10(-4) log10(0) log10(NULL)
712 1.2552725051033 NULL NULL NULL712 1.25527250510331 NULL NULL NULL
72explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);72explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
73id select_type table type possible_keys key key_len ref rows filtered Extra73id select_type table type possible_keys key key_len ref rows filtered Extra
741 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used741 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -85,7 +85,7 @@
85set @@rand_seed1=10000000,@@rand_seed2=1000000;85set @@rand_seed1=10000000,@@rand_seed2=1000000;
86select rand(999999),rand();86select rand(999999),rand();
87rand(999999) rand()87rand(999999) rand()
880.014231365187309 0.028870999839968880.0142313651873091 0.028870999839968
89explain extended select rand(999999),rand();89explain extended select rand(999999),rand();
90id select_type table type possible_keys key key_len ref rows filtered Extra90id select_type table type possible_keys key key_len ref rows filtered Extra
911 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used911 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -101,7 +101,7 @@
101Note 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)`101Note 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)`
102select degrees(pi()),radians(360);102select degrees(pi()),radians(360);
103degrees(pi()) radians(360)103degrees(pi()) radians(360)
104180 6.2831853071796104180 6.28318530717959
105select format(atan(-2, 2), 6);105select format(atan(-2, 2), 6);
106format(atan(-2, 2), 6)106format(atan(-2, 2), 6)
107-0.785398107-0.785398
108108
=== modified file 'mysql-test/suite/pbxt/r/func_str.result'
--- mysql-test/suite/pbxt/r/func_str.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/func_str.result 2009-08-17 15:57:58 +0000
@@ -1327,10 +1327,10 @@
132720.06132720.06
1328select conv("18383815659218730760",10,10) + 0;1328select conv("18383815659218730760",10,10) + 0;
1329conv("18383815659218730760",10,10) + 01329conv("18383815659218730760",10,10) + 0
13301.8383815659219e+1913301.83838156592187e+19
1331select "18383815659218730760" + 0;1331select "18383815659218730760" + 0;
1332"18383815659218730760" + 01332"18383815659218730760" + 0
13331.8383815659219e+1913331.83838156592187e+19
1334CREATE TABLE t1 (code varchar(10));1334CREATE TABLE t1 (code varchar(10));
1335INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');1335INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
1336SELECT ASCII(code), code FROM t1 WHERE code='A12';1336SELECT ASCII(code), code FROM t1 WHERE code='A12';
13371337
=== modified file 'mysql-test/suite/pbxt/r/grant.result'
--- mysql-test/suite/pbxt/r/grant.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/grant.result 2009-08-17 15:57:58 +0000
@@ -457,7 +457,7 @@
457Alter Tables To alter the table457Alter Tables To alter the table
458Alter routine Functions,Procedures To alter or drop stored functions/procedures458Alter routine Functions,Procedures To alter or drop stored functions/procedures
459Create Databases,Tables,Indexes To create new databases and tables459Create Databases,Tables,Indexes To create new databases and tables
460Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE460Create routine Databases To use CREATE FUNCTION/PROCEDURE
461Create temporary tables Databases To use CREATE TEMPORARY TABLE461Create temporary tables Databases To use CREATE TEMPORARY TABLE
462Create view Tables To create new views462Create view Tables To create new views
463Create user Server Admin To create new users463Create user Server Admin To create new users
464464
=== modified file 'mysql-test/suite/pbxt/r/group_min_max.result'
--- mysql-test/suite/pbxt/r/group_min_max.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/group_min_max.result 2009-08-17 15:57:58 +0000
@@ -133,34 +133,34 @@
133test.t3 analyze status OK133test.t3 analyze status OK
134explain select a1, min(a2) from t1 group by a1;134explain select a1, min(a2) from t1 group by a1;
135id select_type table type possible_keys key key_len ref rows Extra135id select_type table type possible_keys key key_len ref rows Extra
1361 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by1361 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
137explain select a1, max(a2) from t1 group by a1;137explain select a1, max(a2) from t1 group by a1;
138id select_type table type possible_keys key key_len ref rows Extra138id select_type table type possible_keys key key_len ref rows Extra
1391 SIMPLE t1 range NULL idx_t1_1 65 NULL 10 Using index for group-by1391 SIMPLE t1 range NULL idx_t1_1 65 NULL 129 Using index for group-by
140explain select a1, min(a2), max(a2) from t1 group by a1;140explain select a1, min(a2), max(a2) from t1 group by a1;
141id select_type table type possible_keys key key_len ref rows Extra141id select_type table type possible_keys key key_len ref rows Extra
1421 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by1421 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
143explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;143explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
144id select_type table type possible_keys key key_len ref rows Extra144id select_type table type possible_keys key key_len ref rows Extra
1451 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by1451 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
146explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;146explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
147id select_type table type possible_keys key key_len ref rows Extra147id select_type table type possible_keys key key_len ref rows Extra
1481 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by1481 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
149explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;149explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
150id select_type table type possible_keys key key_len ref rows Extra150id select_type table type possible_keys key key_len ref rows Extra
1511 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by1511 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by
152explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;152explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
153id select_type table type possible_keys key key_len ref rows Extra153id select_type table type possible_keys key key_len ref rows Extra
1541 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by1541 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
155explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;155explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
156id select_type table type possible_keys key key_len ref rows Extra156id select_type table type possible_keys key key_len ref rows Extra
1571 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by1571 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
158explain select min(a2) from t1 group by a1;158explain select min(a2) from t1 group by a1;
159id select_type table type possible_keys key key_len ref rows Extra159id select_type table type possible_keys key key_len ref rows Extra
1601 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using index for group-by1601 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using index for group-by
161explain select a2, min(c), max(c) from t1 group by a1,a2,b;161explain select a2, min(c), max(c) from t1 group by a1,a2,b;
162id select_type table type possible_keys key key_len ref rows Extra162id select_type table type possible_keys key key_len ref rows Extra
1631 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by1631 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
164select a1, min(a2) from t1 group by a1;164select a1, min(a2) from t1 group by a1;
165a1 min(a2)165a1 min(a2)
166a a166a a
@@ -293,13 +293,13 @@
2931 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where2931 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
294explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;294explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
295id select_type table type possible_keys key key_len ref rows Extra295id select_type table type possible_keys key key_len ref rows Extra
2961 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 1 Using where; Using index for group-by2961 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
297explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;297explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
298id select_type table type possible_keys key key_len ref rows Extra298id select_type table type possible_keys key key_len ref rows Extra
2991 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 1 Using where; Using index for group-by2991 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
300explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;300explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
301id select_type table type possible_keys key key_len ref rows Extra301id select_type table type possible_keys key key_len ref rows Extra
3021 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by3021 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
303explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;303explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
304id select_type table type possible_keys key key_len ref rows Extra304id select_type table type possible_keys key key_len ref rows Extra
3051 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 65 NULL 3 Using where; Using index3051 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 65 NULL 3 Using where; Using index
@@ -669,40 +669,40 @@
669d p422669d p422
670explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;670explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
671id select_type table type possible_keys key key_len ref rows Extra671id select_type table type possible_keys key key_len ref rows Extra
6721 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by6721 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
673explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;673explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
674id select_type table type possible_keys key key_len ref rows Extra674id select_type table type possible_keys key key_len ref rows Extra
6751 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by6751 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
676explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;676explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
677id select_type table type possible_keys key key_len ref rows Extra677id select_type table type possible_keys key key_len ref rows Extra
6781 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by6781 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
679explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;679explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
680id select_type table type possible_keys key key_len ref rows Extra680id select_type table type possible_keys key key_len ref rows Extra
6811 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by6811 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
682explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;682explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
683id select_type table type possible_keys key key_len ref rows Extra683id select_type table type possible_keys key key_len ref rows Extra
6841 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by6841 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
685explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;685explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
686id select_type table type possible_keys key key_len ref rows Extra686id select_type table type possible_keys key key_len ref rows Extra
6871 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by6871 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
688explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;688explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
689id select_type table type possible_keys key key_len ref rows Extra689id select_type table type possible_keys key key_len ref rows Extra
6901 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by6901 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
691explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;691explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
692id select_type table type possible_keys key key_len ref rows Extra692id select_type table type possible_keys key key_len ref rows Extra
6931 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by6931 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
694explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;694explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
695id select_type table type possible_keys key key_len ref rows Extra695id select_type table type possible_keys key key_len ref rows Extra
6961 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by6961 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
697explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;697explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
698id select_type table type possible_keys key key_len ref rows Extra698id select_type table type possible_keys key key_len ref rows Extra
6991 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by6991 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
700explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;700explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
701id select_type table type possible_keys key key_len ref rows Extra701id select_type table type possible_keys key key_len ref rows Extra
7021 SIMPLE t3 range NULL idx_t3_1 6 NULL 10 Using where; Using index for group-by7021 SIMPLE t3 range NULL idx_t3_1 6 NULL 193 Using where; Using index for group-by
703explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;703explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
704id select_type table type possible_keys key key_len ref rows Extra704id select_type table type possible_keys key key_len ref rows Extra
7051 SIMPLE t3 range NULL idx_t3_1 6 NULL 10 Using where; Using index for group-by7051 SIMPLE t3 range NULL idx_t3_1 6 NULL 193 Using where; Using index for group-by
706select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;706select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
707a1 a2 b max(c) min(c)707a1 a2 b max(c) min(c)
708a a b h112 e112708a a b h112 e112
@@ -804,22 +804,22 @@
804c h312 e312804c h312 e312
805explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;805explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
806id select_type table type possible_keys key key_len ref rows Extra806id select_type table type possible_keys key key_len ref rows Extra
8071 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by8071 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
808explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;808explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
809id select_type table type possible_keys key key_len ref rows Extra809id select_type table type possible_keys key key_len ref rows Extra
8101 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by8101 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
811explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;811explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
812id select_type table type possible_keys key key_len ref rows Extra812id select_type table type possible_keys key key_len ref rows Extra
8131 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by8131 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
814explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;814explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
815id select_type table type possible_keys key key_len ref rows Extra815id select_type table type possible_keys key key_len ref rows Extra
8161 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by8161 SIMPLE t2 range NULL idx_t2_1 146 NULL 165 Using where; Using index for group-by
817explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;817explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
818id select_type table type possible_keys key key_len ref rows Extra818id select_type table type possible_keys key key_len ref rows Extra
8191 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by8191 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
820explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;820explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
821id select_type table type possible_keys key key_len ref rows Extra821id select_type table type possible_keys key key_len ref rows Extra
8221 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by8221 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 Using where; Using index for group-by
823select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;823select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
824a1 a2 b min(c)824a1 a2 b min(c)
825a a NULL a777825a a NULL a777
@@ -849,49 +849,49 @@
8491 SIMPLE t1 range NULL idx_t1_1 147 NULL # Using where; Using index for group-by8491 SIMPLE t1 range NULL idx_t1_1 147 NULL # Using where; Using index for group-by
850explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;850explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
851id select_type table type possible_keys key key_len ref rows Extra851id select_type table type possible_keys key key_len ref rows Extra
8521 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8521 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
853explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;853explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
854id select_type table type possible_keys key key_len ref rows Extra854id select_type table type possible_keys key key_len ref rows Extra
8551 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by8551 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
856explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;856explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
857id select_type table type possible_keys key key_len ref rows Extra857id select_type table type possible_keys key key_len ref rows Extra
8581 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8581 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
859explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;859explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
860id select_type table type possible_keys key key_len ref rows Extra860id select_type table type possible_keys key key_len ref rows Extra
8611 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8611 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
862explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;862explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
863id select_type table type possible_keys key key_len ref rows Extra863id select_type table type possible_keys key key_len ref rows Extra
8641 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8641 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
865explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;865explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
866id select_type table type possible_keys key key_len ref rows Extra866id select_type table type possible_keys key key_len ref rows Extra
8671 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8671 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
868explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;868explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
869id select_type table type possible_keys key key_len ref rows Extra869id select_type table type possible_keys key key_len ref rows Extra
8701 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8701 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
871explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;871explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
872id select_type table type possible_keys key key_len ref rows Extra872id select_type table type possible_keys key key_len ref rows Extra
8731 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8731 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
874explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;874explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
875id select_type table type possible_keys key key_len ref rows Extra875id select_type table type possible_keys key key_len ref rows Extra
8761 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8761 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
877explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;877explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
878id select_type table type possible_keys key key_len ref rows Extra878id select_type table type possible_keys key key_len ref rows Extra
8791 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by8791 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
880explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;880explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
881id select_type table type possible_keys key key_len ref rows Extra881id select_type table type possible_keys key key_len ref rows Extra
8821 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by8821 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
883explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;883explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
884id select_type table type possible_keys key key_len ref rows Extra884id select_type table type possible_keys key key_len ref rows Extra
8851 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8851 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
886explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;886explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
887id select_type table type possible_keys key key_len ref rows Extra887id select_type table type possible_keys key key_len ref rows Extra
8881 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8881 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
889explain 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;889explain 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;
890id select_type table type possible_keys key key_len ref rows Extra890id select_type table type possible_keys key key_len ref rows Extra
8911 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8911 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
892explain 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;892explain 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;
893id select_type table type possible_keys key key_len ref rows Extra893id select_type table type possible_keys key key_len ref rows Extra
8941 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by8941 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
895explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;895explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
896id select_type table type possible_keys key key_len ref rows Extra896id select_type table type possible_keys key key_len ref rows Extra
8971 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by8971 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -1364,29 +1364,29 @@
1364where exists ( select * from t2 where t2.c > 'b1' )1364where exists ( select * from t2 where t2.c > 'b1' )
1365group by a1,a2,b;1365group by a1,a2,b;
1366id select_type table type possible_keys key key_len ref rows Extra1366id select_type table type possible_keys key key_len ref rows Extra
13671 PRIMARY t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by13671 PRIMARY t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
13682 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index13682 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1369explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;1369explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1370id select_type table type possible_keys key key_len ref rows Extra1370id select_type table type possible_keys key key_len ref rows Extra
13711 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by13711 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
1372explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;1372explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
1373id select_type table type possible_keys key key_len ref rows Extra1373id select_type table type possible_keys key key_len ref rows Extra
13741 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 10 Using where; Using index for group-by13741 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
1375explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;1375explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
1376id select_type table type possible_keys key key_len ref rows Extra1376id select_type table type possible_keys key key_len ref rows Extra
13771 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by13771 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
1378explain 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;1378explain 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;
1379id select_type table type possible_keys key key_len ref rows Extra1379id select_type table type possible_keys key key_len ref rows Extra
13801 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 1 Using where; Using index for group-by13801 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
1381explain 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;1381explain 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;
1382id select_type table type possible_keys key key_len ref rows Extra1382id select_type table type possible_keys key key_len ref rows Extra
13831 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 1 Using where; Using index for group-by13831 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
1384explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;1384explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1385id select_type table type possible_keys key key_len ref rows Extra1385id select_type table type possible_keys key key_len ref rows Extra
13861 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where13861 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
1387explain 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;1387explain 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;
1388id select_type table type possible_keys key key_len ref rows Extra1388id select_type table type possible_keys key key_len ref rows Extra
13891 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by13891 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
1390explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;1390explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1391id select_type table type possible_keys key key_len ref rows Extra1391id select_type table type possible_keys key key_len ref rows Extra
13921 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by13921 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
@@ -1491,13 +1491,13 @@
1491a1 a2 b min(c)1491a1 a2 b min(c)
1492explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;1492explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1493id select_type table type possible_keys key key_len ref rows Extra1493id select_type table type possible_keys key key_len ref rows Extra
14941 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by14941 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
1495explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;1495explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1496id select_type table type possible_keys key key_len ref rows Extra1496id select_type table type possible_keys key key_len ref rows Extra
14971 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by14971 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
1498explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;1498explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1499id select_type table type possible_keys key key_len ref rows Extra1499id select_type table type possible_keys key key_len ref rows Extra
15001 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by15001 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
1501explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;1501explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1502id select_type table type possible_keys key key_len ref rows Extra1502id select_type table type possible_keys key key_len ref rows Extra
15031 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where15031 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where
@@ -1554,13 +1554,13 @@
1554a1 a2 b1554a1 a2 b
1555explain select distinct a1,a2,b from t1;1555explain select distinct a1,a2,b from t1;
1556id select_type table type possible_keys key key_len ref rows Extra1556id select_type table type possible_keys key key_len ref rows Extra
15571 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by15571 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
1558explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');1558explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
1559id select_type table type possible_keys key key_len ref rows Extra1559id select_type table type possible_keys key key_len ref rows Extra
15601 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by15601 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
1561explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');1561explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1562id select_type table type possible_keys key key_len ref rows filtered Extra1562id select_type table type possible_keys key key_len ref rows filtered Extra
15631 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 100.00 Using where; Using index for group-by15631 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 99.22 Using where; Using index for group-by
1564Warnings:1564Warnings:
1565Note 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'))1565Note 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'))
1566explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');1566explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1577,7 +1577,7 @@
15771 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using where; Using index for group-by15771 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using where; Using index for group-by
1578explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');1578explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1579id select_type table type possible_keys key key_len ref rows filtered Extra1579id select_type table type possible_keys key key_len ref rows filtered Extra
15801 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 100.00 Using where; Using index for group-by15801 SIMPLE t2 range NULL idx_t2_1 163 NULL 165 99.39 Using where; Using index for group-by
1581Warnings:1581Warnings:
1582Note 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'))1582Note 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'))
1583explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');1583explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1702,19 +1702,19 @@
1702d e1702d e
1703explain select distinct a1,a2,b from t1;1703explain select distinct a1,a2,b from t1;
1704id select_type table type possible_keys key key_len ref rows Extra1704id select_type table type possible_keys key key_len ref rows Extra
17051 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by17051 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
1706explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;1706explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1707id select_type table type possible_keys key key_len ref rows Extra1707id select_type table type possible_keys key key_len ref rows Extra
17081 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by17081 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
1709explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;1709explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1710id select_type table type possible_keys key key_len ref rows Extra1710id select_type table type possible_keys key key_len ref rows Extra
17111 SIMPLE t1 range NULL idx_t1_1 163 NULL 10 Using where; Using index for group-by17111 SIMPLE t1 range NULL idx_t1_1 163 NULL 129 Using where; Using index for group-by
1712explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;1712explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1713id select_type table type possible_keys key key_len ref rows Extra1713id select_type table type possible_keys key key_len ref rows Extra
17141 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where17141 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 1 Using where
1715explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;1715explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1716id select_type table type possible_keys key key_len ref rows Extra1716id select_type table type possible_keys key key_len ref rows Extra
17171 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using where; Using index for group-by; Using temporary; Using filesort17171 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by; Using temporary; Using filesort
1718explain select distinct a1,a2,b from t2;1718explain select distinct a1,a2,b from t2;
1719id select_type table type possible_keys key key_len ref rows Extra1719id select_type table type possible_keys key key_len ref rows Extra
17201 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using index for group-by17201 SIMPLE t2 range NULL idx_t2_2 146 NULL # Using index for group-by
@@ -1846,7 +1846,7 @@
18461 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where18461 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 1 Using where
1847explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;1847explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
1848id select_type table type possible_keys key key_len ref rows Extra1848id select_type table type possible_keys key key_len ref rows Extra
18491 SIMPLE t1 range NULL idx_t1_1 147 NULL 10 Using index for group-by18491 SIMPLE t1 range NULL idx_t1_1 147 NULL 129 Using index for group-by
1850select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;1850select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
1851a1 a2 b concat(min(c), max(c))1851a1 a2 b concat(min(c), max(c))
1852a a a a111d1111852a a a a111d111
@@ -1985,7 +1985,7 @@
1985d1985d
1986explain select a1 from t1 where a2 = 'b' group by a1;1986explain select a1 from t1 where a2 = 'b' group by a1;
1987id select_type table type possible_keys key key_len ref rows Extra1987id select_type table type possible_keys key key_len ref rows Extra
19881 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using where; Using index for group-by19881 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using where; Using index for group-by
1989select a1 from t1 where a2 = 'b' group by a1;1989select a1 from t1 where a2 = 'b' group by a1;
1990a11990a1
1991a1991a
@@ -1994,7 +1994,7 @@
1994d1994d
1995explain select distinct a1 from t1 where a2 = 'b';1995explain select distinct a1 from t1 where a2 = 'b';
1996id select_type table type possible_keys key key_len ref rows Extra1996id select_type table type possible_keys key key_len ref rows Extra
19971 SIMPLE t1 range NULL idx_t1_1 130 NULL 10 Using where; Using index for group-by19971 SIMPLE t1 range NULL idx_t1_1 130 NULL 129 Using where; Using index for group-by
1998select distinct a1 from t1 where a2 = 'b';1998select distinct a1 from t1 where a2 = 'b';
1999a11999a1
2000a2000a
@@ -2188,7 +2188,7 @@
2188(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);2188(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
2189EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;2189EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
2190id select_type table type possible_keys key key_len ref rows Extra2190id select_type table type possible_keys key key_len ref rows Extra
21911 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by21911 SIMPLE t1 index NULL a 10 NULL 15 Using index
2192FLUSH STATUS;2192FLUSH STATUS;
2193SELECT max(b), a FROM t1 GROUP BY a;2193SELECT max(b), a FROM t1 GROUP BY a;
2194max(b) a2194max(b) a
@@ -2202,7 +2202,7 @@
2202Handler_read_next 02202Handler_read_next 0
2203EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;2203EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
2204id select_type table type possible_keys key key_len ref rows Extra2204id select_type table type possible_keys key key_len ref rows Extra
22051 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by22051 SIMPLE t1 index NULL a 10 NULL 15 Using index
2206FLUSH STATUS;2206FLUSH STATUS;
2207CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;2207CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
2208SHOW STATUS LIKE 'handler_read__e%';2208SHOW STATUS LIKE 'handler_read__e%';
@@ -2235,14 +2235,14 @@
2235EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION 2235EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
2236(SELECT max(b), a FROM t1 GROUP BY a);2236(SELECT max(b), a FROM t1 GROUP BY a);
2237id select_type table type possible_keys key key_len ref rows Extra2237id select_type table type possible_keys key key_len ref rows Extra
22381 PRIMARY t1 range NULL a 5 NULL 8 Using index for group-by22381 PRIMARY t1 index NULL a 10 NULL 15 Using index
22392 UNION t1 range NULL a 5 NULL 8 Using index for group-by22392 UNION t1 index NULL a 10 NULL 15 Using index
2240NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 2240NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
2241EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x2241EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
2242FROM t1 AS t1_outer;2242FROM t1 AS t1_outer;
2243id select_type table type possible_keys key key_len ref rows Extra2243id select_type table type possible_keys key key_len ref rows Extra
22441 PRIMARY t1_outer index NULL a 10 NULL 15 Using index22441 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
22452 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by22452 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2246EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS 2246EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
2247(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);2247(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2248id select_type table type possible_keys key key_len ref rows Extra2248id select_type table type possible_keys key key_len ref rows Extra
@@ -2252,7 +2252,7 @@
2252(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;2252(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
2253id select_type table type possible_keys key key_len ref rows Extra2253id select_type table type possible_keys key key_len ref rows Extra
22541 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE22541 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
22552 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by22552 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2256EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE 2256EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
2257a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);2257a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2258id select_type table type possible_keys key key_len ref rows Extra2258id select_type table type possible_keys key key_len ref rows Extra
@@ -2261,21 +2261,21 @@
2261EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING 2261EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
2262a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);2262a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2263id select_type table type possible_keys key key_len ref rows Extra2263id select_type table type possible_keys key key_len ref rows Extra
22641 PRIMARY t1_outer range NULL a 5 NULL 8 Using index for group-by22641 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
22652 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by22652 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2266EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 2266EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
2267ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) 2267ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
2268AND t1_outer1.b = t1_outer2.b;2268AND t1_outer1.b = t1_outer2.b;
2269id select_type table type possible_keys key key_len ref rows Extra2269id select_type table type possible_keys key key_len ref rows Extra
22701 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index22701 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
22711 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer22711 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer
22722 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by22722 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2273EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x2273EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
2274FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;2274FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
2275id select_type table type possible_keys key key_len ref rows Extra2275id select_type table type possible_keys key key_len ref rows Extra
22761 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index22761 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
22772 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index22772 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
22783 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by22783 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2279CREATE TABLE t3 LIKE t1;2279CREATE TABLE t3 LIKE t1;
2280FLUSH STATUS;2280FLUSH STATUS;
2281INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;2281INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
@@ -2312,7 +2312,7 @@
2312(4), (2), (1), (2), (2), (4), (1), (4);2312(4), (2), (1), (2), (2), (4), (1), (4);
2313EXPLAIN SELECT DISTINCT(a) FROM t1;2313EXPLAIN SELECT DISTINCT(a) FROM t1;
2314id select_type table type possible_keys key key_len ref rows Extra2314id select_type table type possible_keys key key_len ref rows Extra
23151 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by23151 SIMPLE t1 index NULL idx 5 NULL 16 Using index
2316SELECT DISTINCT(a) FROM t1;2316SELECT DISTINCT(a) FROM t1;
2317a2317a
2318123181
@@ -2320,7 +2320,7 @@
2320423204
2321EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;2321EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
2322id select_type table type possible_keys key key_len ref rows Extra2322id select_type table type possible_keys key key_len ref rows Extra
23231 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by23231 SIMPLE t1 index NULL idx 5 NULL 16 Using index
2324SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;2324SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
2325a2325a
2326123261
@@ -2345,7 +2345,7 @@
2345EXPLAIN2345EXPLAIN
2346SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;2346SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
2347id select_type table type possible_keys key key_len ref rows Extra2347id select_type table type possible_keys key key_len ref rows Extra
23481 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by23481 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
2349SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;2349SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
2350a MIN(b) MAX(b)2350a MIN(b) MAX(b)
23511 1 323511 1 3
@@ -2355,7 +2355,7 @@
2355EXPLAIN2355EXPLAIN
2356SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;2356SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2357id select_type table type possible_keys key key_len ref rows Extra2357id select_type table type possible_keys key key_len ref rows Extra
23581 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by; Using temporary; Using filesort23581 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
2359SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;2359SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2360a MIN(b) MAX(b)2360a MIN(b) MAX(b)
23614 1 323614 1 3
23622362
=== modified file 'mysql-test/suite/pbxt/r/join.result'
--- mysql-test/suite/pbxt/r/join.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/join.result 2009-08-17 15:57:58 +0000
@@ -774,7 +774,7 @@
774explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;774explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
775id select_type table type possible_keys key key_len ref rows Extra775id select_type table type possible_keys key key_len ref rows Extra
7761 SIMPLE t2 range a,b a 5 NULL 1 Using where7761 SIMPLE t2 range a,b a 5 NULL 1 Using where
7771 SIMPLE t3 ref b b 5 test.t2.b 11 Using where7771 SIMPLE t3 ref b b 5 test.t2.b 1 Using where
778drop table t1, t2, t3;778drop table t1, t2, t3;
779create table t1 (a int);779create table t1 (a int);
780insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);780insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
781781
=== modified file 'mysql-test/suite/pbxt/r/join_nested.result'
--- mysql-test/suite/pbxt/r/join_nested.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/join_nested.result 2009-08-17 15:57:58 +0000
@@ -851,7 +851,7 @@
851id select_type table type possible_keys key key_len ref rows filtered Extra851id select_type table type possible_keys key key_len ref rows filtered Extra
8521 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 8521 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
8531 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer8531 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
8541 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 8541 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00
8551 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 8551 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
856Warnings:856Warnings:
857Note 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 1857Note 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
@@ -958,15 +958,15 @@
9581 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where9581 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
9591 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer9591 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
9601 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where9601 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
9611 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
9611 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where9621 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
9621 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
9631 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where9631 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
9641 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where9641 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
9651 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where9651 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
9661 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where9661 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
9671 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer9671 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
968Warnings:968Warnings:
969Note 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`)))969Note 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`)))
970CREATE INDEX idx_b ON t8(b);970CREATE INDEX idx_b ON t8(b);
971EXPLAIN EXTENDED971EXPLAIN EXTENDED
972SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,972SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -1008,14 +1008,14 @@
10081 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer10081 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
10091 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where10091 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
10101 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where10101 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
10111 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where10111 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
10121 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where10121 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
10131 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
10131 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where10141 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
10141 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where10151 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
10151 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
10161 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer10161 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1017Note 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`)))
1017Warnings:1018Warnings:
1018Note 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`)))
1019CREATE INDEX idx_b ON t1(b);1019CREATE INDEX idx_b ON t1(b);
1020CREATE INDEX idx_a ON t0(a);1020CREATE INDEX idx_a ON t0(a);
1021EXPLAIN EXTENDED1021EXPLAIN EXTENDED
@@ -1055,17 +1055,17 @@
1055(t9.a=1);1055(t9.a=1);
1056id select_type table type possible_keys key key_len ref rows filtered Extra1056id select_type table type possible_keys key key_len ref rows filtered Extra
10571 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where10571 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where
10581 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00 Using where10581 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where
10591 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where10591 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
10601 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where10601 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
10611 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where10611 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
10621 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where10621 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
10631 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
10631 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where10641 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
10641 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where10651 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
10651 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
10661 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer10661 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1067Note 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`)))
1067Warnings:1068Warnings:
1068Note 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`)))
1069SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,1069SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1070t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b1070t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1071FROM t0,t11071FROM t0,t1
@@ -1102,21 +1102,21 @@
1102(t9.a=1);1102(t9.a=1);
1103a b a b a b a b a b a b a b a b a b a b1103a b a b a b a b a b a b a b a b a b a b
11041 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 111041 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 1
11051 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 2
11061 2 3 2 4 2 1 2 3 2 2 2 6 2 2 2 0 2 1 2
11051 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 111071 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 1
11081 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 2
11061 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 111091 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 1
11101 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
11111 2 3 2 4 2 1 2 4 2 2 2 6 2 2 2 0 2 1 2
11071 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 111121 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 1
11131 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 2
11081 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 111141 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 1
11151 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
11161 2 3 2 5 3 NULL NULL NULL NULL 2 2 6 2 2 2 0 2 1 2
11091 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 111171 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 1
11181 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 2
11101 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 111191 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 1
11111 2 2 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 2
11121 2 3 2 4 2 1 2 3 2 3 1 6 2 1 1 NULL NULL 1 2
11131 2 3 2 4 2 1 2 3 2 2 2 6 2 2 2 0 2 1 2
11141 2 3 2 4 2 1 2 3 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
11151 2 3 2 4 2 1 2 4 2 3 1 6 2 1 1 NULL NULL 1 2
11161 2 3 2 4 2 1 2 4 2 2 2 6 2 2 2 0 2 1 2
11171 2 3 2 4 2 1 2 4 2 3 3 NULL NULL NULL NULL NULL NULL 1 2
11181 2 3 2 5 3 NULL NULL NULL NULL 3 1 6 2 1 1 NULL NULL 1 2
11191 2 3 2 5 3 NULL NULL NULL NULL 2 2 6 2 2 2 0 2 1 2
11201 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 211201 2 3 2 5 3 NULL NULL NULL NULL 3 3 NULL NULL NULL NULL NULL NULL 1 2
1121SELECT t2.a,t2.b1121SELECT t2.a,t2.b
1122FROM t2;1122FROM t2;
@@ -1203,7 +1203,7 @@
1203id select_type table type possible_keys key key_len ref rows Extra1203id select_type table type possible_keys key key_len ref rows Extra
12041 SIMPLE t1 index NULL a 5 NULL 21 Using index12041 SIMPLE t1 index NULL a 5 NULL 21 Using index
12051 SIMPLE t3 index c c 5 NULL 6 Using index12051 SIMPLE t3 index c c 5 NULL 6 Using index
12061 SIMPLE t2 ref b b 5 test.t3.c 2 Using index12061 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
1207EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;1207EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1208id select_type table type possible_keys key key_len ref rows Extra1208id select_type table type possible_keys key key_len ref rows Extra
12091 SIMPLE t1 index NULL a 5 NULL # Using index12091 SIMPLE t1 index NULL a 5 NULL # Using index
@@ -1484,8 +1484,8 @@
1484on (t1.a = t2.a);1484on (t1.a = t2.a);
1485id select_type table type possible_keys key key_len ref rows Extra1485id select_type table type possible_keys key key_len ref rows Extra
14861 SIMPLE t1 ALL NULL NULL NULL NULL 10 14861 SIMPLE t1 ALL NULL NULL NULL NULL 10
14871 SIMPLE t2 ref a a 5 test.t1.a 11 14871 SIMPLE t2 ref a a 5 test.t1.a 1
14881 SIMPLE t3 ref a a 5 test.t2.a 11 14881 SIMPLE t3 ref a a 5 test.t2.a 1
1489drop table t1, t2, t3;1489drop table t1, t2, t3;
1490CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10));1490CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10));
1491CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10));1491CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10));
14921492
=== modified file 'mysql-test/suite/pbxt/r/key.result'
--- mysql-test/suite/pbxt/r/key.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/key.result 2009-08-17 15:57:58 +0000
@@ -153,7 +153,7 @@
153t1 0 a 1 a A 0 NULL NULL BTREE 153t1 0 a 1 a A 0 NULL NULL BTREE
154t1 0 e 1 e A 0 NULL NULL BTREE 154t1 0 e 1 e A 0 NULL NULL BTREE
155t1 0 b 1 b A 0 NULL NULL YES BTREE 155t1 0 b 1 b A 0 NULL NULL YES BTREE
156t1 1 c 1 c A NULL NULL NULL YES BTREE 156t1 1 c 1 c A 0 NULL NULL YES BTREE
157drop table t1;157drop table t1;
158CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,158CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
159UNIQUE (c,i));159UNIQUE (c,i));
160160
=== modified file 'mysql-test/suite/pbxt/r/key_cache.result'
--- mysql-test/suite/pbxt/r/key_cache.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/key_cache.result 2009-08-17 15:57:58 +0000
@@ -122,7 +122,7 @@
122explain select count(*) from t1, t2 where t1.p = t2.i;122explain select count(*) from t1, t2 where t1.p = t2.i;
123id select_type table type possible_keys key key_len ref rows Extra123id select_type table type possible_keys key key_len ref rows Extra
1241 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index1241 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
1251 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using where; Using index1251 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using where; Using index
126select count(*) from t1, t2 where t1.p = t2.i;126select count(*) from t1, t2 where t1.p = t2.i;
127count(*)127count(*)
12831283
@@ -257,8 +257,6 @@
257drop table t1,t2,t3;257drop table t1,t2,t3;
258set global keycache2.key_buffer_size=0;258set global keycache2.key_buffer_size=0;
259set global keycache3.key_buffer_size=100;259set global keycache3.key_buffer_size=100;
260Warnings:
261Warning 1292 Truncated incorrect key_buffer_size value: '100'
262set global keycache3.key_buffer_size=0;260set global keycache3.key_buffer_size=0;
263create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;261create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;
264insert t1 values ('aaabbb');262insert t1 values ('aaabbb');
265263
=== modified file 'mysql-test/suite/pbxt/r/key_diff.result'
--- mysql-test/suite/pbxt/r/key_diff.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/key_diff.result 2009-08-17 15:57:58 +0000
@@ -36,7 +36,7 @@
36explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;36explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
37id select_type table type possible_keys key key_len ref rows Extra37id select_type table type possible_keys key key_len ref rows Extra
381 SIMPLE t1 ALL a NULL NULL NULL 5 381 SIMPLE t1 ALL a NULL NULL NULL 5
391 SIMPLE t2 ALL b NULL NULL NULL 5 Using where; Using join buffer391 SIMPLE t2 ref b b 4 test.t1.a 1 Using where
40select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;40select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
41a b a b41a b a b
42A B a a42A B a a
4343
=== modified file 'mysql-test/suite/pbxt/r/mysqlshow.result'
--- mysql-test/suite/pbxt/r/mysqlshow.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/mysqlshow.result 2009-08-17 15:57:58 +0000
@@ -107,7 +107,21 @@
107| TRIGGERS |107| TRIGGERS |
108| USER_PRIVILEGES |108| USER_PRIVILEGES |
109| VIEWS |109| VIEWS |
110| INNODB_BUFFER_POOL_PAGES |
110| PBXT_STATISTICS |111| PBXT_STATISTICS |
112| INNODB_CMP |
113| INNODB_RSEG |
114| XTRADB_ENHANCEMENTS |
115| INNODB_BUFFER_POOL_PAGES_INDEX |
116| INNODB_INDEX_STATS |
117| INNODB_TRX |
118| INNODB_CMP_RESET |
119| INNODB_LOCK_WAITS |
120| INNODB_CMPMEM_RESET |
121| INNODB_LOCKS |
122| INNODB_CMPMEM |
123| INNODB_TABLE_STATS |
124| INNODB_BUFFER_POOL_PAGES_BLOB |
111+---------------------------------------+125+---------------------------------------+
112Database: INFORMATION_SCHEMA126Database: INFORMATION_SCHEMA
113+---------------------------------------+127+---------------------------------------+
@@ -141,7 +155,21 @@
141| TRIGGERS |155| TRIGGERS |
142| USER_PRIVILEGES |156| USER_PRIVILEGES |
143| VIEWS |157| VIEWS |
158| INNODB_BUFFER_POOL_PAGES |
144| PBXT_STATISTICS |159| PBXT_STATISTICS |
160| INNODB_CMP |
161| INNODB_RSEG |
162| XTRADB_ENHANCEMENTS |
163| INNODB_BUFFER_POOL_PAGES_INDEX |
164| INNODB_INDEX_STATS |
165| INNODB_TRX |
166| INNODB_CMP_RESET |
167| INNODB_LOCK_WAITS |
168| INNODB_CMPMEM_RESET |
169| INNODB_LOCKS |
170| INNODB_CMPMEM |
171| INNODB_TABLE_STATS |
172| INNODB_BUFFER_POOL_PAGES_BLOB |
145+---------------------------------------+173+---------------------------------------+
146Wildcard: inf_rmation_schema174Wildcard: inf_rmation_schema
147+--------------------+175+--------------------+
148176
=== modified file 'mysql-test/suite/pbxt/r/null.result'
--- mysql-test/suite/pbxt/r/null.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/null.result 2009-08-17 15:57:58 +0000
@@ -93,9 +93,11 @@
93Warnings:93Warnings:
94Warning 1265 Data truncated for column 'd' at row 194Warning 1265 Data truncated for column 'd' at row 1
95UPDATE t1 SET d=1/NULL;95UPDATE t1 SET d=1/NULL;
96ERROR 23000: Column 'd' cannot be null96Warnings:
97Warning 1265 Data truncated for column 'd' at row 1
97UPDATE t1 SET d=NULL;98UPDATE t1 SET d=NULL;
98ERROR 23000: Column 'd' cannot be null99Warnings:
100Warning 1048 Column 'd' cannot be null
99INSERT INTO t1 (a) values (null);101INSERT INTO t1 (a) values (null);
100ERROR 23000: Column 'a' cannot be null102ERROR 23000: Column 'a' cannot be null
101INSERT INTO t1 (a) values (1/null);103INSERT INTO t1 (a) values (1/null);
@@ -130,7 +132,7 @@
130Warning 1048 Column 'd' cannot be null132Warning 1048 Column 'd' cannot be null
131select * from t1;133select * from t1;
132a b c d134a b c d
133 0 0000-00-00 00:00:00 2003135 0 0000-00-00 00:00:00 0
134 0 0000-00-00 00:00:00 0136 0 0000-00-00 00:00:00 0
135 0 0000-00-00 00:00:00 0137 0 0000-00-00 00:00:00 0
136 0 0000-00-00 00:00:00 0138 0 0000-00-00 00:00:00 0
137139
=== modified file 'mysql-test/suite/pbxt/r/null_key.result'
--- mysql-test/suite/pbxt/r/null_key.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/null_key.result 2009-08-17 15:57:58 +0000
@@ -407,8 +407,8 @@
407LEFT JOIN t3 ON t2.b=t3.b;407LEFT JOIN t3 ON t2.b=t3.b;
408id select_type table type possible_keys key key_len ref rows Extra408id select_type table type possible_keys key key_len ref rows Extra
4091 SIMPLE t1 ALL NULL NULL NULL NULL 4 4091 SIMPLE t1 ALL NULL NULL NULL NULL 4
4101 SIMPLE t2 ref idx idx 5 test.t1.a 2 4101 SIMPLE t2 ref idx idx 5 test.t1.a 1
4111 SIMPLE t3 ref idx idx 5 test.t2.b 186 Using index4111 SIMPLE t3 ref idx idx 5 test.t2.b 1 Using index
412FLUSH STATUS ;412FLUSH STATUS ;
413SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a413SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
414LEFT JOIN t3 ON t2.b=t3.b;414LEFT JOIN t3 ON t2.b=t3.b;
415415
=== modified file 'mysql-test/suite/pbxt/r/partition_pruning.result'
--- mysql-test/suite/pbxt/r/partition_pruning.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/partition_pruning.result 2009-08-17 15:57:58 +0000
@@ -338,12 +338,12 @@
338where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);338where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
339id select_type table partitions type possible_keys key key_len ref rows Extra339id select_type table partitions type possible_keys key key_len ref rows Extra
3401 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 2 Using where3401 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 2 Using where
3411 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where3411 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 1 Using where
342explain partitions342explain partitions
343select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);343select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
344id select_type table partitions type possible_keys key key_len ref rows Extra344id select_type table partitions type possible_keys key key_len ref rows Extra
3451 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where3451 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
3461 SIMPLE Y p1,p2 ref a a 4 test.X.a 2 3461 SIMPLE Y p1,p2 ref a a 4 test.X.a 1
347drop table t1;347drop table t1;
348create table t1 (a int) partition by hash(a) partitions 20;348create table t1 (a int) partition by hash(a) partitions 20;
349insert into t1 values (1),(2),(3);349insert into t1 values (1),(2),(3);
350350
=== modified file 'mysql-test/suite/pbxt/r/pbxt_bugs.result'
--- mysql-test/suite/pbxt/r/pbxt_bugs.result 2009-04-02 20:36:52 +0000
+++ mysql-test/suite/pbxt/r/pbxt_bugs.result 2009-08-17 15:57:58 +0000
@@ -1218,3 +1218,59 @@
12180 opq12180 opq
12191 jkl12191 jkl
1220DROP TABLE t1;1220DROP TABLE t1;
1221create table parent (id int primary key);
1222create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
1223insert into parent values (2), (3), (4);
1224insert into child values (3), (4);
1225delete ignore from parent;
1226ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (Constraint: `FOREIGN_1`)
1227select * from parent;
1228id
12292
12303
12314
1232drop table child, parent;
1233create schema test378222;
1234use test378222;
1235create table t1 (id int primary key);
1236create table t2 (id int primary key);
1237alter table t1 add constraint foreign key (id) references t2 (id);
1238alter table t2 add constraint foreign key (id) references t1 (id);
1239drop schema test378222;
1240create schema test378222a;
1241create schema test378222b;
1242create table test378222a.t1 (id int primary key);
1243create table test378222b.t2 (id int primary key);
1244alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
1245alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
1246set foreign_key_checks = 1;
1247drop schema test378222a;
1248ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
1249drop schema test378222b;
1250ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
1251set foreign_key_checks = 0;
1252drop schema test378222a;
1253drop schema test378222b;
1254set foreign_key_checks = 1;
1255use test;
1256CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
1257SHOW CREATE TABLE t1;
1258Table Create Table
1259t1 CREATE TABLE `t1` (
1260 `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
1261 PRIMARY KEY (`c1`)
1262) ENGINE=PBXT AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
1263INSERT INTO t1 VALUES(null);
1264INSERT INTO t1 VALUES(null);
1265INSERT INTO t1 VALUES(null);
1266SELECT * FROM t1;
1267c1
126810
126911
127012
1271TRUNCATE TABLE t1;
1272INSERT INTO t1 VALUES(null);
1273SELECT * FROM t1;
1274c1
12751
1276DROP TABLE t1;
12211277
=== modified file 'mysql-test/suite/pbxt/r/pbxt_ref_int.result'
--- mysql-test/suite/pbxt/r/pbxt_ref_int.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/pbxt_ref_int.result 2009-08-17 15:57:58 +0000
@@ -166,7 +166,7 @@
166 `parent_id` int(11) DEFAULT NULL,166 `parent_id` int(11) DEFAULT NULL,
167 KEY `par_ind` (`parent_id`),167 KEY `par_ind` (`parent_id`),
168 KEY `child_ind` (`id`),168 KEY `child_ind` (`id`),
169 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)169 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
170) ENGINE=PBXT DEFAULT CHARSET=latin1170) ENGINE=PBXT DEFAULT CHARSET=latin1
171drop index child_ind on child;171drop index child_ind on child;
172show create table child;172show create table child;
@@ -175,7 +175,7 @@
175 `id` int(11) DEFAULT NULL,175 `id` int(11) DEFAULT NULL,
176 `parent_id` int(11) DEFAULT NULL,176 `parent_id` int(11) DEFAULT NULL,
177 KEY `par_ind` (`parent_id`),177 KEY `par_ind` (`parent_id`),
178 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)178 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
179) ENGINE=PBXT DEFAULT CHARSET=latin1179) ENGINE=PBXT DEFAULT CHARSET=latin1
180alter table parent add column c1 varchar(40);180alter table parent add column c1 varchar(40);
181insert child values(2000, 2);181insert child values(2000, 2);
@@ -243,7 +243,7 @@
243 `id` int(11) DEFAULT NULL,243 `id` int(11) DEFAULT NULL,
244 `parent_id` int(11) DEFAULT NULL,244 `parent_id` int(11) DEFAULT NULL,
245 KEY `par_ind` (`parent_id`),245 KEY `par_ind` (`parent_id`),
246 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)246 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
247) ENGINE=PBXT DEFAULT CHARSET=latin1247) ENGINE=PBXT DEFAULT CHARSET=latin1
248alter table child add column c1 varchar(40);248alter table child add column c1 varchar(40);
249insert child values(400, 1, "asd");249insert child values(400, 1, "asd");
@@ -284,7 +284,7 @@
284 `id` int(11) DEFAULT NULL,284 `id` int(11) DEFAULT NULL,
285 `parent_id` int(11) DEFAULT NULL,285 `parent_id` int(11) DEFAULT NULL,
286 KEY `par_ind` (`parent_id`),286 KEY `par_ind` (`parent_id`),
287 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE287 CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE
288) ENGINE=PBXT DEFAULT CHARSET=latin1288) ENGINE=PBXT DEFAULT CHARSET=latin1
289insert parent values(1);289insert parent values(1);
290insert child values(100, 1);290insert child values(100, 1);
291291
=== modified file 'mysql-test/suite/pbxt/r/preload.result'
--- mysql-test/suite/pbxt/r/preload.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/preload.result 2009-08-17 15:57:58 +0000
@@ -144,7 +144,7 @@
144load index into cache t3, t2 key (primary,b) ;144load index into cache t3, t2 key (primary,b) ;
145Table Op Msg_type Msg_text145Table Op Msg_type Msg_text
146test.t3 preload_keys Error Table 'test.t3' doesn't exist146test.t3 preload_keys Error Table 'test.t3' doesn't exist
147test.t3 preload_keys error Corrupt147test.t3 preload_keys status Operation failed
148test.t2 preload_keys note The storage engine for the table doesn't support preload_keys148test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
149show status like "key_read%";149show status like "key_read%";
150Variable_name Value150Variable_name Value
@@ -159,7 +159,7 @@
159load index into cache t3 key (b), t2 key (c) ;159load index into cache t3 key (b), t2 key (c) ;
160Table Op Msg_type Msg_text160Table Op Msg_type Msg_text
161test.t3 preload_keys Error Table 'test.t3' doesn't exist161test.t3 preload_keys Error Table 'test.t3' doesn't exist
162test.t3 preload_keys error Corrupt162test.t3 preload_keys status Operation failed
163test.t2 preload_keys note The storage engine for the table doesn't support preload_keys163test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
164show status like "key_read%";164show status like "key_read%";
165Variable_name Value165Variable_name Value
166166
=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
--- mysql-test/suite/pbxt/r/ps_1general.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/ps_1general.result 2009-08-17 15:57:58 +0000
@@ -289,7 +289,7 @@
289execute stmt4;289execute stmt4;
290Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment290Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
291t2 0 PRIMARY 1 a A 0 NULL NULL BTREE 291t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
292t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE 292t2 1 t2_idx 1 b A 0 NULL NULL YES BTREE
293prepare stmt4 from ' show table status from test like ''t2%'' ';293prepare stmt4 from ' show table status from test like ''t2%'' ';
294execute stmt4;294execute stmt4;
295Name 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 Comment295Name 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
@@ -447,7 +447,7 @@
447def possible_keys 253 4096 0 Y 0 31 8447def possible_keys 253 4096 0 Y 0 31 8
448def key 253 64 0 Y 0 31 8448def key 253 64 0 Y 0 31 8
449def key_len 253 4096 0 Y 0 31 8449def key_len 253 4096 0 Y 0 31 8
450def ref 253 1024 0 Y 0 31 8450def ref 253 2048 0 Y 0 31 8
451def rows 8 10 1 Y 32928 0 63451def rows 8 10 1 Y 32928 0 63
452def Extra 253 255 14 N 1 31 8452def Extra 253 255 14 N 1 31 8
453id select_type table type possible_keys key key_len ref rows Extra453id select_type table type possible_keys key key_len ref rows Extra
@@ -463,7 +463,7 @@
463def possible_keys 253 4096 7 Y 0 31 8463def possible_keys 253 4096 7 Y 0 31 8
464def key 253 64 7 Y 0 31 8464def key 253 64 7 Y 0 31 8
465def key_len 253 4096 1 Y 0 31 8465def key_len 253 4096 1 Y 0 31 8
466def ref 253 1024 0 Y 0 31 8466def ref 253 2048 0 Y 0 31 8
467def rows 8 10 1 Y 32928 0 63467def rows 8 10 1 Y 32928 0 63
468def Extra 253 255 27 N 1 31 8468def Extra 253 255 27 N 1 31 8
469id select_type table type possible_keys key key_len ref rows Extra469id select_type table type possible_keys key key_len ref rows Extra
470470
=== modified file 'mysql-test/suite/pbxt/r/range.result'
--- mysql-test/suite/pbxt/r/range.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/range.result 2009-08-17 15:57:58 +0000
@@ -423,19 +423,19 @@
423explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;423explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
424id select_type table type possible_keys key key_len ref rows Extra424id select_type table type possible_keys key key_len ref rows Extra
4251 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where4251 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
4261 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12 4261 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
427explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;427explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
428id select_type table type possible_keys key key_len ref rows Extra428id select_type table type possible_keys key key_len ref rows Extra
4291 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where4291 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
4301 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12 4301 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
431explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;431explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
432id select_type table type possible_keys key key_len ref rows Extra432id select_type table type possible_keys key key_len ref rows Extra
4331 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where4331 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
4341 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12 4341 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
435explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;435explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
436id select_type table type possible_keys key key_len ref rows Extra436id select_type table type possible_keys key key_len ref rows Extra
4371 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where4371 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
4381 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12 4381 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
439select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;439select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
440id name uid id name uid440id name uid id name uid
4411001 A 1 1001 A 14411001 A 1 1001 A 1
442442
=== modified file 'mysql-test/suite/pbxt/r/schema.result'
--- mysql-test/suite/pbxt/r/schema.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/schema.result 2009-08-17 15:57:58 +0000
@@ -3,11 +3,13 @@
3show create schema foo;3show create schema foo;
4Database Create Database4Database Create Database
5foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */5foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
6create table t1 (id int) engine=pbxt;
6show schemas;7show schemas;
7Database8Database
8information_schema9information_schema
9foo10foo
10mtr11mtr
11mysql12mysql
13pbxt
12test14test
13drop schema foo;15drop schema foo;
1416
=== modified file 'mysql-test/suite/pbxt/r/select.result'
--- mysql-test/suite/pbxt/r/select.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/select.result 2009-08-17 15:57:58 +0000
@@ -604,15 +604,15 @@
604explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;604explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
605id select_type table type possible_keys key key_len ref rows Extra605id select_type table type possible_keys key key_len ref rows Extra
6061 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort6061 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
6071 SIMPLE t3 ref period period 4 test.t1.period 18 6071 SIMPLE t3 ref period period 4 test.t1.period 1
608explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;608explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
609id select_type table type possible_keys key key_len ref rows Extra609id select_type table type possible_keys key key_len ref rows Extra
6101 SIMPLE t3 index period period 4 NULL 1 6101 SIMPLE t3 index period period 4 NULL 10
6111 SIMPLE t1 ref period period 4 test.t3.period 18 6111 SIMPLE t1 ref period period 4 test.t3.period 1
612explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;612explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
613id select_type table type possible_keys key key_len ref rows Extra613id select_type table type possible_keys key key_len ref rows Extra
6141 SIMPLE t1 index period period 4 NULL 1 6141 SIMPLE t1 index period period 4 NULL 10
6151 SIMPLE t3 ref period period 4 test.t1.period 18 6151 SIMPLE t3 ref period period 4 test.t1.period 1
616select period from t1;616select period from t1;
617period617period
61894106189410
@@ -2095,7 +2095,7 @@
2095Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment2095Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
2096t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE 2096t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
2097t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE 2097t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
2098t2 1 fld3 1 fld3 A NULL NULL NULL BTREE 2098t2 1 fld3 1 fld3 A 1199 NULL NULL BTREE
2099drop table t4, t3, t2, t1;2099drop table t4, t3, t2, t1;
2100DO 1;2100DO 1;
2101DO benchmark(100,1+1),1,1;2101DO benchmark(100,1+1),1,1;
@@ -2369,7 +2369,7 @@
2369explain select * from t1 left join t2 on a=c where d in (4);2369explain select * from t1 left join t2 on a=c where d in (4);
2370id select_type table type possible_keys key key_len ref rows Extra2370id select_type table type possible_keys key key_len ref rows Extra
23711 SIMPLE t2 ref c,d d 5 const 1 Using where23711 SIMPLE t2 ref c,d d 5 const 1 Using where
23721 SIMPLE t1 ref a a 5 test.t2.c 2 Using where23721 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
2373select * from t1 left join t2 on a=c where d in (4);2373select * from t1 left join t2 on a=c where d in (4);
2374a b c d2374a b c d
23753 2 3 423753 2 3 4
@@ -2377,7 +2377,7 @@
2377explain select * from t1 left join t2 on a=c where d = 4;2377explain select * from t1 left join t2 on a=c where d = 4;
2378id select_type table type possible_keys key key_len ref rows Extra2378id select_type table type possible_keys key key_len ref rows Extra
23791 SIMPLE t2 ref c,d d 5 const 1 Using where23791 SIMPLE t2 ref c,d d 5 const 1 Using where
23801 SIMPLE t1 ref a a 5 test.t2.c 2 Using where23801 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
2381select * from t1 left join t2 on a=c where d = 4;2381select * from t1 left join t2 on a=c where d = 4;
2382a b c d2382a b c d
23833 2 3 423833 2 3 4
@@ -2403,11 +2403,11 @@
2403EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;2403EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
2404id select_type table type possible_keys key key_len ref rows Extra2404id select_type table type possible_keys key key_len ref rows Extra
24051 SIMPLE t1 ALL NULL NULL NULL NULL 5 24051 SIMPLE t1 ALL NULL NULL NULL NULL 5
24061 SIMPLE t2 ref a a 23 test.t1.a 2 24061 SIMPLE t2 ref a a 23 test.t1.a 1
2407EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;2407EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
2408id select_type table type possible_keys key key_len ref rows Extra2408id select_type table type possible_keys key key_len ref rows Extra
24091 SIMPLE t1 ALL NULL NULL NULL NULL 5 24091 SIMPLE t1 ALL NULL NULL NULL NULL 5
24101 SIMPLE t2 ref a a 23 test.t1.a 2 24101 SIMPLE t2 ref a a 23 test.t1.a 1
2411DROP TABLE t1, t2;2411DROP TABLE t1, t2;
2412CREATE TABLE t1 ( city char(30) );2412CREATE TABLE t1 ( city char(30) );
2413INSERT INTO t1 VALUES ('London');2413INSERT INTO t1 VALUES ('London');
@@ -2792,26 +2792,26 @@
27921 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away27921 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2793select max(key1) from t1 where key1 <= 0.6158;2793select max(key1) from t1 where key1 <= 0.6158;
2794max(key1)2794max(key1)
27950.6158000230789227950.615800023078918
2796select max(key2) from t2 where key2 <= 1.6158;2796select max(key2) from t2 where key2 <= 1.6158;
2797max(key2)2797max(key2)
27981.615800023078927981.61580002307892
2799select min(key1) from t1 where key1 >= 0.3762;2799select min(key1) from t1 where key1 >= 0.3762;
2800min(key1)2800min(key1)
28010.3761999905109428010.376199990510941
2802select min(key2) from t2 where key2 >= 1.3762;2802select min(key2) from t2 where key2 >= 1.3762;
2803min(key2)2803min(key2)
28041.376199960708628041.37619996070862
2805select max(key1), min(key2) from t1, t22805select max(key1), min(key2) from t1, t2
2806where key1 <= 0.6158 and key2 >= 1.3762;2806where key1 <= 0.6158 and key2 >= 1.3762;
2807max(key1) min(key2)2807max(key1) min(key2)
28080.61580002307892 1.376199960708628080.615800023078918 1.37619996070862
2809select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;2809select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
2810max(key1)2810max(key1)
28110.6158000230789228110.615800023078918
2812select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;2812select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
2813min(key1)2813min(key1)
28140.3761999905109428140.376199990510941
2815DROP TABLE t1,t2;2815DROP TABLE t1,t2;
2816CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);2816CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
2817INSERT INTO t1 VALUES (10);2817INSERT INTO t1 VALUES (10);
@@ -3454,7 +3454,7 @@
3454and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);3454and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
3455id select_type table type possible_keys key key_len ref rows Extra3455id select_type table type possible_keys key key_len ref rows Extra
34561 SIMPLE A range PRIMARY PRIMARY 12 NULL 1 Using where34561 SIMPLE A range PRIMARY PRIMARY 12 NULL 1 Using where
34571 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 11 34571 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 1
3458drop table t1, t2;3458drop table t1, t2;
3459CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));3459CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
3460INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),3460INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
@@ -3468,12 +3468,12 @@
3468SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;3468SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
3469id select_type table type possible_keys key key_len ref rows Extra3469id select_type table type possible_keys key key_len ref rows Extra
34701 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where34701 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where
34711 SIMPLE t2 ref c c 5 test.t1.a 2 Using where34711 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
3472EXPLAIN3472EXPLAIN
3473SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;3473SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
3474id select_type table type possible_keys key key_len ref rows Extra3474id select_type table type possible_keys key key_len ref rows Extra
34751 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where34751 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where
34761 SIMPLE t2 ref c c 5 test.t1.a 2 Using where34761 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
3477DROP TABLE t1, t2;3477DROP TABLE t1, t2;
3478create table t1 (3478create table t1 (
3479a int unsigned not null auto_increment primary key,3479a int unsigned not null auto_increment primary key,
34803480
=== modified file 'mysql-test/suite/pbxt/r/select_safe.result'
--- mysql-test/suite/pbxt/r/select_safe.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/select_safe.result 2009-08-17 15:57:58 +0000
@@ -70,12 +70,12 @@
70explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;70explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
71id select_type table type possible_keys key key_len ref rows Extra71id select_type table type possible_keys key key_len ref rows Extra
721 SIMPLE t1 ALL b NULL NULL NULL 21 721 SIMPLE t1 ALL b NULL NULL NULL 21
731 SIMPLE t2 ref b b 21 test.t1.b 2 Using where731 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
74set MAX_SEEKS_FOR_KEY=1;74set MAX_SEEKS_FOR_KEY=1;
75explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;75explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
76id select_type table type possible_keys key key_len ref rows Extra76id select_type table type possible_keys key key_len ref rows Extra
771 SIMPLE t1 ALL b NULL NULL NULL 21 771 SIMPLE t1 ALL b NULL NULL NULL 21
781 SIMPLE t2 ref b b 21 test.t1.b 2 Using where781 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
79SET MAX_SEEKS_FOR_KEY=DEFAULT;79SET MAX_SEEKS_FOR_KEY=DEFAULT;
80drop table t1;80drop table t1;
81create table t1 (a int);81create table t1 (a int);
8282
=== modified file 'mysql-test/suite/pbxt/r/subselect.result'
--- mysql-test/suite/pbxt/r/subselect.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/subselect.result 2009-08-17 15:57:58 +0000
@@ -1333,7 +1333,7 @@
1333explain extended select * from t2 where t2.a in (select a from t1);1333explain extended select * from t2 where t2.a in (select a from t1);
1334id select_type table type possible_keys key key_len ref rows filtered Extra1334id select_type table type possible_keys key key_len ref rows filtered Extra
13351 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index13351 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
13362 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where13362 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1337Warnings:1337Warnings:
1338Note 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`))))1338Note 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`))))
1339select * from t2 where t2.a in (select a from t1 where t1.b <> 30);1339select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1343,7 +1343,7 @@
1343explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);1343explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1344id select_type table type possible_keys key key_len ref rows filtered Extra1344id select_type table type possible_keys key key_len ref rows filtered Extra
13451 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index13451 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
13462 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where13462 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1347Warnings:1347Warnings:
1348Note 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`)))))1348Note 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`)))))
1349select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);1349select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1353,8 +1353,8 @@
1353explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);1353explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
1354id select_type table type possible_keys key key_len ref rows filtered Extra1354id select_type table type possible_keys key key_len ref rows filtered Extra
13551 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index13551 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
13562 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index13562 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using where; Using index
13572 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer13572 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using where; Using index
1358Warnings:1358Warnings:
1359Note 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`))))1359Note 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`))))
1360insert into t1 values (3,31);1360insert into t1 values (3,31);
@@ -1370,7 +1370,7 @@
1370explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);1370explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
1371id select_type table type possible_keys key key_len ref rows filtered Extra1371id select_type table type possible_keys key key_len ref rows filtered Extra
13721 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index13721 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
13732 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where13732 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
1374Warnings:1374Warnings:
1375Note 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`)))))1375Note 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`)))))
1376drop table t1, t2, t3;1376drop table t1, t2, t3;
@@ -3546,7 +3546,7 @@
3546id select_type table type possible_keys key key_len ref rows Extra3546id select_type table type possible_keys key key_len ref rows Extra
35471 PRIMARY t2 ALL NULL NULL NULL NULL 1 35471 PRIMARY t2 ALL NULL NULL NULL NULL 1
35481 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index; Using join buffer35481 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index; Using join buffer
35492 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 2 Using where; Using index; Using filesort35492 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 1 Using where; Using index; Using filesort
3550SELECT * FROM t1,t23550SELECT * FROM t1,t2
3551WHERE t1.t = (SELECT t1.t FROM t1 3551WHERE t1.t = (SELECT t1.t FROM t1
3552WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i13552WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
@@ -4214,7 +4214,7 @@
4214EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);4214EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
4215id select_type table type possible_keys key key_len ref rows Extra4215id select_type table type possible_keys key key_len ref rows Extra
42161 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where42161 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
42172 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where42172 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
4218SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);4218SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
4219a b4219a b
4220CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));4220CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
@@ -4224,14 +4224,14 @@
4224EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);4224EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
4225id select_type table type possible_keys key key_len ref rows Extra4225id select_type table type possible_keys key key_len ref rows Extra
42261 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where42261 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
42272 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where42272 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 1 Using index; Using where
4228SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);4228SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
4229a b4229a b
4230EXPLAIN4230EXPLAIN
4231SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);4231SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4232id select_type table type possible_keys key key_len ref rows Extra4232id select_type table type possible_keys key key_len ref rows Extra
42331 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where42331 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
42342 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where42342 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
4235SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);4235SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4236a b4236a b
4237DROP TABLE t1,t2;4237DROP TABLE t1,t2;
42384238
=== modified file 'mysql-test/suite/pbxt/r/type_enum.result'
--- mysql-test/suite/pbxt/r/type_enum.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/type_enum.result 2009-08-17 15:57:58 +0000
@@ -1776,8 +1776,14 @@
1776 `russian_deviant` enum('E','F','EÿF','F,E') NOT NULL DEFAULT 'E'1776 `russian_deviant` enum('E','F','EÿF','F,E') NOT NULL DEFAULT 'E'
1777) ENGINE=PBXT DEFAULT CHARSET=latin11777) ENGINE=PBXT DEFAULT CHARSET=latin1
1778drop table t1;1778drop table t1;
1779select @@SESSION.sql_mode;
1780@@SESSION.sql_mode
1781
1782select @@GLOBAL.sql_mode;
1783@@GLOBAL.sql_mode
1784
1779create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ',' 1785create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
17801786
17811787
17821788
17831789
17841790
17851791
1786 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));1792 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
1787ERROR HY000: Can't create table 'test.t1' (errno: -1)1793drop table t1;
1788End of 5.1 tests1794End of 5.1 tests
17891795
=== modified file 'mysql-test/suite/pbxt/r/type_ranges.result'
--- mysql-test/suite/pbxt/r/type_ranges.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/type_ranges.result 2009-08-17 15:57:58 +0000
@@ -70,19 +70,19 @@
70show keys from t1;70show keys from t1;
71Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment71Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
72t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE 72t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
73t1 1 utiny 1 utiny A NULL NULL NULL BTREE 73t1 1 utiny 1 utiny A 0 NULL NULL BTREE
74t1 1 tiny 1 tiny A NULL NULL NULL BTREE 74t1 1 tiny 1 tiny A 0 NULL NULL BTREE
75t1 1 short 1 short A NULL NULL NULL BTREE 75t1 1 short 1 short A 0 NULL NULL BTREE
76t1 1 any_name 1 medium A NULL NULL NULL BTREE 76t1 1 any_name 1 medium A 0 NULL NULL BTREE
77t1 1 longlong 1 longlong A NULL NULL NULL BTREE 77t1 1 longlong 1 longlong A 0 NULL NULL BTREE
78t1 1 real_float 1 real_float A NULL NULL NULL BTREE 78t1 1 real_float 1 real_float A 0 NULL NULL BTREE
79t1 1 ushort 1 ushort A NULL NULL NULL BTREE 79t1 1 ushort 1 ushort A 0 NULL NULL BTREE
80t1 1 umedium 1 umedium A NULL NULL NULL BTREE 80t1 1 umedium 1 umedium A 0 NULL NULL BTREE
81t1 1 ulong 1 ulong A NULL NULL NULL BTREE 81t1 1 ulong 1 ulong A 0 NULL NULL BTREE
82t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE 82t1 1 ulonglong 1 ulonglong A 0 NULL NULL BTREE
83t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE 83t1 1 ulonglong 2 ulong A 0 NULL NULL BTREE
84t1 1 options 1 options A NULL NULL NULL BTREE 84t1 1 options 1 options A 0 NULL NULL BTREE
85t1 1 options 2 flags A NULL NULL NULL BTREE 85t1 1 options 2 flags A 0 NULL NULL BTREE
86CREATE UNIQUE INDEX test on t1 ( auto ) ;86CREATE UNIQUE INDEX test on t1 ( auto ) ;
87CREATE INDEX test2 on t1 ( ulonglong,ulong) ;87CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
88CREATE INDEX test3 on t1 ( medium ) ;88CREATE INDEX test3 on t1 ( medium ) ;
8989
=== modified file 'mysql-test/suite/pbxt/r/type_timestamp.result'
--- mysql-test/suite/pbxt/r/type_timestamp.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/type_timestamp.result 2009-08-17 15:57:58 +0000
@@ -101,13 +101,13 @@
101t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),101t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
102t14 timestamp(14));102t14 timestamp(14));
103Warnings:103Warnings:
104Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead104Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
105Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead105Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
106Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead106Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
107Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead107Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
108Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead108Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
109Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead109Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
110Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead110Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
111insert t1 values (0,0,0,0,0,0,0),111insert t1 values (0,0,0,0,0,0,0),
112("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",112("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
113"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",113"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
114114
=== modified file 'mysql-test/suite/pbxt/r/union.result'
--- mysql-test/suite/pbxt/r/union.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/union.result 2009-08-17 15:57:58 +0000
@@ -1301,12 +1301,14 @@
1301 `left(a,100000000)` longtext1301 `left(a,100000000)` longtext
1302) ENGINE=PBXT DEFAULT CHARSET=latin11302) ENGINE=PBXT DEFAULT CHARSET=latin1
1303drop tables t1,t2,t3;1303drop tables t1,t2,t3;
1304SELECT @tmp_max:= @@global.max_allowed_packet;
1305@tmp_max:= @@global.max_allowed_packet
13061048576
1307SET @@global.max_allowed_packet=25000000;
1304CREATE TABLE t1 (a mediumtext);1308CREATE TABLE t1 (a mediumtext);
1305CREATE TABLE t2 (b varchar(20));1309CREATE TABLE t2 (b varchar(20));
1306INSERT INTO t1 VALUES ('a');1310INSERT INTO t1 VALUES ('a');
1307CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;1311CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
1308Warnings:
1309Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1310SHOW CREATE TABLE t3;1312SHOW CREATE TABLE t3;
1311Table Create Table1313Table Create Table
1312t3 CREATE TABLE `t3` (1314t3 CREATE TABLE `t3` (
@@ -1340,6 +1342,7 @@
1340 `a` varbinary(510) DEFAULT NULL1342 `a` varbinary(510) DEFAULT NULL
1341) ENGINE=PBXT DEFAULT CHARSET=latin11343) ENGINE=PBXT DEFAULT CHARSET=latin1
1342DROP TABLES t1,t2,t3;1344DROP TABLES t1,t2,t3;
1345SET @@global.max_allowed_packet:= @tmp_max;
1343create table t1 ( id int not null auto_increment, primary key (id), col1 int);1346create table t1 ( id int not null auto_increment, primary key (id), col1 int);
1344insert into t1 (col1) values (2),(3),(4),(5),(6);1347insert into t1 (col1) values (2),(3),(4),(5),(6);
1345select 99 union all select id from t1 order by 1;1348select 99 union all select id from t1 order by 1;
13461349
=== modified file 'mysql-test/suite/pbxt/r/view_grant.result'
--- mysql-test/suite/pbxt/r/view_grant.result 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/r/view_grant.result 2009-08-17 15:57:58 +0000
@@ -28,7 +28,7 @@
28ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'28ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
29show create view v1;29show create view v1;
30View Create View character_set_client collation_connection30View Create View character_set_client collation_connection
31v1 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_ci31v1 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
32grant create view,drop,select on test.* to mysqltest_1@localhost;32grant create view,drop,select on test.* to mysqltest_1@localhost;
33use test;33use test;
34alter view v1 as select * from mysqltest.t1;34alter view v1 as select * from mysqltest.t1;
@@ -309,7 +309,7 @@
309create view v1 as select * from mysqltest.t1;309create view v1 as select * from mysqltest.t1;
310show create view v1;310show create view v1;
311View Create View character_set_client collation_connection311View Create View character_set_client collation_connection
312v1 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_ci312v1 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
313revoke select on mysqltest.t1 from mysqltest_1@localhost;313revoke select on mysqltest.t1 from mysqltest_1@localhost;
314select * from v1;314select * from v1;
315ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them315ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
316316
=== modified file 'mysql-test/suite/pbxt/t/auto_increment.test'
--- mysql-test/suite/pbxt/t/auto_increment.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/auto_increment.test 2009-08-17 15:57:58 +0000
@@ -150,7 +150,6 @@
150update t1 set a=0 where b=5;150update t1 set a=0 where b=5;
151select * from t1 order by b;151select * from t1 order by b;
152delete from t1 where a=0;152delete from t1 where a=0;
153--error 1048
154update t1 set a=NULL where b=6;153update t1 set a=NULL where b=6;
155update t1 set a=300 where b=7;154update t1 set a=300 where b=7;
156SET SQL_MODE='';155SET SQL_MODE='';
@@ -166,7 +165,6 @@
166update t1 set a=0 where b=12;165update t1 set a=0 where b=12;
167select * from t1 order by b;166select * from t1 order by b;
168delete from t1 where a=0;167delete from t1 where a=0;
169--error 1048
170update t1 set a=NULL where b=13;168update t1 set a=NULL where b=13;
171update t1 set a=500 where b=14;169update t1 set a=500 where b=14;
172select * from t1 order by b;170select * from t1 order by b;
173171
=== modified file 'mysql-test/suite/pbxt/t/delete.test'
--- mysql-test/suite/pbxt/t/delete.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/delete.test 2009-08-17 15:57:58 +0000
@@ -120,13 +120,16 @@
120delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);120delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
121select * from t11;121select * from t11;
122select * from t12;122select * from t12;
123--error 1242
123delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);124delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
124select * from t11;125select * from t11;
125select * from t12;126select * from t12;
127--error 1062
126insert into t11 values (2, 12);128insert into t11 values (2, 12);
127-- error 1242129-- error 1242
128delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);130delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
129select * from t11;131select * from t11;
132--error 1242
130delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);133delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
131select * from t11;134select * from t11;
132drop table t11, t12, t2;135drop table t11, t12, t2;
133136
=== modified file 'mysql-test/suite/pbxt/t/join_nested.test'
--- mysql-test/suite/pbxt/t/join_nested.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/join_nested.test 2009-08-17 15:57:58 +0000
@@ -546,6 +546,7 @@
546546
547CREATE INDEX idx_b ON t8(b);547CREATE INDEX idx_b ON t8(b);
548548
549--sorted_result
549EXPLAIN EXTENDED550EXPLAIN EXTENDED
550SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,551SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
551 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b552 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
@@ -585,6 +586,7 @@
585CREATE INDEX idx_b ON t1(b);586CREATE INDEX idx_b ON t1(b);
586CREATE INDEX idx_a ON t0(a);587CREATE INDEX idx_a ON t0(a);
587588
589--sorted_result
588EXPLAIN EXTENDED590EXPLAIN EXTENDED
589SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,591SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
590 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b592 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
@@ -621,6 +623,7 @@
621 (t8.b=t9.b OR t8.c IS NULL) AND623 (t8.b=t9.b OR t8.c IS NULL) AND
622 (t9.a=1); 624 (t9.a=1);
623625
626--sorted_result
624SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,627SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
625 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b628 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
626 FROM t0,t1629 FROM t0,t1
627630
=== modified file 'mysql-test/suite/pbxt/t/null.test'
--- mysql-test/suite/pbxt/t/null.test 2009-04-02 20:36:52 +0000
+++ mysql-test/suite/pbxt/t/null.test 2009-08-17 15:57:58 +0000
@@ -61,9 +61,7 @@
61#61#
62CREATE 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);62CREATE 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);
63INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";63INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
64--error 1048
65UPDATE t1 SET d=1/NULL;64UPDATE t1 SET d=1/NULL;
66--error 1048
67UPDATE t1 SET d=NULL;65UPDATE t1 SET d=NULL;
68--error 104866--error 1048
69INSERT INTO t1 (a) values (null);67INSERT INTO t1 (a) values (null);
7068
=== modified file 'mysql-test/suite/pbxt/t/pbxt_bugs.test'
--- mysql-test/suite/pbxt/t/pbxt_bugs.test 2009-04-02 20:36:52 +0000
+++ mysql-test/suite/pbxt/t/pbxt_bugs.test 2009-08-17 15:57:58 +0000
@@ -926,7 +926,59 @@
926SELECT * FROM t1 ORDER BY c1;926SELECT * FROM t1 ORDER BY c1;
927DROP TABLE t1;927DROP TABLE t1;
928928
929create table parent (id int primary key);
930create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
931insert into parent values (2), (3), (4);
932insert into child values (3), (4);
933
934--error 1451
935delete ignore from parent;
936--sorted_result
937select * from parent;
938
939drop table child, parent;
940
941# bug 378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
942
943create schema test378222;
944use test378222;
945create table t1 (id int primary key);
946create table t2 (id int primary key);
947alter table t1 add constraint foreign key (id) references t2 (id);
948alter table t2 add constraint foreign key (id) references t1 (id);
949drop schema test378222;
950
951create schema test378222a;
952create schema test378222b;
953create table test378222a.t1 (id int primary key);
954create table test378222b.t2 (id int primary key);
955alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
956alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
957set foreign_key_checks = 1;
958--error 1217
959drop schema test378222a;
960--error 1217
961drop schema test378222b;
962set foreign_key_checks = 0;
963drop schema test378222a;
964drop schema test378222b;
965set foreign_key_checks = 1;
966use test;
967
968# bug 369086: Incosistent/Incorrect Truncate behavior
969CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
970SHOW CREATE TABLE t1;
971INSERT INTO t1 VALUES(null);
972INSERT INTO t1 VALUES(null);
973INSERT INTO t1 VALUES(null);
974SELECT * FROM t1;
975TRUNCATE TABLE t1;
976INSERT INTO t1 VALUES(null);
977SELECT * FROM t1;
978DROP TABLE t1;
979
929--disable_query_log980--disable_query_log
981
930DROP TABLE t2, t5;982DROP TABLE t2, t5;
931drop database pbxt;983drop database pbxt;
932--enable_query_log984--enable_query_log
933985
=== modified file 'mysql-test/suite/pbxt/t/rename.test'
--- mysql-test/suite/pbxt/t/rename.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/rename.test 2009-08-17 15:57:58 +0000
@@ -63,7 +63,28 @@
63# Wait for the the tables to be renamed63# Wait for the the tables to be renamed
64# i.e the query below succeds64# i.e the query below succeds
65let $query= select * from t2, t4;65let $query= select * from t2, t4;
66source include/wait_for_query_to_suceed.inc;66# source include/wait_for_query_to_suceed.inc;
67let $counter= 100;
68
69disable_abort_on_error;
70disable_query_log;
71disable_result_log;
72eval $query;
73while ($mysql_errno)
74{
75 eval $query;
76 sleep 0.1;
77 dec $counter;
78
79 if (!$counter)
80 {
81 die("Waited too long for query to suceed");
82 }
83}
84enable_abort_on_error;
85enable_query_log;
86enable_result_log;
87
6788
68show tables;89show tables;
6990
7091
=== modified file 'mysql-test/suite/pbxt/t/schema.test'
--- mysql-test/suite/pbxt/t/schema.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/schema.test 2009-08-17 15:57:58 +0000
@@ -10,5 +10,12 @@
1010
11create schema foo;11create schema foo;
12show create schema foo;12show create schema foo;
13# force PBXT schema to be created
14create table t1 (id int) engine=pbxt;
13show schemas;15show schemas;
14drop schema foo;16drop schema foo;
17
18--disable_query_log
19drop table if exists t1;
20drop database pbxt;
21--enable_query_log
1522
=== modified file 'mysql-test/suite/pbxt/t/type_enum.test'
--- mysql-test/suite/pbxt/t/type_enum.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/type_enum.test 2009-08-17 15:57:58 +0000
@@ -153,12 +153,19 @@
153show create table t1;153show create table t1;
154drop table t1;154drop table t1;
155155
156# ER_WRONG_FIELD_TERMINATORS156# the following create statement sometimes fails like it would if NO_BACKSLASH_ESCAPES sql mode was on,
157--error 1005157# we check sql mode here
158select @@SESSION.sql_mode;
159select @@GLOBAL.sql_mode;
160
161## ER_WRONG_FIELD_TERMINATORS
162#--error 1005
158create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ',' 163create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
159164
160165
161166
162167
163168
164169
165 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));170 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
166171
172drop table t1;
173
167--disable_query_log174--disable_query_log
168drop database pbxt;175drop database pbxt;
169--enable_query_log176--enable_query_log
170177
=== modified file 'mysql-test/suite/pbxt/t/union.test'
--- mysql-test/suite/pbxt/t/union.test 2009-04-02 10:03:14 +0000
+++ mysql-test/suite/pbxt/t/union.test 2009-08-17 15:57:58 +0000
@@ -802,6 +802,10 @@
802# exceeds mediumtext maximum length802# exceeds mediumtext maximum length
803#803#
804804
805SELECT @tmp_max:= @@global.max_allowed_packet;
806SET @@global.max_allowed_packet=25000000;
807# switching connection to allow the new max_allowed_packet take effect
808--connect (newconn, localhost, root,,)
805CREATE TABLE t1 (a mediumtext);809CREATE TABLE t1 (a mediumtext);
806CREATE TABLE t2 (b varchar(20));810CREATE TABLE t2 (b varchar(20));
807INSERT INTO t1 VALUES ('a');811INSERT INTO t1 VALUES ('a');
@@ -823,6 +827,9 @@
823CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;827CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
824SHOW CREATE TABLE t3;828SHOW CREATE TABLE t3;
825DROP TABLES t1,t2,t3;829DROP TABLES t1,t2,t3;
830--connection default
831SET @@global.max_allowed_packet:= @tmp_max;
832--disconnect newconn
826833
827#834#
828# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM835# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
829836
=== modified file 'storage/pbxt/ChangeLog'
--- storage/pbxt/ChangeLog 2009-04-02 11:49:57 +0000
+++ storage/pbxt/ChangeLog 2009-08-18 07:46:53 +0000
@@ -1,7 +1,75 @@
1PBXT Release Notes1PBXT Release Notes
2==================2==================
33
4------- 1.0.08 RC - Not yet released4------- 1.0.08c RC2 - 2009-08-18
5
6RN266: 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.
7
8RN265: 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.
9
10RN264: 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.
11
12RN263: Updated xtstat to compile on Windows/MS Visual C++.
13
14RN262: Merged changes for PBMS version 0.5.09.
15
16RN261: Concerning bug #377788: Cannot find index for FK. Fixed buffer overflow which occurred when the error was reported.
17
18RN260: 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.
19
20RN259: Fixed bug #309424: xtstat doesn't use my.cnf. You can now add an [xtstat] section to my.cnf, for use with xtstat.
21
22RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started
23
24RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled
25
26RN256: Update datalog eof pointer only if write opearions were sucessful
27
28RN255: 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.
29
30RN254: 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.
31
32RN253: 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.
33
34RN252: Fixed bug #368692: PBXT not reporting data size correctly in information_schema.
35
36------- 1.0.08 RC2 - 2009-06-30
37
38RN251: A Windows-specific test update, also removed false assertion that failed on Windows.
39
40RN250: 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.
41
42RN249: 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.
43
44RN248: PBXT now compiles and runs with MySQL 5.1.35. All tests pass.
45
46RN247: Fixed bug #369086: Incosistent/Incorrect Truncate behavior
47
48RN246: Fixed bug #378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
49
50RN245: Fixed bug #379315: Inconsistent behavior of DELETE IGNORE and FK constraint.
51
52RN244: 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.
53
54RN243: 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
55
56RN242: 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
57
58RN241: 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.
59
60RN240: Load the record cache on read when no using memory mapped files.
61
62RN239: 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.
63
64RN238: 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.
65
66RN237: 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.
67
68RN236: Fixed bug #349177: a bug in configure.in script.
69
70RN235: Fixed bug 349176: a compiler warning.
71
72RN234: Completed Drizzle integration. All Drizzle tests now run with PBXT.
573
6RN233: Fixed bugs which occur when PBXT is used together with PBMS (BLOB Streaming engine).74RN233: Fixed bugs which occur when PBXT is used together with PBMS (BLOB Streaming engine).
775
876
=== modified file 'storage/pbxt/src/cache_xt.cc'
--- storage/pbxt/src/cache_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/cache_xt.cc 2009-08-17 11:12:36 +0000
@@ -23,6 +23,10 @@
2323
24#include "xt_config.h"24#include "xt_config.h"
2525
26#ifdef DRIZZLED
27#include <bitset>
28#endif
29
26#ifndef XT_WIN30#ifndef XT_WIN
27#include <unistd.h>31#include <unistd.h>
28#endif32#endif
@@ -51,17 +55,22 @@
51#define IDX_CAC_SEGMENT_COUNT ((off_t) 1 << XT_INDEX_CACHE_SEGMENT_SHIFTS)55#define IDX_CAC_SEGMENT_COUNT ((off_t) 1 << XT_INDEX_CACHE_SEGMENT_SHIFTS)
52#define IDX_CAC_SEGMENT_MASK (IDX_CAC_SEGMENT_COUNT - 1)56#define IDX_CAC_SEGMENT_MASK (IDX_CAC_SEGMENT_COUNT - 1)
5357
54//#define IDX_USE_SPINRWLOCK58#ifdef XT_NO_ATOMICS
55#define IDX_USE_RWMUTEX59#define IDX_CAC_USE_PTHREAD_RW
60#else
61//#define IDX_CAC_USE_RWMUTEX
56//#define IDX_CAC_USE_PTHREAD_RW62//#define IDX_CAC_USE_PTHREAD_RW
63//#define IDX_USE_SPINXSLOCK
64#define IDX_CAC_USE_XSMUTEX
65#endif
5766
58#ifdef IDX_CAC_USE_FASTWRLOCK67#ifdef IDX_CAC_USE_XSMUTEX
59#define IDX_CAC_LOCK_TYPE XTFastRWLockRec68#define IDX_CAC_LOCK_TYPE XTXSMutexRec
60#define IDX_CAC_INIT_LOCK(s, i) xt_fastrwlock_init(s, &(i)->cs_lock)69#define IDX_CAC_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, &(i)->cs_lock)
61#define IDX_CAC_FREE_LOCK(s, i) xt_fastrwlock_free(s, &(i)->cs_lock) 70#define IDX_CAC_FREE_LOCK(s, i) xt_xsmutex_free(s, &(i)->cs_lock)
62#define IDX_CAC_READ_LOCK(i, o) xt_fastrwlock_slock(&(i)->cs_lock, (o))71#define IDX_CAC_READ_LOCK(i, o) xt_xsmutex_slock(&(i)->cs_lock, (o)->t_id)
63#define IDX_CAC_WRITE_LOCK(i, o) xt_fastrwlock_xlock(&(i)->cs_lock, (o))72#define IDX_CAC_WRITE_LOCK(i, o) xt_xsmutex_xlock(&(i)->cs_lock, (o)->t_id)
64#define IDX_CAC_UNLOCK(i, o) xt_fastrwlock_unlock(&(i)->cs_lock, (o))73#define IDX_CAC_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->cs_lock, (o)->t_id)
65#elif defined(IDX_CAC_USE_PTHREAD_RW)74#elif defined(IDX_CAC_USE_PTHREAD_RW)
66#define IDX_CAC_LOCK_TYPE xt_rwlock_type75#define IDX_CAC_LOCK_TYPE xt_rwlock_type
67#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)76#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)
@@ -69,13 +78,20 @@
69#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)78#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
70#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)79#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
71#define IDX_CAC_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->cs_lock)80#define IDX_CAC_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->cs_lock)
72#elif defined(IDX_USE_RWMUTEX)81#elif defined(IDX_CAC_USE_RWMUTEX)
73#define IDX_CAC_LOCK_TYPE XTRWMutexRec82#define IDX_CAC_LOCK_TYPE XTRWMutexRec
74#define IDX_CAC_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, &(i)->cs_lock)83#define IDX_CAC_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, &(i)->cs_lock)
75#define IDX_CAC_FREE_LOCK(s, i) xt_rwmutex_free(s, &(i)->cs_lock) 84#define IDX_CAC_FREE_LOCK(s, i) xt_rwmutex_free(s, &(i)->cs_lock)
76#define IDX_CAC_READ_LOCK(i, o) xt_rwmutex_slock(&(i)->cs_lock, (o)->t_id)85#define IDX_CAC_READ_LOCK(i, o) xt_rwmutex_slock(&(i)->cs_lock, (o)->t_id)
77#define IDX_CAC_WRITE_LOCK(i, o) xt_rwmutex_xlock(&(i)->cs_lock, (o)->t_id)86#define IDX_CAC_WRITE_LOCK(i, o) xt_rwmutex_xlock(&(i)->cs_lock, (o)->t_id)
78#define IDX_CAC_UNLOCK(i, o) xt_rwmutex_unlock(&(i)->cs_lock, (o)->t_id)87#define IDX_CAC_UNLOCK(i, o) xt_rwmutex_unlock(&(i)->cs_lock, (o)->t_id)
88#elif defined(IDX_CAC_USE_SPINXSLOCK)
89#define IDX_CAC_LOCK_TYPE XTSpinXSLockRec
90#define IDX_CAC_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, &(i)->cs_lock)
91#define IDX_CAC_FREE_LOCK(s, i) xt_spinxslock_free(s, &(i)->cs_lock)
92#define IDX_CAC_READ_LOCK(i, s) xt_spinxslock_slock(&(i)->cs_lock, (s)->t_id)
93#define IDX_CAC_WRITE_LOCK(i, s) xt_spinxslock_xlock(&(i)->cs_lock, (s)->t_id)
94#define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id)
79#endif95#endif
8096
81#define ID_HANDLE_USE_SPINLOCK97#define ID_HANDLE_USE_SPINLOCK
@@ -308,7 +324,8 @@
308324
309 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];325 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];
310326
311 ASSERT_NS(iref->ir_ulock == XT_UNLOCK_READ);327 ASSERT_NS(iref->ir_xlock == FALSE);
328 ASSERT_NS(iref->ir_updated == FALSE);
312 ID_HANDLE_LOCK(&hs->hs_handles_lock);329 ID_HANDLE_LOCK(&hs->hs_handles_lock);
313#ifdef CHECK_HANDLE_STRUCTS330#ifdef CHECK_HANDLE_STRUCTS
314 ic_check_handle_structs();331 ic_check_handle_structs();
@@ -337,10 +354,10 @@
337 * at least an Slock on the index.354 * at least an Slock on the index.
338 * So this excludes anyone who is reading 355 * So this excludes anyone who is reading
339 * cb_handle_count in the index.356 * cb_handle_count in the index.
340 * (all cache block writers, and a freeer).357 * (all cache block writers, and the freeer).
341 *358 *
342 * The increment is safe because I have the list359 * The increment is safe because I have the list
343 * lock, which is required by anyone else360 * lock (hs_handles_lock), which is required by anyone else
344 * who increments or decrements this value.361 * who increments or decrements this value.
345 */362 */
346 iref->ir_block->cb_handle_count++;363 iref->ir_block->cb_handle_count++;
@@ -396,8 +413,11 @@
396 xblock = seg->cs_hash_table[hash_idx];413 xblock = seg->cs_hash_table[hash_idx];
397 while (xblock) {414 while (xblock) {
398 if (block == xblock) {415 if (block == xblock) {
399 /* Found the block... */416 /* Found the block...
400 xt_atomicrwlock_xlock(&block->cb_lock, thread->t_id);417 * {HANDLE-COUNT-SLOCK}
418 * 04.05.2009, changed to slock.
419 */
420 XT_IPAGE_READ_LOCK(&block->cb_lock);
401 goto block_found;421 goto block_found;
402 }422 }
403 xblock = xblock->cb_next;423 xblock = xblock->cb_next;
@@ -431,7 +451,18 @@
431 /* {HANDLE-COUNT-USAGE}451 /* {HANDLE-COUNT-USAGE}
432 * This is safe here because I have excluded452 * This is safe here because I have excluded
433 * all readers by taking an Xlock on the453 * all readers by taking an Xlock on the
434 * cache block.454 * cache block (CHANGED - see below).
455 *
456 * {HANDLE-COUNT-SLOCK}
457 * 04.05.2009, changed to slock.
458 * Should be OK, because:
459 * A have a lock on the list lock (hs_handles_lock),
460 * which prevents concurrent updates to cb_handle_count.
461 *
462 * I have also have a read lock on the cache block
463 * but not a lock on the index. As a result, we cannot
464 * excluded all index writers (and readers of
465 * cb_handle_count.
435 */466 */
436 block->cb_handle_count--;467 block->cb_handle_count--;
437 }468 }
@@ -466,7 +497,7 @@
466 ID_HANDLE_UNLOCK(&hs->hs_handles_lock);497 ID_HANDLE_UNLOCK(&hs->hs_handles_lock);
467498
468 if (block)499 if (block)
469 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);500 XT_IPAGE_UNLOCK(&block->cb_lock, FALSE);
470}501}
471502
472/* Call this function before a referenced cache block is modified!503/* Call this function before a referenced cache block is modified!
@@ -482,17 +513,28 @@
482513
483 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];514 hs = &ind_cac_globals.cg_handle_slot[iref->ir_block->cb_address % XT_HANDLE_SLOTS];
484515
516 ID_HANDLE_LOCK(&hs->hs_handles_lock);
517
485 /* {HANDLE-COUNT-USAGE}518 /* {HANDLE-COUNT-USAGE}
486 * This is only called by updaters of this index block, or519 * This is only called by updaters of this index block, or
487 * the free which holds an Xlock on the index block.520 * the free which holds an Xlock on the index block.
488 *
489 * These are all mutually exclusive for the index block.521 * These are all mutually exclusive for the index block.
522 *
523 * {HANDLE-COUNT-SLOCK}
524 * Do this check again, after we have the list lock (hs_handles_lock).
525 * There is a small chance that the count has changed, since we last
526 * checked because xt_ind_release_handle() only holds
527 * an slock on the index page.
528 *
529 * An updater can sometimes have a XLOCK on the index and an slock
530 * on the cache block. In this case xt_ind_release_handle()
531 * could have run through.
490 */532 */
491 ASSERT_NS(iref->ir_block->cb_handle_count);533 if (!iref->ir_block->cb_handle_count) {
492 if (!iref->ir_block->cb_handle_count)534 ID_HANDLE_UNLOCK(&hs->hs_handles_lock);
493 return OK;535 return OK;
536 }
494537
495 ID_HANDLE_LOCK(&hs->hs_handles_lock);
496#ifdef CHECK_HANDLE_STRUCTS538#ifdef CHECK_HANDLE_STRUCTS
497 ic_check_handle_structs();539 ic_check_handle_structs();
498#endif540#endif
@@ -609,7 +651,7 @@
609#endif651#endif
610652
611 for (u_int i=0; i<ind_cac_globals.cg_block_count; i++) {653 for (u_int i=0; i<ind_cac_globals.cg_block_count; i++) {
612 xt_atomicrwlock_init_with_autoname(self, &block->cb_lock);654 XT_IPAGE_INIT_LOCK(self, &block->cb_lock);
613 block->cb_state = IDX_CAC_BLOCK_FREE;655 block->cb_state = IDX_CAC_BLOCK_FREE;
614 block->cb_next = ind_cac_globals.cg_free_list;656 block->cb_next = ind_cac_globals.cg_free_list;
615#ifdef XT_USE_DIRECT_IO_ON_INDEX657#ifdef XT_USE_DIRECT_IO_ON_INDEX
@@ -836,10 +878,10 @@
836 while (xblock) {878 while (xblock) {
837 if (block == xblock) {879 if (block == xblock) {
838 /* Found the block... */880 /* Found the block... */
839 xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);881 XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
840 if (block->cb_state != IDX_CAC_BLOCK_CLEAN) {882 if (block->cb_state != IDX_CAC_BLOCK_CLEAN) {
841 /* This block cannot be freeed: */883 /* This block cannot be freeed: */
842 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);884 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
843 IDX_CAC_UNLOCK(seg, ot->ot_thread);885 IDX_CAC_UNLOCK(seg, ot->ot_thread);
844#ifdef DEBUG_CHECK_IND_CACHE886#ifdef DEBUG_CHECK_IND_CACHE
845 xt_ind_check_cache(NULL);887 xt_ind_check_cache(NULL);
@@ -878,11 +920,12 @@
878 if (block->cb_handle_count) {920 if (block->cb_handle_count) {
879 XTIndReferenceRec iref;921 XTIndReferenceRec iref;
880 922
881 iref.ir_ulock = XT_UNLOCK_WRITE;923 iref.ir_xlock = TRUE;
924 iref.ir_updated = FALSE;
882 iref.ir_block = block;925 iref.ir_block = block;
883 iref.ir_branch = (XTIdxBranchDPtr) block->cb_data;926 iref.ir_branch = (XTIdxBranchDPtr) block->cb_data;
884 if (!xt_ind_copy_on_write(&iref)) {927 if (!xt_ind_copy_on_write(&iref)) {
885 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);928 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
886 return FALSE;929 return FALSE;
887 }930 }
888 }931 }
@@ -918,7 +961,7 @@
918 IDX_TRACE("%d- f%x\n", (int) XT_NODE_ID(address), (int) XT_GET_DISK_2(block->cb_data));961 IDX_TRACE("%d- f%x\n", (int) XT_NODE_ID(address), (int) XT_GET_DISK_2(block->cb_data));
919962
920 /* Unlock BEFORE the block is reused! */963 /* Unlock BEFORE the block is reused! */
921 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);964 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
922965
923 xt_unlock_mutex_ns(&ind_cac_globals.cg_lock);966 xt_unlock_mutex_ns(&ind_cac_globals.cg_lock);
924967
@@ -1001,7 +1044,7 @@
1001 * Fetch the block. Note, if we are about to write the block1044 * Fetch the block. Note, if we are about to write the block
1002 * then there is no need to read it from disk!1045 * then there is no need to read it from disk!
1003 */1046 */
1004static XTIndBlockPtr ind_cac_fetch(XTOpenTablePtr ot, xtIndexNodeID address, DcSegmentPtr *ret_seg, xtBool read_data)1047static XTIndBlockPtr ind_cac_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, DcSegmentPtr *ret_seg, xtBool read_data)
1005{1048{
1006 register XTOpenFilePtr file = ot->ot_ind_file;1049 register XTOpenFilePtr file = ot->ot_ind_file;
1007 register XTIndBlockPtr block, new_block;1050 register XTIndBlockPtr block, new_block;
@@ -1110,6 +1153,7 @@
1110 new_block->cb_state = IDX_CAC_BLOCK_CLEAN;1153 new_block->cb_state = IDX_CAC_BLOCK_CLEAN;
1111 new_block->cb_handle_count = 0;1154 new_block->cb_handle_count = 0;
1112 new_block->cp_flush_seq = 0;1155 new_block->cp_flush_seq = 0;
1156 new_block->cp_del_count = 0;
1113 new_block->cb_dirty_next = NULL;1157 new_block->cb_dirty_next = NULL;
1114 new_block->cb_dirty_prev = NULL;1158 new_block->cb_dirty_prev = NULL;
11151159
@@ -1172,6 +1216,13 @@
1172#endif1216#endif
1173 xt_unlock_mutex_ns(&dcg->cg_lock);1217 xt_unlock_mutex_ns(&dcg->cg_lock);
11741218
1219 /* {LAZY-DEL-INDEX-ITEMS}
1220 * Conditionally count the number of deleted entries in the index:
1221 * We do this before other threads can read the block.
1222 */
1223 if (ind->mi_lazy_delete && read_data)
1224 xt_ind_count_deleted_items(ot->ot_table, ind, block);
1225
1175 /* Add to the hash table: */1226 /* Add to the hash table: */
1176 block->cb_next = seg->cs_hash_table[hash_idx];1227 block->cb_next = seg->cs_hash_table[hash_idx];
1177 seg->cs_hash_table[hash_idx] = block;1228 seg->cs_hash_table[hash_idx] = block;
@@ -1221,10 +1272,10 @@
1221 XTIndBlockPtr block;1272 XTIndBlockPtr block;
1222 DcSegmentPtr seg;1273 DcSegmentPtr seg;
12231274
1224 if (!(block = ind_cac_fetch(ot, address, &seg, FALSE)))1275 if (!(block = ind_cac_fetch(ot, ind, address, &seg, FALSE)))
1225 return FAILED;1276 return FAILED;
12261277
1227 xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);1278 XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
1228 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);1279 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
1229 memcpy(block->cb_data, data, size);1280 memcpy(block->cb_data, data, size);
1230 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;1281 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;
@@ -1239,7 +1290,7 @@
1239 xt_spinlock_unlock(&ind->mi_dirty_lock);1290 xt_spinlock_unlock(&ind->mi_dirty_lock);
1240 block->cb_state = IDX_CAC_BLOCK_DIRTY;1291 block->cb_state = IDX_CAC_BLOCK_DIRTY;
1241 }1292 }
1242 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);1293 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
1243 IDX_CAC_UNLOCK(seg, ot->ot_thread);1294 IDX_CAC_UNLOCK(seg, ot->ot_thread);
1244#ifdef XT_TRACK_INDEX_UPDATES1295#ifdef XT_TRACK_INDEX_UPDATES
1245 ot->ot_ind_changed++;1296 ot->ot_ind_changed++;
@@ -1259,10 +1310,10 @@
1259 return FAILED;1310 return FAILED;
12601311
1261 if (block) {1312 if (block) {
1262 xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);1313 XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
1263 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);1314 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
1264 memcpy(block->cb_data, data, size);1315 memcpy(block->cb_data, data, size);
1265 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);1316 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
1266 IDX_CAC_UNLOCK(seg, ot->ot_thread);1317 IDX_CAC_UNLOCK(seg, ot->ot_thread);
1267 }1318 }
12681319
@@ -1277,7 +1328,7 @@
1277 if (!ind_cac_get(ot, address, &seg, &block))1328 if (!ind_cac_get(ot, address, &seg, &block))
1278 return FAILED;1329 return FAILED;
1279 if (block) {1330 if (block) {
1280 xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);1331 XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
1281 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);1332 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
12821333
1283 if (block->cb_state == IDX_CAC_BLOCK_DIRTY) {1334 if (block->cb_state == IDX_CAC_BLOCK_DIRTY) {
@@ -1293,7 +1344,7 @@
1293 xt_spinlock_unlock(&ind->mi_dirty_lock);1344 xt_spinlock_unlock(&ind->mi_dirty_lock);
1294 block->cb_state = IDX_CAC_BLOCK_CLEAN;1345 block->cb_state = IDX_CAC_BLOCK_CLEAN;
1295 }1346 }
1296 xt_atomicrwlock_unlock(&block->cb_lock, TRUE);1347 XT_IPAGE_UNLOCK(&block->cb_lock, TRUE);
12971348
1298 IDX_CAC_UNLOCK(seg, ot->ot_thread);1349 IDX_CAC_UNLOCK(seg, ot->ot_thread);
1299 }1350 }
@@ -1301,29 +1352,33 @@
1301 return OK;1352 return OK;
1302}1353}
13031354
1304xtPublic xtBool xt_ind_read_bytes(XTOpenTablePtr ot, xtIndexNodeID address, size_t size, xtWord1 *data)1355xtPublic xtBool xt_ind_read_bytes(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, size_t size, xtWord1 *data)
1305{1356{
1306 XTIndBlockPtr block;1357 XTIndBlockPtr block;
1307 DcSegmentPtr seg;1358 DcSegmentPtr seg;
13081359
1309 if (!(block = ind_cac_fetch(ot, address, &seg, TRUE)))1360 if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
1310 return FAILED;1361 return FAILED;
13111362
1312 xt_atomicrwlock_slock(&block->cb_lock);1363 XT_IPAGE_READ_LOCK(&block->cb_lock);
1313 memcpy(data, block->cb_data, size);1364 memcpy(data, block->cb_data, size);
1314 xt_atomicrwlock_unlock(&block->cb_lock, FALSE);1365 XT_IPAGE_UNLOCK(&block->cb_lock, FALSE);
1315 IDX_CAC_UNLOCK(seg, ot->ot_thread);1366 IDX_CAC_UNLOCK(seg, ot->ot_thread);
1316 return OK;1367 return OK;
1317}1368}
13181369
1319xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, xtIndexNodeID address, XTPageLockType ltype, XTIndReferencePtr iref)1370xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTPageLockType ltype, XTIndReferencePtr iref)
1320{1371{
1321 register XTIndBlockPtr block;1372 register XTIndBlockPtr block;
1322 DcSegmentPtr seg;1373 DcSegmentPtr seg;
1323 xtWord2 branch_size;1374 xtWord2 branch_size;
1375 xtBool xlock = FALSE;
13241376
1325 ASSERT_NS(iref->ir_ulock == XT_UNLOCK_NONE);1377#ifdef DEBUG
1326 if (!(block = ind_cac_fetch(ot, address, &seg, TRUE)))1378 ASSERT_NS(iref->ir_xlock == 2);
1379 ASSERT_NS(iref->ir_xlock == 2);
1380#endif
1381 if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
1327 return NULL;1382 return NULL;
13281383
1329 branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);1384 branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);
@@ -1333,21 +1388,50 @@
1333 return FAILED;1388 return FAILED;
1334 }1389 }
13351390
1336 if (ltype == XT_XLOCK_LEAF) {1391 switch (ltype) {
1337 if (XT_IS_NODE(branch_size))1392 case XT_LOCK_READ:
1338 ltype = XT_LOCK_READ;1393 break;
1339 else1394 case XT_LOCK_WRITE:
1340 ltype = XT_LOCK_WRITE;1395 xlock = TRUE;
1396 break;
1397 case XT_XLOCK_LEAF:
1398 if (!XT_IS_NODE(branch_size))
1399 xlock = TRUE;
1400 break;
1401 case XT_XLOCK_DEL_LEAF:
1402 if (!XT_IS_NODE(branch_size)) {
1403 if (ot->ot_table->tab_dic.dic_no_lazy_delete)
1404 xlock = TRUE;
1405 else {
1406 /*
1407 * {LAZY-DEL-INDEX-ITEMS}
1408 *
1409 * We are fetch a page for delete purpose.
1410 * we decide here if we plan to do a lazy delete,
1411 * Or if we plan to compact the node.
1412 *
1413 * A lazy delete just requires a shared lock.
1414 *
1415 */
1416 if (ind->mi_lazy_delete) {
1417 /* If the number of deleted items is greater than
1418 * half of the number of times that can fit in the
1419 * page, then we will compact the node.
1420 */
1421 if (!xt_idx_lazy_delete_on_leaf(ind, block, XT_GET_INDEX_BLOCK_LEN(branch_size)))
1422 xlock = TRUE;
1423 }
1424 else
1425 xlock = TRUE;
1426 }
1427 }
1428 break;
1341 }1429 }
13421430
1343 if (ltype == XT_LOCK_WRITE) {1431 if ((iref->ir_xlock = xlock))
1344 xt_atomicrwlock_xlock(&block->cb_lock, ot->ot_thread->t_id);1432 XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id);
1345 iref->ir_ulock = XT_UNLOCK_WRITE;1433 else
1346 }1434 XT_IPAGE_READ_LOCK(&block->cb_lock);
1347 else {
1348 xt_atomicrwlock_slock(&block->cb_lock);
1349 iref->ir_ulock = XT_UNLOCK_READ;
1350 }
13511435
1352 IDX_CAC_UNLOCK(seg, ot->ot_thread);1436 IDX_CAC_UNLOCK(seg, ot->ot_thread);
13531437
@@ -1358,18 +1442,31 @@
1358 * As a result, we need to pass a pointer to both the1442 * As a result, we need to pass a pointer to both the
1359 * cache block and the cache block data:1443 * cache block and the cache block data:
1360 */1444 */
1445 iref->ir_updated = FALSE;
1361 iref->ir_block = block;1446 iref->ir_block = block;
1362 iref->ir_branch = (XTIdxBranchDPtr) block->cb_data;1447 iref->ir_branch = (XTIdxBranchDPtr) block->cb_data;
1363 return OK;1448 return OK;
1364}1449}
13651450
1366xtPublic xtBool xt_ind_release(XTOpenTablePtr ot, XTIndexPtr ind, XTPageUnlockType XT_UNUSED(utype), XTIndReferencePtr iref)1451xtPublic xtBool xt_ind_release(XTOpenTablePtr ot, XTIndexPtr ind, XTPageUnlockType XT_NDEBUG_UNUSED(utype), XTIndReferencePtr iref)
1367{1452{
1368 register XTIndBlockPtr block;1453 register XTIndBlockPtr block;
13691454
1370 block = iref->ir_block;1455 block = iref->ir_block;
13711456
1372 if (utype == XT_UNLOCK_R_UPDATE || utype == XT_UNLOCK_W_UPDATE) {1457#ifdef DEBUG
1458 ASSERT_NS(iref->ir_xlock != 2);
1459 ASSERT_NS(iref->ir_updated != 2);
1460 if (iref->ir_updated)
1461 ASSERT_NS(utype == XT_UNLOCK_R_UPDATE || utype == XT_UNLOCK_W_UPDATE);
1462 else
1463 ASSERT_NS(utype == XT_UNLOCK_READ || utype == XT_UNLOCK_WRITE);
1464 if (iref->ir_xlock)
1465 ASSERT_NS(utype == XT_UNLOCK_WRITE || utype == XT_UNLOCK_W_UPDATE);
1466 else
1467 ASSERT_NS(utype == XT_UNLOCK_READ || utype == XT_UNLOCK_R_UPDATE);
1468#endif
1469 if (iref->ir_updated) {
1373 /* The page was update: */1470 /* The page was update: */
1374 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);1471 ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_CLEAN || block->cb_state == IDX_CAC_BLOCK_DIRTY);
1375 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;1472 block->cp_flush_seq = ot->ot_table->tab_ind_flush_seq;
@@ -1386,16 +1483,10 @@
1386 }1483 }
1387 }1484 }
13881485
1389#ifdef DEBUG1486 XT_IPAGE_UNLOCK(&block->cb_lock, iref->ir_xlock);
1390 if (utype == XT_UNLOCK_W_UPDATE)1487#ifdef DEBUG
1391 utype = XT_UNLOCK_WRITE;1488 iref->ir_xlock = 2;
1392 else if (utype == XT_UNLOCK_R_UPDATE)1489 iref->ir_updated = 2;
1393 utype = XT_UNLOCK_READ;
1394 ASSERT_NS(iref->ir_ulock == utype);
1395#endif
1396 xt_atomicrwlock_unlock(&block->cb_lock, iref->ir_ulock == XT_UNLOCK_WRITE ? TRUE : FALSE);
1397#ifdef DEBUG
1398 iref->ir_ulock = XT_UNLOCK_NONE;
1399#endif1490#endif
1400 return OK;1491 return OK;
1401}1492}
@@ -1484,24 +1575,3 @@
1484 xt_ind_free_reserved(ot);1575 xt_ind_free_reserved(ot);
1485}1576}
14861577
1487xtPublic void xt_load_indices(XTThreadPtr self, XTOpenTablePtr ot)
1488{
1489 register XTTableHPtr tab = ot->ot_table;
1490 register XTIndBlockPtr block;
1491 DcSegmentPtr seg;
1492 xtIndexNodeID id;
1493
1494 xt_lock_mutex_ns(&tab->tab_ind_flush_lock);
1495
1496 for (id=1; id < XT_NODE_ID(tab->tab_ind_eof); id++) {
1497 if (!(block = ind_cac_fetch(ot, id, &seg, TRUE))) {
1498 xt_unlock_mutex_ns(&tab->tab_ind_flush_lock);
1499 xt_throw(self);
1500 }
1501 IDX_CAC_UNLOCK(seg, ot->ot_thread);
1502 }
1503
1504 xt_unlock_mutex_ns(&tab->tab_ind_flush_lock);
1505}
1506
1507
15081578
=== modified file 'storage/pbxt/src/cache_xt.h'
--- storage/pbxt/src/cache_xt.h 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/cache_xt.h 2009-08-17 11:12:36 +0000
@@ -45,8 +45,46 @@
45#define IDX_CAC_BLOCK_CLEAN 145#define IDX_CAC_BLOCK_CLEAN 1
46#define IDX_CAC_BLOCK_DIRTY 246#define IDX_CAC_BLOCK_DIRTY 2
4747
48typedef enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF };48#ifdef XT_NO_ATOMICS
49typedef enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };49#define XT_IPAGE_USE_PTHREAD_RW
50#else
51//#define XT_IPAGE_USE_ATOMIC_RW
52#define XT_IPAGE_USE_SPINXSLOCK
53//#define XT_IPAGE_USE_SKEW_RW
54#endif
55
56#ifdef XT_IPAGE_USE_ATOMIC_RW
57#define XT_IPAGE_LOCK_TYPE XTAtomicRWLockRec
58#define XT_IPAGE_INIT_LOCK(s, i) xt_atomicrwlock_init_with_autoname(s, i)
59#define XT_IPAGE_FREE_LOCK(s, i) xt_atomicrwlock_free(s, i)
60#define XT_IPAGE_READ_LOCK(i) xt_atomicrwlock_slock(i)
61#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, o)
62#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
63#elif defined(XT_IPAGE_USE_PTHREAD_RW)
64#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
65#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
66#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
67#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
68#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
69#define XT_IPAGE_UNLOCK(i, x) xt_unlock_rwlock_ns(i)
70#elif defined(XT_IPAGE_USE_SPINXSLOCK)
71#define XT_IPAGE_LOCK_TYPE XTSpinXSLockRec
72#define XT_IPAGE_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
73#define XT_IPAGE_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
74#define XT_IPAGE_READ_LOCK(i) xt_spinxslock_slock(i)
75#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
76#define XT_IPAGE_UNLOCK(i, x) xt_spinxslock_unlock(i, x)
77#else // XT_IPAGE_USE_SKEW_RW
78#define XT_IPAGE_LOCK_TYPE XTSkewRWLockRec
79#define XT_IPAGE_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i)
80#define XT_IPAGE_FREE_LOCK(s, i) xt_skewrwlock_free(s, i)
81#define XT_IPAGE_READ_LOCK(i) xt_skewrwlock_slock(i)
82#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, o)
83#define XT_IPAGE_UNLOCK(i, x) xt_skewrwlock_unlock(i, x)
84#endif
85
86enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF, XT_XLOCK_DEL_LEAF };
87enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
5088
51/* A block is X locked if it is being changed or freed.89/* A block is X locked if it is being changed or freed.
52 * A block is S locked if it is being read.90 * A block is S locked if it is being read.
@@ -64,10 +102,11 @@
64 struct XTIndBlock *cb_mr_used; /* More recently used blocks. */102 struct XTIndBlock *cb_mr_used; /* More recently used blocks. */
65 struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */103 struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */
66 /* Protected by cb_lock: */104 /* Protected by cb_lock: */
67 XTAtomicRWLockRec cb_lock;105 XT_IPAGE_LOCK_TYPE cb_lock;
68 xtWord1 cb_state; /* Block status. */106 xtWord1 cb_state; /* Block status. */
69 xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */107 xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */
70 xtWord2 cp_flush_seq;108 xtWord2 cp_flush_seq;
109 xtWord2 cp_del_count; /* Number of deleted entries. */
71#ifdef XT_USE_DIRECT_IO_ON_INDEX110#ifdef XT_USE_DIRECT_IO_ON_INDEX
72 xtWord1 *cb_data;111 xtWord1 *cb_data;
73#else112#else
@@ -76,16 +115,18 @@
76} XTIndBlockRec, *XTIndBlockPtr;115} XTIndBlockRec, *XTIndBlockPtr;
77116
78typedef struct XTIndReference {117typedef struct XTIndReference {
79 XTPageUnlockType ir_ulock;118 xtBool ir_xlock; /* Set to TRUE if the cache block is X locked. */
119 xtBool ir_updated; /* Set to TRUE if the cache block is updated. */
80 XTIndBlockPtr ir_block;120 XTIndBlockPtr ir_block;
81 XTIdxBranchDPtr ir_branch;121 XTIdxBranchDPtr ir_branch;
82} XTIndReferenceRec, *XTIndReferencePtr;122} XTIndReferenceRec, *XTIndReferencePtr;
83123
84typedef struct XTIndFreeBlock {124typedef struct XTIndFreeBlock {
125 XTDiskValue1 if_zero1_1; /* Must be set to zero. */
126 XTDiskValue1 if_zero2_1; /* Must be set to zero. */
85 XTDiskValue1 if_status_1;127 XTDiskValue1 if_status_1;
86 XTDiskValue1 if_unused1_1;128 XTDiskValue1 if_unused1_1;
87 XTDiskValue2 if_unused2_2;129 XTDiskValue4 if_unused2_4;
88 XTDiskValue4 if_unused3_4;
89 XTDiskValue8 if_next_block_8;130 XTDiskValue8 if_next_block_8;
90} XTIndFreeBlockRec, *XTIndFreeBlockPtr;131} XTIndFreeBlockRec, *XTIndFreeBlockPtr;
91132
@@ -116,14 +157,13 @@
116xtBool xt_ind_write(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);157xtBool xt_ind_write(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
117xtBool xt_ind_write_cache(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);158xtBool xt_ind_write_cache(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
118xtBool xt_ind_clean(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset);159xtBool xt_ind_clean(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset);
119xtBool xt_ind_read_bytes(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);160xtBool xt_ind_read_bytes(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
120void xt_ind_check_cache(XTIndexPtr ind);161void xt_ind_check_cache(XTIndexPtr ind);
121xtBool xt_ind_reserve(struct XTOpenTable *ot, u_int count, XTIdxBranchDPtr not_this);162xtBool xt_ind_reserve(struct XTOpenTable *ot, u_int count, XTIdxBranchDPtr not_this);
122void xt_ind_free_reserved(struct XTOpenTable *ot);163void xt_ind_free_reserved(struct XTOpenTable *ot);
123void xt_ind_unreserve(struct XTOpenTable *ot);164void xt_ind_unreserve(struct XTOpenTable *ot);
124void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
125165
126xtBool xt_ind_fetch(struct XTOpenTable *ot, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);166xtBool xt_ind_fetch(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
127xtBool xt_ind_release(struct XTOpenTable *ot, XTIndexPtr ind, XTPageUnlockType utype, XTIndReferencePtr iref);167xtBool xt_ind_release(struct XTOpenTable *ot, XTIndexPtr ind, XTPageUnlockType utype, XTIndReferencePtr iref);
128168
129void xt_ind_lock_handle(XTIndHandlePtr handle);169void xt_ind_lock_handle(XTIndHandlePtr handle);
130170
=== modified file 'storage/pbxt/src/ccutils_xt.cc'
--- storage/pbxt/src/ccutils_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/ccutils_xt.cc 2009-08-17 11:12:36 +0000
@@ -29,7 +29,7 @@
29#include "ccutils_xt.h"29#include "ccutils_xt.h"
30#include "bsearch_xt.h"30#include "bsearch_xt.h"
3131
32static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)32static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
33{33{
34 XTObject *obj_ptr = (XTObject *) b;34 XTObject *obj_ptr = (XTObject *) b;
3535
3636
=== modified file 'storage/pbxt/src/database_xt.cc'
--- storage/pbxt/src/database_xt.cc 2009-04-02 10:03:14 +0000
+++ storage/pbxt/src/database_xt.cc 2009-08-17 11:12:36 +0000
@@ -23,6 +23,10 @@
2323
24#include "xt_config.h"24#include "xt_config.h"
2525
26#ifdef DRIZZLED
27#include <bitset>
28#endif
29
26#include <string.h>30#include <string.h>
27#include <stdio.h>31#include <stdio.h>
2832
@@ -240,7 +244,7 @@
240 xt_heap_release(self, (XTDatabaseHPtr) data);244 xt_heap_release(self, (XTDatabaseHPtr) data);
241}245}
242246
243static int db_cmp_db_id(struct XTThread XT_UNUSED(*self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)247static int db_cmp_db_id(struct XTThread *XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
244{248{
245 xtDatabaseID db_id = *((xtDatabaseID *) a);249 xtDatabaseID db_id = *((xtDatabaseID *) a);
246 XTDatabaseHPtr *db_ptr = (XTDatabaseHPtr *) b;250 XTDatabaseHPtr *db_ptr = (XTDatabaseHPtr *) b;
@@ -346,7 +350,7 @@
346 }350 }
347}351}
348352
349static void db_onrelease(XTThreadPtr self, void XT_UNUSED(*x))353static void db_onrelease(XTThreadPtr self, void *XT_UNUSED(x))
350{354{
351 /* Signal threads waiting for exclusive use of the database: */355 /* Signal threads waiting for exclusive use of the database: */
352 if (xt_db_open_databases) // The database may already be closed.356 if (xt_db_open_databases) // The database may already be closed.
@@ -612,7 +616,7 @@
612xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool multi_path)616xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool multi_path)
613{617{
614 XTDatabaseHPtr db;618 XTDatabaseHPtr db;
615 619
616 /* We cannot get a database, without unusing the current620 /* We cannot get a database, without unusing the current
617 * first. The reason is that the restart process will621 * first. The reason is that the restart process will
618 * partially set the current database!622 * partially set the current database!
@@ -621,7 +625,7 @@
621 db = xt_get_database(self, path, multi_path);625 db = xt_get_database(self, path, multi_path);
622 pushr_(xt_heap_release, db);626 pushr_(xt_heap_release, db);
623 xt_use_database(self, db, XT_FOR_USER);627 xt_use_database(self, db, XT_FOR_USER);
624 freer_(); // xt_heap_release(self, db); 628 freer_(); // xt_heap_release(self, db);
625}629}
626630
627/* This function can only be called if you do not already have a database in631/* This function can only be called if you do not already have a database in
@@ -638,6 +642,12 @@
638642
639 xt_heap_reference(self, db);643 xt_heap_reference(self, db);
640 self->st_database = db;644 self->st_database = db;
645#ifdef XT_WAIT_FOR_CLEANUP
646 self->st_last_xact = 0;
647 for (int i=0; i<XT_MAX_XACT_BEHIND; i++) {
648 self->st_prev_xact[i] = db->db_xn_curr_id;
649 }
650#endif
641 xt_xn_init_thread(self, what_for);651 xt_xn_init_thread(self, what_for);
642}652}
643653
@@ -1117,15 +1127,18 @@
1117 XTDatabaseHPtr db = ot->ot_table->tab_db;1127 XTDatabaseHPtr db = ot->ot_table->tab_db;
1118 xtBool flush_table = TRUE;1128 xtBool flush_table = TRUE;
11191129
1130 /* No open table returned to the pool should still
1131 * have a cache handle!
1132 */
1133 ASSERT_NS(!ot->ot_ind_rhandle);
1120 xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);1134 xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
11211135
1122 if (!(table_pool = db_get_open_table_pool(db, ot->ot_table->tab_id)))1136 if (!(table_pool = db_get_open_table_pool(db, ot->ot_table->tab_id)))
1123 goto failed;1137 goto failed;
11241138
1125 if (table_pool->opt_locked && !table_pool->opt_flushing) {1139 if (table_pool->opt_locked && !table_pool->opt_flushing) {
1126 table_pool->opt_total_open--;
1127 /* Table will be closed below: */1140 /* Table will be closed below: */
1128 if (table_pool->opt_total_open > 0)1141 if (table_pool->opt_total_open > 1)
1129 flush_table = FALSE;1142 flush_table = FALSE;
1130 }1143 }
1131 else {1144 else {
@@ -1151,14 +1164,21 @@
1151 ot = NULL;1164 ot = NULL;
1152 }1165 }
11531166
1167 if (ot) {
1168 xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
1169 xt_close_table(ot, flush_table, FALSE);
1170
1171 /* assume that table_pool cannot be invalidated in between as we have table_pool->opt_total_open > 0 */
1172 xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
1173 table_pool->opt_total_open--;
1174 }
1175
1154 db_free_open_table_pool(NULL, table_pool);1176 db_free_open_table_pool(NULL, table_pool);
11551177
1156 if (!xt_broadcast_cond_ns(&db->db_ot_pool.opt_cond))1178 if (!xt_broadcast_cond_ns(&db->db_ot_pool.opt_cond))
1157 goto failed;1179 goto failed;
1158 xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);1180 xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
1159 if (ot)1181
1160 xt_close_table(ot, flush_table, FALSE);
1161
1162 return;1182 return;
11631183
1164 failed:1184 failed:
11651185
=== modified file 'storage/pbxt/src/datadic_xt.cc'
--- storage/pbxt/src/datadic_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/datadic_xt.cc 2009-08-18 07:46:53 +0000
@@ -26,6 +26,10 @@
2626
27#include "xt_config.h"27#include "xt_config.h"
2828
29#ifdef DRIZZLED
30#include <bitset>
31#endif
32
29#include <ctype.h>33#include <ctype.h>
30#include <errno.h>34#include <errno.h>
3135
@@ -433,7 +437,7 @@
433 XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);437 XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);
434};438};
435439
436void ri_free_token(XTThreadPtr self __attribute__((unused)), XTToken *tk)440void ri_free_token(XTThreadPtr XT_UNUSED(self), XTToken *tk)
437{441{
438 delete tk;442 delete tk;
439}443}
@@ -524,6 +528,13 @@
524 break;528 break;
525 tkn_curr_pos++;529 tkn_curr_pos++;
526 }530 }
531 /* TODO: Unless sql_mode == 'NO_BACKSLASH_ESCAPES'!!! */
532 if (*tkn_curr_pos == '\\') {
533 if (*(tkn_curr_pos+1) == quote) {
534 if (quote == '"' || quote == '\'')
535 tkn_curr_pos++;
536 }
537 }
527 tkn_curr_pos++;538 tkn_curr_pos++;
528 }539 }
529 540
@@ -639,7 +650,7 @@
639 int parseKeyAction(XTThreadPtr self); 650 int parseKeyAction(XTThreadPtr self);
640 void parseCreateTable(XTThreadPtr self);651 void parseCreateTable(XTThreadPtr self);
641 void parseAddTableItem(XTThreadPtr self);652 void parseAddTableItem(XTThreadPtr self);
642 void parseQualifiedName(XTThreadPtr self, char *name);653 void parseQualifiedName(XTThreadPtr self, char *parent_name, char *name);
643 void parseTableName(XTThreadPtr self, bool alterTable);654 void parseTableName(XTThreadPtr self, bool alterTable);
644 void parseExpression(XTThreadPtr self, bool allow_reserved);655 void parseExpression(XTThreadPtr self, bool allow_reserved);
645 void parseBrackets(XTThreadPtr self);656 void parseBrackets(XTThreadPtr self);
@@ -667,53 +678,53 @@
667 memset(&pt_sbuffer, 0, sizeof(XTStringBufferRec));678 memset(&pt_sbuffer, 0, sizeof(XTStringBufferRec));
668 }679 }
669680
670 virtual void finalize(XTThreadPtr self __attribute__((unused))) {681 virtual void finalize(XTThreadPtr XT_UNUSED(self)) {
671 if (pt_tokenizer)682 if (pt_tokenizer)
672 delete pt_tokenizer;683 delete pt_tokenizer;
673 xt_sb_set_size(NULL, &pt_sbuffer, 0);684 xt_sb_set_size(NULL, &pt_sbuffer, 0);
674 }685 }
675686
676 // Hooks to receive output from the parser:687 // Hooks to receive output from the parser:
677 virtual void setTableName(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), bool alterTable __attribute__((unused))) {688 virtual void setTableName(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), bool XT_UNUSED(alterTable)) {
678 }689 }
679 virtual void addColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused)), char *old_col_name __attribute__((unused))) {690 virtual void addColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name), char *XT_UNUSED(old_col_name)) {
680 }691 }
681 virtual void setDataType(XTThreadPtr self, char *cstring) {692 virtual void setDataType(XTThreadPtr self, char *cstring) {
682 if (cstring) 693 if (cstring)
683 xt_free(self, cstring);694 xt_free(self, cstring);
684 }695 }
685 virtual void setNull(XTThreadPtr self __attribute__((unused)), bool nullOK __attribute__((unused))) {696 virtual void setNull(XTThreadPtr XT_UNUSED(self), bool XT_UNUSED(nullOK)) {
686 }697 }
687 virtual void setAutoInc(XTThreadPtr self __attribute__((unused)), bool autoInc __attribute__((unused))) {698 virtual void setAutoInc(XTThreadPtr XT_UNUSED(self), bool XT_UNUSED(autoInc)) {
688 }699 }
689 700
690 /* Add a contraint. If lastColumn is TRUE then add the contraint 701 /* Add a contraint. If lastColumn is TRUE then add the contraint
691 * to the last column. If not, expect addListedColumn() to be called.702 * to the last column. If not, expect addListedColumn() to be called.
692 */703 */
693 virtual void addConstraint(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), u_int type __attribute__((unused)), bool lastColumn __attribute__((unused))) {704 virtual void addConstraint(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), u_int XT_UNUSED(type), bool XT_UNUSED(lastColumn)) {
694 }705 }
695 706
696 /* Move the last column created. If symbol is NULL then move the column to the707 /* Move the last column created. If symbol is NULL then move the column to the
697 * first position, else move it to the position just after the given column.708 * first position, else move it to the position just after the given column.
698 */709 */
699 virtual void moveColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused))) {710 virtual void moveColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name)) {
700 }711 }
701712
702 virtual void dropColumn(XTThreadPtr self __attribute__((unused)), char *col_name __attribute__((unused))) {713 virtual void dropColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(col_name)) {
703 }714 }
704715
705 virtual void dropConstraint(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused)), u_int type __attribute__((unused))) {716 virtual void dropConstraint(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name), u_int XT_UNUSED(type)) {
706 }717 }
707718
708 virtual void setIndexName(XTThreadPtr self __attribute__((unused)), char *name __attribute__((unused))) {719 virtual void setIndexName(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(name)) {
709 }720 }
710 virtual void addListedColumn(XTThreadPtr self __attribute__((unused)), char *index_col_name __attribute__((unused))) {721 virtual void addListedColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(index_col_name)) {
711 }722 }
712 virtual void setReferencedTable(XTThreadPtr self __attribute__((unused)), char *ref_table __attribute__((unused))) {723 virtual void setReferencedTable(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(ref_schema), char *XT_UNUSED(ref_table)) {
713 }724 }
714 virtual void addReferencedColumn(XTThreadPtr self __attribute__((unused)), char *index_col_name __attribute__((unused))) {725 virtual void addReferencedColumn(XTThreadPtr XT_UNUSED(self), char *XT_UNUSED(index_col_name)) {
715 }726 }
716 virtual void setActions(XTThreadPtr self __attribute__((unused)), int on_delete __attribute__((unused)), int on_update __attribute__((unused))) {727 virtual void setActions(XTThreadPtr XT_UNUSED(self), int XT_UNUSED(on_delete), int XT_UNUSED(on_update)) {
717 }728 }
718729
719 virtual void parseTable(XTThreadPtr self, bool convert, char *sql); 730 virtual void parseTable(XTThreadPtr self, bool convert, char *sql);
@@ -859,7 +870,7 @@
859 if (pt_current->isKeyWord("CONSTRAINT")) {870 if (pt_current->isKeyWord("CONSTRAINT")) {
860 pt_current = pt_tokenizer->nextToken(self);871 pt_current = pt_tokenizer->nextToken(self);
861 if (pt_current->isIdentifier())872 if (pt_current->isIdentifier())
862 parseQualifiedName(self, name);873 parseQualifiedName(self, NULL, name);
863 }874 }
864875
865 if (pt_current->isReservedWord(XT_TK_PRIMARY)) {876 if (pt_current->isReservedWord(XT_TK_PRIMARY)) {
@@ -974,13 +985,15 @@
974 char name[XT_IDENTIFIER_NAME_SIZE];985 char name[XT_IDENTIFIER_NAME_SIZE];
975986
976 pt_current = pt_tokenizer->nextToken(self);987 pt_current = pt_tokenizer->nextToken(self);
977 parseQualifiedName(self, name);988 parseQualifiedName(self, NULL, name);
978 moveColumn(self, name);989 moveColumn(self, name);
979 }990 }
980}991}
981992
982void XTParseTable::parseQualifiedName(XTThreadPtr self, char *name)993void XTParseTable::parseQualifiedName(XTThreadPtr self, char *parent_name, char *name)
983{994{
995 if (parent_name)
996 parent_name[0] = '\0';
984 /* Should be an identifier by I have this example:997 /* Should be an identifier by I have this example:
985 * CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default '' ) CHARSET=latin5;998 * CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default '' ) CHARSET=latin5;
986 *999 *
@@ -990,6 +1003,8 @@
990 raiseError(self, pt_current, XT_ERR_ID_TOO_LONG);1003 raiseError(self, pt_current, XT_ERR_ID_TOO_LONG);
991 pt_current = pt_tokenizer->nextToken(self);1004 pt_current = pt_tokenizer->nextToken(self);
992 while (pt_current->isKeyWord(".")) {1005 while (pt_current->isKeyWord(".")) {
1006 if (parent_name)
1007 xt_strcpy(XT_IDENTIFIER_NAME_SIZE,parent_name, name);
993 pt_current = pt_tokenizer->nextToken(self);1008 pt_current = pt_tokenizer->nextToken(self);
994 /* Accept anything after the DOT! */1009 /* Accept anything after the DOT! */
995 if (pt_current->getString(name, XT_IDENTIFIER_NAME_SIZE) >= XT_IDENTIFIER_NAME_SIZE)1010 if (pt_current->getString(name, XT_IDENTIFIER_NAME_SIZE) >= XT_IDENTIFIER_NAME_SIZE)
@@ -1002,7 +1017,7 @@
1002{1017{
1003 char name[XT_IDENTIFIER_NAME_SIZE];1018 char name[XT_IDENTIFIER_NAME_SIZE];
10041019
1005 parseQualifiedName(self, name);1020 parseQualifiedName(self, NULL, name);
1006 setTableName(self, name, alterTable);1021 setTableName(self, name, alterTable);
1007}1022}
10081023
@@ -1011,7 +1026,7 @@
1011 char col_name[XT_IDENTIFIER_NAME_SIZE];1026 char col_name[XT_IDENTIFIER_NAME_SIZE];
10121027
1013 // column_definition1028 // column_definition
1014 parseQualifiedName(self, col_name);1029 parseQualifiedName(self, NULL, col_name);
1015 addColumn(self, col_name, old_col_name);1030 addColumn(self, col_name, old_col_name);
1016 parseDataType(self);1031 parseDataType(self);
10171032
@@ -1111,7 +1126,7 @@
1111 pt_current->expectKeyWord(self, "(");1126 pt_current->expectKeyWord(self, "(");
1112 do {1127 do {
1113 pt_current = pt_tokenizer->nextToken(self);1128 pt_current = pt_tokenizer->nextToken(self);
1114 parseQualifiedName(self, name);1129 parseQualifiedName(self, NULL, name);
1115 addListedColumn(self, name);1130 addListedColumn(self, name);
1116 cols++;1131 cols++;
1117 if (index_cols) {1132 if (index_cols) {
@@ -1135,19 +1150,20 @@
1135 int on_delete = XT_KEY_ACTION_DEFAULT;1150 int on_delete = XT_KEY_ACTION_DEFAULT;
1136 int on_update = XT_KEY_ACTION_DEFAULT;1151 int on_update = XT_KEY_ACTION_DEFAULT;
1137 char name[XT_IDENTIFIER_NAME_SIZE];1152 char name[XT_IDENTIFIER_NAME_SIZE];
1153 char parent_name[XT_IDENTIFIER_NAME_SIZE];
1138 u_int cols = 0;1154 u_int cols = 0;
11391155
1140 // REFERENCES tbl_name1156 // REFERENCES tbl_name
1141 pt_current = pt_tokenizer->nextToken(self, "REFERENCES", pt_current);1157 pt_current = pt_tokenizer->nextToken(self, "REFERENCES", pt_current);
1142 parseQualifiedName(self, name);1158 parseQualifiedName(self, parent_name, name);
1143 setReferencedTable(self, name);1159 setReferencedTable(self, parent_name[0] ? parent_name : NULL, name);
11441160
1145 // [ (index_col_name,...) ]1161 // [ (index_col_name,...) ]
1146 if (pt_current->isKeyWord("(")) {1162 if (pt_current->isKeyWord("(")) {
1147 pt_current->expectKeyWord(self, "(");1163 pt_current->expectKeyWord(self, "(");
1148 do {1164 do {
1149 pt_current = pt_tokenizer->nextToken(self);1165 pt_current = pt_tokenizer->nextToken(self);
1150 parseQualifiedName(self, name);1166 parseQualifiedName(self, NULL, name);
1151 addReferencedColumn(self, name);1167 addReferencedColumn(self, name);
1152 cols++;1168 cols++;
1153 if (cols > req_cols)1169 if (cols > req_cols)
@@ -1219,7 +1235,7 @@
1219 if (pt_current->isReservedWord(XT_TK_COLUMN))1235 if (pt_current->isReservedWord(XT_TK_COLUMN))
1220 pt_current = pt_tokenizer->nextToken(self);1236 pt_current = pt_tokenizer->nextToken(self);
12211237
1222 parseQualifiedName(self, old_col_name);1238 parseQualifiedName(self, NULL, old_col_name);
1223 parseColumnDefinition(self, old_col_name);1239 parseColumnDefinition(self, old_col_name);
1224 parseMoveColumn(self);1240 parseMoveColumn(self);
1225 }1241 }
@@ -1251,7 +1267,7 @@
1251 else {1267 else {
1252 if (pt_current->isReservedWord(XT_TK_COLUMN))1268 if (pt_current->isReservedWord(XT_TK_COLUMN))
1253 pt_current = pt_tokenizer->nextToken(self);1269 pt_current = pt_tokenizer->nextToken(self);
1254 parseQualifiedName(self, name);1270 parseQualifiedName(self, NULL, name);
1255 dropColumn(self, name);1271 dropColumn(self, name);
1256 }1272 }
1257 }1273 }
@@ -1259,7 +1275,7 @@
1259 pt_current = pt_tokenizer->nextToken(self);1275 pt_current = pt_tokenizer->nextToken(self);
1260 if (pt_current->isKeyWord("TO"))1276 if (pt_current->isKeyWord("TO"))
1261 pt_current = pt_tokenizer->nextToken(self);1277 pt_current = pt_tokenizer->nextToken(self);
1262 parseQualifiedName(self, name);1278 parseQualifiedName(self, NULL, name);
1263 }1279 }
1264 else1280 else
1265 /* Just ignore the syntax until the next , */1281 /* Just ignore the syntax until the next , */
@@ -1284,7 +1300,7 @@
1284 else if (pt_current->isKeyWord("SPACIAL"))1300 else if (pt_current->isKeyWord("SPACIAL"))
1285 pt_current = pt_tokenizer->nextToken(self);1301 pt_current = pt_tokenizer->nextToken(self);
1286 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);1302 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);
1287 parseQualifiedName(self, name);1303 parseQualifiedName(self, NULL, name);
1288 optionalIndexType(self);1304 optionalIndexType(self);
1289 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);1305 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);
1290 parseTableName(self, true);1306 parseTableName(self, true);
@@ -1299,7 +1315,7 @@
12991315
1300 pt_current = pt_tokenizer->nextToken(self, "DROP", pt_current);1316 pt_current = pt_tokenizer->nextToken(self, "DROP", pt_current);
1301 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);1317 pt_current = pt_tokenizer->nextToken(self, "INDEX", pt_current);
1302 parseQualifiedName(self, name);1318 parseQualifiedName(self, NULL, name);
1303 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);1319 pt_current = pt_tokenizer->nextToken(self, "ON", pt_current);
1304 parseTableName(self, true);1320 parseTableName(self, true);
1305 dropConstraint(self, name, XT_DD_INDEX);1321 dropConstraint(self, name, XT_DD_INDEX);
@@ -1340,7 +1356,7 @@
1340 virtual void addConstraint(XTThreadPtr self, char *name, u_int type, bool lastColumn);1356 virtual void addConstraint(XTThreadPtr self, char *name, u_int type, bool lastColumn);
1341 virtual void dropConstraint(XTThreadPtr self, char *name, u_int type);1357 virtual void dropConstraint(XTThreadPtr self, char *name, u_int type);
1342 virtual void addListedColumn(XTThreadPtr self, char *index_col_name);1358 virtual void addListedColumn(XTThreadPtr self, char *index_col_name);
1343 virtual void setReferencedTable(XTThreadPtr self, char *ref_table);1359 virtual void setReferencedTable(XTThreadPtr self, char *ref_schema, char *ref_table);
1344 virtual void addReferencedColumn(XTThreadPtr self, char *index_col_name);1360 virtual void addReferencedColumn(XTThreadPtr self, char *index_col_name);
1345 virtual void setActions(XTThreadPtr self, int on_delete, int on_update);1361 virtual void setActions(XTThreadPtr self, int on_delete, int on_update);
13461362
@@ -1535,23 +1551,31 @@
1535 }1551 }
1536}1552}
15371553
1538void XTCreateTable::setReferencedTable(XTThreadPtr self, char *ref_table)1554void XTCreateTable::setReferencedTable(XTThreadPtr self, char *ref_schema, char *ref_table)
1539{1555{
1540 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;1556 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;
1541 char path[PATH_MAX];1557 char path[PATH_MAX];
15421558
1543 xt_strcpy(PATH_MAX, path, ct_tab_path->ps_path);1559 if (ref_schema) {
1544 xt_remove_last_name_of_path(path);1560 xt_strcpy(PATH_MAX,path, ".");
1545 if (ct_convert) {1561 xt_add_dir_char(PATH_MAX, path);
1546 char buffer[XT_IDENTIFIER_NAME_SIZE];1562 xt_strcat(PATH_MAX, path, ref_schema);
1547 size_t len;1563 xt_add_dir_char(PATH_MAX, path);
1548
1549 myxt_static_convert_identifier(self, ct_charset, ref_table, buffer, XT_IDENTIFIER_NAME_SIZE);
1550 len = strlen(path);
1551 myxt_static_convert_table_name(self, buffer, &path[len], PATH_MAX - len);
1552 }
1553 else
1554 xt_strcat(PATH_MAX, path, ref_table);1564 xt_strcat(PATH_MAX, path, ref_table);
1565 } else {
1566 xt_strcpy(PATH_MAX, path, ct_tab_path->ps_path);
1567 xt_remove_last_name_of_path(path);
1568 if (ct_convert) {
1569 char buffer[XT_IDENTIFIER_NAME_SIZE];
1570 size_t len;
1571
1572 myxt_static_convert_identifier(self, ct_charset, ref_table, buffer, XT_IDENTIFIER_NAME_SIZE);
1573 len = strlen(path);
1574 myxt_static_convert_table_name(self, buffer, &path[len], PATH_MAX - len);
1575 }
1576 else
1577 xt_strcat(PATH_MAX, path, ref_table);
1578 }
15551579
1556 fk->fk_ref_tab_name = (XTPathStrPtr) xt_dup_string(self, path);1580 fk->fk_ref_tab_name = (XTPathStrPtr) xt_dup_string(self, path);
1557}1581}
@@ -1578,7 +1602,7 @@
1578 fk->fk_ref_cols.clone(self, &fk->co_cols);1602 fk->fk_ref_cols.clone(self, &fk->co_cols);
1579}1603}
15801604
1581void XTCreateTable::setActions(XTThreadPtr self __attribute__((unused)), int on_delete, int on_update)1605void XTCreateTable::setActions(XTThreadPtr XT_UNUSED(self), int on_delete, int on_update)
1582{1606{
1583 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;1607 XTDDForeignKey *fk = (XTDDForeignKey *) ct_curr_constraint;
15841608
@@ -1711,8 +1735,8 @@
1711void XTDDConstraint::getColumnList(char *buffer, size_t size)1735void XTDDConstraint::getColumnList(char *buffer, size_t size)
1712{1736{
1713 if (co_table->dt_table) {1737 if (co_table->dt_table) {
1714 xt_strcat(size, buffer, "`");1738 xt_strcpy(size, buffer, "`");
1715 xt_strcpy(size, buffer, co_table->dt_table->tab_name->ps_path);1739 xt_strcat(size, buffer, co_table->dt_table->tab_name->ps_path);
1716 xt_strcat(size, buffer, "` (`");1740 xt_strcat(size, buffer, "` (`");
1717 }1741 }
1718 else1742 else
@@ -1739,6 +1763,20 @@
1739 return OK;1763 return OK;
1740}1764}
17411765
1766bool XTDDConstraint::samePrefixColumns(XTDDConstraint *co)
1767{
1768 u_int i = 0;
1769
1770 if (co_cols.size() > co->co_cols.size())
1771 return false;
1772 while (i<co_cols.size()) {
1773 if (myxt_strcasecmp(co_cols.itemAt(i)->cr_col_name, co->co_cols.itemAt(i)->cr_col_name) != 0)
1774 return false;
1775 i++;
1776 }
1777 return OK;
1778}
1779
1742bool XTDDConstraint::attachColumns()1780bool XTDDConstraint::attachColumns()
1743{1781{
1744 XTDDColumn *col;1782 XTDDColumn *col;
@@ -1773,6 +1811,7 @@
1773 XTIdxSearchKeyRec search_key;1811 XTIdxSearchKeyRec search_key;
1774 xtXactID xn_id;1812 xtXactID xn_id;
1775 XTXactWaitRec xw;1813 XTXactWaitRec xw;
1814 bool ok = false;
17761815
1777 if (!(loc_ind = tr_fkey->getReferenceIndexPtr()))1816 if (!(loc_ind = tr_fkey->getReferenceIndexPtr()))
1778 return false;1817 return false;
@@ -1792,40 +1831,42 @@
17921831
1793 /* Search for the key in the child (referencing) table: */1832 /* Search for the key in the child (referencing) table: */
1794 if (!(ot = xt_db_open_table_using_tab(tr_fkey->co_table->dt_table, thread)))1833 if (!(ot = xt_db_open_table_using_tab(tr_fkey->co_table->dt_table, thread)))
1795 goto failed;1834 return false;
17961835
1797 retry:1836 retry:
1798 if (!xt_idx_search(ot, ind, &search_key))1837 if (!xt_idx_search(ot, ind, &search_key))
1799 goto failed;1838 goto done;
1800 1839
1801 while (ot->ot_curr_rec_id && search_key.sk_on_key) {1840 while (ot->ot_curr_rec_id && search_key.sk_on_key) {
1802 switch (xt_tab_maybe_committed(ot, ot->ot_curr_rec_id, &xn_id, &ot->ot_curr_row_id, &ot->ot_curr_updated)) {1841 switch (xt_tab_maybe_committed(ot, ot->ot_curr_rec_id, &xn_id, &ot->ot_curr_row_id, &ot->ot_curr_updated)) {
1803 case XT_MAYBE: 1842 case XT_MAYBE:
1804 xw.xw_xn_id = xn_id;1843 xw.xw_xn_id = xn_id;
1805 if (!xt_xn_wait_for_xact(thread, &xw, NULL))1844 if (!xt_xn_wait_for_xact(thread, &xw, NULL))
1806 goto failed;1845 goto done;
1807 goto retry;1846 goto retry;
1808 case XT_ERR:1847 case XT_ERR:
1809 goto failed;1848 goto done;
1810 case TRUE:1849 case TRUE:
1811 /* We found a matching child: */1850 /* We found a matching child: */
1812 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_ROW_IS_REFERENCED, tr_fkey->co_name);1851 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_ROW_IS_REFERENCED, tr_fkey->co_name);
1813 goto failed;1852 goto done;
1814 break;
1815 case FALSE:1853 case FALSE:
1816 if (!xt_idx_next(ot, ind, &search_key))1854 if (!xt_idx_next(ot, ind, &search_key))
1817 goto failed;1855 goto done;
1818 break;1856 break;
1819 }1857 }
1820 }1858 }
18211859
1822 /* No matching children, all OK: */1860 /* No matching children, all OK: */
1823 xt_db_return_table_to_pool_ns(ot);1861 ok = true;
1824 return true;
18251862
1826 failed:1863 done:
1864 if (ot->ot_ind_rhandle) {
1865 xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
1866 ot->ot_ind_rhandle = NULL;
1867 }
1827 xt_db_return_table_to_pool_ns(ot);1868 xt_db_return_table_to_pool_ns(ot);
1828 return false;1869 return ok;
1829}1870}
18301871
1831/*1872/*
@@ -1962,6 +2003,10 @@
1962 }2003 }
19632004
1964 /* No matching children, all OK: */2005 /* No matching children, all OK: */
2006 if (ot->ot_ind_rhandle) {
2007 xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
2008 ot->ot_ind_rhandle = NULL;
2009 }
1965 xt_db_return_table_to_pool_ns(ot);2010 xt_db_return_table_to_pool_ns(ot);
19662011
1967 success:2012 success:
@@ -1971,6 +2016,10 @@
1971 return true;2016 return true;
19722017
1973 failed_2:2018 failed_2:
2019 if (ot->ot_ind_rhandle) {
2020 xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
2021 ot->ot_ind_rhandle = NULL;
2022 }
1974 xt_db_return_table_to_pool_ns(ot);2023 xt_db_return_table_to_pool_ns(ot);
19752024
1976 failed:2025 failed:
@@ -2055,8 +2104,13 @@
20552104
2056void XTDDForeignKey::loadString(XTThreadPtr self, XTStringBufferPtr sb)2105void XTDDForeignKey::loadString(XTThreadPtr self, XTStringBufferPtr sb)
2057{2106{
2107 char schema_name[XT_IDENTIFIER_NAME_SIZE];
2108
2058 XTDDConstraint::loadString(self, sb);2109 XTDDConstraint::loadString(self, sb);
2059 xt_sb_concat(self, sb, " REFERENCES `");2110 xt_sb_concat(self, sb, " REFERENCES `");
2111 xt_2nd_last_name_of_path(XT_IDENTIFIER_NAME_SIZE, schema_name, fk_ref_tab_name->ps_path);
2112 xt_sb_concat(self, sb, schema_name);
2113 xt_sb_concat(self, sb, "`.`");
2060 xt_sb_concat(self, sb, xt_last_name_of_path(fk_ref_tab_name->ps_path));2114 xt_sb_concat(self, sb, xt_last_name_of_path(fk_ref_tab_name->ps_path));
2061 xt_sb_concat(self, sb, "` ");2115 xt_sb_concat(self, sb, "` ");
20622116
@@ -2136,6 +2190,20 @@
2136 return OK;2190 return OK;
2137}2191}
21382192
2193bool XTDDForeignKey::samePrefixReferenceColumns(XTDDConstraint *co)
2194{
2195 u_int i = 0;
2196
2197 if (fk_ref_cols.size() > co->co_cols.size())
2198 return false;
2199 while (i<fk_ref_cols.size()) {
2200 if (myxt_strcasecmp(fk_ref_cols.itemAt(i)->cr_col_name, co->co_cols.itemAt(i)->cr_col_name) != 0)
2201 return false;
2202 i++;
2203 }
2204 return OK;
2205}
2206
2139bool XTDDForeignKey::checkReferencedTypes(XTDDTable *dt)2207bool XTDDForeignKey::checkReferencedTypes(XTDDTable *dt)
2140{2208{
2141 XTDDColumn *col, *ref_col;2209 XTDDColumn *col, *ref_col;
@@ -2288,6 +2356,10 @@
2288 goto failed_2;2356 goto failed_2;
2289 case TRUE:2357 case TRUE:
2290 /* We found a matching parent: */2358 /* We found a matching parent: */
2359 if (ot->ot_ind_rhandle) {
2360 xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
2361 ot->ot_ind_rhandle = NULL;
2362 }
2291 xt_db_return_table_to_pool_ns(ot);2363 xt_db_return_table_to_pool_ns(ot);
2292 goto success;2364 goto success;
2293 case FALSE:2365 case FALSE:
@@ -2300,6 +2372,10 @@
2300 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_REFERENCED_ROW, co_name);2372 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_REFERENCED_ROW, co_name);
23012373
2302 failed_2:2374 failed_2:
2375 if (ot->ot_ind_rhandle) {
2376 xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread);
2377 ot->ot_ind_rhandle = NULL;
2378 }
2303 xt_db_return_table_to_pool_ns(ot);2379 xt_db_return_table_to_pool_ns(ot);
23042380
2305 failed:2381 failed:
@@ -2672,16 +2748,24 @@
26722748
2673XTDDIndex *XTDDTable::findIndex(XTDDConstraint *co)2749XTDDIndex *XTDDTable::findIndex(XTDDConstraint *co)
2674{2750{
2675 XTDDIndex *ind;2751 XTDDIndex *ind = NULL;
2752 XTDDIndex *cur_ind;
2753 u_int index_size = UINT_MAX;
26762754
2677 for (u_int i=0; i<dt_indexes.size(); i++) {2755 for (u_int i=0; i<dt_indexes.size(); i++) {
2678 ind = dt_indexes.itemAt(i);2756 cur_ind = dt_indexes.itemAt(i);
2679 if (co->sameColumns(ind))2757 u_int sz = cur_ind->getIndexPtr()->mi_key_size;
2680 return ind;2758 if (sz < index_size && co->samePrefixColumns(cur_ind)) {
2759 ind = cur_ind;
2760 index_size = sz;
2761 }
2681 }2762 }
2763
2764 if (ind)
2765 return ind;
2766
2682 {2767 {
2683 char buffer[XT_ERR_MSG_SIZE - 200];2768 char buffer[XT_ERR_MSG_SIZE - 200];
2684
2685 co->getColumnList(buffer, XT_ERR_MSG_SIZE - 200);2769 co->getColumnList(buffer, XT_ERR_MSG_SIZE - 200);
2686 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_MATCHING_INDEX, buffer);2770 xt_register_ixterr(XT_REG_CONTEXT, XT_ERR_NO_MATCHING_INDEX, buffer);
2687 }2771 }
@@ -2690,16 +2774,24 @@
26902774
2691XTDDIndex *XTDDTable::findReferenceIndex(XTDDForeignKey *fk)2775XTDDIndex *XTDDTable::findReferenceIndex(XTDDForeignKey *fk)
2692{2776{
2693 XTDDIndex *ind;2777 XTDDIndex *ind = NULL;
2778 XTDDIndex *cur_ind;
2694 XTDDColumnRef *cr;2779 XTDDColumnRef *cr;
2695 u_int i;2780 u_int i;
2781 u_int index_size = UINT_MAX;
26962782
2697 for (i=0; i<dt_indexes.size(); i++) {2783 for (i=0; i<dt_indexes.size(); i++) {
2698 ind = dt_indexes.itemAt(i);2784 cur_ind = dt_indexes.itemAt(i);
2699 if (fk->sameReferenceColumns(ind))2785 u_int sz = cur_ind->getIndexPtr()->mi_key_size;
2700 return ind;2786 if (sz < index_size && fk->samePrefixReferenceColumns(cur_ind)) {
2787 ind = cur_ind;
2788 index_size = sz;
2789 }
2701 }2790 }
27022791
2792 if (ind)
2793 return ind;
2794
2703 /* If the index does not exist, maybe the columns do not exist?! */2795 /* If the index does not exist, maybe the columns do not exist?! */
2704 for (i=0; i<fk->fk_ref_cols.size(); i++) {2796 for (i=0; i<fk->fk_ref_cols.size(); i++) {
2705 cr = fk->fk_ref_cols.itemAt(i);2797 cr = fk->fk_ref_cols.itemAt(i);
@@ -2867,9 +2959,33 @@
2867 return ok;2959 return ok;
2868}2960}
28692961
2870xtBool XTDDTable::checkCanDrop()2962/*
2963 * drop_db parameter is TRUE if we are dropping the schema of this table. In this case
2964 * we return TRUE if the table has only refs to the tables from its own schema
2965 */
2966xtBool XTDDTable::checkCanDrop(xtBool drop_db)
2871{2967{
2872 /* no refs or references only itself */2968 /* no refs or references only itself */
2873 return (dt_trefs == NULL) || 2969 if ((dt_trefs == NULL) || ((dt_trefs->tr_next == NULL) && (dt_trefs->tr_fkey->co_table == this)))
2874 (dt_trefs->tr_next == NULL) && (dt_trefs->tr_fkey->co_table == this);2970 return TRUE;
2971
2972 if (!drop_db)
2973 return FALSE;
2974
2975 const char *this_schema = xt_last_2_names_of_path(dt_table->tab_name->ps_path);
2976 size_t this_schema_sz = xt_last_name_of_path(dt_table->tab_name->ps_path) - this_schema;
2977 XTDDTableRef *tr = dt_trefs;
2978
2979 while (tr) {
2980 const char *tab_path = tr->tr_fkey->co_table->dt_table->tab_name->ps_path;
2981 const char *tab_schema = xt_last_2_names_of_path(tab_path);
2982 size_t tab_schema_sz = xt_last_name_of_path(tab_path) - tab_schema;
2983
2984 if (this_schema_sz != tab_schema_sz || strncmp(this_schema, tab_schema, tab_schema_sz))
2985 return FALSE;
2986
2987 tr = tr->tr_next;
2988 }
2989
2990 return TRUE;
2875}2991}
28762992
=== modified file 'storage/pbxt/src/datadic_xt.h'
--- storage/pbxt/src/datadic_xt.h 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/datadic_xt.h 2009-08-18 07:46:53 +0000
@@ -137,6 +137,7 @@
137 return new_obj;137 return new_obj;
138 }138 }
139139
140 virtual void init(XTThreadPtr self) { XTObject::init(self); }
140 virtual void init(XTThreadPtr self, XTObject *obj);141 virtual void init(XTThreadPtr self, XTObject *obj);
141 virtual void finalize(XTThreadPtr self);142 virtual void finalize(XTThreadPtr self);
142};143};
@@ -156,6 +157,7 @@
156 co_ind_name(NULL) {157 co_ind_name(NULL) {
157 }158 }
158159
160 virtual void init(XTThreadPtr self) { XTObject::init(self); }
159 virtual void init(XTThreadPtr self, XTObject *obj);161 virtual void init(XTThreadPtr self, XTObject *obj);
160 virtual void finalize(XTThreadPtr self) {162 virtual void finalize(XTThreadPtr self) {
161 if (co_name)163 if (co_name)
@@ -169,6 +171,7 @@
169 virtual void alterColumnName(XTThreadPtr self, char *from_name, char *to_name);171 virtual void alterColumnName(XTThreadPtr self, char *from_name, char *to_name);
170 void getColumnList(char *buffer, size_t size);172 void getColumnList(char *buffer, size_t size);
171 bool sameColumns(XTDDConstraint *co);173 bool sameColumns(XTDDConstraint *co);
174 bool samePrefixColumns(XTDDConstraint *co);
172 bool attachColumns();175 bool attachColumns();
173};176};
174177
@@ -198,6 +201,7 @@
198 return new_obj;201 return new_obj;
199 }202 }
200203
204 virtual void init(XTThreadPtr self) { XTDDConstraint::init(self); };
201 virtual void init(XTThreadPtr self, XTObject *obj);205 virtual void init(XTThreadPtr self, XTObject *obj);
202 struct XTIndex *getIndexPtr();206 struct XTIndex *getIndexPtr();
203};207};
@@ -230,12 +234,14 @@
230 return new_obj;234 return new_obj;
231 }235 }
232236
237 virtual void init(XTThreadPtr self) { XTDDIndex::init(self); }
233 virtual void init(XTThreadPtr self, XTObject *obj);238 virtual void init(XTThreadPtr self, XTObject *obj);
234 virtual void finalize(XTThreadPtr self);239 virtual void finalize(XTThreadPtr self);
235 virtual void loadString(XTThreadPtr self, XTStringBufferPtr sb);240 virtual void loadString(XTThreadPtr self, XTStringBufferPtr sb);
236 void getReferenceList(char *buffer, size_t size);241 void getReferenceList(char *buffer, size_t size);
237 struct XTIndex *getReferenceIndexPtr();242 struct XTIndex *getReferenceIndexPtr();
238 bool sameReferenceColumns(XTDDConstraint *co);243 bool sameReferenceColumns(XTDDConstraint *co);
244 bool samePrefixReferenceColumns(XTDDConstraint *co);
239 bool checkReferencedTypes(XTDDTable *dt);245 bool checkReferencedTypes(XTDDTable *dt);
240 void removeReference(XTThreadPtr self);246 void removeReference(XTThreadPtr self);
241 bool insertRow(xtWord1 *before, xtWord1 *after, XTThreadPtr thread);247 bool insertRow(xtWord1 *before, xtWord1 *after, XTThreadPtr thread);
@@ -284,7 +290,7 @@
284 XTDDIndex *findReferenceIndex(XTDDForeignKey *fk);290 XTDDIndex *findReferenceIndex(XTDDForeignKey *fk);
285 bool insertRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);291 bool insertRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
286 bool checkNoAction(struct XTOpenTable *ot, xtRecordID rec_id);292 bool checkNoAction(struct XTOpenTable *ot, xtRecordID rec_id);
287 xtBool checkCanDrop();293 xtBool checkCanDrop(xtBool drop_db);
288 bool deleteRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);294 bool deleteRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
289 void deleteAllRows(XTThreadPtr self);295 void deleteAllRows(XTThreadPtr self);
290 bool updateRow(struct XTOpenTable *rec_ot, xtWord1 *before, xtWord1 *after);296 bool updateRow(struct XTOpenTable *rec_ot, xtWord1 *before, xtWord1 *after);
291297
=== modified file 'storage/pbxt/src/datalog_xt.cc'
--- storage/pbxt/src/datalog_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/datalog_xt.cc 2009-08-18 07:46:53 +0000
@@ -69,6 +69,7 @@
69 sl_rec_log_id = 0;69 sl_rec_log_id = 0;
70 sl_rec_log_offset = 0;70 sl_rec_log_offset = 0;
71 sl_record_len = 0;71 sl_record_len = 0;
72 sl_extra_garbage = 0;
7273
73 return sl_buffer != NULL;74 return sl_buffer != NULL;
74}75}
@@ -130,8 +131,25 @@
130/*131/*
131 * Unlike the transaction log sequential reader, this function only returns132 * Unlike the transaction log sequential reader, this function only returns
132 * the header of a record.133 * the header of a record.
134 *
135 * {SKIP-GAPS}
136 * This function now skips gaps. This should not be required, because in normal
137 * operation, no gaps should be created.
138 *
139 * However, if his happens there is a danger that a valid record after the
140 * gap will be lost.
141 *
142 * So, if we find an invalid record, we scan through the log to find the next
143 * valid record. Note, that there is still a danger that will will find
144 * data that looks like a valid record, but is not.
145 *
146 * In this case, this "pseudo record" may cause the function to actually skip
147 * valid records.
148 *
149 * Note, any such malfunction will eventually cause the record to be lost forever
150 * after the garbage collector has run.
133 */151 */
134xtBool XTDataSeqRead::sl_seq_next(XTXactLogBufferDPtr *ret_entry, xtBool verify, struct XTThread *thread)152xtBool XTDataSeqRead::sl_seq_next(XTXactLogBufferDPtr *ret_entry, struct XTThread *thread)
135{153{
136 XTXactLogBufferDPtr record;154 XTXactLogBufferDPtr record;
137 size_t tfer;155 size_t tfer;
@@ -140,10 +158,12 @@
140 size_t max_rec_len;158 size_t max_rec_len;
141 xtBool reread_from_buffer;159 xtBool reread_from_buffer;
142 xtWord4 size;160 xtWord4 size;
161 xtLogOffset gap_start = 0;
143162
144 /* Go to the next record (xseq_record_len must be initialized163 /* Go to the next record (xseq_record_len must be initialized
145 * to 0 for this to work.164 * to 0 for this to work.
146 */165 */
166 retry:
147 sl_rec_log_offset += sl_record_len;167 sl_rec_log_offset += sl_record_len;
148 sl_record_len = 0;168 sl_record_len = 0;
149169
@@ -174,6 +194,8 @@
174 record = (XTXactLogBufferDPtr) (sl_buffer + rec_offset);194 record = (XTXactLogBufferDPtr) (sl_buffer + rec_offset);
175 switch (record->xl.xl_status_1) {195 switch (record->xl.xl_status_1) {
176 case XT_LOG_ENT_HEADER:196 case XT_LOG_ENT_HEADER:
197 if (sl_rec_log_offset != 0)
198 goto scan_to_next_record;
177 if (offsetof(XTXactLogHeaderDRec, xh_size_4) + 4 > max_rec_len) {199 if (offsetof(XTXactLogHeaderDRec, xh_size_4) + 4 > max_rec_len) {
178 reread_from_buffer = TRUE;200 reread_from_buffer = TRUE;
179 goto read_more;201 goto read_more;
@@ -183,33 +205,42 @@
183 reread_from_buffer = TRUE;205 reread_from_buffer = TRUE;
184 goto read_more;206 goto read_more;
185 }207 }
186 if (verify) {208
187 if (record->xh.xh_checksum_1 != XT_CHECKSUM_1(sl_rec_log_id))209 if (record->xh.xh_checksum_1 != XT_CHECKSUM_1(sl_rec_log_id))
188 goto return_empty;210 goto return_empty;
189 if (XT_LOG_HEAD_MAGIC(record, len) != XT_LOG_FILE_MAGIC)211 if (XT_LOG_HEAD_MAGIC(record, len) != XT_LOG_FILE_MAGIC)
190 goto return_empty;212 goto return_empty;
191 if (len > offsetof(XTXactLogHeaderDRec, xh_log_id_4) + 4) {213 if (len > offsetof(XTXactLogHeaderDRec, xh_log_id_4) + 4) {
192 if (XT_GET_DISK_4(record->xh.xh_log_id_4) != sl_rec_log_id)214 if (XT_GET_DISK_4(record->xh.xh_log_id_4) != sl_rec_log_id)
193 goto return_empty;215 goto return_empty;
194 }
195 }216 }
196 break;217 break;
197 case XT_LOG_ENT_EXT_REC_OK:218 case XT_LOG_ENT_EXT_REC_OK:
198 case XT_LOG_ENT_EXT_REC_DEL:219 case XT_LOG_ENT_EXT_REC_DEL:
220 if (gap_start) {
221 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));
222 gap_start = 0;
223 }
199 len = offsetof(XTactExtRecEntryDRec, er_data);224 len = offsetof(XTactExtRecEntryDRec, er_data);
200 if (len > max_rec_len) {225 if (len > max_rec_len) {
201 reread_from_buffer = TRUE;226 reread_from_buffer = TRUE;
202 goto read_more;227 goto read_more;
203 }228 }
204 size = XT_GET_DISK_4(record->er.er_data_size_4);229 size = XT_GET_DISK_4(record->er.er_data_size_4);
205 if (verify) {230 /* Verify the record as good as we can! */
206 if (sl_rec_log_offset + (xtLogOffset) offsetof(XTactExtRecEntryDRec, er_data) + size > sl_log_eof)231 if (!size)
207 goto return_empty;232 goto scan_to_next_record;
208 }233 if (sl_rec_log_offset + (xtLogOffset) offsetof(XTactExtRecEntryDRec, er_data) + size > sl_log_eof)
234 goto scan_to_next_record;
235 if (!XT_GET_DISK_4(record->er.er_tab_id_4))
236 goto scan_to_next_record;
237 if (!XT_GET_DISK_4(record->er.er_rec_id_4))
238 goto scan_to_next_record;
209 break;239 break;
210 default:240 default:
211 ASSERT_NS(FALSE);241 /* Note, we no longer assume EOF.
212 goto return_empty;242 * Instead, we skip to the next value record. */
243 goto scan_to_next_record;
213 }244 }
214245
215 if (len <= max_rec_len) {246 if (len <= max_rec_len) {
@@ -243,7 +274,20 @@
243 *ret_entry = (XTXactLogBufferDPtr) sl_buffer;274 *ret_entry = (XTXactLogBufferDPtr) sl_buffer;
244 return OK;275 return OK;
245276
277 scan_to_next_record:
278 if (!gap_start) {
279 gap_start = sl_rec_log_offset;
280 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);
281 }
282 sl_record_len = 1;
283 sl_extra_garbage++;
284 goto retry;
285
246 return_empty:286 return_empty:
287 if (gap_start) {
288 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));
289 gap_start = 0;
290 }
247 *ret_entry = NULL;291 *ret_entry = NULL;
248 return OK;292 return OK;
249}293}
@@ -285,18 +329,50 @@
285 return OK;329 return OK;
286}330}
287331
288static xtBool dl_write_log_header(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtBool flush, XTThreadPtr thread)332static xtBool dl_write_garbage_level(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtBool flush, XTThreadPtr thread)
289{333{
290 XTXactLogHeaderDRec header;334 XTXactLogHeaderDRec header;
291335
292 /* The header was not completely written, so write a new one: */336 /* The header was not completely written, so write a new one: */
293 XT_SET_DISK_8(header.xh_free_space_8, data_log->dlf_garbage_count);337 XT_SET_DISK_8(header.xh_free_space_8, data_log->dlf_garbage_count);
338 if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 8, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))
339 return FAILED;
340 if (flush && !xt_flush_file(of, &thread->st_statistics.st_data, thread))
341 return FAILED;
342 return OK;
343}
344
345/*
346 * {SKIP-GAPS}
347 * Extra garbage is the amount of space skipped during recovery of the data
348 * log file. We assume this space has not be counted as garbage,
349 * and add it to the garbage count.
350 *
351 * This may mean that our estimate of garbaged is higher than it should
352 * be, but that is better than the other way around.
353 *
354 * The fact is, there should not be any gaps in the data log files, so
355 * this is actually an exeption which should not occur.
356 */
357static xtBool dl_write_log_header(XTDataLogFilePtr data_log, XTOpenFilePtr of, xtLogOffset extra_garbage, XTThreadPtr thread)
358{
359 XTXactLogHeaderDRec header;
360
294 XT_SET_DISK_8(header.xh_file_len_8, data_log->dlf_log_eof);361 XT_SET_DISK_8(header.xh_file_len_8, data_log->dlf_log_eof);
295 XT_SET_DISK_8(header.xh_comp_pos_8, data_log->dlf_start_offset);
296362
297 if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 24, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))363 if (extra_garbage) {
298 return FAILED;364 data_log->dlf_garbage_count += extra_garbage;
299 if (flush && !xt_flush_file(of, &thread->st_statistics.st_data, thread))365 if (data_log->dlf_garbage_count > data_log->dlf_log_eof)
366 data_log->dlf_garbage_count = data_log->dlf_log_eof;
367 XT_SET_DISK_8(header.xh_free_space_8, data_log->dlf_garbage_count);
368 if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_free_space_8), 16, (xtWord1 *) &header.xh_free_space_8, &thread->st_statistics.st_data, thread))
369 return FAILED;
370 }
371 else {
372 if (!xt_pwrite_file(of, offsetof(XTXactLogHeaderDRec, xh_file_len_8), 8, (xtWord1 *) &header.xh_file_len_8, &thread->st_statistics.st_data, thread))
373 return FAILED;
374 }
375 if (!xt_flush_file(of, &thread->st_statistics.st_data, thread))
300 return FAILED;376 return FAILED;
301 return OK;377 return OK;
302}378}
@@ -318,7 +394,7 @@
318 seq_read.sl_seq_start(data_log->dlf_log_id, 0, FALSE);394 seq_read.sl_seq_start(data_log->dlf_log_id, 0, FALSE);
319395
320 for (;;) {396 for (;;) {
321 if (!seq_read.sl_seq_next(&record, TRUE, self))397 if (!seq_read.sl_seq_next(&record, self))
322 xt_throw(self);398 xt_throw(self);
323 if (!record)399 if (!record)
324 break;400 break;
@@ -331,13 +407,18 @@
331 }407 }
332 }408 }
333409
334 if (!(data_log->dlf_log_eof = seq_read.sl_rec_log_offset)) {410 ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
411 data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
412
413 if (data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
335 data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);414 data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
336 if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))415 if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
337 xt_throw(self);416 xt_throw(self);
338 }417 }
339 if (!dl_write_log_header(data_log, seq_read.sl_log_file, TRUE, self))418 else {
340 xt_throw(self);419 if (!dl_write_log_header(data_log, seq_read.sl_log_file, seq_read.sl_extra_garbage, self))
420 xt_throw(self);
421 }
341422
342 freer_(); // dl_free_seq_read(&seq_read)423 freer_(); // dl_free_seq_read(&seq_read)
343}424}
@@ -452,7 +533,7 @@
452 return FAILED;533 return FAILED;
453}534}
454535
455static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)536static int dl_cmp_log_id(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
456{537{
457 xtLogID log_id_a = *((xtLogID *) a);538 xtLogID log_id_a = *((xtLogID *) a);
458 xtLogID log_id_b = *((xtLogID *) b);539 xtLogID log_id_b = *((xtLogID *) b);
@@ -1110,7 +1191,6 @@
11101191
1111 *log_id = dlb_data_log->dlf_log_id;1192 *log_id = dlb_data_log->dlf_log_id;
1112 *out_offset = dlb_data_log->dlf_log_eof;1193 *out_offset = dlb_data_log->dlf_log_eof;
1113 dlb_data_log->dlf_log_eof += req_size;
1114 return OK;1194 return OK;
1115}1195}
11161196
@@ -1149,7 +1229,7 @@
1149 return OK;1229 return OK;
1150}1230}
11511231
1152xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)1232xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
1153{1233{
1154 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);1234 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
11551235
@@ -1158,6 +1238,11 @@
11581238
1159 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread))1239 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread))
1160 return FAILED;1240 return FAILED;
1241 /* Increment of dlb_data_log->dlf_log_eof was moved here from dlb_get_log_offset()
1242 * to ensure it is done after a successful update of the log, otherwise otherwise a
1243 * gap occurs in the log which cause eof to be detected in middle of the log
1244 */
1245 dlb_data_log->dlf_log_eof += size;
1161#ifdef DEBUG1246#ifdef DEBUG
1162 if (log_offset + size > dlb_max_write_offset)1247 if (log_offset + size > dlb_max_write_offset)
1163 dlb_max_write_offset = log_offset + size;1248 dlb_max_write_offset = log_offset + size;
@@ -1166,7 +1251,7 @@
1166 return OK;1251 return OK;
1167}1252}
11681253
1169xtBool XTDataLogBuffer::dlb_append_log(xtLogID log_id __attribute__((unused)), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)1254xtBool XTDataLogBuffer::dlb_append_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOffset log_offset, size_t size, xtWord1 *data, XTThreadPtr thread)
1170{1255{
1171 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);1256 ASSERT_NS(log_id == dlb_data_log->dlf_log_id);
11721257
@@ -1179,10 +1264,12 @@
1179 if (dlb_buffer_size >= dlb_buffer_len + size) {1264 if (dlb_buffer_size >= dlb_buffer_len + size) {
1180 memcpy(dlb_log_buffer + dlb_buffer_len, data, size);1265 memcpy(dlb_log_buffer + dlb_buffer_len, data, size);
1181 dlb_buffer_len += size;1266 dlb_buffer_len += size;
1267 dlb_data_log->dlf_log_eof += size;
1182 return OK;1268 return OK;
1183 }1269 }
1184 }1270 }
1185 dlb_flush_log(FALSE, thread);1271 if (dlb_flush_log(FALSE, thread) != OK)
1272 return FAILED;
1186 }1273 }
1187 1274
1188 ASSERT_NS(dlb_buffer_len == 0);1275 ASSERT_NS(dlb_buffer_len == 0);
@@ -1191,6 +1278,7 @@
1191 dlb_buffer_offset = log_offset;1278 dlb_buffer_offset = log_offset;
1192 dlb_buffer_len = size;1279 dlb_buffer_len = size;
1193 memcpy(dlb_log_buffer, data, size);1280 memcpy(dlb_log_buffer, data, size);
1281 dlb_data_log->dlf_log_eof += size;
1194 return OK;1282 return OK;
1195 }1283 }
11961284
@@ -1202,6 +1290,7 @@
1202 dlb_max_write_offset = log_offset + size;1290 dlb_max_write_offset = log_offset + size;
1203#endif1291#endif
1204 dlb_flush_required = TRUE;1292 dlb_flush_required = TRUE;
1293 dlb_data_log->dlf_log_eof += size;
1205 return OK;1294 return OK;
1206}1295}
12071296
@@ -1306,7 +1395,7 @@
1306 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);1395 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
1307 dlb_data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;1396 dlb_data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;
1308 ASSERT_NS(dlb_data_log->dlf_garbage_count < dlb_data_log->dlf_log_eof);1397 ASSERT_NS(dlb_data_log->dlf_garbage_count < dlb_data_log->dlf_log_eof);
1309 if (!dl_write_log_header(dlb_data_log, dlb_data_log->dlf_log_file, FALSE, thread)) {1398 if (!dl_write_garbage_level(dlb_data_log, dlb_data_log->dlf_log_file, FALSE, thread)) {
1310 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);1399 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
1311 return FAILED;1400 return FAILED;
1312 }1401 }
@@ -1329,7 +1418,7 @@
1329 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);1418 xt_lock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
1330 data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;1419 data_log->dlf_garbage_count += offsetof(XTactExtRecEntryDRec, er_data) + size;
1331 ASSERT_NS(data_log->dlf_garbage_count < data_log->dlf_log_eof);1420 ASSERT_NS(data_log->dlf_garbage_count < data_log->dlf_log_eof);
1332 if (!dl_write_log_header(data_log, open_log->odl_log_file, FALSE, thread)) {1421 if (!dl_write_garbage_level(data_log, open_log->odl_log_file, FALSE, thread)) {
1333 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);1422 xt_unlock_mutex_ns(&dlb_db->db_datalogs.dlc_head_lock);
1334 goto failed;1423 goto failed;
1335 }1424 }
@@ -1357,7 +1446,7 @@
1357 * Delete all the extended data belonging to a particular1446 * Delete all the extended data belonging to a particular
1358 * table.1447 * table.
1359 */1448 */
1360xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool missing_ok __attribute__((unused)), xtBool have_table_lock)1449xtPublic void xt_dl_delete_ext_data(XTThreadPtr self, XTTableHPtr tab, xtBool XT_UNUSED(missing_ok), xtBool have_table_lock)
1361{1450{
1362 XTOpenTablePtr ot;1451 XTOpenTablePtr ot;
1363 xtRecordID page_rec_id, offs_rec_id;1452 xtRecordID page_rec_id, offs_rec_id;
@@ -1674,7 +1763,7 @@
1674 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);1763 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
1675 data_log->dlf_garbage_count += garbage_count;1764 data_log->dlf_garbage_count += garbage_count;
1676 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);1765 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);
1677 if (!dl_write_log_header(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {1766 if (!dl_write_garbage_level(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
1678 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);1767 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);
1679 xt_throw(self);1768 xt_throw(self);
1680 }1769 }
@@ -1683,7 +1772,7 @@
1683 freer_(); // dl_free_compactor_state(&cs)1772 freer_(); // dl_free_compactor_state(&cs)
1684 return FAILED;1773 return FAILED;
1685 }1774 }
1686 if (!cs.cs_seqread->sl_seq_next(&record, TRUE, self))1775 if (!cs.cs_seqread->sl_seq_next(&record, self))
1687 xt_throw(self);1776 xt_throw(self);
1688 cs.cs_seqread->sl_seq_pos(&curr_log_id, &curr_log_offset);1777 cs.cs_seqread->sl_seq_pos(&curr_log_id, &curr_log_offset);
1689 if (!record) {1778 if (!record) {
@@ -1809,7 +1898,7 @@
1809 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);1898 xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
1810 data_log->dlf_garbage_count += garbage_count;1899 data_log->dlf_garbage_count += garbage_count;
1811 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);1900 ASSERT(data_log->dlf_garbage_count < data_log->dlf_log_eof);
1812 if (!dl_write_log_header(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {1901 if (!dl_write_garbage_level(data_log, cs.cs_seqread->sl_seq_open_file(), TRUE, self)) {
1813 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);1902 xt_unlock_mutex_ns(&db->db_datalogs.dlc_head_lock);
1814 xt_throw(self);1903 xt_throw(self);
1815 }1904 }
18161905
=== modified file 'storage/pbxt/src/datalog_xt.h'
--- storage/pbxt/src/datalog_xt.h 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/datalog_xt.h 2009-08-18 07:46:53 +0000
@@ -183,8 +183,8 @@
183 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread) {183 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread) {
184 (void) log_offset; (void) size; (void) data; (void) read; (void) thread; return OK;184 (void) log_offset; (void) size; (void) data; (void) read; (void) thread; return OK;
185 };185 };
186 virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread) {186 virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread) {
187 (void) entry; (void) verify; (void) thread; return OK;187 (void) entry; (void) thread; return OK;
188 };188 };
189 virtual void sl_seq_skip(size_t size) { (void) size; }189 virtual void sl_seq_skip(size_t size) { (void) size; }
190} XTSeqLogReadRec, *XTSeqLogReadPtr;190} XTSeqLogReadRec, *XTSeqLogReadPtr;
@@ -195,6 +195,7 @@
195 xtLogOffset sl_rec_log_offset; /* The current log read position. */195 xtLogOffset sl_rec_log_offset; /* The current log read position. */
196 size_t sl_record_len; /* The length of the current record. */196 size_t sl_record_len; /* The length of the current record. */
197 xtLogOffset sl_log_eof;197 xtLogOffset sl_log_eof;
198 xtLogOffset sl_extra_garbage; /* Garbage found during a scan. */
198199
199 size_t sl_buffer_size; /* Size of the buffer. */200 size_t sl_buffer_size; /* Size of the buffer. */
200 xtLogOffset sl_buf_log_offset; /* File offset of the buffer. */201 xtLogOffset sl_buf_log_offset; /* File offset of the buffer. */
@@ -208,7 +209,7 @@
208 virtual void sl_seq_pos(xtLogID *log_id, xtLogOffset *log_offset);209 virtual void sl_seq_pos(xtLogID *log_id, xtLogOffset *log_offset);
209 virtual xtBool sl_seq_start(xtLogID log_id, xtLogOffset log_offset, xtBool missing_ok);210 virtual xtBool sl_seq_start(xtLogID log_id, xtLogOffset log_offset, xtBool missing_ok);
210 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread);211 virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread);
211 virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread);212 virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread);
212 virtual void sl_seq_skip(size_t size);213 virtual void sl_seq_skip(size_t size);
213 virtual void sl_seq_skip_to(off_t offset);214 virtual void sl_seq_skip_to(off_t offset);
214} XTDataSeqReadRec, *XTDataSeqReadPtr;215} XTDataSeqReadRec, *XTDataSeqReadPtr;
215216
=== modified file 'storage/pbxt/src/discover_xt.cc'
--- storage/pbxt/src/discover_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/discover_xt.cc 2009-08-17 11:12:36 +0000
@@ -1282,9 +1282,11 @@
1282#endif // LOCK_OPEN_HACK_REQUIRED1282#endif // LOCK_OPEN_HACK_REQUIRED
12831283
1284//------------------------------1284//------------------------------
1285int 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)1285int 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)
1286{1286{
1287#ifdef DRIZZLED1287#ifdef DRIZZLED
1288 drizzled::message::Table table_proto;
1289
1288 static const char *ext = ".dfe";1290 static const char *ext = ".dfe";
1289 static const int ext_len = 4;1291 static const int ext_len = 4;
1290#else1292#else
@@ -1329,8 +1331,7 @@
1329 info->field_flags,1331 info->field_flags,
1330 COLUMN_FORMAT_TYPE_FIXED,1332 COLUMN_FORMAT_TYPE_FIXED,
1331 NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,1333 NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
1332 NULL /*interval_list*/, info->field_charset,1334 NULL /*interval_list*/, info->field_charset))
1333 NULL /*vcol_info*/))
1334#else1335#else
1335 if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,1336 if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
1336 info->field_flags,1337 info->field_flags,
@@ -1365,7 +1366,10 @@
1365 1366
1366 /* Create an internal temp table */1367 /* Create an internal temp table */
1367#ifdef DRIZZLED1368#ifdef DRIZZLED
1368 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0, false)) 1369 table_proto.set_name(name);
1370 table_proto.set_type(drizzled::message::Table::STANDARD);
1371
1372 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
1369 goto error;1373 goto error;
1370#else1374#else
1371 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0)) 1375 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
13721376
=== modified file 'storage/pbxt/src/filesys_xt.cc'
--- storage/pbxt/src/filesys_xt.cc 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/filesys_xt.cc 2009-08-18 07:46:53 +0000
@@ -23,6 +23,10 @@
2323
24#include "xt_config.h"24#include "xt_config.h"
2525
26#ifdef DRIZZLED
27#include <bitset>
28#endif
29
26#ifndef XT_WIN30#ifndef XT_WIN
27#include <unistd.h>31#include <unistd.h>
28#include <dirent.h>32#include <dirent.h>
@@ -50,6 +54,7 @@
50//#define DEBUG_TRACE_IO54//#define DEBUG_TRACE_IO
51//#define DEBUG_TRACE_MAP_IO55//#define DEBUG_TRACE_MAP_IO
52//#define DEBUG_TRACE_FILES56//#define DEBUG_TRACE_FILES
57//#define INJECT_WRITE_REMAP_ERROR
53#endif58#endif
5459
55#ifdef DEBUG_TRACE_FILES60#ifdef DEBUG_TRACE_FILES
@@ -57,6 +62,11 @@
57#define PRINTF xt_trace62#define PRINTF xt_trace
58#endif63#endif
5964
65#ifdef INJECT_WRITE_REMAP_ERROR
66#define INJECT_REMAP_FILE_SIZE 1000000
67#define INJECT_REMAP_FILE_TYPE "xtd"
68#endif
69
60/* ----------------------------------------------------------------------70/* ----------------------------------------------------------------------
61 * Globals71 * Globals
62 */72 */
@@ -127,11 +137,11 @@
127 mm->mm_start = NULL;137 mm->mm_start = NULL;
128 }138 }
129#endif139#endif
130 xt_rwmutex_free(self, &mm->mm_lock);140 FILE_MAP_FREE_LOCK(self, &mm->mm_lock);
131 xt_free(self, mm);141 xt_free(self, mm);
132}142}
133143
134static void fs_free_file(XTThreadPtr self, void *thunk __attribute__((unused)), void *item)144static void fs_free_file(XTThreadPtr self, void *XT_UNUSED(thunk), void *item)
135{145{
136 XTFilePtr file_ptr = *((XTFilePtr *) item);146 XTFilePtr file_ptr = *((XTFilePtr *) item);
137147
@@ -148,17 +158,13 @@
148 file_ptr->fil_filedes = XT_NULL_FD;158 file_ptr->fil_filedes = XT_NULL_FD;
149 }159 }
150160
151 if (file_ptr->fil_memmap) {
152 fs_close_fmap(self, file_ptr->fil_memmap);
153 file_ptr->fil_memmap = NULL;
154 }
155
156#ifdef DEBUG_TRACE_FILES161#ifdef DEBUG_TRACE_FILES
157 PRINTF("%s: free file: (%d) %s\n", self->t_name, (int) file_ptr->fil_id, 162 PRINTF("%s: free file: (%d) %s\n", self->t_name, (int) file_ptr->fil_id,
158 file_ptr->fil_path ? xt_last_2_names_of_path(file_ptr->fil_path) : "?");163 file_ptr->fil_path ? xt_last_2_names_of_path(file_ptr->fil_path) : "?");
159#endif164#endif
160165
161 if (!file_ptr->fil_ref_count) {166 if (!file_ptr->fil_ref_count) {
167 ASSERT_NS(!file_ptr->fil_handle_count);
162 /* Flush any cache before this file is invalid: */168 /* Flush any cache before this file is invalid: */
163 if (file_ptr->fil_path) {169 if (file_ptr->fil_path) {
164 xt_free(self, file_ptr->fil_path);170 xt_free(self, file_ptr->fil_path);
@@ -169,7 +175,7 @@
169 }175 }
170}176}
171177
172static int fs_comp_file(XTThreadPtr self __attribute__((unused)), register const void *thunk __attribute__((unused)), register const void *a, register const void *b)178static int fs_comp_file(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
173{179{
174 char *file_name = (char *) a;180 char *file_name = (char *) a;
175 XTFilePtr file_ptr = *((XTFilePtr *) b);181 XTFilePtr file_ptr = *((XTFilePtr *) b);
@@ -177,7 +183,7 @@
177 return strcmp(file_name, file_ptr->fil_path);183 return strcmp(file_name, file_ptr->fil_path);
178}184}
179185
180static int fs_comp_file_ci(XTThreadPtr self __attribute__((unused)), register const void *thunk __attribute__((unused)), register const void *a, register const void *b)186static int fs_comp_file_ci(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
181{187{
182 char *file_name = (char *) a;188 char *file_name = (char *) a;
183 XTFilePtr file_ptr = *((XTFilePtr *) b);189 XTFilePtr file_ptr = *((XTFilePtr *) b);
@@ -868,11 +874,22 @@
868 goto failed;874 goto failed;
869 }875 }
870#else876#else
877 /* Mac OS X has problems with fsync. We had several cases of index corruption presumably because
878 * fsync didn't really flush index pages to disk. fcntl(F_FULLFSYNC) is considered more effective
879 * in such case.
880 */
881#ifdef F_FULLFSYNC
882 if (fcntl(of->of_filedes, F_FULLFSYNC, 0) == -1) {
883 xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
884 goto failed;
885 }
886#else
871 if (fsync(of->of_filedes) == -1) {887 if (fsync(of->of_filedes) == -1) {
872 xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));888 xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
873 goto failed;889 goto failed;
874 }890 }
875#endif891#endif
892#endif
876#ifdef DEBUG_TRACE_IO893#ifdef DEBUG_TRACE_IO
877 xt_trace("/* %s */ pbxt_file_sync(\"%s\");\n", xt_trace_clock_diff(timef, start), of->fr_file->fil_path);894 xt_trace("/* %s */ pbxt_file_sync(\"%s\");\n", xt_trace_clock_diff(timef, start), of->fr_file->fil_path);
878#endif895#endif
@@ -938,6 +955,29 @@
938 return OK;955 return OK;
939}956}
940957
958xtPublic xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr thread)
959{
960 size_t red_size;
961
962 if (!*data) {
963 if (!(*data = (xtWord1 *) xt_malloc_ns(size)))
964 return FAILED;
965 }
966
967 if (!xt_pread_file(of, offset, size, 0, *data, &red_size, stat, thread))
968 return FAILED;
969
970 //if (red_size < size)
971 // memset();
972 return OK;
973}
974
975xtPublic void xt_unlock_file_ptr(XTOpenFilePtr XT_UNUSED(of), xtWord1 *data, XTThreadPtr XT_UNUSED(thread))
976{
977 if (data)
978 xt_free_ns(data);
979}
980
941/* ----------------------------------------------------------------------981/* ----------------------------------------------------------------------
942 * Directory operations982 * Directory operations
943 */983 */
@@ -949,7 +989,13 @@
949{989{
950 XTOpenDirPtr od;990 XTOpenDirPtr od;
951991
952 pushsr_(od, xt_dir_close, (XTOpenDirPtr) xt_calloc(self, sizeof(XTOpenDirRec)));992#ifdef XT_SOLARIS
993 /* see the comment in filesys_xt.h */
994 size_t sz = pathconf(path, _PC_NAME_MAX) + sizeof(XTOpenDirRec) + 1;
995#else
996 size_t sz = sizeof(XTOpenDirRec);
997#endif
998 pushsr_(od, xt_dir_close, (XTOpenDirPtr) xt_calloc(self, sz));
953999
954#ifdef XT_WIN1000#ifdef XT_WIN
955 size_t len;1001 size_t len;
@@ -976,7 +1022,6 @@
976 if (!od->od_dir)1022 if (!od->od_dir)
977 xt_throw_ferrno(XT_CONTEXT, errno, path);1023 xt_throw_ferrno(XT_CONTEXT, errno, path);
978#endif1024#endif
979
980 popr_(); // Discard xt_dir_close(od)1025 popr_(); // Discard xt_dir_close(od)
981 return od;1026 return od;
982}1027}
@@ -1097,7 +1142,7 @@
1097}1142}
1098#endif1143#endif
10991144
1100char *xt_dir_name(XTThreadPtr self __attribute__((unused)), XTOpenDirPtr od)1145char *xt_dir_name(XTThreadPtr XT_UNUSED(self), XTOpenDirPtr od)
1101{1146{
1102#ifdef XT_WIN1147#ifdef XT_WIN
1103 return od->od_data.cFileName;1148 return od->od_data.cFileName;
@@ -1106,8 +1151,9 @@
1106#endif1151#endif
1107}1152}
11081153
1109xtBool xt_dir_is_file(XTThreadPtr self __attribute__((unused)), XTOpenDirPtr od)1154xtBool xt_dir_is_file(XTThreadPtr self, XTOpenDirPtr od)
1110{1155{
1156 (void) self;
1111#ifdef XT_WIN1157#ifdef XT_WIN
1112 if (od->od_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)1158 if (od->od_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1113 return FALSE;1159 return FALSE;
@@ -1156,6 +1202,15 @@
11561202
1157static xtBool fs_map_file(XTFileMemMapPtr mm, XTFilePtr file, xtBool grow)1203static xtBool fs_map_file(XTFileMemMapPtr mm, XTFilePtr file, xtBool grow)
1158{1204{
1205#ifdef INJECT_WRITE_REMAP_ERROR
1206 if (xt_is_extension(file->fil_path, INJECT_REMAP_FILE_TYPE)) {
1207 if (mm->mm_length > INJECT_REMAP_FILE_SIZE) {
1208 xt_register_ferrno(XT_REG_CONTEXT, 30, file->fil_path);
1209 return FAILED;
1210 }
1211 }
1212#endif
1213
1159 ASSERT_NS(!mm->mm_start);1214 ASSERT_NS(!mm->mm_start);
1160#ifdef XT_WIN1215#ifdef XT_WIN
1161 /* This will grow the file to the given size: */1216 /* This will grow the file to the given size: */
@@ -1228,7 +1283,7 @@
1228 /* NULL is the value returned on error! */1283 /* NULL is the value returned on error! */
1229 mm->mm_mapdes = NULL;1284 mm->mm_mapdes = NULL;
1230#endif1285#endif
1231 xt_rwmutex_init_with_autoname(self, &mm->mm_lock);1286 FILE_MAP_INIT_LOCK(self, &mm->mm_lock);
1232 mm->mm_length = fs_seek_eof(self, map->fr_file->fil_filedes, map->fr_file);1287 mm->mm_length = fs_seek_eof(self, map->fr_file->fil_filedes, map->fr_file);
1233 if (sizeof(size_t) == 4 && mm->mm_length >= (off_t) 0xFFFFFFFF)1288 if (sizeof(size_t) == 4 && mm->mm_length >= (off_t) 0xFFFFFFFF)
1234 xt_throw_ixterr(XT_CONTEXT, XT_ERR_FILE_TOO_LONG, map->fr_file->fil_path);1289 xt_throw_ixterr(XT_CONTEXT, XT_ERR_FILE_TOO_LONG, map->fr_file->fil_path);
@@ -1257,21 +1312,19 @@
12571312
1258xtPublic void xt_close_fmap(XTThreadPtr self, XTMapFilePtr map)1313xtPublic void xt_close_fmap(XTThreadPtr self, XTMapFilePtr map)
1259{1314{
1315 ASSERT_NS(!map->mf_slock_count);
1260 if (map->fr_file) {1316 if (map->fr_file) {
1261 xt_fs_release_file(self, map->fr_file);
1262
1263 xt_sl_lock(self, fs_globals.fsg_open_files);1317 xt_sl_lock(self, fs_globals.fsg_open_files);
1264 pushr_(xt_sl_unlock, fs_globals.fsg_open_files);1318 pushr_(xt_sl_unlock, fs_globals.fsg_open_files);
1265
1266 map->fr_file->fil_handle_count--;1319 map->fr_file->fil_handle_count--;
1267 if (!map->fr_file->fil_handle_count)1320 if (!map->fr_file->fil_handle_count) {
1268 fs_free_file(self, NULL, &map->fr_file);1321 fs_close_fmap(self, map->fr_file->fil_memmap);
12691322 map->fr_file->fil_memmap = NULL;
1323 }
1270 freer_();1324 freer_();
12711325
1326 xt_fs_release_file(self, map->fr_file);
1272 map->fr_file = NULL;1327 map->fr_file = NULL;
1273
1274
1275 }1328 }
1276 map->mf_memmap = NULL;1329 map->mf_memmap = NULL;
1277 xt_free(self, map);1330 xt_free(self, map);
@@ -1346,14 +1399,23 @@
1346 }1399 }
1347 mm->mm_start = NULL;1400 mm->mm_start = NULL;
1348#ifdef XT_WIN1401#ifdef XT_WIN
1349 if (!CloseHandle(mm->mm_mapdes))1402 /* It is possible that a previous remap attempt has failed: the map was closed
1403 * but the new map was not allocated (e.g. because of insufficient disk space).
1404 * In this case mm->mm_mapdes will be NULL.
1405 */
1406 if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes))
1350 return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map));1407 return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map));
1351 mm->mm_mapdes = NULL;1408 mm->mm_mapdes = NULL;
1352#endif1409#endif
1410 off_t old_size = mm->mm_length;
1353 mm->mm_length = new_size;1411 mm->mm_length = new_size;
13541412
1355 if (!fs_map_file(mm, map->fr_file, TRUE))1413 if (!fs_map_file(mm, map->fr_file, TRUE)) {
1414 /* Try to restore old mapping */
1415 mm->mm_length = old_size;
1416 fs_map_file(mm, map->fr_file, FALSE);
1356 return FAILED;1417 return FAILED;
1418 }
1357 }1419 }
1358 return OK;1420 return OK;
1359 1421
@@ -1367,16 +1429,19 @@
1367xtPublic xtBool xt_pwrite_fmap(XTMapFilePtr map, off_t offset, size_t size, void *data, XTIOStatsPtr stat, XTThreadPtr thread)1429xtPublic xtBool xt_pwrite_fmap(XTMapFilePtr map, off_t offset, size_t size, void *data, XTIOStatsPtr stat, XTThreadPtr thread)
1368{1430{
1369 XTFileMemMapPtr mm = map->mf_memmap;1431 XTFileMemMapPtr mm = map->mf_memmap;
1432#ifndef FILE_MAP_USE_PTHREAD_RW
1370 xtThreadID thd_id = thread->t_id;1433 xtThreadID thd_id = thread->t_id;
1434#endif
13711435
1372#ifdef DEBUG_TRACE_MAP_IO1436#ifdef DEBUG_TRACE_MAP_IO
1373 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);1437 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);
1374#endif1438#endif
1375 xt_rwmutex_slock(&mm->mm_lock, thd_id);1439 ASSERT_NS(!map->mf_slock_count);
1440 FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
1376 if (!mm->mm_start || offset + (off_t) size > mm->mm_length) {1441 if (!mm->mm_start || offset + (off_t) size > mm->mm_length) {
1377 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1442 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
13781443
1379 xt_rwmutex_xlock(&mm->mm_lock, thd_id);1444 FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
1380 if (!fs_remap_file(map, offset, size, stat))1445 if (!fs_remap_file(map, offset, size, stat))
1381 goto failed;1446 goto failed;
1382 }1447 }
@@ -1396,29 +1461,32 @@
1396 memcpy(mm->mm_start + offset, data, size);1461 memcpy(mm->mm_start + offset, data, size);
1397#endif1462#endif
13981463
1399 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1464 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1400 stat->ts_write += size;1465 stat->ts_write += size;
1401 return OK;1466 return OK;
14021467
1403 failed:1468 failed:
1404 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1469 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1405 return FAILED;1470 return FAILED;
1406}1471}
14071472
1408xtPublic xtBool xt_pread_fmap_4(XTMapFilePtr map, off_t offset, xtWord4 *value, XTIOStatsPtr stat, XTThreadPtr thread)1473xtPublic xtBool xt_pread_fmap_4(XTMapFilePtr map, off_t offset, xtWord4 *value, XTIOStatsPtr stat, XTThreadPtr thread)
1409{1474{
1410 XTFileMemMapPtr mm = map->mf_memmap;1475 XTFileMemMapPtr mm = map->mf_memmap;
1476#ifndef FILE_MAP_USE_PTHREAD_RW
1411 xtThreadID thd_id = thread->t_id;1477 xtThreadID thd_id = thread->t_id;
1478#endif
14121479
1413#ifdef DEBUG_TRACE_MAP_IO1480#ifdef DEBUG_TRACE_MAP_IO
1414 xt_trace("/* %s */ pbxt_fmap_read_4(\"%s\", %lu, 4);\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path, (u_long) offset);1481 xt_trace("/* %s */ pbxt_fmap_read_4(\"%s\", %lu, 4);\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path, (u_long) offset);
1415#endif1482#endif
1416 xt_rwmutex_slock(&mm->mm_lock, thd_id);1483 if (!map->mf_slock_count)
1484 FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
1417 if (!mm->mm_start) {1485 if (!mm->mm_start) {
1418 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1486 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1419 xt_rwmutex_xlock(&mm->mm_lock, thd_id);1487 FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
1420 if (!fs_remap_file(map, 0, 0, stat)) {1488 if (!fs_remap_file(map, 0, 0, stat)) {
1421 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1489 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1422 return FAILED;1490 return FAILED;
1423 }1491 }
1424 }1492 }
@@ -1436,7 +1504,7 @@
1436 }1504 }
1437 __except(EXCEPTION_EXECUTE_HANDLER)1505 __except(EXCEPTION_EXECUTE_HANDLER)
1438 {1506 {
1439 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1507 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1440 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));1508 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));
1441 }1509 }
1442#else1510#else
@@ -1444,7 +1512,8 @@
1444#endif1512#endif
1445 }1513 }
14461514
1447 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1515 if (!map->mf_slock_count)
1516 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1448 stat->ts_read += 4;1517 stat->ts_read += 4;
1449 return OK;1518 return OK;
1450}1519}
@@ -1452,7 +1521,9 @@
1452xtPublic 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)1521xtPublic 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)
1453{1522{
1454 XTFileMemMapPtr mm = map->mf_memmap;1523 XTFileMemMapPtr mm = map->mf_memmap;
1524#ifndef FILE_MAP_USE_PTHREAD_RW
1455 xtThreadID thd_id = thread->t_id;1525 xtThreadID thd_id = thread->t_id;
1526#endif
1456 size_t tfer;1527 size_t tfer;
14571528
1458#ifdef DEBUG_TRACE_MAP_IO1529#ifdef DEBUG_TRACE_MAP_IO
@@ -1461,6 +1532,8 @@
1461 /* NOTE!! The file map may already be locked,1532 /* NOTE!! The file map may already be locked,
1462 * by a call to xt_lock_fmap_ptr()!1533 * by a call to xt_lock_fmap_ptr()!
1463 *1534 *
1535 * 20.05.2009: This problem should be fixed now with mf_slock_count!
1536 *
1464 * This can occur during a sequential scan:1537 * This can occur during a sequential scan:
1465 * xt_pread_fmap() Line 13301538 * xt_pread_fmap() Line 1330
1466 * XTTabCache::tc_read_direct() Line 3611539 * XTTabCache::tc_read_direct() Line 361
@@ -1491,13 +1564,16 @@
1491 * As a result, the slock must be able to handle1564 * As a result, the slock must be able to handle
1492 * nested calls to lock/unlock.1565 * nested calls to lock/unlock.
1493 */1566 */
1494 xt_rwmutex_slock(&mm->mm_lock, thd_id);1567 if (!map->mf_slock_count)
1568 FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
1495 tfer = size;1569 tfer = size;
1496 if (!mm->mm_start) {1570 if (!mm->mm_start) {
1497 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1571 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1498 xt_rwmutex_xlock(&mm->mm_lock, thd_id);1572 ASSERT_NS(!map->mf_slock_count);
1573 FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
1499 if (!fs_remap_file(map, 0, 0, stat)) {1574 if (!fs_remap_file(map, 0, 0, stat)) {
1500 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1575 if (!map->mf_slock_count)
1576 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1501 return FAILED;1577 return FAILED;
1502 }1578 }
1503 }1579 }
@@ -1514,7 +1590,8 @@
1514 }1590 }
1515 __except(EXCEPTION_EXECUTE_HANDLER)1591 __except(EXCEPTION_EXECUTE_HANDLER)
1516 {1592 {
1517 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1593 if (!map->mf_slock_count)
1594 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1518 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));1595 return xt_register_ferrno(XT_REG_CONTEXT, GetExceptionCode(), xt_file_path(map));
1519 }1596 }
1520#else1597#else
@@ -1522,7 +1599,8 @@
1522#endif1599#endif
1523 }1600 }
15241601
1525 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1602 if (!map->mf_slock_count)
1603 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1526 if (tfer < min_size)1604 if (tfer < min_size)
1527 return xt_register_ferrno(XT_REG_CONTEXT, ESPIPE, xt_file_path(map));1605 return xt_register_ferrno(XT_REG_CONTEXT, ESPIPE, xt_file_path(map));
15281606
@@ -1535,18 +1613,23 @@
1535xtPublic xtBool xt_flush_fmap(XTMapFilePtr map, XTIOStatsPtr stat, XTThreadPtr thread)1613xtPublic xtBool xt_flush_fmap(XTMapFilePtr map, XTIOStatsPtr stat, XTThreadPtr thread)
1536{1614{
1537 XTFileMemMapPtr mm = map->mf_memmap;1615 XTFileMemMapPtr mm = map->mf_memmap;
1616#ifndef FILE_MAP_USE_PTHREAD_RW
1538 xtThreadID thd_id = thread->t_id;1617 xtThreadID thd_id = thread->t_id;
1618#endif
1539 xtWord8 s;1619 xtWord8 s;
15401620
1541#ifdef DEBUG_TRACE_MAP_IO1621#ifdef DEBUG_TRACE_MAP_IO
1542 xt_trace("/* %s */ pbxt_fmap_sync(\"%s\");\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path);1622 xt_trace("/* %s */ pbxt_fmap_sync(\"%s\");\n", xt_trace_clock_diff(NULL), map->fr_file->fil_path);
1543#endif1623#endif
1544 xt_rwmutex_slock(&mm->mm_lock, thd_id);1624 if (!map->mf_slock_count)
1625 FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
1545 if (!mm->mm_start) {1626 if (!mm->mm_start) {
1546 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1627 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1547 xt_rwmutex_xlock(&mm->mm_lock, thd_id);1628 ASSERT_NS(!map->mf_slock_count);
1629 FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
1548 if (!fs_remap_file(map, 0, 0, stat)) {1630 if (!fs_remap_file(map, 0, 0, stat)) {
1549 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1631 if (!map->mf_slock_count)
1632 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1550 return FAILED;1633 return FAILED;
1551 }1634 }
1552 }1635 }
@@ -1562,7 +1645,8 @@
1562 goto failed;1645 goto failed;
1563 }1646 }
1564#endif1647#endif
1565 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1648 if (!map->mf_slock_count)
1649 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1566 s = stat->ts_flush_start;1650 s = stat->ts_flush_start;
1567 stat->ts_flush_start = 0;1651 stat->ts_flush_start = 0;
1568 stat->ts_flush_time += xt_trace_clock() - s;1652 stat->ts_flush_time += xt_trace_clock() - s;
@@ -1570,22 +1654,27 @@
1570 return OK;1654 return OK;
15711655
1572 failed:1656 failed:
1573 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1657 if (!map->mf_slock_count)
1658 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1574 s = stat->ts_flush_start;1659 s = stat->ts_flush_start;
1575 stat->ts_flush_start = 0;1660 stat->ts_flush_start = 0;
1576 stat->ts_flush_time += xt_trace_clock() - s;1661 stat->ts_flush_time += xt_trace_clock() - s;
1577 return FAILED;1662 return FAILED;
1578}1663}
15791664
1580xtPublic xtWord1 *xt_lock_fmap_ptr(XTMapFilePtr map, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr XT_UNUSED(thread))1665xtPublic xtWord1 *xt_lock_fmap_ptr(XTMapFilePtr map, off_t offset, size_t size, XTIOStatsPtr stat, XTThreadPtr thread)
1581{1666{
1582 XTFileMemMapPtr mm = map->mf_memmap;1667 XTFileMemMapPtr mm = map->mf_memmap;
1668#ifndef FILE_MAP_USE_PTHREAD_RW
1583 xtThreadID thd_id = thread->t_id;1669 xtThreadID thd_id = thread->t_id;
1670#endif
15841671
1585 xt_rwmutex_slock(&mm->mm_lock, thd_id);1672 if (!map->mf_slock_count)
1673 FILE_MAP_READ_LOCK(&mm->mm_lock, thd_id);
1674 map->mf_slock_count++;
1586 if (!mm->mm_start) {1675 if (!mm->mm_start) {
1587 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1676 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1588 xt_rwmutex_xlock(&mm->mm_lock, thd_id);1677 FILE_MAP_WRITE_LOCK(&mm->mm_lock, thd_id);
1589 if (!fs_remap_file(map, 0, 0, stat))1678 if (!fs_remap_file(map, 0, 0, stat))
1590 goto failed;1679 goto failed;
1591 }1680 }
@@ -1599,13 +1688,17 @@
1599 return mm->mm_start + offset;1688 return mm->mm_start + offset;
16001689
1601 failed:1690 failed:
1602 xt_rwmutex_unlock(&mm->mm_lock, thd_id);1691 map->mf_slock_count--;
1692 if (!map->mf_slock_count)
1693 FILE_MAP_UNLOCK(&mm->mm_lock, thd_id);
1603 return NULL;1694 return NULL;
1604}1695}
16051696
1606xtPublic void xt_unlock_fmap_ptr(XTMapFilePtr map, XTThreadPtr thread)1697xtPublic void xt_unlock_fmap_ptr(XTMapFilePtr map, XTThreadPtr thread)
1607{1698{
1608 xt_rwmutex_unlock(&map->mf_memmap->mm_lock, thread->t_id);1699 map->mf_slock_count--;
1700 if (!map->mf_slock_count)
1701 FILE_MAP_UNLOCK(&map->mf_memmap->mm_lock, thread->t_id);
1609}1702}
16101703
1611/* ----------------------------------------------------------------------1704/* ----------------------------------------------------------------------
16121705
=== modified file 'storage/pbxt/src/filesys_xt.h'
--- storage/pbxt/src/filesys_xt.h 2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/filesys_xt.h 2009-08-17 11:12:36 +0000
@@ -76,13 +76,60 @@
76#define XT_NULL_FD (-1)76#define XT_NULL_FD (-1)
77#endif77#endif
7878
79/* Note, this lock must be re-entrant,
80 * The only lock that satifies this is
81 * FILE_MAP_USE_RWMUTEX!
82 *
83 * 20.05.2009: This problem should be fixed now with mf_slock_count!
84 *
85 * The lock need no longer be re-entrant
86 */
87#ifdef XT_NO_ATOMICS
88#define FILE_MAP_USE_PTHREAD_RW
89#else
90//#define FILE_MAP_USE_RWMUTEX
91//#define FILE_MAP_USE_PTHREAD_RW
92//#define IDX_USE_SPINXSLOCK
93#define FILE_MAP_USE_XSMUTEX
94#endif
95
96#ifdef FILE_MAP_USE_XSMUTEX
97#define FILE_MAP_LOCK_TYPE XTXSMutexRec
98#define FILE_MAP_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, i)
99#define FILE_MAP_FREE_LOCK(s, i) xt_xsmutex_free(s, i)
100#define FILE_MAP_READ_LOCK(i, o) xt_xsmutex_slock(i, o)
101#define FILE_MAP_WRITE_LOCK(i, o) xt_xsmutex_xlock(i, o)
102#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
103#elif defined(FILE_MAP_USE_PTHREAD_RW)
104#define FILE_MAP_LOCK_TYPE xt_rwlock_type
105#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
106#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
107#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
108#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
109#define FILE_MAP_UNLOCK(i, o) xt_unlock_rwlock_ns(i)
110#elif defined(FILE_MAP_USE_RWMUTEX)
111#define FILE_MAP_LOCK_TYPE XTRWMutexRec
112#define FILE_MAP_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, i)
113#define FILE_MAP_FREE_LOCK(s, i) xt_rwmutex_free(s, i)
114#define FILE_MAP_READ_LOCK(i, o) xt_rwmutex_slock(i, o)
115#define FILE_MAP_WRITE_LOCK(i, o) xt_rwmutex_xlock(i, o)
116#define FILE_MAP_UNLOCK(i, o) xt_rwmutex_unlock(i, o)
117#elif defined(FILE_MAP_USE_SPINXSLOCK)
118#define FILE_MAP_LOCK_TYPE XTSpinXSLockRec
119#define FILE_MAP_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
120#define FILE_MAP_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
121#define FILE_MAP_READ_LOCK(i, o) xt_spinxslock_slock(i, o)
122#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
123#define FILE_MAP_UNLOCK(i, o) xt_spinxslock_unlock(i, o)
124#endif
125
79typedef struct XTFileMemMap {126typedef struct XTFileMemMap {
80 xtWord1 *mm_start; /* The in-memory start of the map. */127 xtWord1 *mm_start; /* The in-memory start of the map. */
81#ifdef XT_WIN128#ifdef XT_WIN
82 HANDLE mm_mapdes;129 HANDLE mm_mapdes;
83#endif130#endif
84 off_t mm_length; /* The length of the file map. */131 off_t mm_length; /* The length of the file map. */
85 XTRWMutexRec mm_lock; /* The file map R/W lock. */132 FILE_MAP_LOCK_TYPE mm_lock; /* The file map R/W lock. */
86 size_t mm_grow_size; /* The amount by which the map file is increased. */133 size_t mm_grow_size; /* The amount by which the map file is increased. */
87} XTFileMemMapRec, *XTFileMemMapPtr;134} XTFileMemMapRec, *XTFileMemMapPtr;
88135
@@ -127,6 +174,9 @@
127xtBool 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);174xtBool 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);
128xtBool xt_flush_file(XTOpenFilePtr of, struct XTIOStats *timer, struct XTThread *thread);175xtBool xt_flush_file(XTOpenFilePtr of, struct XTIOStats *timer, struct XTThread *thread);
129176
177xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, struct XTIOStats *timer, struct XTThread *thread);
178void xt_unlock_file_ptr(XTOpenFilePtr of, xtWord1 *data, struct XTThread *thread);
179
130typedef struct XTOpenDir {180typedef struct XTOpenDir {
131 char *od_path;181 char *od_path;
132#ifdef XT_WIN182#ifdef XT_WIN
@@ -134,8 +184,14 @@
134 WIN32_FIND_DATA od_data;184 WIN32_FIND_DATA od_data;
135#else185#else
136 char *od_filter;186 char *od_filter;
187 DIR *od_dir;
188 /* WARNING: Solaris requires od_entry.d_name member to have size at least as returned
189 * by pathconf() function on per-directory basis. This makes it impossible to statically
190 * pre-set the size. So xt_dir_open on Solaris dynamically allocates space as needed.
191 *
192 * This also means that the od_entry member should always be last in the XTOpenDir structure.
193 */
137 struct dirent od_entry;194 struct dirent od_entry;
138 DIR *od_dir;
139#endif195#endif
140} XTOpenDirRec, *XTOpenDirPtr;196} XTOpenDirRec, *XTOpenDirPtr;
141197
@@ -147,6 +203,7 @@
147off_t xt_dir_file_size(struct XTThread *self, XTOpenDirPtr od);203off_t xt_dir_file_size(struct XTThread *self, XTOpenDirPtr od);
148204
149typedef struct XTMapFile : public XTFileRef {205typedef struct XTMapFile : public XTFileRef {
206 u_int mf_slock_count;
150 XTFileMemMapPtr mf_memmap;207 XTFileMemMapPtr mf_memmap;
151} XTMapFileRec, *XTMapFilePtr;208} XTMapFileRec, *XTMapFilePtr;
152209
153210
=== modified file 'storage/pbxt/src/ha_pbxt.cc'
--- storage/pbxt/src/ha_pbxt.cc 2009-04-02 11:49:57 +0000
+++ storage/pbxt/src/ha_pbxt.cc 2009-08-18 07:46:53 +0000
@@ -65,8 +65,8 @@
65#include "heap_xt.h"65#include "heap_xt.h"
66#include "myxt_xt.h"66#include "myxt_xt.h"
67#include "datadic_xt.h"67#include "datadic_xt.h"
68#ifdef XT_STREAMING68#ifdef PBMS_ENABLED
69#include "streaming_xt.h"69#include "pbms_enabled.h"
70#endif70#endif
71#include "tabcache_xt.h"71#include "tabcache_xt.h"
72#include "systab_xt.h"72#include "systab_xt.h"
@@ -91,20 +91,22 @@
91//#define PRINT_STATEMENTS91//#define PRINT_STATEMENTS
92#endif92#endif
9393
94#ifndef DRIZZLED
94static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root);95static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root);
95static int pbxt_init(void *p);96static int pbxt_init(void *p);
96static int pbxt_end(void *p);97static int pbxt_end(void *p);
97#ifndef DRIZZLED
98static int pbxt_panic(handlerton *hton, enum ha_panic_function flag);98static int pbxt_panic(handlerton *hton, enum ha_panic_function flag);
99#endif
100static void pbxt_drop_database(handlerton *hton, char *path);99static void pbxt_drop_database(handlerton *hton, char *path);
101static int pbxt_close_connection(handlerton *hton, THD* thd);100static int pbxt_close_connection(handlerton *hton, THD* thd);
102static int pbxt_commit(handlerton *hton, THD *thd, bool all);101static int pbxt_commit(handlerton *hton, THD *thd, bool all);
103static int pbxt_rollback(handlerton *hton, THD *thd, bool all);102static int pbxt_rollback(handlerton *hton, THD *thd, bool all);
103#endif
104static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);104static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
105static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);105static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
106static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);106static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
107107
108extern void xt_xres_start_database_recovery(XTThreadPtr self);
109
108#ifdef TRACE_STATEMENTS110#ifdef TRACE_STATEMENTS
109111
110#ifdef PRINT_STATEMENTS112#ifdef PRINT_STATEMENTS
@@ -167,7 +169,7 @@
167/* Variables for pbxt share methods */169/* Variables for pbxt share methods */
168static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped170static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped
169static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables171static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables
170static XTDatabaseHPtr pbxt_database = NULL; // The global open database172XTDatabaseHPtr pbxt_database = NULL; // The global open database
171static char *pbxt_index_cache_size;173static char *pbxt_index_cache_size;
172static char *pbxt_record_cache_size;174static char *pbxt_record_cache_size;
173static char *pbxt_log_cache_size;175static char *pbxt_log_cache_size;
@@ -178,6 +180,7 @@
178static char *pbxt_data_log_threshold;180static char *pbxt_data_log_threshold;
179static char *pbxt_data_file_grow_size;181static char *pbxt_data_file_grow_size;
180static char *pbxt_row_file_grow_size;182static char *pbxt_row_file_grow_size;
183static int pbxt_max_threads;
181184
182#ifdef DEBUG185#ifdef DEBUG
183#define XT_SHARE_LOCK_WAIT 5000186#define XT_SHARE_LOCK_WAIT 5000
@@ -454,7 +457,7 @@
454 * operation to make sure it does not occur while457 * operation to make sure it does not occur while
455 * some other thread is doing a "closeall".458 * some other thread is doing a "closeall".
456 */459 */
457xtPublic void xt_ha_open_database_of_table(XTThreadPtr self, XTPathStrPtr table_path __attribute__((unused)))460xtPublic void xt_ha_open_database_of_table(XTThreadPtr self, XTPathStrPtr XT_UNUSED(table_path))
458{461{
459#ifdef XT_USE_GLOBAL_DB462#ifdef XT_USE_GLOBAL_DB
460 if (!self->st_database) {463 if (!self->st_database) {
@@ -574,7 +577,7 @@
574}577}
575578
576/* The first bit is 1. */579/* The first bit is 1. */
577static u_int ha_get_max_bit(MY_BITMAP *map)580static u_int ha_get_max_bit(MX_BITMAP *map)
578{581{
579 my_bitmap_map *data_ptr = map->bitmap;582 my_bitmap_map *data_ptr = map->bitmap;
580 my_bitmap_map *end_ptr = map->last_word_ptr;583 my_bitmap_map *end_ptr = map->last_word_ptr;
@@ -676,7 +679,7 @@
676 return(-1); // Unknown error679 return(-1); // Unknown error
677}680}
678681
679xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *thd __attribute__((unused)), const XTThreadPtr self, int ignore_dup_key)682xtPublic int xt_ha_pbxt_thread_error_for_mysql(THD *XT_UNUSED(thd), const XTThreadPtr self, int ignore_dup_key)
680{683{
681 int xt_err = self->t_exception.e_xt_err;684 int xt_err = self->t_exception.e_xt_err;
682685
@@ -965,8 +968,8 @@
965 /* This may cause the streaming engine to cleanup connections and 968 /* This may cause the streaming engine to cleanup connections and
966 * tables belonging to this engine. This in turn may require some of969 * tables belonging to this engine. This in turn may require some of
967 * the stuff below (like xt_create_thread() called from pbxt_close_table()! */970 * the stuff below (like xt_create_thread() called from pbxt_close_table()! */
968#ifdef XT_STREAMING971#ifdef PBMS_ENABLED
969 xt_exit_streaming();972 pbms_finalize();
970#endif973#endif
971 pbxt_call_exit(self);974 pbxt_call_exit(self);
972 xt_exit_threading(self);975 xt_exit_threading(self);
@@ -979,9 +982,13 @@
979/*982/*
980 * Outout the PBXT status. Return FALSE on error.983 * Outout the PBXT status. Return FALSE on error.
981 */984 */
982static bool pbxt_show_status(handlerton *hton __attribute__((unused)), THD* thd, 985#ifdef DRIZZLED
986bool PBXTStorageEngine::show_status(Session *thd, stat_print_fn *stat_print, enum ha_stat_type)
987#else
988static bool pbxt_show_status(handlerton *XT_UNUSED(hton), THD* thd,
983 stat_print_fn* stat_print,989 stat_print_fn* stat_print,
984 enum ha_stat_type stat_type __attribute__((unused)))990 enum ha_stat_type XT_UNUSED(stat_type))
991#endif
985{992{
986 XTThreadPtr self; 993 XTThreadPtr self;
987 int err = 0;994 int err = 0;
@@ -997,6 +1004,9 @@
997 xt_trace("// %s - dump\n", xt_trace_clock_diff(NULL));1004 xt_trace("// %s - dump\n", xt_trace_clock_diff(NULL));
998 xt_dump_trace();1005 xt_dump_trace();
999#endif1006#endif
1007#ifdef XT_TRACK_CONNECTIONS
1008 xt_dump_conn_tracking();
1009#endif
10001010
1001 try_(a) {1011 try_(a) {
1002 myxt_get_status(self, &strbuf);1012 myxt_get_status(self, &strbuf);
@@ -1020,14 +1030,18 @@
1020 *1030 *
1021 * return 1 on error, else 0.1031 * return 1 on error, else 0.
1022 */1032 */
1033#ifdef DRIZZLED
1034static int pbxt_init(PluginRegistry &registry)
1035#else
1023static int pbxt_init(void *p)1036static int pbxt_init(void *p)
1037#endif
1024{1038{
1025 int init_err = 0;1039 int init_err = 0;
10261040
1027 XT_TRACE_CALL();1041 XT_TRACE_CALL();
10281042
1029 if (sizeof(xtWordPS) != sizeof(void *)) {1043 if (sizeof(xtWordPS) != sizeof(void *)) {
1030 printf("PBXT: This won't work, I require that sizeof(xtWordPS) != sizeof(void *)!\n");1044 printf("PBXT: This won't work, I require that sizeof(xtWordPS) == sizeof(void *)!\n");
1031 XT_RETURN(1);1045 XT_RETURN(1);
1032 }1046 }
10331047
@@ -1045,28 +1059,31 @@
10451059
1046 xt_p_mutex_init_with_autoname(&pbxt_database_mutex, NULL);1060 xt_p_mutex_init_with_autoname(&pbxt_database_mutex, NULL);
10471061
1062#ifdef DRIZZLED
1063 pbxt_hton= new PBXTStorageEngine(std::string("PBXT"));
1064 registry.add(pbxt_hton);
1065#else
1048 pbxt_hton = (handlerton *) p;1066 pbxt_hton = (handlerton *) p;
1049 pbxt_hton->state = SHOW_OPTION_YES;1067 pbxt_hton->state = SHOW_OPTION_YES;
1050#ifndef DRIZZLED
1051 pbxt_hton->db_type = DB_TYPE_PBXT; // Wow! I have my own!1068 pbxt_hton->db_type = DB_TYPE_PBXT; // Wow! I have my own!
1052#endif
1053 pbxt_hton->close_connection = pbxt_close_connection; /* close_connection, cleanup thread related data. */1069 pbxt_hton->close_connection = pbxt_close_connection; /* close_connection, cleanup thread related data. */
1054 pbxt_hton->commit = pbxt_commit; /* commit */1070 pbxt_hton->commit = pbxt_commit; /* commit */
1055 pbxt_hton->rollback = pbxt_rollback; /* rollback */1071 pbxt_hton->rollback = pbxt_rollback; /* rollback */
1056 pbxt_hton->create = pbxt_create_handler; /* Create a new handler */1072 pbxt_hton->create = pbxt_create_handler; /* Create a new handler */
1057 pbxt_hton->drop_database = pbxt_drop_database; /* Drop a database */1073 pbxt_hton->drop_database = pbxt_drop_database; /* Drop a database */
1058#ifndef DRIZZLED
1059 pbxt_hton->panic = pbxt_panic; /* Panic call */1074 pbxt_hton->panic = pbxt_panic; /* Panic call */
1060#endif
1061 pbxt_hton->show_status = pbxt_show_status;1075 pbxt_hton->show_status = pbxt_show_status;
1062 pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */1076 pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */
10631077#endif
1064 if (!xt_init_logging()) /* Initialize logging */1078 if (!xt_init_logging()) /* Initialize logging */
1065 goto error_1;1079 goto error_1;
10661080
1067#ifdef XT_STREAMING1081#ifdef PBMS_ENABLED
1068 if (!xt_init_streaming())1082 PBMSResultRec result;
1083 if (!pbms_initialize("PBXT", false, &result)) {
1084 xt_logf(XT_NT_ERROR, "pbms_initialize() Error: %s", result.mr_message);
1069 goto error_2;1085 goto error_2;
1086 }
1070#endif1087#endif
10711088
1072 if (!xt_init_memory()) /* Initialize memory */1089 if (!xt_init_memory()) /* Initialize memory */
@@ -1082,9 +1099,13 @@
1082 * +1 Free'er thread1099 * +1 Free'er thread
1083 * +1 Temporary thread (e.g. TempForClose, TempForEnd)1100 * +1 Temporary thread (e.g. TempForClose, TempForEnd)
1084 */1101 */
1085 self = xt_init_threading(max_connections + 7); /* Create the main self: */1102#ifndef DRIZZLED
1103 if (pbxt_max_threads == 0)
1104 pbxt_max_threads = max_connections + 7;
1105#endif
1106 self = xt_init_threading(pbxt_max_threads); /* Create the main self: */
1086 if (!self)1107 if (!self)
1087 goto error_4;1108 goto error_3;
10881109
1089 pbxt_inited = true;1110 pbxt_inited = true;
10901111
@@ -1111,7 +1132,7 @@
1111 ASSERT(!pbxt_database);1132 ASSERT(!pbxt_database);
1112 {1133 {
1113 THD *curr_thd = current_thd;1134 THD *curr_thd = current_thd;
1114 THD *thd = curr_thd;1135 THD *thd = NULL;
11151136
1116#ifndef DRIZZLED1137#ifndef DRIZZLED
1117 extern myxt_mutex_t LOCK_plugin;1138 extern myxt_mutex_t LOCK_plugin;
@@ -1148,21 +1169,23 @@
1148 xt_throw(self);1169 xt_throw(self);
1149 }1170 }
11501171
1151 xt_open_database(self, mysql_real_data_home, TRUE);1172 xt_xres_start_database_recovery(self);
1152 pbxt_database = self->st_database;
1153 xt_heap_reference(self, pbxt_database);
1154 }1173 }
1155 catch_(b) {1174 catch_(b) {
1156 if (!curr_thd && thd)1175 /* It is possible that the error was reset by cleanup code.
1157 myxt_destroy_thread(thd, FALSE);1176 * Set a generic error code in that case.
1158#ifndef DRIZZLED1177 */
1159 myxt_mutex_lock(&LOCK_plugin);1178 /* PMC - This is not necessary in because exceptions are
1160#endif1179 * now preserved, in exception handler cleanup.
1161 xt_throw(self);1180 */
1181 if (!self->t_exception.e_xt_err)
1182 xt_register_error(XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed");
1183 xt_log_exception(self, &self->t_exception, XT_LOG_DEFAULT);
1184 init_err = 1;
1162 }1185 }
1163 cont_(b);1186 cont_(b);
11641187
1165 if (!curr_thd)1188 if (thd)
1166 myxt_destroy_thread(thd, FALSE);1189 myxt_destroy_thread(thd, FALSE);
1167#ifndef DRIZZLED1190#ifndef DRIZZLED
1168 myxt_mutex_lock(&LOCK_plugin);1191 myxt_mutex_lock(&LOCK_plugin);
@@ -1205,32 +1228,37 @@
1205 * I have to stop the freeer here because it was1228 * I have to stop the freeer here because it was
1206 * started before opening the database.1229 * started before opening the database.
1207 */1230 */
1208 pbxt_call_exit(self);1231
1209 pbxt_inited = FALSE;1232 /* {FREEER-HANG-ON-INIT-ERROR}
1210 xt_exit_threading(self);1233 * pbxt_init is called with LOCK_plugin and if it fails and tries to exit
1211 goto error_4;1234 * the freeer here it hangs because the freeer calls THD::~THD which tries
1235 * to aquire the same lock and hangs. OTOH MySQL calls pbxt_end() after
1236 * an unsuccessful call to pbxt_init, so we defer cleaup, except
1237 * releasing 'self'
1238 */
1239 xt_free_thread(self);
1240 goto error_3;
1212 }1241 }
1213 xt_free_thread(self);1242 xt_free_thread(self);
1214 }1243 }
1215 XT_RETURN(init_err);1244 XT_RETURN(init_err);
12161245
1217 error_4:
1218 xt_exit_memory();
1219
1220 error_3:1246 error_3:
1221#ifdef XT_STREAMING1247#ifdef PBMS_ENABLED
1222 xt_exit_streaming();1248 pbms_finalize();
12231249
1224 error_2:1250 error_2:
1225#endif1251#endif
1226 xt_exit_logging();
12271252
1228 error_1:1253 error_1:
1229 xt_p_mutex_destroy(&pbxt_database_mutex);
1230 XT_RETURN(1);1254 XT_RETURN(1);
1231}1255}
12321256
1233static int pbxt_end(void *p __attribute__((unused)))1257#ifdef DRIZZLED
1258static int pbxt_end(PluginRegistry &registry)
1259#else
1260static int pbxt_end(void *)
1261#endif
1234{1262{
1235 XTThreadPtr self;1263 XTThreadPtr self;
1236 int err = 0;1264 int err = 0;
@@ -1241,7 +1269,7 @@
1241 XTExceptionRec e;1269 XTExceptionRec e;
12421270
1243 /* This flag also means "shutting down". */1271 /* This flag also means "shutting down". */
1244 pbxt_inited = FALSE;1272 pbxt_inited = FALSE;
1245 self = xt_create_thread("TempForEnd", FALSE, TRUE, &e);1273 self = xt_create_thread("TempForEnd", FALSE, TRUE, &e);
1246 if (self) {1274 if (self) {
1247 self->t_main = TRUE;1275 self->t_main = TRUE;
@@ -1249,6 +1277,9 @@
1249 }1277 }
1250 }1278 }
12511279
1280#ifdef DRIZZLED
1281 registry.remove(pbxt_hton);
1282#endif
1252 XT_RETURN(err);1283 XT_RETURN(err);
1253}1284}
12541285
@@ -1262,12 +1293,15 @@
1262/*1293/*
1263 * Kill the PBXT thread associated with the MySQL thread.1294 * Kill the PBXT thread associated with the MySQL thread.
1264 */1295 */
1296#ifdef DRIZZLED
1297int PBXTStorageEngine::close_connection(Session *thd)
1298{
1299 PBXTStorageEngine * const hton = this;
1300#else
1265static int pbxt_close_connection(handlerton *hton, THD* thd)1301static int pbxt_close_connection(handlerton *hton, THD* thd)
1266{1302{
1303#endif
1267 XTThreadPtr self;1304 XTThreadPtr self;
1268#ifdef XT_STREAMING
1269 XTExceptionRec e;
1270#endif
12711305
1272 XT_TRACE_CALL();1306 XT_TRACE_CALL();
1273 if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {1307 if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
@@ -1278,10 +1312,6 @@
1278 xt_set_self(self);1312 xt_set_self(self);
1279 xt_free_thread(self);1313 xt_free_thread(self);
1280 }1314 }
1281#ifdef XT_STREAMING
1282 if (!xt_pbms_close_connection((void *) thd, &e))
1283 xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
1284#endif
1285 return 0;1315 return 0;
1286}1316}
12871317
@@ -1290,7 +1320,11 @@
1290 * when the last PBXT table was removed from the 1320 * when the last PBXT table was removed from the
1291 * database.1321 * database.
1292 */1322 */
1293static void pbxt_drop_database(handlerton *hton __attribute__((unused)), char *path __attribute__((unused)))1323#ifdef DRIZZLED
1324void PBXTStorageEngine::drop_database(char *)
1325#else
1326static void pbxt_drop_database(handlerton *XT_UNUSED(hton), char *XT_UNUSED(path))
1327#endif
1294{1328{
1295 XT_TRACE_CALL();1329 XT_TRACE_CALL();
1296}1330}
@@ -1317,8 +1351,14 @@
1317 * pbxt_thr is a pointer the the PBXT thread structure.1351 * pbxt_thr is a pointer the the PBXT thread structure.
1318 *1352 *
1319 */1353 */
1354#ifdef DRIZZLED
1355int PBXTStorageEngine::commit(Session *thd, bool all)
1356{
1357 PBXTStorageEngine * const hton = this;
1358#else
1320static int pbxt_commit(handlerton *hton, THD *thd, bool all)1359static int pbxt_commit(handlerton *hton, THD *thd, bool all)
1321{1360{
1361#endif
1322 int err = 0;1362 int err = 0;
1323 XTThreadPtr self;1363 XTThreadPtr self;
13241364
@@ -1343,8 +1383,14 @@
1343 return err;1383 return err;
1344}1384}
13451385
1386#ifdef DRIZZLED
1387int PBXTStorageEngine::rollback(Session *thd, bool all)
1388{
1389 PBXTStorageEngine * const hton = this;
1390#else
1346static int pbxt_rollback(handlerton *hton, THD *thd, bool all)1391static int pbxt_rollback(handlerton *hton, THD *thd, bool all)
1347{1392{
1393#endif
1348 int err = 0;1394 int err = 0;
1349 XTThreadPtr self;1395 XTThreadPtr self;
13501396
@@ -1377,8 +1423,14 @@
1377 return 0;1423 return 0;
1378}1424}
13791425
1426#ifdef DRIZZLED
1427handler *PBXTStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
1428{
1429 PBXTStorageEngine * const hton = this;
1430#else
1380static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root)1431static handler *pbxt_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root)
1381{1432{
1433#endif
1382 if (table && XTSystemTableShare::isSystemTable(table->path.str))1434 if (table && XTSystemTableShare::isSystemTable(table->path.str))
1383 return new (mem_root) ha_xtsys(hton, table);1435 return new (mem_root) ha_xtsys(hton, table);
1384 else1436 else
@@ -1513,7 +1565,11 @@
1513 freer_(); // xt_unlock_mutex(share->sh_ex_mutex)1565 freer_(); // xt_unlock_mutex(share->sh_ex_mutex)
1514}1566}
15151567
1516static void ha_release_exclusive_use(XTThreadPtr self __attribute__((unused)), XTSharePtr share)1568#ifdef PBXT_ALLOW_PRINTING
1569static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share)
1570#else
1571static void ha_release_exclusive_use(XTThreadPtr XT_UNUSED(self), XTSharePtr share)
1572#endif
1517{1573{
1518 XT_PRINT1(self, "ha_release_exclusive_use %s PBXT X UNLOCK\n", share->sh_table_path->ps_path);1574 XT_PRINT1(self, "ha_release_exclusive_use %s PBXT X UNLOCK\n", share->sh_table_path->ps_path);
1519 xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);1575 xt_lock_mutex_ns((xt_mutex_type *) share->sh_ex_mutex);
@@ -1629,11 +1685,23 @@
1629 { 0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}1685 { 0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
1630};1686};
16311687
1688#ifdef DRIZZLED
1689static InfoSchemaTable *pbxt_statistics_table;
1690
1691int pbxt_init_statitics(PluginRegistry &registry)
1692#else
1632int pbxt_init_statitics(void *p)1693int pbxt_init_statitics(void *p)
1694#endif
1633{1695{
1634 ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;1696#ifdef DRIZZLED
1635 schema->fields_info = pbxt_statistics_fields_info;1697 pbxt_statistics_table = (InfoSchemaTable *)xt_calloc_ns(sizeof(InfoSchemaTable));
1636 schema->fill_table = pbxt_statistics_fill_table;1698 pbxt_statistics_table->table_name= "PBXT_STATISTICS";
1699 registry.add(pbxt_statistics_table);
1700#else
1701 ST_SCHEMA_TABLE *pbxt_statistics_table = (ST_SCHEMA_TABLE *) p;
1702#endif
1703 pbxt_statistics_table->fields_info = pbxt_statistics_fields_info;
1704 pbxt_statistics_table->fill_table = pbxt_statistics_fill_table;
16371705
1638#if defined(XT_WIN) && defined(XT_COREDUMP)1706#if defined(XT_WIN) && defined(XT_COREDUMP)
1639 void register_crash_filter();1707 void register_crash_filter();
@@ -1645,8 +1713,16 @@
1645 return 0;1713 return 0;
1646}1714}
16471715
1648int pbxt_exit_statitics(void *p __attribute__((unused)))1716#ifdef DRIZZLED
1717int pbxt_exit_statitics(PluginRegistry &registry)
1718#else
1719int pbxt_exit_statitics(void *XT_UNUSED(p))
1720#endif
1649{1721{
1722#ifdef DRIZZLED
1723 registry.remove(pbxt_statistics_table);
1724 xt_free_ns(pbxt_statistics_table);
1725#endif
1650 return(0);1726 return(0);
1651}1727}
16521728
@@ -1765,7 +1841,7 @@
1765 */1841 */
1766#define FLAGS_ARE_READ_DYNAMICALLY1842#define FLAGS_ARE_READ_DYNAMICALLY
17671843
1768MX_ULONG_T ha_pbxt::index_flags(uint inx __attribute__((unused)), uint part __attribute__((unused)), bool all_parts __attribute__((unused))) const1844MX_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