Bug #3969 replication slave segfaults when ignoring a big query with REGEXPs
Submitted: 2 Jun 2004 16:30 Modified: 11 Jun 2004 15:29
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:3.23 and above OS:Linux (linux at least)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[2 Jun 2004 16:30] Guilhem Bichot
Description:
When the slave ignores (because of replicate-wild-ignore-table) a long INSERT SELECT containing many REGEXP, it crashes (or it crashes at shutdown).
Crash = segmentation fault.

How to repeat:
Use this Perl program:
print "INSERT INTO t2 SELECT * FROM t1 WHERE";
for ($i= 0; $i<4100; $i++)
  {
    if ($i > 0)
      {
        print " OR ";
      }
    print " a REGEXP '".$i."'";
  }
print ";\n";
(4100 is a value which worked for me; 4000 is not enough on my machine)*
to make a big query. Create 2 tables on master:
CREATE TABLE t1 (
  a int(11) default NULL,
  b int(11) default NULL
) TYPE=MyISAM;
CREATE TABLE t2 (
  a int(11) default NULL,
  b int(11) default NULL
) TYPE=MyISAM;
Then start slave with replicate-wild-ignore-table=test.% if test is the db where you created t1 and t2. Execute the big query on master, the slave should crash after ignoring it (or if it does not, it should crash at shutdown).

Suggested fix:
debugging this...
[2 Jun 2004 22:42] Guilhem Bichot
Another way to make the crash happen is not use --replicate-wild* options, but have the query killed on the master. Then the slave will crash as well (which is logical, as the executed code is very similar as the one of the first case).
[3 Jun 2004 14:55] Oleksandr Byelkin
ChangeSet 
  1.1440 04/06/03 15:38:38 bell@sanja.is.com.ua +1 -0 
  removed incorrect destructor (to prevent deleting item by recursion instead 
of by list scanning in case of chained OR or 
+AND)
[11 Jun 2004 15:29] Oleksandr Byelkin
thnak you for bugreport, patch & test suite are pushed to source repositoty.