~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Brian Aker
  • Date: 2009-01-24 13:22:10 UTC
  • Revision ID: brian@gir-3.local-20090124132210-kdoac6t6ztyp3crc
Move number of threads to use for pool of threads to module. Removed slave
thrad cheats from session object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1007
1007
  if (all_tables || !lex->is_single_level_stmt())
1008
1008
    drizzle_reset_errors(session, 0);
1009
1009
 
1010
 
  if (unlikely(session->slave_thread))
1011
 
  {
1012
 
    /*
1013
 
      Check if statment should be skipped because of slave filtering
1014
 
      rules
1015
 
 
1016
 
      Exceptions are:
1017
 
      - UPDATE MULTI: For this statement, we want to check the filtering
1018
 
        rules later in the code
1019
 
      - SET: we always execute it (Not that many SET commands exists in
1020
 
        the binary log anyway -- only 4.1 masters write SET statements,
1021
 
        in 5.0 there are no SET statements in the binary log)
1022
 
      - DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we
1023
 
        have stale files on slave caused by exclusion of one tmp table).
1024
 
    */
1025
 
    if (!(lex->sql_command == SQLCOM_UPDATE_MULTI) &&
1026
 
        !(lex->sql_command == SQLCOM_SET_OPTION) &&
1027
 
        !(lex->sql_command == SQLCOM_DROP_TABLE &&
1028
 
          lex->drop_temporary && lex->drop_if_exists) &&
1029
 
        all_tables_not_ok(session, all_tables))
1030
 
    {
1031
 
      /* we warn the slave SQL thread */
1032
 
      my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
1033
 
      return(0);
1034
 
    }
1035
 
  }
1036
 
 
1037
1010
  status_var_increment(session->status_var.com_stat[lex->sql_command]);
1038
1011
 
1039
1012
  assert(session->transaction.stmt.modified_non_trans_table == false);
1459
1432
 
1460
1433
    res= mysql_multi_update_prepare(session);
1461
1434
 
1462
 
    /* Check slave filtering rules */
1463
 
    if (unlikely(session->slave_thread))
1464
 
    {
1465
 
      if (all_tables_not_ok(session, all_tables))
1466
 
      {
1467
 
        if (res!= 0)
1468
 
        {
1469
 
          res= 0;             /* don't care of prev failure  */
1470
 
          session->clear_error(); /* filters are of highest prior */
1471
 
        }
1472
 
        /* we warn the slave SQL thread */
1473
 
        my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
1474
 
        break;
1475
 
      }
1476
 
      if (res)
1477
 
        break;
1478
 
    }
1479
 
    else
1480
1435
    {
1481
1436
      if (res)
1482
1437
        break;
1677
1632
    }
1678
1633
    else
1679
1634
    {
1680
 
      /*
1681
 
        If this is a slave thread, we may sometimes execute some
1682
 
        DROP / * 40005 TEMPORARY * / TABLE
1683
 
        that come from parts of binlogs (likely if we use RESET SLAVE or CHANGE
1684
 
        MASTER TO), while the temporary table has already been dropped.
1685
 
        To not generate such irrelevant "table does not exist errors",
1686
 
        we silently add IF EXISTS if TEMPORARY was used.
1687
 
      */
1688
 
      if (session->slave_thread)
1689
 
        lex->drop_if_exists= 1;
1690
 
 
1691
1635
      /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
1692
1636
      session->options|= OPTION_KEEP_LOG;
1693
1637
    }
2013
1957
        res= true; // cannot happen
2014
1958
      else
2015
1959
      {
2016
 
        if (((session->options & OPTION_KEEP_LOG) ||
2017
 
             session->transaction.all.modified_non_trans_table) &&
2018
 
            !session->slave_thread)
 
1960
        if ((session->options & OPTION_KEEP_LOG) || session->transaction.all.modified_non_trans_table)
2019
1961
          push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2020
1962
                       ER_WARNING_NOT_COMPLETE_ROLLBACK,
2021
1963
                       ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));