Hi!

>>>>> "Lance" == Lance Lovette <[EMAIL PROTECTED]> writes:

Lance> If I INSERT DELAYED into a table with an auto_increment column and specify a
Lance> value of NULL for that column, the query fails. This is to be expected.
Lance> After this failure however, normal INSERT queries start piling up in the
Lance> 'Locked' state and remain there indefinitely. The only way to get things
Lance> back to normal is to use kill -9 on the mysqld process that is hanging. Is
Lance> there something wrong with my installation? I appear to be using
Lance> glibc-2.1.3-15 and I am using the pre-built MySQL RPMs.

Lance> This same problem was reported on the mailing list over a year ago:
Lance> http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:msn:20927:cedcofcbgbbfjpmfodlb

Unfortunately our developers missed that message and as no did a full bug
repeatable bug report of this we didn't know about this bug.

Anyway, here is a patch that fixes this problem:

===== sql/sql_insert.cc 1.32 vs edited =====
*** /tmp/sql_insert.cc-1.32-20207       Tue Mar  6 15:24:04 2001
--- edited/sql/sql_insert.cc    Thu Mar  8 21:39:24 2001
***************
*** 247,255 ****
    }
    if (lock_type == TL_WRITE_DELAYED)
    {
!     id=0;                                     // No auto_increment id
!     info.copied=values_list.elements;
!     end_delayed_insert(thd);
    }
    else
    {
--- 247,258 ----
    }
    if (lock_type == TL_WRITE_DELAYED)
    {
!     if (!error)
!     {
!       id=0;                                   // No auto_increment id
!       info.copied=values_list.elements;
!       end_delayed_insert(thd);
!     }
    }
    else
    {
***************
*** 486,492 ****
       table(0),tables_in_use(0),stacked_inserts(0), status(0), dead(0),
       group_count(0)
    {
!     thd.user=thd.host=(char*) "";
      thd.current_tablenr=0;
      thd.version=refresh_version;
      thd.command=COM_DELAYED_INSERT;
--- 489,495 ----
       table(0),tables_in_use(0),stacked_inserts(0), status(0), dead(0),
       group_count(0)
    {
!     thd.user=0; thd.host=(char*) localhost;
      thd.current_tablenr=0;
      thd.version=refresh_version;
      thd.command=COM_DELAYED_INSERT;
***************
*** 676,682 ****
  TABLE *delayed_insert::get_local_table(THD* client_thd)
  {
    my_ptrdiff_t adjust_ptrs;
!   Field **field,**org_field;
    TABLE *copy;
  
    /* First request insert thread to get a lock */
--- 679,685 ----
  TABLE *delayed_insert::get_local_table(THD* client_thd)
  {
    my_ptrdiff_t adjust_ptrs;
!   Field **field,**org_field, *found_next_number_field;
    TABLE *copy;
  
    /* First request insert thread to get a lock */
***************
*** 719,729 ****
--- 722,735 ----
  
    adjust_ptrs=PTR_BYTE_DIFF(copy->record[0],table->record[0]);
  
+   found_next_number_field=table->found_next_number_field;
    for (org_field=table->field ; *org_field ; org_field++,field++)
    {
      if (!(*field= (*org_field)->new_field(copy)))
        return 0;
      (*field)->move_field(adjust_ptrs);                // Point at copy->record[0]
+     if (*org_field == found_next_number_field)
+       (*field)->table->found_next_number_field= *field;
    }
    *field=0;
  
***************
*** 806,819 ****
--- 812,828 ----
  
  static void end_delayed_insert(THD *thd)
  {
+   DBUG_ENTER("end_delayed_insert");
    delayed_insert *di=thd->di;
    pthread_mutex_lock(&di->mutex);
+   DBUG_PRINT("info",("tables in use: %d",di->tables_in_use));
    if (!--di->tables_in_use || di->thd.killed)
    {                                           // Unlock table
      di->status=1;
      pthread_cond_signal(&di->cond);
    }
    pthread_mutex_unlock(&di->mutex);
+   DBUG_VOID_RETURN;
  }
  
  
***************
*** 951,956 ****
--- 960,966 ----
        pthread_mutex_unlock(&di->thd.mysys_var->mutex);
        di->thd.proc_info=0;
  
+       DBUG_PRINT("info",("Waiting for someone to insert rows"));
        for ( ; ;)
        {
        int error;


Lance> Also, when searching the mailing list, is there a way to order the results
Lance> by date? It is difficult to find the most recent discussions about a topic
Lance> otherwise.

We shall think about that one. Thanks for the suggestion.

Lance> Thanks!
Lance> Lance

Regards,
Monty

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to