List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 29 1999 10:01pm
Subject:Bug in select distinct
View as plain text  
>>>>> "Phuc" == Phuc Truong <ptruong@stripped> writes:

Phuc> Hi guys,
Phuc> I'm experiencing a really strange problem with a table that stores html
Phuc> documents.  There are only two records (if you need the dump of the
Phuc> record, I could e-mail it to you it's only 64k).  If you dump into the
Phuc> database from the dump file or insert these html documents into the
Phuc> database, it works fine but when you do this selection on the table, it
Phuc> gives you this error:

Phuc> select distinct announcement.* from announcement;
Phuc> ERROR 2013: Lost connection to MySQL server during query

Phuc> This error then causes mysql to restart because of hanging processes:

Phuc> Number of processes running now: 1
Phuc> mysqld process hanging, pid 830 - killed
Phuc> mysqld restarted on  Wed Sep 29 03:11:32 UTC 1999
Phuc> /usr/local/mysql/bin/mysqld: ready for connections

Phuc> I'm running:

Phuc> mysqladmin  Ver 7.11 Distrib 3.22.25, for pc-linux-gnu on i686
Phuc> linux 2.2.10

Phuc> I also tried both binary and statically compiled versions of mysql. Also
Phuc> tried increasing the max_allowed_packet like the manual says but this
Phuc> didn't help.  Below are the settings I used for my safe_mysql script: 

Phuc> nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
Phuc> -O max_allowed_packet=32m  -O key_buffer=16m \
Phuc> -O sort_buffer=16m  -O record_buffer=16m  -O max_connections=160 \
Phuc> -O table_cache=500  -O tmp_table_size=16m  --skip-locking >> $err_log
2> &1

Phuc> Note that only certain html files causes these errors and it happens only
Phuc> on a select.  If you do a select * from announcement, it also works
Phuc> (perhaps the "distinct" screws it up).  Also, if you want to know,
Phuc> the html documents were generated in front page.  Thanks for the help. 

Hi!

This is a bug in the DISTINCT handling of BLOBS in 3.22.25 and 3.22.26
Anyway, here is the patch for this:

*** /my/monty/master/mysql-3.22.26a/sql/sql_select.cc   Fri Sep  3 00:39:51 1999
--- ./sql_select.cc     Wed Sep 15 13:41:44 1999
***************
*** 4045,4056 ****
      if (error == 0)
      {
        ha_info(entry,1);
-       memcpy(new_record,org_record,reclength);
        if (copy_blobs(first_field))
        {
        error=ENOMEM;
        break;
        }
        while ((error=info.read_record(&info)) <= 0)
        {
        if (error == 0)
--- 4045,4056 ----
      if (error == 0)
      {
        ha_info(entry,1);
        if (copy_blobs(first_field))
        {
        error=ENOMEM;
        break;
        }
+       memcpy(new_record,org_record,reclength);
        while ((error=info.read_record(&info)) <= 0)
        {
        if (error == 0)

Regards,
Monty




Thread
Bug in select distinctPhuc Truong29 Sep
  • Bug in select distinctMichael Widenius30 Sep