Commit c4066b91 authored by unknown's avatar unknown
Browse files

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new

parents 9d5fc2b2 6afa409b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -367,8 +367,11 @@ enum ha_base_keytype {
                                          given value */
#define HA_ERR_RBR_LOGGING_FAILED 161  /* Row-based binlogging of row failed */
#define HA_ERR_DROP_INDEX_FK      162  /* Index needed in foreign key constr. */
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints
                                            would lead to a duplicate key
                                            error in some other table. */

#define HA_ERR_LAST               162  /* Copy last error no */
#define HA_ERR_LAST               163  /* Copy last error no */

/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS            (HA_ERR_LAST - HA_ERR_FIRST + 1)
+18 −0
Original line number Diff line number Diff line
@@ -2758,3 +2758,21 @@ e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
End of 5.0 tests
CREATE TABLE t1 (
field1 varchar(8) NOT NULL DEFAULT '',
field2 varchar(8) NOT NULL DEFAULT '',
PRIMARY KEY  (field1, field2)
) ENGINE=InnoDB;
CREATE TABLE t2 (
field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
FOREIGN KEY (field1) REFERENCES t1 (field1)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('old', 'somevalu');
INSERT INTO t1 VALUES ('other', 'anyvalue');
INSERT INTO t2 VALUES ('old');
INSERT INTO t2 VALUES ('other');
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
DROP TABLE t2;
DROP TABLE t1;
+29 −0
Original line number Diff line number Diff line
@@ -1715,3 +1715,32 @@ create table t1 (a varchar(255) character set utf8,
                 key (a,b,c,d,e)) engine=innodb;

--echo End of 5.0 tests

#
# Test that cascading updates leading to duplicate keys give the correct
# error message (bug #9680)
#

CREATE TABLE t1 (
  field1 varchar(8) NOT NULL DEFAULT '',
  field2 varchar(8) NOT NULL DEFAULT '',
  PRIMARY KEY  (field1, field2)
) ENGINE=InnoDB;

CREATE TABLE t2 (
  field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
  FOREIGN KEY (field1) REFERENCES t1 (field1)
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;

INSERT INTO t1 VALUES ('old', 'somevalu');
INSERT INTO t1 VALUES ('other', 'anyvalue');

INSERT INTO t2 VALUES ('old');
INSERT INTO t2 VALUES ('other');

--error ER_FOREIGN_DUPLICATE_KEY
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';

DROP TABLE t2;
DROP TABLE t1;
+4 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@

extern  ulong thread_created;
extern const char *my_localhost;
extern pthread_attr_t connection_attrib;

pthread_mutex_t LOCK_event_arrays,
                LOCK_workers_count,
@@ -41,7 +42,7 @@ bool evex_is_running= false;

ulonglong evex_main_thread_id= 0;
ulong opt_event_executor;
volatile my_bool event_executor_running_global_var;
my_bool event_executor_running_global_var;
static my_bool evex_mutexes_initted= false;
static uint workers_count;

@@ -102,7 +103,7 @@ init_events()
  {
#ifndef DBUG_FAULTY_THR
    //TODO Andrey: Change the error code returned!
    if (pthread_create(&th, NULL, event_executor_main, (void*)NULL))
    if (pthread_create(&th, &connection_attrib, event_executor_main,(void*)NULL))
      DBUG_RETURN(ER_SLAVE_THREAD);
#else
    event_executor_main(NULL);
@@ -351,7 +352,7 @@ event_executor_main(void *arg)
      ++iter_num;
      DBUG_PRINT("info", ("  Spawning a thread %d", iter_num));
#ifndef DBUG_FAULTY_THR
      if (pthread_create(&th, NULL, event_executor_worker, (void*)et))
      if (pthread_create(&th,&connection_attrib,event_executor_worker,(void*)et))
      {
        sql_print_error("Problem while trying to create a thread");
        UNLOCK_MUTEX_AND_BAIL_OUT(LOCK_event_arrays, err);
+4 −0
Original line number Diff line number Diff line
@@ -465,6 +465,10 @@ convert_error_code_to_mysql(

    		return(HA_ERR_FOUND_DUPP_KEY);

  	} else if (error == (int) DB_FOREIGN_DUPLICATE_KEY) {

		return(HA_ERR_FOREIGN_DUPLICATE_KEY);

 	} else if (error == (int) DB_RECORD_NOT_FOUND) {

    		return(HA_ERR_NO_ACTIVE_RECORD);
Loading