From 2239aa172b9a7e0100f0ab98e7e421bc0cfeb270 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Nov 2001 13:50:48 +0200 Subject: [PATCH] Fixes for embedded version. BitKeeper/deleted/.del-WHITEPAPER~da1226799debcf3f: Delete: libmysqld/WHITEPAPER Docs/manual.texi: Changelog client/mysqltest.c: Fix things that crashed embedded MySQL libmysqld/examples/test-run: Cleanup of old BDB files. mysql-test/r/innodb.result: Fix for embedded library mysql-test/t/innodb.test: Fix for embedded library mysys/mf_keycache.c: Safety sql/ha_berkeley.cc: Added DBUG statements sql/ha_innobase.cc: Fixed bug for embedded version sql/ha_innobase.h: Fix to use index when doing an ORDER BY on a whole InnoDB table sql/handler.h: Fix to use index when doing an ORDER BY on a whole InnoDB table sql/mysqld.cc: Safety fix sql/sql_base.cc: cleanup sql/sql_select.cc: Fix to use index when doing an ORDER BY on a whole InnoDB table --- Docs/manual.texi | 11 ++++++++--- client/mysqltest.c | 7 +++---- libmysqld/WHITEPAPER | 16 ---------------- libmysqld/examples/test-run | 1 + mysql-test/r/innodb.result | 2 +- mysql-test/t/innodb.test | 3 ++- mysys/mf_keycache.c | 1 + sql/ha_berkeley.cc | 3 ++- sql/ha_innobase.cc | 3 ++- sql/ha_innobase.h | 1 + sql/handler.h | 1 + sql/mysqld.cc | 2 +- sql/sql_base.cc | 4 ++-- sql/sql_select.cc | 2 +- 14 files changed, 26 insertions(+), 31 deletions(-) delete mode 100644 libmysqld/WHITEPAPER diff --git a/Docs/manual.texi b/Docs/manual.texi index ffa42d2ba73..b75668cf514 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -32431,7 +32431,7 @@ create_definition: or INDEX [index_name] (index_col_name,...) or UNIQUE [INDEX] [index_name] (index_col_name,...) or FULLTEXT [INDEX] [index_name] (index_col_name,...) - or [CONSTRAINT symbol] FOREIGN KEY index_name (index_col_name,...) + or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) [reference_definition] or CHECK (expr) @@ -32866,7 +32866,7 @@ All mapped tables must be in the same database as the @code{MERGE} table. @item If you want to insert data in a @code{MERGE} table, you have to specify with @code{INSERT_METHOD} into with table the row should be inserted. -@xref{MERGE}. +@xref{MERGE}. This option was introduced in MySQL 4.0.0. @item In the created table the @code{PRIMARY} key will be placed first, followed @@ -45796,7 +45796,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item @code{LOCATE()} and @code{INSTR()} are case sensitive if neither -argument is a binary string. binary strings. +argument is a binary string. +@item +Changed @code{RND()} initialization so that @code{RND(N)} and @code{RND(N+1)} +are more distinct. @item Fixed core dump bug in @code{UPDATE ... ORDER BY }. @item @@ -45808,6 +45811,8 @@ Added boolean fulltext search code. It should be considered early alpha. @item Extended @code{MODIFY} and @code{CHANGE} in @code{ALTER TABLE} to accept the @code{AFTER} keyword. +@item +Index are now used with @code{ORDER} BY on a whole InnoDB table. @end itemize @node News-4.0.0, , News-4.0.1, News-4.0.x diff --git a/client/mysqltest.c b/client/mysqltest.c index 71b4e886f91..3174294fd8a 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1334,9 +1334,9 @@ int do_connect(struct st_query* q) con_sock=fn_format(buff, con_sock, TMPDIR, "",0); if (!con_db[0]) con_db=db; - if((con_error = safe_connect(&next_con->mysql, con_host, - con_user, con_pass, - con_db, con_port, *con_sock ? con_sock: 0))) + if ((con_error = safe_connect(&next_con->mysql, con_host, + con_user, con_pass, + con_db, con_port, con_sock ? con_sock: 0))) die("Could not open connection '%s': %s", con_name, mysql_error(&next_con->mysql)); @@ -2403,7 +2403,6 @@ int main(int argc, char** argv) printf("ok\n"); } - mysql_server_end(); free_used_memory(); exit(error ? 1 : 0); return error ? 1 : 0; /* Keep compiler happy */ diff --git a/libmysqld/WHITEPAPER b/libmysqld/WHITEPAPER deleted file mode 100644 index 191cdb4e0fd..00000000000 --- a/libmysqld/WHITEPAPER +++ /dev/null @@ -1,16 +0,0 @@ -LIBRARY VERSION DESIGN (EMBEDDED SERVER) - - -- The library version of MySQL server is the client library that contains embedded server. - -- This client DLL has name : libmysqlclient_e (.la) - -- The client application that supposed to use MySQL LV need to be rebuilt against libmysqlclient_e.la. The rebuild process is necessary, because libmysqlclient_e is a LIBTOOL object, which has the different LIBS list compared to the original libmysqlclient.la. - -- The client and the server code run in the same process and the same thread; - -- The server code is invoked when client writes the command to the net, and when connection is established; - - - - diff --git a/libmysqld/examples/test-run b/libmysqld/examples/test-run index d525c7a14a3..c7434488259 100755 --- a/libmysqld/examples/test-run +++ b/libmysqld/examples/test-run @@ -78,6 +78,7 @@ if test $clean = 1 then rm -f $datadir/ib_* $datadir/ibdata* rm -f $datadir/log.00* + rm -f $datadir/test/*.db fi rm -f $datadir/../tmp/* rm -f test-gdbinit diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index f569f2ea405..f0144af24a8 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -858,7 +858,7 @@ insert into test_$1.t3 values(1); commit; drop database test_$1; show tables from test_$1; -Can't read dir of './test_$1/' (Errcode: 2) +Got one of the listed errors create table t1 (a int not null) type= innodb; insert into t1 values(1),(2); truncate table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 4e107b29cf4..6bac7bb8059 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -527,7 +527,8 @@ create table test_$1.t3 (a int not null) type= heap; insert into test_$1.t3 values(1); commit; drop database test_$1; ---error 12 +# Don't check error message +--error 12,12 show tables from test_$1; # diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index d223a4779a0..b02d0928325 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -169,6 +169,7 @@ void end_key_cache(void) } } key_cache_inited=0; + _my_hash_blocks=my_blocks_used=0; DBUG_PRINT("status", ("used: %d changed: %d w_requests: %ld writes: %ld r_requests: %ld reads: %ld", _my_blocks_used,_my_blocks_changed,_my_cache_w_requests, diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index f52b99f5a12..c11b1bbd4f8 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1879,13 +1879,14 @@ int ha_berkeley::delete_table(const char *name) { int error; char name_buff[FN_REFLEN]; + DBUG_ENTER("delete_table"); if ((error=db_create(&file, db_env, 0))) my_errno=error; /* purecov: inspected */ else error=file->remove(file,fn_format(name_buff,name,"",ha_berkeley_ext,2 | 4), NULL,0); file=0; // Safety - return error; + DBUG_RETURN(error); } /* diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index f5f93be98a6..8c92e0635a5 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -544,13 +544,14 @@ innobase_init(void) When using the embedded server, the datadirectory is not in the current directory. */ - if (!mysql_embedded) + if (mysql_embedded) default_path=mysql_real_data_home; else { /* It's better to use current lib, to keep path's short */ current_lib[0]=FN_CURLIB; current_lib[1]=FN_LIBCHAR; + current_lib[2]=0; default_path=current_lib; } diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 95bba76c842..83e43b1d662 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -101,6 +101,7 @@ class ha_innobase: public handler bytes */ uint max_key_length() const { return 7000; } bool fast_key_read() { return 1;} + key_map keys_to_use_for_scanning() { return ~(key_map) 0; } bool has_transactions() { return 1;} int open(const char *name, int mode, uint test_if_locked); diff --git a/sql/handler.h b/sql/handler.h index b18118bb114..98358c3b3e4 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -231,6 +231,7 @@ public: { return ulonglong2double(data_file_length) / IO_SIZE + 1; } virtual double read_time(ha_rows rows) { return rows; } virtual bool fast_key_read() { return 0;} + virtual key_map keys_to_use_for_scanning() { return 0; } virtual bool has_transactions(){ return 0;} virtual uint extra_rec_buf_length() { return 0; } virtual ha_rows estimate_number_of_rows() { return records+EXTRA_RECORDS; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2774e2a4050..54a8b7c67c1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -736,8 +736,8 @@ void clean_up(bool print_message) if (!opt_noacl) udf_free(); #endif - end_key_cache(); (void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */ + end_key_cache(); #ifdef USE_RAID end_raid(); #endif diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 32318180081..2f8c44c6f0b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1516,8 +1516,8 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, { tmp_table->next=thd->temporary_tables; thd->temporary_tables=tmp_table; - if(thd->slave_thread) - ++slave_open_temp_tables; + if (thd->slave_thread) + slave_open_temp_tables++; } DBUG_RETURN(tmp_table); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index abb1d891166..2b2dff1bdac 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5346,7 +5346,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, retrieving all rows through an index. */ if (select_limit >= table->file->records) - keys&= table->used_keys; + keys&= (table->used_keys | table->file->keys_to_use_for_scanning()); for (nr=0; keys ; keys>>=1, nr++) {