Bug #20583 After "coalesce partition" and "add partition" client "lost connection"
Submitted: 20 Jun 2006 19:05 Modified: 4 Jul 2006 6:13
Reporter: Horst Hunger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.12 OS:Linux (Suse Linux 10.1)
Assigned to: Mikael Ronström CPU Architecture:Any

[20 Jun 2006 19:05] Horst Hunger
Description:
The system_3 stress test executes short programms doing insert, update, select randomly, also "coalesce partition" and "add partition" repeating them in a nondeterministic order. After "add partition" the client "lost connection".  As it was not possible to reduce the test to a short order of significant SQL statements reproducing the crash, I have attached the backtrace, master.err, general_log.CSV. The engine was myisam.
I also have attached the programs doing coalesce and add partition and "sys3.cnf", to insert them into the system_3. Also "partition_tests.txt".

How to repeat:
clone the actual "mysql-test-extra-5.1".
insert the two programs and "partition_tests.txt"  into ".../suite/system_3/t.
generate result files by executing "touch tb1_eng1_add_partition.result" in ".../suite/system_3/r", same for "...coalesce..".
Insert "sys3.cnf" into ".../suite/system_3", change the variables to your directories (sys3.cnf must be executable).
./run_systest3 --config=sys3.cnf --duration=120                                         

(hope, I have nothing forgotten, otherwise call me)
[20 Jun 2006 19:07] Horst Hunger
backtrace

Attachment: bt1.txt (text/plain), 4.25 KiB.

[20 Jun 2006 19:15] Horst Hunger
Sorry for so many files. I'll put them in a tar file.
[22 Jun 2006 7:37] Mikael Ronström
Hi Horst,
It was a simple bug, I had missed to implement support for
index_last with unordered index scans.
So the query log is the one I really am looking for.
So a query that executes with only one partition using
ORDER BY a DESC on an index field or something like that
should probably do the trick with a simple test case.
So the fix I already am pretty clear on how to do, but it
would be nice to have a simple test case for the patch as
well.
[22 Jun 2006 8:59] Mikael Ronström
CREATE TABLE t1 (a int, index(a))
partition by hash(a);
insert into t1 values (1),(2);
select * from t1 ORDER BY a DESC;

This test case is a fairly minimal test case that causes the crash.
[1 Jul 2006 12:52] Mikael Ronström
Patch pushed to the 5.1-kt team tree
[3 Jul 2006 22:02] Mikael Ronström
Patch will appear in 5.1.12
[4 Jul 2006 6:13] Jon Stephens
Documented bugfix in 5.1.12 changelog using Mikael's explanation of the bug, as shown here:

        <para>
          A query selecting records from a single partition of a
          partitioned table and using <literal>ORDER BY
            <replaceable>ic</replaceable> DESC</literal> (where
          <replaceable>ic</replaceable> represents an indexed column)
          could cause errors or crash the server. (Bug #20583)
        </para>