Commit c361f3c6 authored by unknown's avatar unknown
Browse files

Merge dator5.(none):/home/pappa/clean-mysql-5.1

into  dator5.(none):/home/pappa/bug17138


mysql-test/t/partition.test:
  Auto merged
sql/handler.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents 9f8c532f 7ac2e509
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1199,4 +1199,27 @@ alter table t1 drop partition p2;
use test;
drop database db99;

#
#BUG 17138 Problem with stored procedure and analyze partition
#
create table t1 (a int)
partition by list (a)
(partition p0 values in (0));

insert into t1 values (0);
delimiter //;

create procedure po ()
begin
  begin
    declare continue handler for sqlexception begin end;
    update ignore t1 set a = 1 where a = 0;
  end;
  prepare stmt1 from 'alter table t1';
  execute stmt1;
end//

call po()//
delimiter ;//
drop table t1;
--echo End of 5.1 tests
+8 −0
Original line number Diff line number Diff line
@@ -654,6 +654,14 @@ class ha_ndbcluster: public handler
  int get_default_no_partitions(ulonglong max_rows);
  bool get_no_parts(const char *name, uint *no_parts);
  void set_auto_partitions(partition_info *part_info);
  virtual bool cannot_ignore_error(int error, uint flags)
  {
    if (!handler::cannot_ignore_error(error, flags))
      return FALSE;
    if (error == HA_ERR_NO_PARTITION_FOUND)
      return FALSE;
    return TRUE;
  }

  THR_LOCK_DATA **store_lock(THD *thd,
                             THR_LOCK_DATA **to,
+8 −0
Original line number Diff line number Diff line
@@ -302,6 +302,14 @@ class ha_partition :public handler
  virtual void start_bulk_insert(ha_rows rows);
  virtual int end_bulk_insert();

  virtual bool cannot_ignore_error(int error, uint flags)
  {
    if (!handler::cannot_ignore_error(error, flags))
      return FALSE;
    if (error == HA_ERR_NO_PARTITION_FOUND)
      return FALSE;
    return TRUE;
  }
  /*
    -------------------------------------------------------------------------
    MODULE full table scan
+23 −2
Original line number Diff line number Diff line
@@ -971,6 +971,27 @@ class handler :public Sql_alloc
  { return (ha_table_flags() & HA_NO_TRANSACTIONS) == 0; }
  virtual uint extra_rec_buf_length() const { return 0; }

  /*
    This method is used to analyse the error to see whether the error
    is ignorable or not, certain handlers can have more error that are
    ignorable than others. E.g. the partition handler can get inserts
    into a range where there is no partition and this is an ignorable
    error.
  */
#define HA_CHECK_DUPP_KEY 1
#define HA_CHECK_DUPP_UNIQUE 2
#define HA_CHECK_DUPP (HA_CHECK_DUPP_KEY + HA_CHECK_DUPP_UNIQUE)
  virtual bool cannot_ignore_error(int error, uint flags)
  {
    if (!error ||
        ((flags & HA_CHECK_DUPP_KEY) &&
         error == HA_ERR_FOUND_DUPP_KEY) ||
         ((flags & HA_CHECK_DUPP_UNIQUE) &&
          error == HA_ERR_FOUND_DUPP_UNIQUE))
      return FALSE;
    return TRUE;
  }

  /*
    Number of rows in table. It will only be called if
    (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0
+4 −5
Original line number Diff line number Diff line
@@ -2049,8 +2049,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
  }
  else if ((error=table->file->ha_write_row(table->record[0]))) // insert
  {						// This should never happen
    if (error && error != HA_ERR_FOUND_DUPP_KEY &&
	error != HA_ERR_FOUND_DUPP_UNIQUE)	/* purecov: inspected */
    if (table->file->cannot_ignore_error(error, HA_CHECK_DUPP))
    {
      table->file->print_error(error,MYF(0));	/* purecov: deadcode */
      error= -1;				/* purecov: deadcode */
@@ -2172,7 +2171,7 @@ static int replace_db_table(TABLE *table, const char *db,
  }
  else if (rights && (error= table->file->ha_write_row(table->record[0])))
  {
    if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
    if (table->file->cannot_ignore_error(error, HA_CHECK_DUPP_KEY))
      goto table_error; /* purecov: deadcode */
  }

@@ -2744,7 +2743,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
  else
  {
    error=table->file->ha_write_row(table->record[0]);
    if (error && error != HA_ERR_FOUND_DUPP_KEY)
    if (table->file->cannot_ignore_error(error, HA_CHECK_DUPP_KEY))
      goto table_error;				/* purecov: deadcode */
  }

@@ -2862,7 +2861,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
  else
  {
    error=table->file->ha_write_row(table->record[0]);
    if (error && error != HA_ERR_FOUND_DUPP_KEY)
    if (table->file->cannot_ignore_error(error, HA_CHECK_DUPP_KEY))
      goto table_error;
  }

Loading