From 15735b241f204f1e6b6a31a232ab1e270bcc333c Mon Sep 17 00:00:00 2001 From: "brian@avenger.(none)" <> Date: Mon, 29 Nov 2004 01:40:25 -0800 Subject: [PATCH 1/8] Adding support for archive to handle delayed inserts. --- sql/examples/ha_archive.cc | 22 ++++++++++++++++++---- sql/examples/ha_archive.h | 14 ++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index ea8b3694109..b03e655fef7 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -305,6 +305,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table) share->use_count= 0; share->table_name_length= length; share->table_name= tmp_name; + share->delayed= FALSE; fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME); fn_format(meta_file_name,table_name,"",ARM,MY_REPLACE_EXT|MY_UNPACK_FILENAME); strmov(share->table_name,table_name); @@ -536,7 +537,11 @@ int ha_archive::write_row(byte * buf) pthread_mutex_lock(&share->mutex); written= gzwrite(share->archive_write, buf, table->reclength); DBUG_PRINT("ha_archive::get_row", ("Wrote %d bytes expected %d", written, table->reclength)); - share->dirty= TRUE; + if (!delayed_insert) + share->dirty= TRUE; + else + share->delayed= TRUE; + if (written != table->reclength) goto error; /* @@ -594,6 +599,7 @@ int ha_archive::rnd_init(bool scan) { gzflush(share->archive_write, Z_SYNC_FLUSH); share->dirty= FALSE; + share->delayed= FALSE; } pthread_mutex_unlock(&share->mutex); } @@ -628,9 +634,12 @@ int ha_archive::get_row(gzFile file_to_read, byte *buf) if (read == 0) DBUG_RETURN(HA_ERR_END_OF_FILE); - /* If the record is the wrong size, the file is probably damaged */ + /* If the record is the wrong size, the file is probably damaged, unless + we are dealing with a delayed insert. In that case we can assume the file is ok, + but our row count doesn't match our data since the file has not been flushed. + */ if ((ulong) read != table->reclength) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(share->delayed ? HA_ERR_END_OF_FILE : HA_ERR_CRASHED_ON_USAGE); /* Calculate blob length, we use this for our buffer */ for (field=table->blob_field; *field ; field++) @@ -648,7 +657,7 @@ int ha_archive::get_row(gzFile file_to_read, byte *buf) { read= gzread(file_to_read, last, size); if ((size_t) read != size) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(share->delayed ? HA_ERR_END_OF_FILE : HA_ERR_CRASHED_ON_USAGE); (*field)->set_ptr(size, last); last += size; } @@ -839,6 +848,11 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) { + if (lock_type == TL_WRITE_DELAYED) + delayed_insert= TRUE; + else + delayed_insert= FALSE; + if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) { /* diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index eb78b28034c..a3f2327b4a7 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -32,10 +32,11 @@ typedef struct st_archive_share { uint table_name_length,use_count; pthread_mutex_t mutex; THR_LOCK lock; - File meta_file; /* Meta file we use */ - gzFile archive_write; /* Archive file we are working with */ - bool dirty; /* Flag for if a flush should occur */ - ulonglong rows_recorded; /* Number of rows in tables */ + File meta_file; /* Meta file we use */ + gzFile archive_write; /* Archive file we are working with */ + bool dirty; /* Flag for if a flush should occur */ + ulonglong rows_recorded; /* Number of rows in tables */ + bool delayed; /* If a delayed insert has happened since opena */ } ARCHIVE_SHARE; /* @@ -53,9 +54,10 @@ class ha_archive: public handler byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ String buffer; /* Buffer used for blob storage */ ulonglong scan_rows; /* Number of rows left in scan */ + bool delayed_insert; /* If the insert is delayed */ public: - ha_archive(TABLE *table): handler(table) + ha_archive(TABLE *table): handler(table), delayed_insert(0) { /* Set our original buffer from pre-allocated memory */ buffer.set(byte_buffer, IO_SIZE, system_charset_info); @@ -72,7 +74,7 @@ public: ulong table_flags() const { return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_NO_AUTO_INCREMENT | - HA_FILE_BASED); + HA_FILE_BASED | HA_CAN_INSERT_DELAYED); } ulong index_flags(uint idx, uint part, bool all_parts) const { From 07417cd309a67ad157e3154cd5c7c02a01833b1b Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 29 Nov 2004 15:36:43 +0000 Subject: [PATCH 2/8] NdbScanOperation.cpp: added missing return --- ndb/src/ndbapi/NdbScanOperation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index 7acc64093e8..f4973b2e66f 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -1648,4 +1648,5 @@ NdbIndexScanOperation::set_new_bound() m_first_bound_word = theKEYINFOptr + theTotalNrOfKeyWordInSignal;; m_this_bound_start = theTupKeyLen; + return 0; } From 57b30a1eef38d247179f8632f3f3ba7390afff9d Mon Sep 17 00:00:00 2001 From: "jani@a193-229-222-105.elisa-laajakaista.fi" <> Date: Mon, 29 Nov 2004 18:32:52 +0200 Subject: [PATCH 3/8] Applied some patches for Netware. --- client/mysqladmin.cc | 9 +++++++++ netware/comp_err.def | 2 +- netware/isamchk.def | 2 +- netware/isamlog.def | 2 +- netware/libmysql.def | 2 +- netware/my_print_defaults.def | 2 +- netware/myisam_ftdump.def | 2 +- netware/myisamchk.def | 2 +- netware/myisamlog.def | 2 +- netware/myisampack.def | 2 +- netware/mysql.def | 2 +- netware/mysql_install.def | 2 +- netware/mysql_install_db.def | 2 +- netware/mysql_test_run.def | 2 +- netware/mysql_waitpid.def | 2 +- netware/mysqladmin.def | 2 +- netware/mysqlbinlog.def | 2 +- netware/mysqlcheck.def | 2 +- netware/mysqld.def | 2 +- netware/mysqld_safe.def | 2 +- netware/mysqldump.def | 2 +- netware/mysqlimport.def | 2 +- netware/mysqlshow.def | 2 +- netware/mysqltest.def | 2 +- netware/pack_isam.def | 2 +- netware/perror.def | 2 +- netware/replace.def | 2 +- netware/resolve_stack_dump.def | 2 +- netware/resolveip.def | 2 +- sql/mysqld.cc | 8 ++++++-- 30 files changed, 43 insertions(+), 30 deletions(-) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 8491d0df7b5..fe450868342 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -125,6 +125,10 @@ static TYPELIB command_typelib= static struct my_option my_long_options[] = { +#ifdef __NETWARE__ + {"autoclose", 'a', " Auto close the screen on exit for NetWare", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"count", 'c', "Number of iterations to make. This works with -i (--sleep) only.", (gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT, @@ -218,6 +222,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int error = 0; switch(optid) { +#ifdef __NETWARE__ + case 'a': + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen / + break; +#endif case 'c': opt_count_iterations= 1; break; diff --git a/netware/comp_err.def b/netware/comp_err.def index d694c07174a..f27b40c7b78 100644 --- a/netware/comp_err.def +++ b/netware/comp_err.def @@ -2,7 +2,7 @@ # MySQL Error File Compiler #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Error File Compiler" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/isamchk.def b/netware/isamchk.def index 69e8ac0405b..31cf3fc569a 100644 --- a/netware/isamchk.def +++ b/netware/isamchk.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL ISAM Table Check Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL ISAM Table Check Tool" VERSION 4, 0 STACKSIZE 65536 diff --git a/netware/isamlog.def b/netware/isamlog.def index bb8312066ef..52f9de0d928 100644 --- a/netware/isamlog.def +++ b/netware/isamlog.def @@ -2,7 +2,7 @@ # ISAM Log #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL ISAM Table Log Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/libmysql.def b/netware/libmysql.def index 7804c4468a5..fea117dedd1 100644 --- a/netware/libmysql.def +++ b/netware/libmysql.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm EXPORT @libmysql.imp -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Client Library" VERSION 4, 0 AUTOUNLOAD diff --git a/netware/my_print_defaults.def b/netware/my_print_defaults.def index 49f167341ae..826981256b5 100644 --- a/netware/my_print_defaults.def +++ b/netware/my_print_defaults.def @@ -2,7 +2,7 @@ # My Print Defaults #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Print Defaults Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/myisam_ftdump.def b/netware/myisam_ftdump.def index 259d6617445..9639404b53b 100644 --- a/netware/myisam_ftdump.def +++ b/netware/myisam_ftdump.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL MyISAM Table Dump Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL MyISAM Table Dump Tool" VERSION 4, 0 STACKSIZE 65536 diff --git a/netware/myisamchk.def b/netware/myisamchk.def index cdfe186058f..eaa01730872 100644 --- a/netware/myisamchk.def +++ b/netware/myisamchk.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL MyISAM Table Check Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL MyISAM Table Check Tool" VERSION 4, 0 STACKSIZE 65536 diff --git a/netware/myisamlog.def b/netware/myisamlog.def index 5c4cbb23361..3580c870c10 100644 --- a/netware/myisamlog.def +++ b/netware/myisamlog.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL MyISAM Table Log Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL MyISAM Table Log Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/myisampack.def b/netware/myisampack.def index 9111538c2c0..a6946982236 100644 --- a/netware/myisampack.def +++ b/netware/myisampack.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL MyISAM Table Pack Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL MyISAM Table Pack Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysql.def b/netware/mysql.def index 9b4424ed4fb..5ae8dc102a0 100644 --- a/netware/mysql.def +++ b/netware/mysql.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Monitor" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Monitor" VERSION 4, 0 MULTIPLE diff --git a/netware/mysql_install.def b/netware/mysql_install.def index 87fc76919f9..3392afb7298 100644 --- a/netware/mysql_install.def +++ b/netware/mysql_install.def @@ -2,7 +2,7 @@ # My Print Defaults #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Install Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysql_install_db.def b/netware/mysql_install_db.def index 4653638b5ad..1657b7c17af 100644 --- a/netware/mysql_install_db.def +++ b/netware/mysql_install_db.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Install" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Initial Database Installer" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysql_test_run.def b/netware/mysql_test_run.def index b34f62a1f91..d4d4baee168 100644 --- a/netware/mysql_test_run.def +++ b/netware/mysql_test_run.def @@ -4,7 +4,7 @@ MODULE libc.nlm STACKSIZE 65536 SCREENNAME "MySQL Test Run" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Test Run" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysql_waitpid.def b/netware/mysql_waitpid.def index 4d56d29c42f..da0884ccba3 100644 --- a/netware/mysql_waitpid.def +++ b/netware/mysql_waitpid.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm #SCREENNAME "MySQL Tool - Wait for a Program to Terminate" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Tool - Wait for a Program to Terminate" VERSION 4, 0 STACKSIZE 65536 diff --git a/netware/mysqladmin.def b/netware/mysqladmin.def index 0ace36992b1..46f90d531fa 100644 --- a/netware/mysqladmin.def +++ b/netware/mysqladmin.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Admin" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Admin Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def index 89677b4a353..25a470e7353 100644 --- a/netware/mysqlbinlog.def +++ b/netware/mysqlbinlog.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Binary Log Dump Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Binary Log Dump Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def index 8820e9aae8e..7067b1d1729 100644 --- a/netware/mysqlcheck.def +++ b/netware/mysqlcheck.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Check Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Check Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqld.def b/netware/mysqld.def index 6856aefe56c..42c2d176a1b 100644 --- a/netware/mysqld.def +++ b/netware/mysqld.def @@ -2,7 +2,7 @@ # MySQL Server #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Database Server" VERSION 4, 0 MULTIPLE diff --git a/netware/mysqld_safe.def b/netware/mysqld_safe.def index 9080ef783c9..2a9ef04b47d 100644 --- a/netware/mysqld_safe.def +++ b/netware/mysqld_safe.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Database Server" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Database Server Monitor" VERSION 4, 0 MULTIPLE diff --git a/netware/mysqldump.def b/netware/mysqldump.def index 901c9b262dc..ddacf7bc0d5 100644 --- a/netware/mysqldump.def +++ b/netware/mysqldump.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Dump Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Dump Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def index d6f7fcb6bbd..5253da42567 100644 --- a/netware/mysqlimport.def +++ b/netware/mysqlimport.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Import" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Import Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqlshow.def b/netware/mysqlshow.def index 2b41386f643..0b61b81dcf9 100644 --- a/netware/mysqlshow.def +++ b/netware/mysqlshow.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm SCREENNAME "MySQL Show" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Show Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/mysqltest.def b/netware/mysqltest.def index d98f6436a4a..e134acede07 100644 --- a/netware/mysqltest.def +++ b/netware/mysqltest.def @@ -2,7 +2,7 @@ # MySQL Admin #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Test Case Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/pack_isam.def b/netware/pack_isam.def index f0f5a7e328a..b93cfdffbeb 100644 --- a/netware/pack_isam.def +++ b/netware/pack_isam.def @@ -2,7 +2,7 @@ # Pack ISAM #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL ISAM Table Pack Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/perror.def b/netware/perror.def index f1d23715f55..18c95d8b236 100644 --- a/netware/perror.def +++ b/netware/perror.def @@ -2,7 +2,7 @@ # PERROR #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Error Code Description Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/replace.def b/netware/replace.def index b55690152b9..19348ee4245 100644 --- a/netware/replace.def +++ b/netware/replace.def @@ -2,7 +2,7 @@ # Replace #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Text Replacement Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/netware/resolve_stack_dump.def b/netware/resolve_stack_dump.def index 21fd177fbc7..01042699d61 100644 --- a/netware/resolve_stack_dump.def +++ b/netware/resolve_stack_dump.def @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------ MODULE libc.nlm #SCREENNAME "MySQL Stack Dump Resolve Tool" -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL Stack Dump Resolve Tool" VERSION 4, 0 STACKSIZE 65536 diff --git a/netware/resolveip.def b/netware/resolveip.def index 10b99304e22..244f52bb969 100644 --- a/netware/resolveip.def +++ b/netware/resolveip.def @@ -2,7 +2,7 @@ # Resolve IP #------------------------------------------------------------------------------ MODULE libc.nlm -COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." +COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." DESCRIPTION "MySQL IP/Hostname Resolve Tool" VERSION 4, 0 XDCDATA ../netware/mysql.xdc diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5a97daa04ae..382042e2b42 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -149,6 +149,7 @@ static VolumeID_t datavolid; static event_handle_t eh; static Report_t ref; static void *refneb= NULL; +my_bool event_flag= FALSE; static int volumeid= -1; /* NEB event callback */ @@ -819,7 +820,8 @@ static void __cdecl kill_server(int sig_ptr) unireg_end(); #ifdef __NETWARE__ - pthread_join(select_thread, NULL); // wait for main thread + if(!event_flag) + pthread_join(select_thread, NULL); // wait for main thread #endif /* __NETWARE__ */ pthread_exit(0); /* purecov: deadcode */ @@ -1530,6 +1532,7 @@ static void check_data_home(const char *path) // down server event callback void mysql_down_server_cb(void *, void *) { + event_flag= TRUE; kill_server(0); } @@ -1563,7 +1566,7 @@ void mysql_cb_init() Register for volume deactivation event Wrap the callback function, as it is called by non-LibC thread */ - (void)NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb); + (void *) NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb); registerwithneb(); NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up @@ -1660,6 +1663,7 @@ ulong neb_event_callback(struct EventBlock *eblock) { consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n"); nw_panic = TRUE; + event_flag= TRUE; kill_server(0); } } From ee70c9a50176f5fab16e96b72dc634013ff2dbfc Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 29 Nov 2004 17:46:32 +0000 Subject: [PATCH 4/8] ndb_grant.later: Rename: mysql-test/t/ndb_grant.test -> mysql-test/t/ndb_grant.later --- mysql-test/t/{ndb_grant.test => ndb_grant.later} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mysql-test/t/{ndb_grant.test => ndb_grant.later} (100%) diff --git a/mysql-test/t/ndb_grant.test b/mysql-test/t/ndb_grant.later similarity index 100% rename from mysql-test/t/ndb_grant.test rename to mysql-test/t/ndb_grant.later From 57cd047ca3b105dcd1fb1a823118ffe806970276 Mon Sep 17 00:00:00 2001 From: "paul@kite-hub.kitebird.com" <> Date: Mon, 29 Nov 2004 13:26:12 -0600 Subject: [PATCH 5/8] monty.doc: Grammar fix. user.r: A few typo fixes. --- dbug/monty.doc | 2 +- dbug/user.r | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dbug/monty.doc b/dbug/monty.doc index 1c102e1c31e..bd4096951d2 100644 --- a/dbug/monty.doc +++ b/dbug/monty.doc @@ -15,6 +15,6 @@ All changes that I or other people at MySQL AB have done to all files in the dbug library (Mainly in dbug.c, dbug_analyze.c, dbug_long.h, dbug.h) are put in public domain, as the rest of the dbug.c library) -To my knowledge, all code in dbug library are in public domain. +To my knowledge, all code in dbug library is in public domain. Michael Widenius diff --git a/dbug/user.r b/dbug/user.r index f03f0675e0f..198f88cf272 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -377,7 +377,7 @@ The factorial function is then called three times, with the arguments Note that the DBUG_PRINT takes exactly .B two arguments, with the second argument (a format string and list -of printable values) enclosed in parenthesis. +of printable values) enclosed in parentheses. .P Debug control strings consist of a header, the "-#", followed by a colon separated list of debugger arguments. @@ -575,7 +575,7 @@ The second argument to a .B DBUG_PRINT macro is a standard printf style format string and one or more arguments to print, all -enclosed in parenthesis so that they collectively become a single macro +enclosed in parentheses so that they collectively become a single macro argument. This is how variable numbers of printf arguments are supported. Also note that no explicit newline is required at the end of the format string. @@ -807,7 +807,7 @@ and the corresponding argument list. Note that the format string and argument list are all one macro argument and .B must -be enclosed in parenthesis. +be enclosed in parentheses. .SP 1 EX:\ \fCDBUG_PRINT\ ("eof",\ ("end\ of\ file\ found"));\fR .br @@ -826,7 +826,7 @@ EX: \fCDBUG_DBUG\ ("net",\ packet,\ len);\fR .LI DBUG_SETJMP\ Used in place of the setjmp() function to first save the current debugger state and then execute the standard setjmp call. -This allows to the debugger to restore it's state when the +This allows to the debugger to restore its state when the DBUG_LONGJMP macro is used to invoke the standard longjmp() call. Currently all instances of DBUG_SETJMP must occur within the same function and at the same function nesting level. From ceb0d1cf87dabc135186c8947ba53e60175bfa9d Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Mon, 29 Nov 2004 22:47:50 +0100 Subject: [PATCH 6/8] compatibility fixes --- mysql-test/r/strict.result | 2 +- mysql-test/r/view.result | 8 ++++---- mysql-test/t/information_schema.test | 1 + mysql-test/t/ps_1general.test | 2 ++ mysql-test/t/view.test | 6 ++++-- sql/field.cc | 28 ++++++++++++++-------------- sql/item_cmpfunc.h | 2 +- sql/sql_select.cc | 15 +++++++++------ 8 files changed, 36 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index b7c5ac38b76..3d735be9423 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -616,7 +616,7 @@ col1 col2 -9223372036854775808 0 9223372036854775807 18446744073709551615 -9223372036854773760 0 --9223372036854775808 1844674407370953984 +9223372036854775807 1844674407370953984 -9223372036854775808 NULL -9223372036854775808 NULL NULL 18446744073709551615 diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index f4430ae1004..41de883a4d6 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -8,7 +8,7 @@ create temporary table t1 (a int, b int); create view v1 (c) as select b+1 from t1; ERROR HY000: View's SELECT contains a temporary table 't1' drop table t1; -create table t1 (a int, b int) max_rows=1000000; +create table t1 (a int, b int); insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10); create view v1 (c,d) as select a,b+@@global.max_user_connections from t1; ERROR HY000: View's SELECT contains a variable or parameter @@ -149,7 +149,7 @@ v5 VIEW v6 VIEW show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 9 Fixed 5 9 45 150994943 1024 0 NULL # # NULL latin1_swedish_ci NULL max_rows=1000000 +t1 MyISAM 9 Fixed 5 9 45 38654705663 1024 0 NULL # # NULL latin1_swedish_ci NULL v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view v3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view @@ -1213,14 +1213,14 @@ select * from v1; drop view v1; drop table t1; create function x1 () returns int return 5; -create table t1 (s1 int) max_rows=1000000; +create table t1 (s1 int); create view v1 as select x1() from t1; drop function x1; select * from v1; ERROR 42000: FUNCTION test.x1 does not exist show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 9 Fixed 0 0 0 83886079 1024 0 NULL # # NULL latin1_swedish_ci NULL max_rows=1000000 +t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL FUNCTION test.x1 does not exist drop view v1; drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 93e201c5121..1f44ad49812 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -41,6 +41,7 @@ show tables like 't%'; --replace_column 15 # 16 # show tables * from test where table_name like 't%'; --replace_column 12 # 13 # +--replace_result "2147483647 " "21474836479 " show table status; show full columns from t3 like "a%"; show full columns from mysql.db like "Insert%"; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 1c2bb9260cb..f9ac454c093 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -294,12 +294,14 @@ execute stmt4; prepare stmt4 from ' show table status from test like ''t2%'' '; # egalize date and time values --replace_column 12 # 13 # 14 # +--replace_result 2147483647 64424509439 # Bug#4288 : prepared statement 'show table status ..', wrong output on execute execute stmt4; # try the same with the big table prepare stmt4 from ' show table status from test like ''t9%'' '; # egalize date and time values --replace_column 12 # 13 # 14 # +--replace_result 2147483647 4294967295 # Bug#4288 execute stmt4; prepare stmt4 from ' show status like ''Threads_running'' '; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 5b2eeaca966..65f464fc77b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -19,7 +19,7 @@ create temporary table t1 (a int, b int); create view v1 (c) as select b+1 from t1; drop table t1; -create table t1 (a int, b int) max_rows=1000000; +create table t1 (a int, b int); insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10); # view with variable @@ -84,6 +84,7 @@ explain extended select c from v6; show tables; show full tables; --replace_column 12 # 13 # +--replace_result 2147483647 38654705663 show table status; drop view v1,v2,v3,v4,v5,v6; @@ -1165,12 +1166,13 @@ drop table t1; # VIEW over dropped function # create function x1 () returns int return 5; -create table t1 (s1 int) max_rows=1000000; +create table t1 (s1 int); create view v1 as select x1() from t1; drop function x1; -- error 1305 select * from v1; --replace_column 12 # 13 # +--replace_result "2147483647 " "21474836479 " show table status; drop view v1; drop table t1; diff --git a/sql/field.cc b/sql/field.cc index e8669dad406..e573f6528f4 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1182,7 +1182,7 @@ int Field_tiny::store(double nr) error= 1; } else - *ptr=(char) nr; + *ptr=(char) (int) nr; } return error; } @@ -1313,9 +1313,9 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } - else if (tmp > (uint16) ~0) + else if (tmp > UINT_MAX16) { - tmp=(uint16) ~0; + tmp=UINT_MAX16; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } @@ -1364,9 +1364,9 @@ int Field_short::store(double nr) set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } - else if (nr > (double) (uint16) ~0) + else if (nr > (double) UINT_MAX16) { - res=(int16) (uint16) ~0; + res=(int16) UINT_MAX16; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } @@ -1388,7 +1388,7 @@ int Field_short::store(double nr) error= 1; } else - res=(int16) nr; + res=(int16) (int) nr; } #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) @@ -1413,9 +1413,9 @@ int Field_short::store(longlong nr) set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } - else if (nr > (longlong) (uint16) ~0) + else if (nr > (longlong) UINT_MAX16) { - res=(int16) (uint16) ~0; + res=(int16) UINT_MAX16; set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); error= 1; } @@ -1884,7 +1884,7 @@ int Field_long::store(double nr) error= 1; } else - res=(int32) nr; + res=(int32) (longlong) nr; } if (error) set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); @@ -2123,7 +2123,7 @@ int Field_longlong::store(double nr) res=0; error= 1; } - else if (nr >= (double) ~ (ulonglong) 0) + else if (nr >= (double) ULONGLONG_MAX) { res= ~(longlong) 0; error= 1; @@ -2133,15 +2133,15 @@ int Field_longlong::store(double nr) } else { - if (nr < (double) LONGLONG_MIN) + if (nr <= (double) LONGLONG_MIN) { res= LONGLONG_MIN; - error= 1; + error= (nr < (double) LONGLONG_MIN); } - else if (nr > (double) LONGLONG_MAX) + else if (nr >= (double) LONGLONG_MAX) { res= LONGLONG_MAX; - error= 1; + error= (nr > (double) LONGLONG_MAX); } else res=(longlong) nr; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 35ce494257b..6a7e037bed1 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1086,7 +1086,7 @@ public: }; -class Item_equal_iterator :List_iterator_fast +class Item_equal_iterator : public List_iterator_fast { public: inline Item_equal_iterator(Item_equal &item_equal) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fb8e074ebf8..0a7cd0f7338 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3464,7 +3464,7 @@ best_access_path(JOIN *join, { /* Assume that the first key part matches 1% of the file - and that the hole key matches 10 (duplicates) or 1 + and that the whole key matches 10 (duplicates) or 1 (unique) records. Assume also that more key matches proportionally more records @@ -3472,7 +3472,7 @@ best_access_path(JOIN *join, records = (x * (b-a) + a*c-b)/(c-1) b = records matched by whole key - a = records matched by first key part (10% of all records?) + a = records matched by first key part (1% of all records?) c = number of key parts in key x = used key parts (1 <= x <= c) */ @@ -3488,9 +3488,12 @@ best_access_path(JOIN *join, else { double a=s->records*0.01; - tmp = (max_key_part * (rec_per_key - a) + - a*keyinfo->key_parts - rec_per_key)/ - (keyinfo->key_parts-1); + if (keyinfo->key_parts > 1) + tmp= (max_key_part * (rec_per_key - a) + + a*keyinfo->key_parts - rec_per_key)/ + (keyinfo->key_parts-1); + else + tmp= a; set_if_bigger(tmp,1.0); } records = (ulong) tmp; @@ -4421,7 +4424,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, { /* Assume that the first key part matches 1% of the file - and that the hole key matches 10 (duplicates) or 1 + and that the whole key matches 10 (duplicates) or 1 (unique) records. Assume also that more key matches proportionally more records From 474f23a402ae77ff822dd2fe9710fb857d249318 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Tue, 30 Nov 2004 07:41:26 +0100 Subject: [PATCH 7/8] ndb - fixed long overdue problems with unique indexes and null values --- mysql-test/r/ndb_index_unique.result | 36 +++++++++++++++++++++++ mysql-test/t/ndb_index_unique.test | 20 +++++++++++++ sql/ha_ndbcluster.cc | 44 ++++++++++++++++++++++++---- 3 files changed, 94 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result index af9b84022ed..9a5ef4dcca7 100644 --- a/mysql-test/r/ndb_index_unique.result +++ b/mysql-test/r/ndb_index_unique.result @@ -522,3 +522,39 @@ uid gid rid cid 1 1 2 3 1 1 2 4 drop table t1,t2,t3,t4,t5,t6,t7; +CREATE TABLE t1 ( +a int unsigned NOT NULL PRIMARY KEY, +b int unsigned, +c int unsigned, +UNIQUE bc(b,c) ) engine = ndb; +insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); +select * from t1 where b=1 and c=1; +a b c +1 1 1 +select * from t1 where b is null and c is null; +a b c +3 NULL NULL +select * from t1 where b is null and c = 2; +a b c +2 NULL 2 +select * from t1 where b = 4 and c is null; +a b c +4 4 NULL +create table t8 as +select * from t1 where (b = 1 and c = 1) +or (b is null and c is null) +or (b is null and c = 2) +or (b = 4 and c is null); +select * from t8 order by a; +a b c +1 1 1 +2 NULL 2 +3 NULL NULL +4 4 NULL +select * from t1 order by a; +a b c +1 1 1 +2 NULL 2 +3 NULL NULL +4 4 NULL +drop table t1, t8; diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test index bdb23949763..5cfc069d75f 100644 --- a/mysql-test/t/ndb_index_unique.test +++ b/mysql-test/t/ndb_index_unique.test @@ -231,4 +231,24 @@ select * from t4 where rid = 2 order by cid; drop table t1,t2,t3,t4,t5,t6,t7; +# test null in indexes +CREATE TABLE t1 ( + a int unsigned NOT NULL PRIMARY KEY, + b int unsigned, + c int unsigned, + UNIQUE bc(b,c) ) engine = ndb; + +insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); +select * from t1 where b=1 and c=1; +select * from t1 where b is null and c is null; +select * from t1 where b is null and c = 2; +select * from t1 where b = 4 and c is null; +create table t8 as +select * from t1 where (b = 1 and c = 1) + or (b is null and c is null) + or (b is null and c = 2) + or (b = 4 and c is null); +select * from t8 order by a; +select * from t1 order by a; +drop table t1, t8; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 1962065d617..77adf0d7ed3 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1156,9 +1156,10 @@ int ha_ndbcluster::unique_index_read(const byte *key, for (i= 0; key_part != end; key_part++, i++) { - if (set_ndb_key(op, key_part->field, i, key_ptr)) + if (set_ndb_key(op, key_part->field, i, + key_part->null_bit ? key_ptr + 1 : key_ptr)) ERR_RETURN(trans->getNdbError()); - key_ptr+= key_part->length; + key_ptr+= key_part->store_length; } // Get non-index attribute(s) @@ -2243,6 +2244,28 @@ int ha_ndbcluster::index_end() DBUG_RETURN(close_scan()); } +/** + * Check if key contains null + */ +static +int +check_null_in_key(const KEY* key_info, const byte *key, uint key_len) +{ + KEY_PART_INFO *curr_part, *end_part; + const byte* end_ptr = key + key_len; + curr_part= key_info->key_part; + end_part= curr_part + key_info->key_parts; + + + for (; curr_part != end_part && key < end_ptr; curr_part++) + { + if(curr_part->null_bit && *key) + return 1; + + key += curr_part->store_length; + } + return 0; +} int ha_ndbcluster::index_read(byte *buf, const byte *key, uint key_len, @@ -2260,6 +2283,8 @@ int ha_ndbcluster::index_read(byte *buf, case PRIMARY_KEY_INDEX: if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len) { + if(m_active_cursor && (error= close_scan())) + DBUG_RETURN(error); DBUG_RETURN(pk_read(key, key_len, buf)); } else if (type == PRIMARY_KEY_INDEX) @@ -2269,8 +2294,11 @@ int ha_ndbcluster::index_read(byte *buf, break; case UNIQUE_ORDERED_INDEX: case UNIQUE_INDEX: - if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len) + if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len && + !check_null_in_key(key_info, key, key_len)) { + if(m_active_cursor && (error= close_scan())) + DBUG_RETURN(error); DBUG_RETURN(unique_index_read(key, key_len, buf)); } else if (type == UNIQUE_INDEX) @@ -2374,6 +2402,8 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, start_key->length == key_info->key_length && start_key->flag == HA_READ_KEY_EXACT) { + if(m_active_cursor && (error= close_scan())) + DBUG_RETURN(error); error= pk_read(start_key->key, start_key->length, buf); DBUG_RETURN(error == HA_ERR_KEY_NOT_FOUND ? HA_ERR_END_OF_FILE : error); } @@ -2381,10 +2411,12 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, case UNIQUE_ORDERED_INDEX: case UNIQUE_INDEX: key_info= table->key_info + active_index; - if (start_key && - start_key->length == key_info->key_length && - start_key->flag == HA_READ_KEY_EXACT) + if (start_key && start_key->length == key_info->key_length && + start_key->flag == HA_READ_KEY_EXACT && + !check_null_in_key(key_info, start_key->key, start_key->length)) { + if(m_active_cursor && (error= close_scan())) + DBUG_RETURN(error); error= unique_index_read(start_key->key, start_key->length, buf); DBUG_RETURN(error == HA_ERR_KEY_NOT_FOUND ? HA_ERR_END_OF_FILE : error); } From a1a4ddad743eeaf94fcca5486dfab77f8d5a7c4e Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Tue, 30 Nov 2004 08:42:42 +0100 Subject: [PATCH 8/8] ndb - Fixed INCORRECT result file for unique index test --- mysql-test/r/ndb_index_unique.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result index 7ec1319a579..f9cc89ee4cc 100644 --- a/mysql-test/r/ndb_index_unique.result +++ b/mysql-test/r/ndb_index_unique.result @@ -77,8 +77,10 @@ a b c 3 NULL NULL select * from t1 use index (bc) where b IS NULL and c IS NULL order by a; a b c +3 NULL NULL select * from t1 use index (bc) where b IS NULL and c = 2 order by a; a b c +2 NULL 2 select * from t1 use index (bc) where b < 4 order by a; a b c 1 1 1