summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-01-02 21:34:12 +0200
committerunknown <monty@hundin.mysql.fi>2002-01-02 21:34:12 +0200
commit62c4fa399e0c7acb1e7dfdae4ceac4b61daeb744 (patch)
tree8dbf52f0dc71a962692f98d1363958acf5d8fd67
parentf4fee3d90e8456cfd2a4e2f395bd270d0a12c70d (diff)
parent38e174cc59f99e8bd55e98d2d427037a5a7719e6 (diff)
downloadmariadb-git-62c4fa399e0c7acb1e7dfdae4ceac4b61daeb744.tar.gz
merge with 3.23
BitKeeper/deleted/.del-global.h~e80d28157acfdcb5: Auto merged Docs/manual.texi: Auto merged client/client_priv.h: Auto merged extra/resolveip.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/os/os0file.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/srv/srv0srv.c: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/variables.test: Auto merged mysys/my_bitmap.c: Auto merged sql/ha_innobase.cc: Auto merged sql/ha_innobase.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_do.cc: Auto merged sql/sql_select.cc: Auto merged client/mysqldump.c: Use local version in 4.0 configure.in: Use 4.0 code
-rw-r--r--Docs/manual.texi9
-rw-r--r--innobase/btr/btr0sea.c2
-rw-r--r--innobase/include/data0type.ic11
-rw-r--r--innobase/log/log0recv.c18
-rw-r--r--innobase/os/os0file.c7
-rw-r--r--innobase/rem/rem0cmp.c10
-rw-r--r--innobase/row/row0mysql.c18
-rw-r--r--innobase/srv/srv0srv.c14
-rw-r--r--mysql-test/r/variables.result11
-rw-r--r--mysql-test/t/variables.test13
-rw-r--r--sql/ha_innobase.cc4
-rw-r--r--sql/ha_innobase.h7
-rw-r--r--sql/item_func.cc38
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/mysqld.cc5
-rw-r--r--sql/sql_select.cc2
16 files changed, 155 insertions, 18 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index e33eb38e586..605fd69f0b0 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -48193,15 +48193,18 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.47
@itemize @bullet
@item
+Fixed in when using the following construct:
+@code{SELECT ... WHERE key=@@var_name OR $key=@@var_name2}
+@item
+Restrict InnoDB keys to 500 bytes.
+@item
InnoDB now supports @code{NULL} in keys.
@item
Fixed shutdown problem on HPUX. (Introduced in 3.23.46)
@item
-Added 'DO expression' command.
-@item
Fixed core-dump bug in replication when using SELECT RELEASE_LOCK();
@item
-Added new statement DO expression,[expression].
+Added new command: @code{DO expression,[expression]}
@item
Added @code{slave-skip-errors} option
@item
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index 2e08941894c..21b4c12ab56 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -452,7 +452,7 @@ btr_search_info_update_slow(
Checks if a guessed position for a tree cursor is right. Note that if
mode is PAGE_CUR_LE, which is used in inserts, and the function returns
TRUE, then cursor->up_match and cursor->low_match both have sensible values. */
-UNIV_INLINE
+static
ibool
btr_search_check_guess(
/*===================*/
diff --git a/innobase/include/data0type.ic b/innobase/include/data0type.ic
index 4a62902eb1b..d82d976d076 100644
--- a/innobase/include/data0type.ic
+++ b/innobase/include/data0type.ic
@@ -107,14 +107,17 @@ dtype_get_pad_char(
ULINT_UNDEFINED if no padding specified */
dtype_t* type) /* in: type */
{
- if (type->mtype == DATA_CHAR) {
- /* space is the padding character for all char strings */
+ if (type->mtype == DATA_CHAR
+ || type->mtype == DATA_VARCHAR
+ || type->mtype == DATA_BINARY
+ || type->mtype == DATA_FIXBINARY) {
+
+ /* Space is the padding character for all char and binary
+ strings */
return((ulint)' ');
}
- ut_ad((type->mtype == DATA_BINARY) || (type->mtype == DATA_VARCHAR));
-
/* No padding specified */
return(ULINT_UNDEFINED);
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index f83a49d01a6..5cd5850d1a1 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -1019,7 +1019,8 @@ loop:
if (recv_addr->state == RECV_NOT_PROCESSED) {
if (!has_printed) {
fprintf(stderr,
-"InnoDB: Starting an apply batch of log records to the database...\n");
+"InnoDB: Starting an apply batch of log records to the database...\n"
+"InnoDB: Progress in percents:");
has_printed = TRUE;
}
@@ -1046,6 +1047,16 @@ loop:
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
}
+
+ if (has_printed
+ && (i * 100) / hash_get_n_cells(recv_sys->addr_hash)
+ != ((i + 1) * 100)
+ / hash_get_n_cells(recv_sys->addr_hash)) {
+
+ fprintf(stderr, "%lu ",
+ (i * 100) / hash_get_n_cells(recv_sys->addr_hash));
+
+ }
}
/* Wait until all the pages have been processed */
@@ -1059,6 +1070,11 @@ loop:
mutex_enter(&(recv_sys->mutex));
}
+ if (has_printed) {
+
+ fprintf(stderr, "\n");
+ }
+
if (!allow_ibuf) {
/* Flush all the file pages to disk and invalidate them in
the buffer pool */
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index a7cd31af2ee..ac29b292f6a 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -581,6 +581,13 @@ os_file_flush(
return(TRUE);
}
+ /* Since Linux returns EINVAL if the 'file' is actually a raw device,
+ we choose to ignore that error */
+
+ if (errno == EINVAL) {
+ return(TRUE);
+ }
+
fprintf(stderr,
"InnoDB: Error: the OS said file flush did not succeed\n");
diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c
index 1f2987f0182..47b7021bf27 100644
--- a/innobase/rem/rem0cmp.c
+++ b/innobase/rem/rem0cmp.c
@@ -100,7 +100,15 @@ cmp_types_are_equal(
dtype_t* type1, /* in: type 1 */
dtype_t* type2) /* in: type 2 */
{
- if (type1->mtype != type2->mtype) {
+ if ((type1->mtype == DATA_VARCHAR && type2->mtype == DATA_CHAR)
+ || (type1->mtype == DATA_CHAR && type2->mtype == DATA_VARCHAR)
+ || (type1->mtype == DATA_FIXBINARY && type2->mtype == DATA_BINARY)
+ || (type1->mtype == DATA_BINARY && type2->mtype == DATA_FIXBINARY)) {
+
+ return(TRUE);
+ }
+
+ if (type1->mtype != type2->mtype) {
return(FALSE);
}
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index db2dcb0125f..50ec88c595d 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -1683,6 +1683,8 @@ row_scan_and_check_index(
rec_t* rec;
ibool is_ok = TRUE;
int cmp;
+ ibool contains_null;
+ ulint i;
char err_buf[1000];
*n_rows = 0;
@@ -1728,6 +1730,21 @@ loop:
cmp = cmp_dtuple_rec_with_match(prev_entry, rec,
&matched_fields,
&matched_bytes);
+ contains_null = FALSE;
+
+ /* In a unique secondary index we allow equal key values if
+ they contain SQL NULLs */
+
+ for (i = 0;
+ i < dict_index_get_n_ordering_defined_by_user(index);
+ i++) {
+ if (UNIV_SQL_NULL == dfield_get_len(
+ dtuple_get_nth_field(prev_entry, i))) {
+
+ contains_null = TRUE;
+ }
+ }
+
if (cmp > 0) {
fprintf(stderr,
"Error: index records in a wrong order in index %s\n",
@@ -1741,6 +1758,7 @@ loop:
is_ok = FALSE;
} else if ((index->type & DICT_UNIQUE)
+ && !contains_null
&& matched_fields >=
dict_index_get_n_ordering_defined_by_user(index)) {
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 424bb8a7086..3f8763f91d6 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -2427,7 +2427,19 @@ loop:
background_loop:
/* In this loop we run background operations when the server
- is quiet */
+ is quiet and we also come here about once in 10 seconds */
+
+ srv_main_thread_op_info = "flushing buffer pool pages";
+
+ /* Flush a few oldest pages to make the checkpoint younger */
+
+ n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, ut_dulint_max);
+
+ srv_main_thread_op_info = "making checkpoint";
+
+ /* Make a new checkpoint about once in 10 seconds */
+
+ log_checkpoint(TRUE, FALSE);
srv_main_thread_op_info = (char *) "reserving kernel mutex";
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index ca67bdeb857..52189c36831 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -24,3 +24,14 @@ select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
select @t5;
@t5
1.23456
+@min_cid:=min(c_id) @max_cid:=max(c_id)
+1 4
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
+c_id c_name c_country
+1 Bozo USA
+4 Mr. Floppy GB
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index d5ff64d199b..0499263467c 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1,6 +1,7 @@
#
# test variables
#
+drop table if exists t1;
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
@@ -14,3 +15,15 @@ select @test_int,@test_double,@test_string,@test_string2;
select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
select @t5;
+#
+# Test problem with WHERE and variables
+#
+
+CREATE TABLE t1 (c_id INT(4) NOT NULL, c_name CHAR(20), c_country CHAR(3), PRIMARY KEY(c_id));
+INSERT INTO t1 VALUES (1,'Bozo','USA'),(2,'Ronald','USA'),(3,'Kinko','IRE'),(4,'Mr. Floppy','GB');
+SELECT @min_cid:=min(c_id), @max_cid:=max(c_id) from t1;
+SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid;
+SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid OR c_id=666;
+ALTER TABLE t1 DROP PRIMARY KEY;
+select * from t1 where c_id=@min_cid OR c_id=@max_cid;
+drop table t1;
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index 3b6b15d1e79..683e76a19ad 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -3222,7 +3222,7 @@ ha_innobase::update_table_comment(
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
uint length = strlen(comment);
- char* str = my_malloc(length + 200, MYF(0));
+ char* str = my_malloc(length + 550, MYF(0));
char* pos;
if (!str) {
@@ -3241,7 +3241,7 @@ ha_innobase::update_table_comment(
/* We assume 150 bytes of space to print info */
- dict_print_info_on_foreign_keys(pos, 150, prebuilt->table);
+ dict_print_info_on_foreign_keys(pos, 500, prebuilt->table);
return(str);
}
diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h
index bcd11b8a96e..3c3025c39c1 100644
--- a/sql/ha_innobase.h
+++ b/sql/ha_innobase.h
@@ -101,8 +101,11 @@ class ha_innobase: public handler
a secondary key record must also contain the
primary key value:
max key length is therefore set to slightly
- less than 1 / 4 of page size which is 16 kB */
- uint max_key_length() const { return 3500; }
+ less than 1 / 4 of page size which is 16 kB;
+ but currently MySQL does not work with keys
+ whose size is > MAX_KEY_LENGTH */
+ uint max_key_length() const { return((MAX_KEY_LENGTH <= 3500) ?
+ MAX_KEY_LENGTH : 3500);}
bool fast_key_read() { return 1;}
key_map keys_to_use_for_scanning() { return ~(key_map) 0; }
bool has_transactions() { return 1;}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 93edcc64146..b59aceb512e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1845,6 +1845,16 @@ Item_func_set_user_var::val_str(String *str)
}
+void Item_func_set_user_var::print(String *str)
+{
+ str->append('(');
+ str->append(name.str,name.length);
+ str->append(":=",2);
+ args[0]->print(str);
+ str->append(')');
+}
+
+
user_var_entry *Item_func_get_user_var::get_entry()
{
if (!entry || ! entry->value)
@@ -1937,6 +1947,34 @@ enum Item_result Item_func_get_user_var::result_type() const
return entry->type;
}
+
+void Item_func_get_user_var::print(String *str)
+{
+ str->append('@');
+ str->append(name.str,name.length);
+ str->append(')');
+}
+
+bool Item_func_get_user_var::eq(const Item *item) const
+{
+ /* Assume we don't have rtti */
+ if (this == item)
+ return 1; // Same item is same.
+ /* Check if other type is also a get_user_var() object */
+#ifdef FIX_THIS
+ if (item->eq == &Item_func_get_user_var::eq)
+ return 0;
+#else
+ if (item->type() != FUNC_ITEM ||
+ ((Item_func*) item)->func_name() != func_name())
+ return 0;
+#endif
+ Item_func_get_user_var *other=(Item_func_get_user_var*) item;
+ return (name.length == other->name.length &&
+ !memcmp(name.str, other->name.str, name.length));
+}
+
+
longlong Item_func_inet_aton::val_int()
{
uint byte_result = 0;
diff --git a/sql/item_func.h b/sql/item_func.h
index 648ca6d0743..615273e938e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -841,6 +841,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
bool fix_fields(THD *thd,struct st_table_list *tables);
void fix_length_and_dec();
+ void print(String *str);
const char *func_name() const { return "set_user_var"; }
};
@@ -859,13 +860,16 @@ public:
longlong val_int();
String *val_str(String* str);
void fix_length_and_dec();
+ void print(String *str);
enum Item_result result_type() const;
const char *func_name() const { return "get_user_var"; }
bool const_item() const { return const_var_flag; }
table_map used_tables() const
{ return const_var_flag ? 0 : RAND_TABLE_BIT; }
+ bool eq(const Item *item) const;
};
+
class Item_func_inet_aton : public Item_int_func
{
public:
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a6eb447f1a1..38e2fdeb5a9 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2909,9 +2909,9 @@ CHANGEABLE_VAR changeable_vars[] = {
(long*) &innobase_additional_mem_pool_size, 1*1024*1024L, 512*1024L,
~0L, 0, 1024},
{"innodb_file_io_threads",
- (long*) &innobase_file_io_threads, 9, 4, 64, 0, 1},
+ (long*) &innobase_file_io_threads, 4, 4, 64, 0, 1},
{"innodb_lock_wait_timeout",
- (long*) &innobase_lock_wait_timeout, 1024 * 1024 * 1024, 1,
+ (long*) &innobase_lock_wait_timeout, 50, 1,
1024 * 1024 * 1024, 0, 1},
{"innodb_thread_concurrency",
(long*) &innobase_thread_concurrency, 8, 1, 1000, 0, 1},
@@ -4078,6 +4078,7 @@ static void get_options(int argc,char **argv)
break;
case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT:
innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1;
+ break;
case OPT_INNODB_FAST_SHUTDOWN:
innobase_fast_shutdown= optarg ? test(atoi(optarg)) : 1;
break;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c168ce775fc..8530dcbd86e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -35,7 +35,7 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext" };
static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
- DYNAMIC_ARRAY *keyuse);
+ DYNAMIC_ARRAY *keyuse);
static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
JOIN_TAB *join_tab,
uint tables,COND *conds,table_map table_map);