Bug #15891 Current 5.1 fails for NDB tests
Submitted: 20 Dec 2005 15:01 Modified: 20 Dec 2005 20:09
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.1.4 OS:Linux (Linux)
Assigned to: Magnus Blåudd CPU Architecture:Any

[20 Dec 2005 15:01] Ingo Strüwing
Description:
The current 5.1 tree fails for some NDB related tests:

mysql-test-run in default mode: *** Failing the test(s): ndb_basic ndb_blob ndb_condition_pushdown ndb_index_ordered ps_7ndb

A typical error message is this:

mysqltest: At line 51: query 'update t1 set b = b + 1 where b > 4 and b < 7' failed: 1032: Can't find record in 't1'

(this one is from ndb_index_ordered)
The other failures look very similar, just ndb_basic produces a crash.

I checked the 5.1 tree of today, up to and including change set:
ChangeSet@1.1967, 2005-12-19 17:00:53+01:00, kent@mysql.com

The last tree, which was definitely ok, is up to:
ChangeSet@1.1975, 2005-12-15 09:52:11+01:00, knielsen@mysql.com

How to repeat:
BUILD/compile-pentium-debug-max
cd mysql-test
./mysql-test-run ndb_basic ndb_blob ndb_condition_pushdown ndb_index_ordered ps_7ndb
[20 Dec 2005 19:23] Magnus Blåudd
If debug compiled mysql server will crash on the DBUG_ASSER(FALSE) at line 1361 in ha_ndbcluster.cc

static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
{
  if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) {
    Field_varstring* f= (Field_varstring*)field;
    if (f->length_bytes == 1) {
      uint pack_len= field->pack_length();
      DBUG_ASSERT(1 <= pack_len && pack_len <= 256);
      if (ptr[1] == 0) {
        buf[0]= ptr[0];
      } else {
        DBUG_ASSERT(FALSE);
        buf[0]= 255;
      }
      memmove(buf + 1, ptr + 2, pack_len - 1);
      ptr= buf;
    }
  }
}

gdb stacktrace:
(gdb) where
#0  0x00f81402 in __kernel_vsyscall ()
#1  0x0067655f in pthread_kill () from /lib/libpthread.so.0
#2  0x08347a58 in write_core (sig=6) at stacktrace.c:220
#3  0x081f9e07 in handle_segfault (sig=6) at mysqld.cc:2117
#4  <signal handler called>
#5  0x00f81402 in __kernel_vsyscall ()
#6  0x00373118 in raise () from /lib/libc.so.6
#7  0x00374888 in abort () from /lib/libc.so.6
#8  0x0036c2f5 in __assert_fail () from /lib/libc.so.6
#9  0x0839591b in shrink_varchar (field=0xaa1e540, ptr=@0x6af290,
    buf=0x6af190 "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\002") at ha_ndbcluster.cc:1361
#10 0x083959d2 in ha_ndbcluster::set_primary_key (this=0xa9e85b8,
    op=0xaa20bd8, key=0xa9e9360 '\uffff' <repeats 104 times>, "h4z\025\201")
    at ha_ndbcluster.cc:1382
#11 0x0839961a in ha_ndbcluster::pk_read (this=0xa9e85b8,
    key=0xa9e9360 '\uffff' <repeats 104 times>, "h4z\025\201", key_len=52,
    buf=0xaa1e4a0 "", part_id=0) at ha_ndbcluster.cc:1510
#12 0x0839a3f6 in ha_ndbcluster::rnd_pos (this=0xa9e85b8, buf=0xaa1e4a0 "",
    pos=0xa9e9360 '\uffff' <repeats 104 times>, "h4z\025\201")
    at ha_ndbcluster.cc:2980
#13 0x082de45b in rr_from_pointers (info=0xa9eb2b4) at records.cc:446
#14 0x0826a043 in join_init_read_record (tab=0xa9eb278) at sql_select.cc:10306
#15 0x0826717e in sub_select (join=0xa9ea000, join_tab=0xa9eb278,
    end_of_records=false) at sql_select.cc:9694
#16 0x082674f6 in do_select (join=0xa9ea000, fields=0xa941368, table=0x0,
    procedure=0x0) at sql_select.cc:9458
#17 0x0827a3c2 in JOIN::exec (this=0xa9ea000) at sql_select.cc:1733
#18 0x0827a73a in mysql_select (thd=0xa941068, rref_pointer_array=0xa941404,
    tables=0xa9e9d08, wild_num=1, fields=@0xa941368, conds=0x0, og_num=1,
    order=0xa9e9f70, group=0x0, having=0x0, proc_param=0x0,
    select_options=2189707776, result=0xa9e9ff0, unit=0xa9410b8,
    select_lex=0xa9412e4) at sql_select.cc:1897
#19 0x0827aa16 in handle_select (thd=0xa941068, lex=0xa9410a8,
    result=0xa9e9ff0, setup_tables_done_option=0) at sql_select.cc:250
#20 0x08215e70 in mysql_execute_command (thd=0xa941068) at sql_parse.cc:2491
#21 0x0821e691 in mysql_parse (thd=0xa941068,
    inBuf=0xa9e9bf8 "select * from t1 order by f1", length=28)
    at sql_parse.cc:5626
#22 0x0821f0db in dispatch_command (command=COM_QUERY, thd=0xa941068,
    packet=0xa9e1b99 "", packet_length=29) at sql_parse.cc:1708
#23 0x08220697 in do_command (thd=0xa941068) at sql_parse.cc:1509
#24 0x08220aa0 in handle_one_connection (arg=0xa941068) at sql_parse.cc:1152
[20 Dec 2005 20:09] Magnus Blåudd
Pushed to 5.1.4
[21 Dec 2005 10:10] Magnus Blåudd
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

http://lists.mysql.com/commits/300