List:Commits« Previous MessageNext Message »
From:Martin Hansson Date:December 16 2010 8:21am
Subject:Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)
Bug#58207
View as plain text  
Jorgen Loland skrev 2010-12-15 14.07:
> Martin,
>
> The fix looks good, but the test case in the patch does not give 
> valgrind warning. Please provide a test case that is fixed by the 
> patch (e.g., the one reported in the bug). If you violently refuse to 
> replace this test, you can add one more instead.
You did build with BUILD/compile-pentium-valgrind-max, right? If you 
still don't see it you might try to revert to the same revision as I 
committed into.

Does the test case in the bug report give valgrind warnings but mine 
doesn't? If they do then that's serious enough, BUT... things actually 
changed *while* I was working on the bug. First time around, the first 
test caused a core dump. Then when I pulled the latest changes it 
didn't, and then two days later it caused a crash again. The bug is that 
we get a totally runaway pointer, so it's sensitive to just about anything.

I really would want to add an assertion, but alas the Field offset 
information is not available during optimization. It should be added I 
guess but that would be an enormous patch affecting dozens of classes 
(in the Field hierarchy.) Attached please find a really ugly hack, but 
at least it lets you test beyond reasonable doubt whether the bug is 
there or not.

Best Regards

Martin

=== modified file 'sql/field.h'
--- sql/field.h	2010-03-17 18:15:41 +0000
+++ sql/field.h	2010-12-14 09:06:24 +0000
@@ -54,6 +54,8 @@
   { return sql_alloc(size); }
   static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
 
+  my_ptrdiff_t offset_hack;
+
   uchar		*ptr;			// Position to field in record
   /**
      Byte where the @c NULL bit is stored inside a record. If this Field is a

=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc	2010-11-26 12:51:48 +0000
+++ sql/sql_select.cc	2010-12-16 08:01:33 +0000
@@ -10400,6 +10400,9 @@
       my_ptrdiff_t diff;
       Field *orig_field= default_field[i];
       /* Get the value from default_values */
+
+      DBUG_ASSERT(orig_field->ptr - orig_field->offset_hack ==
+                  orig_field->table->record[0]);
       diff= (my_ptrdiff_t) (orig_field->table->s->default_values-
                             orig_field->table->record[0]);
       orig_field->move_field_offset(diff);      // Points now at default_values

=== modified file 'sql/table.cc'
--- sql/table.cc	2010-10-01 11:39:04 +0000
+++ sql/table.cc	2010-12-14 09:29:56 +0000
@@ -1303,7 +1303,7 @@
       error= 4;
       goto err;			/* purecov: inspected */
     }
-
+    reg_field->offset_hack= recpos - 1;
     reg_field->field_index= i;
     reg_field->comment=comment;
     if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))


Thread
bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520) Bug#58207Martin Hansson14 Dec
Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland15 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Martin Hansson16 Dec
    • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland16 Dec
      • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Martin Hansson16 Dec
        • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland16 Dec
          • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Martin Hansson16 Dec
            • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland16 Dec
          • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Martin Hansson22 Dec
            • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland10 Jan
              • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Martin Hansson10 Jan
                • Re: bzr commit into mysql-5.1-bugteam branch (martin.hansson:3520)Bug#58207Jorgen Loland11 Jan