~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.cc

  • Committer: Brian Aker
  • Date: 2008-11-25 15:24:22 UTC
  • Revision ID: brian@tangent.org-20081125152422-6hchtchktzd2lnjf
Remove filtering (wrong layer, belongs in plugin).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <drizzled/log_event.h>
22
22
#include <drizzled/replication/rli.h>
23
23
#include <drizzled/replication/mi.h>
24
 
#include <drizzled/replication/filter.h>
 
24
#include <libdrizzle/libdrizzle.h>
 
25
#include <mysys/hash.h>
25
26
#include <drizzled/replication/utility.h>
26
27
#include <drizzled/replication/record.h>
27
28
#include <mysys/my_dir.h>
1498
1499
int Query_log_event::do_apply_event(Relay_log_info const *rli,
1499
1500
                                      const char *query_arg, uint32_t q_len_arg)
1500
1501
{
1501
 
  LEX_STRING new_db;
1502
1502
  int expected_error,actual_error= 0;
1503
1503
  Query_id &query_id= Query_id::get_query_id();
1504
1504
  /*
1509
1509
    you.
1510
1510
  */
1511
1511
  session->catalog= catalog_len ? (char *) catalog : (char *)"";
1512
 
  new_db.length= db_len;
1513
 
  new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
1514
 
  session->set_db(new_db.str, new_db.length);       /* allocates a copy of 'db' */
 
1512
  session->set_db(db, strlen(db));       /* allocates a copy of 'db' */
1515
1513
  session->variables.auto_increment_increment= auto_increment_increment;
1516
1514
  session->variables.auto_increment_offset=    auto_increment_offset;
1517
1515
 
1540
1538
            ::do_apply_event(), then the companion SET also have so
1541
1539
            we don't need to reset_one_shot_variables().
1542
1540
  */
1543
 
  if (rpl_filter->db_ok(session->db))
 
1541
  if (1)
1544
1542
  {
1545
1543
    session->set_time((time_t)when);
1546
1544
    session->query_length= q_len_arg;
2640
2638
int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
2641
2639
                                   bool use_rli_only_for_errors)
2642
2640
{
2643
 
  LEX_STRING new_db;
2644
2641
  Query_id &query_id= Query_id::get_query_id();
2645
 
  new_db.length= db_len;
2646
 
  new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
2647
 
  session->set_db(new_db.str, new_db.length);
 
2642
  session->set_db(db, strlen(db));
2648
2643
  assert(session->query == 0);
2649
2644
  session->query_length= 0;                         // Should not be needed
2650
2645
  session->is_slave_error= 0;
2691
2686
            ::do_apply_event(), then the companion SET also have so
2692
2687
            we don't need to reset_one_shot_variables().
2693
2688
  */
2694
 
  if (rpl_filter->db_ok(session->db))
 
2689
  if (1)
2695
2690
  {
2696
2691
    session->set_time((time_t)when);
2697
2692
    session->query_id = query_id.next();
2711
2706
    tables.updating= 1;
2712
2707
 
2713
2708
    // the table will be opened in mysql_load    
2714
 
    if (rpl_filter->is_on() && !rpl_filter->tables_ok(session->db, &tables))
2715
 
    {
2716
 
      // TODO: this is a bug - this needs to be moved to the I/O thread
2717
 
      if (net)
2718
 
        skip_load_data_infile(net);
2719
 
    }
2720
 
    else
2721
2709
    {
2722
2710
      char llbuff[22];
2723
2711
      char *end;
2746
2734
 
2747
2735
      if (sql_ex.opt_flags & REPLACE_FLAG)
2748
2736
      {
2749
 
        handle_dup= DUP_REPLACE;
 
2737
        handle_dup= DUP_REPLACE;
2750
2738
      }
2751
2739
      else if (sql_ex.opt_flags & IGNORE_FLAG)
2752
2740
      {
2756
2744
      else
2757
2745
      {
2758
2746
        /*
2759
 
          When replication is running fine, if it was DUP_ERROR on the
 
2747
          When replication is running fine, if it was DUP_ERROR on the
2760
2748
          master then we could choose IGNORE here, because if DUP_ERROR
2761
2749
          suceeded on master, and data is identical on the master and slave,
2762
2750
          then there should be no uniqueness errors on slave, so IGNORE is
2763
2751
          the same as DUP_ERROR. But in the unlikely case of uniqueness errors
2764
2752
          (because the data on the master and slave happen to be different
2765
 
          (user error or bug), we want LOAD DATA to print an error message on
2766
 
          the slave to discover the problem.
 
2753
          (user error or bug), we want LOAD DATA to print an error message on
 
2754
          the slave to discover the problem.
2767
2755
 
2768
2756
          If reading from net (a 3.23 master), mysql_load() will change this
2769
2757
          to IGNORE.
2795
2783
 
2796
2784
      ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
2797
2785
      if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
2798
 
        ex.field_term->length(0);
 
2786
        ex.field_term->length(0);
2799
2787
 
2800
2788
      ex.skip_lines = skip_lines;
2801
2789
      List<Item> field_list;
2804
2792
      session->variables.pseudo_thread_id= thread_id;
2805
2793
      if (net)
2806
2794
      {
2807
 
        // mysql_load will use session->net to read the file
2808
 
        session->net.vio = net->vio;
2809
 
        /*
2810
 
          Make sure the client does not get confused about the packet sequence
2811
 
        */
2812
 
        session->net.pkt_nr = net->pkt_nr;
 
2795
        // mysql_load will use session->net to read the file
 
2796
        session->net.vio = net->vio;
 
2797
        /*
 
2798
          Make sure the client does not get confused about the packet sequence
 
2799
        */
 
2800
        session->net.pkt_nr = net->pkt_nr;
2813
2801
      }
2814
2802
      /*
2815
2803
        It is safe to use tmp_list twice because we are not going to
2821
2809
        session->is_slave_error= 1;
2822
2810
      if (session->cuted_fields)
2823
2811
      {
2824
 
        /* log_pos is the position of the LOAD event in the master log */
 
2812
        /* log_pos is the position of the LOAD event in the master log */
2825
2813
        sql_print_warning(_("Slave: load data infile on table '%s' at "
2826
 
                          "log position %s in log '%s' produced %ld "
2827
 
                          "warning(s). Default database: '%s'"),
 
2814
                            "log position %s in log '%s' produced %ld "
 
2815
                            "warning(s). Default database: '%s'"),
2828
2816
                          (char*) table_name,
2829
2817
                          llstr(log_pos,llbuff), RPL_LOG_NAME, 
2830
2818
                          (ulong) session->cuted_fields,
5083
5071
  RPL_TableList *table_list;
5084
5072
  char *db_mem, *tname_mem;
5085
5073
  Query_id &query_id= Query_id::get_query_id();
5086
 
  size_t dummy_len;
5087
5074
  void *memory;
5088
5075
  assert(rli->sql_session == session);
5089
5076
 
5104
5091
  table_list->next_global= table_list->next_local= 0;
5105
5092
  table_list->table_id= m_table_id;
5106
5093
  table_list->updating= 1;
5107
 
  my_stpcpy(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
 
5094
  my_stpcpy(table_list->db, m_dbnam);
5108
5095
  my_stpcpy(table_list->table_name, m_tblnam);
5109
5096
 
5110
5097
  int error= 0;
5111
5098
 
5112
 
  if (!rpl_filter->db_ok(table_list->db) ||
5113
 
      (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))
5114
 
  {
5115
 
    free(memory);
5116
 
  }
5117
 
  else
5118
5099
  {
5119
5100
    /*
5120
5101
      open_tables() reads the contents of session->lex, so they must be