~ubuntu-branches/ubuntu/maverick/mysql-dfsg-5.1/maverick

« back to all changes in this revision

Viewing changes to sql/log_event.cc

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-05-18 22:22:44 UTC
  • mfrom: (1.1.5 upstream) (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100518222244-xqu0aw6arb8x7uqs
Tags: 5.1.43-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/control:
    + Don't provide a libmysqlclient15-dev package as long as there
      are packages still build-depending on libmysqlclient15-dev and
      mysql-dfsg-5.0 is in the archive.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in a
      full MTA on all installs of mysql-server (LP: #259477)
    + Make mysql-server-5.1 depend on mysql-server-core-5.1. (LP: #509667)
  - debian/rules:
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    + debian/apparmor-profile: apparmor profile
    + debian/rules, debian/mysql-server-5.1.files: install apparmor profile.
    + debian/mysql-server-5.1.dirs: add etc/apparmor.d/fore-complain
    + debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on purge.
    + debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    + debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    + debian/mysql-server-5.1.postinst: reload apparmor profiles
  - debian/additions/my.cfn: remove language options. Error message files are
    located in a different direction in Mysql 5.0. Setting the language option
    to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1 use a
    default value that works. (LP: #316974)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - debian/libmysqlclient16.symbols.amd64: remove amd64 symbols as it has
    not been correctly generated in Debian.
  - Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  - debian/addtions/my.cnf:
    + drop old_password option.
    + fix commentened logging options to use general_log and general_log_file.
  - Don't upgrade if there is an ndb management node configured (LP: #413792)
  - Set thread stack size to 192K rather than 128K. 128K is only useful on
    systems with < 64M RAM and causes stack overrides with some SQL commands.
    See http://dev.mysql.com/doc/refman/5.1/en/server-system-varriables.html
    for more details. (LP: #426919)
  - Convert to upstart:
    + Add mysql-server-5.1.mysql.upstart
    + Dropped debian/mysql-server-5.1.mysql.init,
      debian/additions/mysqld_safe_syslog.cnf
    + debian/additions/my.cnf:
      * Removed pid declaration
      * Set up error logging to /var/log/mysql since we're not piping anything
        around logger anymore.
    + Remove references to mysqld_safe in these files:
      * debian/rules, mysql-server-5.1.logcheck.ignore.paranoid
        mysql-server-5.1.logcheck.ignore.workstation,
        mysql-server-5.1.logcheck.ignore.server
    + debian/mysql-server-5.1.postinst:
      * Replace calls to /etc/init.d with regular upstart calls
      * Remove reference to mysqld_safe
    + Dropped debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch
    + Load apparmor when loading upstart.
   - debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
     running logrotate. (LP: #513135)
   - Make the testsuite installable. (LP: #530752)
   - debian/control: Use database for the package section (LP: #498939).
   - debian/mysql-server-5.1.templates: fix MySQL Cluster package name to
   - Move mysql_install_db and required .sql files from the server package to the 
     server-core package.
   - Dropped:
     + debian/patches/90_mysql_safer_strmov: Merged upstream.
     + debian/patches/52_CVE-2009-4030.dpatch: Merged usptream.
     + debian/patches/53_CVE-2009-4484.dpatch: Merged upstream.
     + debian/patches/54_CVE-2008-7247.dpatch: Merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2138
2138
/**
2139
2139
  Utility function for the next method (Query_log_event::write()) .
2140
2140
*/
2141
 
static void write_str_with_code_and_len(char **dst, const char *src,
2142
 
                                        int len, uint code)
 
2141
static void write_str_with_code_and_len(uchar **dst, const char *src,
 
2142
                                        uint len, uint code)
2143
2143
{
2144
2144
  /*
2145
2145
    only 1 byte to store the length of catalog, so it should not
2234
2234
  }
2235
2235
  if (catalog_len) // i.e. this var is inited (false for 4.0 events)
2236
2236
  {
2237
 
    write_str_with_code_and_len((char **)(&start),
 
2237
    write_str_with_code_and_len(&start,
2238
2238
                                catalog, catalog_len, Q_CATALOG_NZ_CODE);
2239
2239
    /*
2240
2240
      In 5.0.x where x<4 masters we used to store the end zero here. This was
2272
2272
  {
2273
2273
    /* In the TZ sys table, column Name is of length 64 so this should be ok */
2274
2274
    DBUG_ASSERT(time_zone_len <= MAX_TIME_ZONE_NAME_LENGTH);
2275
 
    write_str_with_code_and_len((char **)(&start),
 
2275
    write_str_with_code_and_len(&start,
2276
2276
                                time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
2277
2277
  }
2278
2278
  if (lc_time_names_number)
3171
3171
 
3172
3172
compare_errors:
3173
3173
 
3174
 
     /*
 
3174
    /*
 
3175
      In the slave thread, we may sometimes execute some DROP / * 40005
 
3176
      TEMPORARY * / TABLE that come from parts of binlogs (likely if we
 
3177
      use RESET SLAVE or CHANGE MASTER TO), while the temporary table
 
3178
      has already been dropped. To ignore such irrelevant "table does
 
3179
      not exist errors", we silently clear the error if TEMPORARY was used.
 
3180
    */
 
3181
    if (thd->lex->sql_command == SQLCOM_DROP_TABLE && thd->lex->drop_temporary &&
 
3182
        thd->is_error() && thd->main_da.sql_errno() == ER_BAD_TABLE_ERROR &&
 
3183
        !expected_error)
 
3184
      thd->main_da.reset_diagnostics_area();
 
3185
    /*
3175
3186
      If we expected a non-zero error code, and we don't get the same error
3176
3187
      code, and it should be ignored or is related to a concurrency issue.
3177
3188
    */
4006
4017
  return
4007
4018
    5 + db_len + 3 +                        // "use DB; "
4008
4019
    18 + fname_len + 2 +                    // "LOAD DATA INFILE 'file''"
 
4020
    11 +                                    // "CONCURRENT "
4009
4021
    7 +                                     // LOCAL
4010
4022
    9 +                                     // " REPLACE or IGNORE "
4011
4023
    13 + table_name_len*2 +                 // "INTO TABLE `table`"
4033
4045
 
4034
4046
  pos= strmov(pos, "LOAD DATA ");
4035
4047
 
 
4048
  if (thd->lex->lock_option == TL_WRITE_CONCURRENT_INSERT)
 
4049
    pos= strmov(pos, "CONCURRENT ");
 
4050
 
4036
4051
  if (fn_start)
4037
4052
    *fn_start= pos;
4038
4053
 
4510
4525
    as the present method does not call mysql_parse().
4511
4526
  */
4512
4527
  lex_start(thd);
 
4528
  thd->lex->local_file= local_fname;
4513
4529
  mysql_reset_thd_for_next_command(thd);
4514
4530
 
4515
4531
  if (!use_rli_only_for_errors)
8450
8466
  auto_afree_ptr<char> key(NULL);
8451
8467
 
8452
8468
  /* fill table->record[0] with default values */
8453
 
 
 
8469
  bool abort_on_warnings= (rli->sql_thd->variables.sql_mode &
 
8470
                           (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
8454
8471
  if ((error= prepare_record(table, m_width,
8455
 
                             TRUE /* check if columns have def. values */)))
 
8472
                             table->file->ht->db_type != DB_TYPE_NDBCLUSTER,
 
8473
                             abort_on_warnings, m_curr_row == m_rows_buf)))
8456
8474
    DBUG_RETURN(error);
8457
8475
  
8458
8476
  /* unpack row into table->record[0] */
8459
 
  error= unpack_current_row(rli); // TODO: how to handle errors?
 
8477
  if ((error= unpack_current_row(rli, abort_on_warnings)))
 
8478
    DBUG_RETURN(error);
 
8479
 
8460
8480
  if (m_curr_row == m_rows_buf)
8461
8481
  {
8462
8482
    /* this is the first row to be inserted, we estimate the rows with
9253
9273
 
9254
9274
  store_record(m_table,record[1]);
9255
9275
 
 
9276
  bool abort_on_warnings= (rli->sql_thd->variables.sql_mode &
 
9277
                           (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
9256
9278
  m_curr_row= m_curr_row_end;
9257
 
  error= unpack_current_row(rli); // this also updates m_curr_row_end
 
9279
  /* this also updates m_curr_row_end */
 
9280
  if ((error= unpack_current_row(rli, abort_on_warnings)))
 
9281
    return error;
9258
9282
 
9259
9283
  /*
9260
9284
    Now we have the right row to update.  The old row (the one we're