Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-02-03 00:58:09+02:00, jani@stripped +27
-0
Merge jamppa@stripped:/home/bk/mysql-5.1
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
MERGE: 1.2411.1.3
BUILD/SETUP.sh@stripped, 2007-02-03 00:22:11+02:00, jani@stripped
+0 -0
Auto merged
MERGE: 1.68.1.1
client/mysql.cc@stripped, 2007-02-03 00:22:11+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.250.1.1
configure.in@stripped, 2007-02-03 00:22:11+02:00, jani@stripped
+0 -0
Auto merged
MERGE: 1.421.1.3
libmysqld/lib_sql.cc@stripped, 2007-02-03 00:22:12+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.127.1.4
plugin/daemon_example/daemon_example.cc@stripped, 2007-02-03 00:58:05+02:00,
jani@stripped +16 -10
Merged with main 5.1
MERGE: 1.2.1.3
plugin/daemon_example/daemon_example.cc@stripped, 2007-02-03 00:22:11+02:00,
jani@stripped +0 -0
Merge rename: plugin/daemon_example/daemon_example.c ->
plugin/daemon_example/daemon_example.cc
sql/filesort.cc@stripped, 2007-02-03 00:22:12+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.122.1.1
sql/ha_ndbcluster.cc@stripped, 2007-02-03 00:22:12+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.397.1.1
sql/handler.cc@stripped, 2007-02-03 00:22:12+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.291.1.1
sql/item.cc@stripped, 2007-02-03 00:22:12+02:00, jani@stripped
+0 -0
Auto merged
MERGE: 1.232.1.1
sql/item.h@stripped, 2007-02-03 00:22:13+02:00, jani@stripped +0
-0
Auto merged
MERGE: 1.222.1.1
sql/item_cmpfunc.cc@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.236.1.1
sql/item_cmpfunc.h@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.141.1.1
sql/item_func.cc@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.349.1.3
sql/item_subselect.cc@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.141.1.2
sql/item_timefunc.cc@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.152.1.1
sql/mysql_priv.h@stripped, 2007-02-03 00:22:13+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.473.1.1
sql/mysqld.cc@stripped, 2007-02-03 00:58:05+02:00, jani@stripped
+1 -1
Merged with main 5.1
MERGE: 1.610.1.2
sql/opt_range.cc@stripped, 2007-02-03 00:22:14+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.258.1.2
sql/sql_class.cc@stripped, 2007-02-03 00:22:14+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.310.1.1
sql/sql_lex.h@stripped, 2007-02-03 00:22:14+02:00, jani@stripped
+0 -0
Auto merged
MERGE: 1.258.1.1
sql/sql_parse.cc@stripped, 2007-02-03 00:22:15+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.620.1.2
sql/sql_plugin.cc@stripped, 2007-02-03 00:22:15+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.42.1.1
sql/sql_select.cc@stripped, 2007-02-03 00:22:16+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.485.1.2
sql/sql_show.cc@stripped, 2007-02-03 00:22:16+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.387.1.1
sql/sql_yacc.yy@stripped, 2007-02-03 00:22:17+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.535.1.1
sql/table.cc@stripped, 2007-02-03 00:22:17+02:00, jani@stripped
+0 -0
Auto merged
MERGE: 1.270.1.1
storage/archive/ha_archive.cc@stripped, 2007-02-03 00:22:17+02:00,
jani@stripped +0 -0
Auto merged
MERGE: 1.122.1.2
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jani
# Host: a88-113-38-195.elisa-laajakaista.fi
# Root: /home/my/bk/mysql-5.1/RESYNC
--- 1.251/client/mysql.cc 2007-01-24 19:56:57 +02:00
+++ 1.252/client/mysql.cc 2007-02-03 00:22:11 +02:00
@@ -1409,7 +1409,7 @@
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
char *no_completion(const char*,int)
#else
-int no_completion()
+char *no_completion()
#endif
{
return 0; /* No filename completion */
@@ -1497,10 +1497,10 @@
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
- rl_completion_entry_function= (Function*)&no_completion;
+ rl_completion_entry_function= &no_completion;
#else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
- rl_completion_entry_function= (Function*)&no_completion;
+ rl_completion_entry_function= &no_completion;
#endif
}
--- 1.423/configure.in 2007-01-29 01:51:37 +02:00
+++ 1.424/configure.in 2007-02-03 00:22:11 +02:00
@@ -2354,6 +2354,7 @@
readline_dir=""
readline_h_ln_cmd=""
readline_link=""
+want_to_use_readline="no"
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
then
@@ -2379,6 +2380,7 @@
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
compile_readline=yes
+ want_to_use_readline="yes"
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
else
# Use system readline library
@@ -2388,10 +2390,12 @@
MYSQL_CHECK_NEW_RL_INTERFACE
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
AC_LANG_RESTORE
- if [test "$mysql_cv_new_rl_interface" = "yes"]
+ if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d
"./cmd-line-utils/readline"]
then
- # Use the new readline interface
+ # Use the new readline interface, but only if the package includes a bundled
libreadline
+ # this way we avoid linking commercial source with GPL readline
readline_link="-lreadline"
+ want_to_use_readline="yes"
elif [test "$mysql_cv_libedit_interface" = "yes"]
then
# Use libedit
@@ -2402,6 +2406,15 @@
versions of libedit or readline])
fi
fi
+
+# if there is no readline, but we want to build with readline, we fail
+if [test "$want_to_use_readline" = "yes"] && [test ! -d
"./cmd-line-utils/readline"]
+then
+ AC_MSG_ERROR([This commercially licensed MySQL source package can't
+ be built with libreadline. Please use --with-libedit to use
+ the bundled version of libedit instead.])
+fi
+
#
# if either readline or libedit is enabled - generate Makefile's for both
# (to make sure both are included in 'make dist')
@@ -2531,7 +2544,8 @@
sql/sql_builtin.cc sql-common/Makefile dnl
dbug/Makefile scripts/Makefile include/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl
- support-files/MacOSX/Makefile mysql-test/Makefile dnl
+ support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
+ mysql-test/Makefile dnl
mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile)
--- 1.124/sql/filesort.cc 2007-01-29 01:47:29 +02:00
+++ 1.125/sql/filesort.cc 2007-02-03 00:22:12 +02:00
@@ -434,7 +434,8 @@
byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
my_off_t record;
TABLE *sort_form;
- volatile THD::killed_state *killed= ¤t_thd->killed;
+ THD *thd= current_thd;
+ volatile THD::killed_state *killed= &thd->killed;
handler *file;
MY_BITMAP *save_read_set, *save_write_set;
DBUG_ENTER("find_all_keys");
@@ -547,6 +548,9 @@
}
else
file->unlock_row();
+ /* It does not make sense to read more keys in case of a fatal error */
+ if (thd->net.report_error)
+ DBUG_RETURN(HA_POS_ERROR);
}
if (quick_select)
{
--- 1.293/sql/handler.cc 2007-01-29 01:47:30 +02:00
+++ 1.294/sql/handler.cc 2007-02-03 00:22:12 +02:00
@@ -13,8 +13,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/** @file handler.cc
-/* Handler-calling-functions */
+ @brief
+ Handler-calling-functions
+*/
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
@@ -74,17 +77,16 @@
uint known_extensions_id= 0;
-/*
+/** @brief
Return the default storage engine handlerton for thread
-
+
SYNOPSIS
ha_default_handlerton(thd)
thd current thread
-
+
RETURN
pointer to handlerton
*/
-
handlerton *ha_default_handlerton(THD *thd)
{
return (thd->variables.table_type != NULL) ?
@@ -94,7 +96,7 @@
}
-/*
+/** @brief
Return the storage engine handlerton for the supplied name
SYNOPSIS
@@ -105,7 +107,6 @@
RETURN
pointer to handlerton
*/
-
handlerton *ha_resolve_by_name(THD *thd, const LEX_STRING *name)
{
const LEX_STRING *table_alias;
@@ -184,8 +185,9 @@
}
-/* Use other database handler if databasehandler is not compiled in */
-
+/** @brief
+ Use other database handler if databasehandler is not compiled in
+*/
handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
bool no_substitute, bool report_error)
{
@@ -265,7 +267,7 @@
#endif
-/*
+/** @brief
Register handler error messages for use with my_error().
SYNOPSIS
@@ -275,7 +277,6 @@
0 OK
!= 0 Error
*/
-
static int ha_init_errors(void)
{
#define SETMSG(nr, msg) errmsgs[(nr) - HA_ERR_FIRST]= (msg)
@@ -335,7 +336,7 @@
}
-/*
+/** @brief
Unregister handler error messages.
SYNOPSIS
@@ -345,7 +346,6 @@
0 OK
!= 0 Error
*/
-
static int ha_finish_errors(void)
{
const char **errmsgs;
@@ -553,7 +553,9 @@
}
-/* don't bother to rollback here, it's done already */
+/** @brief
+ don't bother to rollback here, it's done already
+*/
void ha_close_connection(THD* thd)
{
plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0);
@@ -562,7 +564,7 @@
/* ========================================================================
======================= TRANSACTIONS ===================================*/
-/*
+/** @brief
Register a storage engine for a transaction
DESCRIPTION
@@ -604,7 +606,7 @@
DBUG_VOID_RETURN;
}
-/*
+/** @brief
RETURN
0 - ok
1 - error, transaction was rolled back
@@ -644,7 +646,7 @@
DBUG_RETURN(error);
}
-/*
+/** @brief
RETURN
0 - ok
1 - transaction was rolled back
@@ -741,7 +743,7 @@
DBUG_RETURN(error);
}
-/*
+/** @brief
NOTE - this function does not care about global read lock.
A caller should.
*/
@@ -850,7 +852,7 @@
DBUG_RETURN(error);
}
-/*
+/** @brief
This is used to commit or rollback a single statement depending on the value
of error. Note that if the autocommit is on, then the following call inside
InnoDB will commit or rollback the whole transaction (= the statement). The
@@ -858,7 +860,6 @@
the user has used LOCK TABLES then that mechanism does not know to do the
commit.
*/
-
int ha_autocommit_or_rollback(THD *thd, int error)
{
DBUG_ENTER("ha_autocommit_or_rollback");
@@ -976,7 +977,7 @@
}
#endif
-/*
+/** @brief
recover() step of xa
NOTE
@@ -995,7 +996,6 @@
in this case commit_list==0, tc_heuristic_recover == 0
there should be no prepared transactions in this case.
*/
-
struct xarecover_st
{
int len, found_foreign_xids, found_my_xids;
@@ -1127,7 +1127,7 @@
DBUG_RETURN(0);
}
-/*
+/** @brief
return the list of XID's to a client, the same way SHOW commands do
NOTE
@@ -1176,7 +1176,7 @@
DBUG_RETURN(0);
}
-/*
+/** @brief
This function should be called when MySQL sends rows of a SELECT result set
or the EOF mark to the client. It releases a possible adaptive hash index
S-latch held by thd in InnoDB and also releases a possible InnoDB query
@@ -1192,7 +1192,6 @@
thd: the thread handle of the current connection
return value: always 0
*/
-
static my_bool release_temporary_latches(THD *thd, st_plugin_int *plugin,
void *unused)
{
@@ -1259,12 +1258,11 @@
DBUG_RETURN(error);
}
-/*
+/** @brief
note, that according to the sql standard (ISO/IEC 9075-2:2003)
section "4.33.4 SQL-statements and transaction states",
SAVEPOINT is *not* transaction-initiating SQL-statement
*/
-
int ha_savepoint(THD *thd, SAVEPOINT *sv)
{
int error=0;
@@ -1379,11 +1377,10 @@
return FALSE;
}
-/*
+/** @brief
This should return ENOENT if the file doesn't exists.
The .frm file will be deleted only if we return 0 or ENOENT
*/
-
int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
const char *db, const char *alias, bool generate_warning)
{
@@ -1506,14 +1503,13 @@
return TRUE;
}
-/*
+/** @brief
Open database-handler.
IMPLEMENTATION
Try O_RDONLY if cannot open as O_RDWR
Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set
*/
-
int handler::ha_open(TABLE *table_arg, const char *name, int mode,
int test_if_locked)
{
@@ -1561,12 +1557,11 @@
}
-/*
+/** @brief
Read first row (only) from a table
This is never called for InnoDB tables, as these table types
has the HA_STATS_RECORDS_IS_EXACT set.
*/
-
int handler::read_first_row(byte * buf, uint primary_key)
{
register int error;
@@ -1597,7 +1592,7 @@
DBUG_RETURN(error);
}
-/*
+/** @brief
Generate the next auto-increment number based on increment and offset:
computes the lowest number
- strictly greater than "nr"
@@ -1608,7 +1603,6 @@
If increment=10 and offset=5 and previous number is 1, we get:
1,5,15,25,35,...
*/
-
inline ulonglong
compute_next_insert_id(ulonglong nr,struct system_variables *variables)
{
@@ -1634,7 +1628,7 @@
}
-/*
+/** @brief
Computes the largest number X:
- smaller than or equal to "nr"
- of the form: auto_increment_offset + N * auto_increment_increment
@@ -1649,7 +1643,6 @@
RETURN
The number X if it exists, "nr" otherwise.
*/
-
inline ulonglong
prev_insert_id(ulonglong nr, struct system_variables *variables)
{
@@ -1918,7 +1911,7 @@
}
-/*
+/** @brief
MySQL signal that it changed the column bitmap
USAGE
@@ -1931,7 +1924,6 @@
rnd_init() call is made as after this, MySQL will not use the bitmap
for any program logic checking.
*/
-
void handler::column_bitmaps_signal()
{
DBUG_ENTER("column_bitmaps_signal");
@@ -1941,7 +1933,7 @@
}
-/*
+/** @brief
Reserves an interval of auto_increment values from the handler.
SYNOPSIS
@@ -1958,7 +1950,6 @@
If the function sets *nb_reserved_values to ULONGLONG_MAX it means it has
reserved to "positive infinite".
*/
-
void handler::get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
@@ -2056,7 +2047,7 @@
}
-/*
+/** @brief
Print error that we got from handler function
NOTE
@@ -2065,7 +2056,6 @@
table->s->path
table->alias
*/
-
void handler::print_error(int error, myf errflag)
{
DBUG_ENTER("handler::print_error");
@@ -2251,7 +2241,7 @@
}
-/*
+/** @brief
Return an error message specific to this handler
SYNOPSIS
@@ -2259,8 +2249,7 @@
buf Pointer to String where to add error message
Returns true if this is a temporary error
- */
-
+*/
bool handler::get_error_message(int error, String* buf)
{
return FALSE;
@@ -2365,8 +2354,8 @@
-/* Return key if error because of duplicated keys */
-
+/** @brief
+ Return key if error because of duplicated keys */
uint handler::get_dup_key(int error)
{
DBUG_ENTER("handler::get_dup_key");
@@ -2379,7 +2368,7 @@
}
-/*
+/** @brief
Delete all files with extension from bas_ext()
SYNOPSIS
@@ -2395,7 +2384,6 @@
didn't get any other errors than ENOENT
# Error
*/
-
int handler::delete_table(const char *name)
{
int error= 0;
@@ -2441,7 +2429,7 @@
}
-/*
+/** @brief
Performs checks upon the table.
SYNOPSIS
@@ -2457,7 +2445,6 @@
HA_ADMIN_NEEDS_ALTER Table has structures requiring ALTER TABLE
HA_ADMIN_NOT_IMPLEMENTED
*/
-
int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
{
int error;
@@ -2491,7 +2478,7 @@
}
-/*
+/** @brief
Tell the storage engine that it is allowed to "disable transaction" in the
handler. It is a hint that ACID is not required - it is used in NDB for
ALTER TABLE, for example, when data are copied to temporary table.
@@ -2499,7 +2486,6 @@
starts to commit every now and then automatically.
This hint can be safely ignored.
*/
-
int ha_enable_transaction(THD *thd, bool on)
{
int error=0;
@@ -2560,7 +2546,7 @@
** Some general functions that isn't in the handler class
****************************************************************************/
-/*
+/** @brief
Initiates table-file and calls appropriate database-creator
NOTES
@@ -2571,7 +2557,6 @@
0 ok
1 error
*/
-
int ha_create_table(THD *thd, const char *path,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
@@ -2615,7 +2600,7 @@
DBUG_RETURN(error != 0);
}
-/*
+/** @brief
Try to discover table from engine
NOTES
@@ -2627,7 +2612,6 @@
> 0 Error, table existed but could not be created
*/
-
int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
{
int error;
@@ -2702,9 +2686,9 @@
call to ha_init_key_cache() (probably out of memory)
*****************************************************************************/
-/* Init a key cache if it has not been initied before */
-
-
+/** @brief
+ Init a key cache if it has not been initied before
+*/
int ha_init_key_cache(const char *name, KEY_CACHE *key_cache)
{
DBUG_ENTER("ha_init_key_cache");
@@ -2726,8 +2710,9 @@
}
-/* Resize key cache */
-
+/** @brief
+ Resize key cache
+*/
int ha_resize_key_cache(KEY_CACHE *key_cache)
{
DBUG_ENTER("ha_resize_key_cache");
@@ -2748,8 +2733,9 @@
}
-/* Change parameters for key cache (like size) */
-
+/** @brief
+ Change parameters for key cache (like size)
+*/
int ha_change_key_cache_param(KEY_CACHE *key_cache)
{
if (key_cache->key_cache_inited)
@@ -2763,16 +2749,18 @@
return 0;
}
-/* Free memory allocated by a key cache */
-
+/** @brief
+ Free memory allocated by a key cache
+*/
int ha_end_key_cache(KEY_CACHE *key_cache)
{
end_key_cache(key_cache, 1); // Can never fail
return 0;
}
-/* Move all tables from one key cache to another one */
-
+/** @brief
+ Move all tables from one key cache to another one
+*/
int ha_change_key_cache(KEY_CACHE *old_key_cache,
KEY_CACHE *new_key_cache)
{
@@ -2781,7 +2769,7 @@
}
-/*
+/** @brief
Try to discover one table from handler(s)
RETURN
@@ -2789,7 +2777,6 @@
0 : OK. In this case *frmblob and *frmlen are set
>0 : error. frmblob and frmlen may not be set
*/
-
struct st_discover_args
{
const char *db;
@@ -2833,7 +2820,7 @@
}
-/*
+/** @brief
Call this function in order to give the handler the possibility
to ask engine if there are any new tables that should be written to disk
or any dropped tables that need to be removed from disk
@@ -2879,7 +2866,7 @@
}
-/*
+/** @brief
Ask handler if the table exists in engine
RETURN
@@ -2887,8 +2874,7 @@
1 Table exists
# Error code
- */
-
+*/
struct st_table_exists_in_engine_args
{
const char *db;
@@ -2940,7 +2926,7 @@
void *arg;
};
-/*
+/** @brief
Listing handlertons first to avoid recursive calls and deadlock
*/
static my_bool binlog_func_list(THD *thd, st_plugin_int *plugin, void *arg)
@@ -3058,7 +3044,7 @@
}
#endif
-/*
+/** @brief
Read the first row of a multi-range set.
SYNOPSIS
@@ -3082,7 +3068,6 @@
HA_ERR_END_OF_FILE No rows in range
# Error code
*/
-
int handler::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
KEY_MULTI_RANGE *ranges, uint range_count,
bool sorted, HANDLER_BUFFER *buffer)
@@ -3115,7 +3100,7 @@
}
-/*
+/** @brief
Read the next row of a multi-range set.
SYNOPSIS
@@ -3133,7 +3118,6 @@
HA_ERR_END_OF_FILE No (more) rows in range
# Error code
*/
-
int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
{
int result;
@@ -3186,7 +3170,7 @@
}
-/*
+/** @brief
Read first row between two ranges.
Store ranges for future calls to read_range_next
@@ -3205,7 +3189,6 @@
HA_ERR_END_OF_FILE No rows in range
# Error code
*/
-
int handler::read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_range_arg, bool sorted)
@@ -3240,7 +3223,7 @@
}
-/*
+/** @brief
Read next row between two ranges.
SYNOPSIS
@@ -3254,7 +3237,6 @@
HA_ERR_END_OF_FILE No rows in range
# Error code
*/
-
int handler::read_range_next()
{
int result;
@@ -3274,7 +3256,7 @@
}
-/*
+/** @brief
Compare if found key (in row) is over max-value
SYNOPSIS
@@ -3291,7 +3273,6 @@
-1 Key is less than range
1 Key is larger than range
*/
-
int handler::compare_key(key_range *range)
{
int cmp;
@@ -3315,7 +3296,7 @@
}
-/*
+/** @brief
Returns a list of all known extensions.
SYNOPSIS
@@ -3329,7 +3310,6 @@
RETURN VALUE
pointer pointer to TYPELIB structure
*/
-
static my_bool exts_handlerton(THD *unused, st_plugin_int *plugin,
void *arg)
{
@@ -3490,7 +3470,7 @@
}
}
-/*
+/** @brief
Write table maps for all (manually or automatically) locked tables
to the binary log.
@@ -3511,7 +3491,7 @@
SEE ALSO
THD::lock
THD::locked_tables
- */
+*/
namespace
{
int write_locked_table_maps(THD *thd)
@@ -3634,10 +3614,9 @@
}
-/*
+/** @brief
Check handler usage and reset state of file to after 'open'
*/
-
int handler::ha_reset()
{
DBUG_ENTER("ha_reset");
@@ -3694,12 +3673,11 @@
-/*
+/** @brief
use_hidden_primary_key() is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key
*/
-
void handler::use_hidden_primary_key()
{
/* fallback to use all columns in the table to identify row */
@@ -3707,11 +3685,10 @@
}
-/*
+/** @brief
Dummy function which accept information about log files which is not need
by handlers
*/
-
void signal_log_not_needed(struct handlerton, char *log_file)
{
DBUG_ENTER("signal_log_not_needed");
@@ -3767,12 +3744,11 @@
#define fl_dir FN_ROOTDIR
-/*
+/** @brief
Dummy function to return log status should be replaced by function which
really detect the log status and check that the file is a log of this
handler.
*/
-
enum log_status fl_get_log_status(char *log)
{
MY_STAT stat_buff;
@@ -3812,7 +3788,7 @@
}
-/*
+/** @brief
returns buffer, to be assigned in handler_iterator struct
*/
enum handler_create_iterator_result
--- 1.233/sql/item.cc 2007-01-29 01:51:38 +02:00
+++ 1.234/sql/item.cc 2007-02-03 00:22:12 +02:00
@@ -1266,7 +1266,10 @@
if (type() == SUM_FUNC_ITEM && skip_registered &&
((Item_sum *) this)->ref_by)
return;
- if (type() != SUM_FUNC_ITEM && with_sum_func)
+ if ((type() != SUM_FUNC_ITEM && with_sum_func) ||
+ (type() == FUNC_ITEM &&
+ (((Item_func *) this)->functype() == Item_func::ISNOTNULLTEST_FUNC ||
+ ((Item_func *) this)->functype() == Item_func::TRIG_COND_FUNC)))
{
/* Will split complicated items and ignore simple ones */
split_sum_func(thd, ref_pointer_array, fields);
--- 1.350/sql/item_func.cc 2007-01-29 01:51:38 +02:00
+++ 1.351/sql/item_func.cc 2007-02-03 00:22:13 +02:00
@@ -3085,7 +3085,13 @@
int count;
bool locked;
pthread_cond_t cond;
+#ifndef EMBEDDED_LIBRARY
pthread_t thread;
+ void set_thread(THD *thd) { thread= thd->real_id; }
+#else
+ THD *thread;
+ void set_thread(THD *thd) { thread= thd; }
+#endif /*EMBEDDED_LIBRARY*/
ulong thread_id;
User_level_lock(const char *key_arg,uint length, ulong id)
@@ -3239,7 +3245,7 @@
else
{
ull->locked=1;
- ull->thread=thd->real_id;
+ ull->set_thread(thd);
thd->ull=ull;
}
pthread_mutex_unlock(&LOCK_user_locks);
@@ -3314,7 +3320,7 @@
null_value=1; // Probably out of memory
return 0;
}
- ull->thread=thd->real_id;
+ ull->set_thread(thd);
thd->ull=ull;
pthread_mutex_unlock(&LOCK_user_locks);
return 1; // Got new lock
@@ -3355,7 +3361,7 @@
else // We got the lock
{
ull->locked=1;
- ull->thread=thd->real_id;
+ ull->set_thread(thd);
ull->thread_id= thd->thread_id;
thd->ull=ull;
error=0;
@@ -3404,7 +3410,7 @@
else
{
#ifdef EMBEDDED_LIBRARY
- if (ull->locked && pthread_equal(current_thd->real_id,ull->thread))
+ if (ull->locked && (current_thd == ull->thread))
#else
if (ull->locked && pthread_equal(pthread_self(),ull->thread))
#endif
--- 1.153/sql/item_timefunc.cc 2007-01-24 19:56:59 +02:00
+++ 1.154/sql/item_timefunc.cc 2007-02-03 00:22:13 +02:00
@@ -1007,7 +1007,8 @@
{
DBUG_ASSERT(fixed == 1);
TIME ltime;
- (void) get_arg0_date(<ime, TIME_FUZZY_DATE);
+ if (get_arg0_date(<ime, TIME_FUZZY_DATE))
+ return 0;
return (longlong) ((ltime.month+2)/3);
}
@@ -1647,6 +1648,7 @@
{
DBUG_ASSERT(fixed == 1);
TIME ltime;
+ longlong arg_val= args[0]->val_int();
if ((null_value=args[0]->null_value) || str->alloc(19))
{
@@ -1654,7 +1656,7 @@
return (String*) 0;
}
- sec_to_time(args[0]->val_int(), args[0]->unsigned_flag, <ime);
+ sec_to_time(arg_val, args[0]->unsigned_flag, <ime);
make_time((DATE_TIME_FORMAT *) 0, <ime, str);
return str;
@@ -1665,11 +1667,12 @@
{
DBUG_ASSERT(fixed == 1);
TIME ltime;
+ longlong arg_val= args[0]->val_int();
if ((null_value=args[0]->null_value))
return 0;
- sec_to_time(args[0]->val_int(), args[0]->unsigned_flag, <ime);
+ sec_to_time(arg_val, args[0]->unsigned_flag, <ime);
return (ltime.neg ? -1 : 1) *
((ltime.hour)*10000 + ltime.minute*100 + ltime.second);
--- 1.474/sql/mysql_priv.h 2007-01-29 01:51:38 +02:00
+++ 1.475/sql/mysql_priv.h 2007-02-03 00:22:13 +02:00
@@ -1151,7 +1151,8 @@
TABLE_LIST *left_op,
TABLE_LIST *right_op);
void add_join_on(TABLE_LIST *b,Item *expr);
-void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields);
+void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
+ SELECT_LEX *lex);
bool add_proc_to_list(THD *thd, Item *item);
TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
void update_non_unique_table_error(TABLE_LIST *update,
--- 1.611/sql/mysqld.cc 2007-01-29 01:51:38 +02:00
+++ 1.612/sql/mysqld.cc 2007-02-03 00:58:05 +02:00
@@ -2637,6 +2637,14 @@
max_system_variables.pseudo_thread_id= (ulong)~0;
server_start_time= time((time_t*) 0);
+ rpl_filter= new Rpl_filter;
+ binlog_filter= new Rpl_filter;
+ if (!rpl_filter || !binlog_filter)
+ {
+ sql_perror("Could not allocate replication and binlog filters");
+ exit(1);
+ }
+
if (init_thread_environment())
return 1;
mysql_init_variables();
@@ -3502,14 +3510,6 @@
{
MY_INIT(argv[0]); // init my_sys library & pthreads
/* nothing should come before this line ^^^ */
-
- rpl_filter= new Rpl_filter;
- binlog_filter= new Rpl_filter;
- if (!rpl_filter || !binlog_filter)
- {
- sql_perror("Could not allocate replication and binlog filters");
- exit(1);
- }
/*
Perform basic logger initialization logger. Should be called after
--- 1.259/sql/opt_range.cc 2007-01-29 01:51:38 +02:00
+++ 1.260/sql/opt_range.cc 2007-02-03 00:22:14 +02:00
@@ -219,6 +219,8 @@
}
inline void merge_flags(SEL_ARG *arg) { maybe_flag|=arg->maybe_flag; }
inline void maybe_smaller() { maybe_flag=1; }
+ /* Return true iff it's a single-point null interval */
+ inline bool is_null_interval() { return maybe_null && max_value[0] == 1; }
inline int cmp_min_to_min(SEL_ARG* arg)
{
return sel_cmp(field,min_value, arg->min_value, min_flag, arg->min_flag);
@@ -560,6 +562,7 @@
bool is_ror_scan;
/* Number of ranges in the last checked tree->key */
uint n_ranges;
+ uint8 first_null_comp; /* first null component if any, 0 - otherwise */
};
class TABLE_READ_PLAN;
@@ -7008,6 +7011,7 @@
DBUG_ENTER("check_quick_select");
param->is_ror_scan= FALSE;
+ param->first_null_comp= 0;
if (!tree)
DBUG_RETURN(HA_POS_ERROR); // Can't use it
@@ -7108,6 +7112,7 @@
ha_rows records=0, tmp;
uint tmp_min_flag, tmp_max_flag, keynr, min_key_length, max_key_length;
char *tmp_min_key, *tmp_max_key;
+ uint8 save_first_null_comp= param->first_null_comp;
param->max_key_part=max(param->max_key_part,key_tree->part);
if (key_tree->left != &null_element)
@@ -7145,6 +7150,9 @@
param->is_ror_scan= FALSE;
}
+ if (!param->first_null_comp && key_tree->is_null_interval())
+ param->first_null_comp= key_tree->part+1;
+
if (key_tree->next_key_part &&
key_tree->next_key_part->part == key_tree->part+1 &&
key_tree->next_key_part->type == SEL_ARG::KEY_RANGE)
@@ -7188,7 +7196,8 @@
(param->table->key_info[keynr].flags & (HA_NOSAME | HA_END_SPACE_KEY)) ==
HA_NOSAME &&
min_key_length == max_key_length &&
- !memcmp(param->min_key,param->max_key,min_key_length))
+ !memcmp(param->min_key,param->max_key,min_key_length) &&
+ !param->first_null_comp)
{
tmp=1; // Max one record
param->n_ranges++;
@@ -7263,6 +7272,7 @@
return tmp;
records+=tmp;
}
+ param->first_null_comp= save_first_null_comp;
return records;
}
--- 1.259/sql/sql_lex.h 2007-01-29 01:51:39 +02:00
+++ 1.260/sql/sql_lex.h 2007-02-03 00:22:14 +02:00
@@ -621,6 +621,21 @@
/* index in the select list of the expression currently being fixed */
int cur_pos_in_select_list;
+ List<udf_func> udf_list; /* udf function calls stack */
+ /*
+ This is a copy of the original JOIN USING list that comes from
+ the parser. The parser :
+ 1. Sets the natural_join of the second TABLE_LIST in the join
+ and the st_select_lex::prev_join_using.
+ 2. Makes a parent TABLE_LIST and sets its is_natural_join/
+ join_using_fields members.
+ 3. Uses the wrapper TABLE_LIST as a table in the upper level.
+ We cannot assign directly to join_using_fields in the parser because
+ at stage (1.) the parent TABLE_LIST is not constructed yet and
+ the assignment will override the JOIN USING fields of the lower level
+ joins on the right.
+ */
+ List<String> *prev_join_using;
void init_query();
void init_select();
st_select_lex_unit* master_unit();
--- 1.622/sql/sql_parse.cc 2007-01-30 13:52:23 +02:00
+++ 1.623/sql/sql_parse.cc 2007-02-03 00:22:15 +02:00
@@ -3558,7 +3558,7 @@
break;
}
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if (check_one_table_access(thd, DELETE_ACL, all_tables))
+ if (check_one_table_access(thd, DROP_ACL, all_tables))
goto error;
/*
Don't allow this within a transaction because we want to use
@@ -6668,11 +6668,8 @@
If this is a JOIN ... USING, move the list of joined fields to the
table reference that describes the join.
*/
- if (table->join_using_fields)
- {
- ptr->join_using_fields= table->join_using_fields;
- table->join_using_fields= NULL;
- }
+ if (prev_join_using)
+ ptr->join_using_fields= prev_join_using;
}
}
join_list->push_front(ptr);
@@ -6928,6 +6925,7 @@
a Left join argument
b Right join argument
using_fields Field names from USING clause
+ lex The current st_select_lex
IMPLEMENTATION
This function marks that table b should be joined with a either via
@@ -6956,10 +6954,11 @@
None
*/
-void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields)
+void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
+ SELECT_LEX *lex)
{
b->natural_join= a;
- b->join_using_fields= using_fields;
+ lex->prev_join_using= using_fields;
}
--- 1.486/sql/sql_select.cc 2007-01-29 01:51:39 +02:00
+++ 1.487/sql/sql_select.cc 2007-02-03 00:22:16 +02:00
@@ -716,11 +716,20 @@
{
int res;
/*
- opt_sum_query() returns -1 if no rows match to the WHERE conditions,
- or 1 if all items were resolved, or 0, or an error number HA_ERR_...
+ opt_sum_query() returns HA_ERR_KEY_NOT_FOUND if no rows match
+ to the WHERE conditions,
+ or 1 if all items were resolved,
+ or 0, or an error number HA_ERR_...
*/
if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
{
+ if (res == HA_ERR_KEY_NOT_FOUND)
+ {
+ DBUG_PRINT("info",("No matching min/max row"));
+ zero_result_cause= "No matching min/max row";
+ error=0;
+ DBUG_RETURN(0);
+ }
if (res > 1)
{
thd->fatal_error();
@@ -728,13 +737,6 @@
DBUG_PRINT("error",("Error from opt_sum_query"));
DBUG_RETURN(1);
}
- if (res < 0)
- {
- DBUG_PRINT("info",("No matching min/max row"));
- zero_result_cause= "No matching min/max row";
- error=0;
- DBUG_RETURN(0);
- }
DBUG_PRINT("info",("Select tables optimized away"));
zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
@@ -864,6 +866,13 @@
{
ORDER *org_order= order;
order=remove_const(this, order,conds,1, &simple_order);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
+
/*
If we are using ORDER BY NULL or ORDER BY const_expression,
return result in any order (even if we are using a GROUP BY)
@@ -873,10 +882,11 @@
}
/*
Check if we can optimize away GROUP BY/DISTINCT.
- We can do that if there are no aggregate functions and the
+ We can do that if there are no aggregate functions, the
fields in DISTINCT clause (if present) and/or columns in GROUP BY
(if present) contain direct references to all key parts of
- an unique index (in whatever order).
+ an unique index (in whatever order) and if the key parts of the
+ unique index cannot contain NULLs.
Note that the unique keys for DISTINCT and GROUP BY should not
be the same (as long as they are unique).
@@ -971,6 +981,12 @@
group_list= remove_const(this, (old_group_list= group_list), conds,
rollup.state == ROLLUP::STATE_NONE,
&simple_group);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
if (old_group_list && !group_list)
select_distinct= 0;
}
@@ -987,6 +1003,12 @@
{
group_list= procedure->group= remove_const(this, procedure->group, conds,
1, &simple_group);
+ if (thd->net.report_error)
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from remove_const"));
+ DBUG_RETURN(1);
+ }
calc_group_buffer(this, group_list);
}
@@ -6583,6 +6605,8 @@
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
+ if (order->item[0]->with_subselect)
+ order->item[0]->val_str(&order->item[0]->str_value);
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue; // skip const item
}
@@ -12112,7 +12136,7 @@
/*
- Check if GROUP BY/DISTINCT can be optimized away because the set is
+ Check if GROUP BY/DISTINCT can be optimized away because the set is
already known to be distinct.
SYNOPSIS
@@ -12120,7 +12144,7 @@
table The table to operate on.
find_func function to iterate over the list and search
for a field
-
+
DESCRIPTION
Used in removing the GROUP BY/DISTINCT of the following types of
statements:
@@ -12131,12 +12155,13 @@
then <any combination of a,b,c>,{whatever} is also distinct
This function checks if all the key parts of any of the unique keys
- of the table are referenced by a list : either the select list
+ of the table are referenced by a list : either the select list
through find_field_in_item_list or GROUP BY list through
find_field_in_order_list.
- If the above holds then we can safely remove the GROUP BY/DISTINCT,
+ If the above holds and the key parts cannot contain NULLs then we
+ can safely remove the GROUP BY/DISTINCT,
as no result set can be more distinct than an unique key.
-
+
RETURN VALUE
1 found
0 not found.
@@ -12159,7 +12184,8 @@
key_part < key_part_end;
key_part++)
{
- if (!find_func(key_part->field, data))
+ if (key_part->field->maybe_null() ||
+ !find_func(key_part->field, data))
break;
}
if (key_part == key_part_end)
@@ -12267,13 +12293,14 @@
DBUG_ENTER("test_if_skip_sort_order");
LINT_INIT(ref_key_parts);
+ /* Check which keys can be used to resolve ORDER BY. */
+ usable_keys= table->keys_in_use_for_query;
+
/*
- Check which keys can be used to resolve ORDER BY.
- We must not try to use disabled keys.
+ Keys disabled by ALTER TABLE ... DISABLE KEYS should have already
+ been taken into account.
*/
- usable_keys= table->s->keys_in_use;
- /* we must not consider keys that are disabled by IGNORE INDEX */
- usable_keys.intersect(table->keys_in_use_for_query);
+ DBUG_ASSERT(usable_keys.is_subset(table->s->keys_in_use));
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
--- 1.389/sql/sql_show.cc 2007-02-02 14:57:05 +02:00
+++ 1.390/sql/sql_show.cc 2007-02-03 00:22:16 +02:00
@@ -32,7 +32,6 @@
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
#endif
-
enum enum_i_s_events_fields
{
ISE_EVENT_CATALOG= 0,
@@ -57,11 +56,11 @@
};
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
static const char *grant_names[]={
"select","insert","update","delete","create","drop","reload","shutdown",
"process","file","grant","references","index","alter"};
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
"grant_types",
grant_names, NULL};
@@ -140,7 +139,6 @@
{
TABLE *table= (TABLE*) arg;
struct st_mysql_plugin *plug= plugin->plugin;
- Protocol *protocol= thd->protocol;
CHARSET_INFO *cs= system_charset_info;
char version_buf[20];
@@ -153,8 +151,7 @@
cs);
- switch (plugin->state)
- {
+ switch (plugin->state) {
/* case PLUGIN_IS_FREED: does not happen */
case PLUGIN_IS_DELETED:
table->field[2]->store(STRING_WITH_LEN("DELETED"), cs);
@@ -688,10 +685,10 @@
bool mysqld_show_create_db(THD *thd, char *dbname,
HA_CREATE_INFO *create_info)
{
- Security_context *sctx= thd->security_ctx;
char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *sctx= thd->security_ctx;
uint db_access;
#endif
HA_CREATE_INFO create;
@@ -1020,7 +1017,7 @@
HA_CREATE_INFO *create_info_arg)
{
List<Item> field_list;
- char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], *end;
+ char tmp[MAX_FIELD_WIDTH], *for_str, buff[128];
const char *alias;
String type(tmp, sizeof(tmp), system_charset_info);
Field **ptr,*field;
@@ -1307,8 +1304,9 @@
but may extrapolate its existence from that of an AUTO_INCREMENT column.
*/
- if(create_info.auto_increment_value > 1)
+ if (create_info.auto_increment_value > 1)
{
+ char *end;
packet->append(STRING_WITH_LEN(" AUTO_INCREMENT="));
end= longlong10_to_str(create_info.auto_increment_value, buff,10);
packet->append(buff, (uint) (end - buff));
@@ -1338,6 +1336,7 @@
if (share->min_rows)
{
+ char *end;
packet->append(STRING_WITH_LEN(" MIN_ROWS="));
end= longlong10_to_str(share->min_rows, buff, 10);
packet->append(buff, (uint) (end- buff));
@@ -1345,6 +1344,7 @@
if (share->max_rows && !table_list->schema_table)
{
+ char *end;
packet->append(STRING_WITH_LEN(" MAX_ROWS="));
end= longlong10_to_str(share->max_rows, buff, 10);
packet->append(buff, (uint) (end - buff));
@@ -1352,6 +1352,7 @@
if (share->avg_row_length)
{
+ char *end;
packet->append(STRING_WITH_LEN(" AVG_ROW_LENGTH="));
end= longlong10_to_str(share->avg_row_length, buff,10);
packet->append(buff, (uint) (end - buff));
@@ -1372,6 +1373,7 @@
}
if (table->s->key_block_size)
{
+ char *end;
packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
end= longlong10_to_str(table->s->key_block_size, buff, 10);
packet->append(buff, (uint) (end - buff));
@@ -2067,7 +2069,7 @@
if (show_type == SHOW_SYS)
{
- show_type= ((sys_var*) value)->type();
+ show_type= ((sys_var*) value)->show_type();
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
&null_lex_str);
}
@@ -2120,7 +2122,7 @@
end= strend(pos);
break;
}
- case SHOW_CHAR_PTR:
+ case SHOW_CHAR_PTR:
{
if (!(pos= *(char**) value))
pos= "";
@@ -2541,19 +2543,21 @@
List<char> bases;
List_iterator_fast<char> it(bases);
COND *partial_cond;
- Security_context *sctx= thd->security_ctx;
uint derived_tables= lex->derived_tables;
int error= 1;
enum legacy_db_type not_used;
Open_tables_state open_tables_state_backup;
bool save_view_prepare_mode= lex->view_prepare_mode;
Query_tables_list query_tables_list_backup;
- lex->view_prepare_mode= TRUE;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *sctx= thd->security_ctx;
+#endif
DBUG_ENTER("get_all_tables");
LINT_INIT(end);
LINT_INIT(len);
+ lex->view_prepare_mode= TRUE;
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
/*
@@ -2792,7 +2796,9 @@
bool with_i_schema;
HA_CREATE_INFO create;
TABLE *table= tables->table;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
+#endif
DBUG_ENTER("fill_schema_shemata");
if (make_db_list(thd, &files, &idx_field_vals,
@@ -3147,7 +3153,7 @@
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
field->real_type() == MYSQL_TYPE_STRING) // For binary type
{
- uint32 octet_max_length= field->max_length();
+ uint32 octet_max_length= field->max_display_length();
if (is_blob && octet_max_length != (uint32) 4294967295U)
octet_max_length /= field->charset()->mbmaxlen;
longlong char_max_len= is_blob ?
@@ -3177,10 +3183,10 @@
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_INT24:
- field_length= field->max_length() - 1;
+ field_length= field->max_display_length() - 1;
break;
case MYSQL_TYPE_BIT:
- field_length= field->max_length();
+ field_length= field->max_display_length();
decimals= -1; // return NULL
break;
case MYSQL_TYPE_FLOAT:
@@ -3899,8 +3905,8 @@
show_table->file->get_foreign_key_list(thd, &f_key_list);
FOREIGN_KEY_INFO *f_key_info;
- List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
- while ((f_key_info= it++))
+ List_iterator_fast<FOREIGN_KEY_INFO> fkey_it(f_key_list);
+ while ((f_key_info= fkey_it++))
{
LEX_STRING *f_info;
LEX_STRING *r_info;
@@ -4064,7 +4070,6 @@
partition_element *part_elem;
List_iterator<partition_element> part_it(part_info->partitions);
uint part_pos= 0, part_id= 0;
- uint no_parts= part_info->no_parts;
restore_record(table, s->default_values);
table->field[1]->store(base_name, strlen(base_name), cs);
@@ -4234,6 +4239,7 @@
}
+#ifdef NOT_USED
static interval_type get_real_interval_type(interval_type i_type)
{
switch (i_type) {
@@ -4277,6 +4283,8 @@
return INTERVAL_SECOND;
}
+#endif
+
/*
Loads an event from mysql.event and copies it's data to a row of
@@ -5121,7 +5129,6 @@
int fill_schema_files(THD *thd, TABLE_LIST *tables, COND *cond)
{
- TABLE *table= tables->table;
DBUG_ENTER("fill_schema_files");
struct run_hton_fill_schema_files_args args;
@@ -5179,7 +5186,7 @@
if (show_type == SHOW_SYS)
{
- show_type= ((sys_var*) value)->type();
+ show_type= ((sys_var*) value)->show_type();
value= (char*) ((sys_var*) value)->value_ptr(thd, OPT_GLOBAL,
&null_lex_str);
}
--- 1.536/sql/sql_yacc.yy 2007-01-29 01:51:40 +02:00
+++ 1.537/sql/sql_yacc.yy 2007-02-03 00:22:17 +02:00
@@ -7111,11 +7111,11 @@
YYERROR_UNLESS($1 && $3);
}
'(' using_list ')'
- { add_join_natural($1,$3,$7); $$=$3; }
+ { add_join_natural($1,$3,$7,Select); $$=$3; }
| table_ref NATURAL JOIN_SYM table_factor
{
YYERROR_UNLESS($1 && ($$=$4));
- add_join_natural($1,$4,NULL);
+ add_join_natural($1,$4,NULL,Select);
}
/* LEFT JOIN variants */
@@ -7141,11 +7141,15 @@
YYERROR_UNLESS($1 && $5);
}
USING '(' using_list ')'
- { add_join_natural($1,$5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
+ {
+ add_join_natural($1,$5,$9,Select);
+ $5->outer_join|=JOIN_TYPE_LEFT;
+ $$=$5;
+ }
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
{
YYERROR_UNLESS($1 && $6);
- add_join_natural($1,$6,NULL);
+ add_join_natural($1,$6,NULL,Select);
$6->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
}
@@ -7178,12 +7182,12 @@
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
- add_join_natural($$,$5,$9);
+ add_join_natural($$,$5,$9,Select);
}
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
{
YYERROR_UNLESS($1 && $6);
- add_join_natural($6,$1,NULL);
+ add_join_natural($6,$1,NULL,Select);
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
--- 1.271/sql/table.cc 2007-01-29 01:51:40 +02:00
+++ 1.272/sql/table.cc 2007-02-03 00:22:17 +02:00
@@ -3430,6 +3430,7 @@
const char *Natural_join_column::table_name()
{
+ DBUG_ASSERT(table_ref);
return table_ref->alias;
}
--- 1.144/sql/item_subselect.cc 2007-01-29 16:13:14 +02:00
+++ 1.145/sql/item_subselect.cc 2007-02-03 00:22:13 +02:00
@@ -238,6 +238,10 @@
{
int res;
+ if (thd->net.report_error)
+ /* Do not execute subselect in case of a fatal error */
+ return 1;
+
res= engine->exec();
if (engine_changed)
--- 1.128/storage/archive/ha_archive.cc 2007-02-01 06:13:12 +02:00
+++ 1.129/storage/archive/ha_archive.cc 2007-02-03 00:22:17 +02:00
@@ -305,10 +305,8 @@
See ha_example.cc for a longer description.
*/
-ARCHIVE_SHARE *ha_archive::get_share(const char *table_name,
- TABLE *table, int *rc)
+ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
{
- ARCHIVE_SHARE *share;
uint length;
DBUG_ENTER("ha_archive::get_share");
@@ -381,20 +379,21 @@
Free the share.
See ha_example.cc for a description.
*/
-int ha_archive::free_share(ARCHIVE_SHARE *share_to_free)
+int ha_archive::free_share()
{
int rc= 0;
DBUG_ENTER("ha_archive::free_share");
- DBUG_PRINT("ha_archive", ("archive table %.*s has %d open handles on entrance",
- share_to_free->table_name_length, share_to_free->table_name,
- share_to_free->use_count));
+ DBUG_PRINT("ha_archive",
+ ("archive table %.*s has %d open handles on entrance",
+ share->table_name_length, share->table_name,
+ share->use_count));
pthread_mutex_lock(&archive_mutex);
- if (!--share_to_free->use_count)
+ if (!--share->use_count)
{
- hash_delete(&archive_open_tables, (byte*) share_to_free);
- thr_lock_delete(&share_to_free->lock);
- VOID(pthread_mutex_destroy(&share_to_free->mutex));
+ hash_delete(&archive_open_tables, (byte*) share);
+ thr_lock_delete(&share->lock);
+ VOID(pthread_mutex_destroy(&share->mutex));
/*
We need to make sure we don't reset the crashed state.
If we open a crashed file, wee need to close it as crashed unless
@@ -402,12 +401,12 @@
Since we will close the data down after this, we go on and count
the flush on close;
*/
- if (share_to_free->archive_write_open)
+ if (share->archive_write_open)
{
- if (azclose(&(share_to_free->archive_write)))
+ if (azclose(&(share->archive_write)))
rc= 1;
}
- my_free((gptr) share_to_free, MYF(0));
+ my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);
@@ -462,12 +461,14 @@
DBUG_PRINT("ha_archive", ("archive table was opened for crash: %s",
(open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no"));
- share= get_share(name, table, &rc);
+ share= get_share(name, &rc);
if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
{
- free_share(share);
+ /* purecov: begin inspected */
+ free_share();
DBUG_RETURN(rc);
+ /* purecov: end */
}
else if (rc == HA_ERR_OUT_OF_MEM)
{
@@ -482,7 +483,7 @@
if (!record_buffer)
{
- free_share(share);
+ free_share();
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -535,7 +536,7 @@
if (azclose(&archive))
rc= 1;
/* then also close share */
- rc|= free_share(share);
+ rc|= free_share();
DBUG_RETURN(rc);
}
@@ -837,7 +838,7 @@
{
if (!memcmp(read_buf + mfield->offset(record),
table->next_number_field->ptr,
- mfield->max_length()))
+ mfield->max_display_length()))
{
rc= HA_ERR_FOUND_DUPP_KEY;
goto error;
--- 1.2.1.2/plugin/daemon_example/daemon_example.c 2007-01-30 13:52:23 +02:00
+++ 1.5/plugin/daemon_example/daemon_example.cc 2007-02-03 00:58:05 +02:00
@@ -13,10 +13,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <mysql_priv.h>
#include <stdlib.h>
#include <ctype.h>
#include <mysql_version.h>
#include <mysql/plugin.h>
+#include <my_global.h>
+#include <my_dir.h>
/*
Disable __attribute__() on non-gcc compilers.
@@ -26,6 +29,44 @@
#endif
+#define HEART_STRING_BUFFER 100
+
+struct mysql_heartbeat_context
+{
+ pthread_t heartbeat_thread;
+ File heartbeat_file;
+};
+
+pthread_handler_t mysql_heartbeat(void *p)
+{
+ DBUG_ENTER("mysql_heartbeat");
+ struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p;
+ char buffer[HEART_STRING_BUFFER];
+ unsigned int x= 0;
+ time_t result;
+ struct tm tm_tmp;
+
+ while(1)
+ {
+ sleep(5);
+
+ result= time(NULL);
+ localtime_r(&result, &tm_tmp);
+ my_snprintf(buffer, sizeof(buffer),
+ "Heartbeat at %02d%02d%02d %2d:%02d:%02d\n",
+ tm_tmp.tm_year % 100,
+ tm_tmp.tm_mon+1,
+ tm_tmp.tm_mday,
+ tm_tmp.tm_hour,
+ tm_tmp.tm_min,
+ tm_tmp.tm_sec);
+ my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+ x++;
+ }
+
+ DBUG_RETURN(0);
+}
+
/*
Initialize the daemon example at server start or plugin installation.
@@ -33,16 +74,63 @@
daemon_example_plugin_init()
DESCRIPTION
- Does nothing.
+ Starts up heartbeatbeat thread
RETURN VALUE
0 success
1 failure (cannot happen)
*/
-static int daemon_example_plugin_init(void *p __attribute__ ((unused)))
+static int daemon_example_plugin_init(void *p)
{
- return(0);
+
+ DBUG_ENTER("daemon_example_plugin_init");
+ struct mysql_heartbeat_context *con;
+ pthread_attr_t attr; /* Thread attributes */
+ char heartbeat_filename[FN_REFLEN];
+ char buffer[HEART_STRING_BUFFER];
+ time_t result= time(NULL);
+ struct tm tm_tmp;
+
+ struct st_plugin_int *plugin= (struct st_plugin_int *)p;
+
+ con= (struct mysql_heartbeat_context *)
+ my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0));
+
+ fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log",
+ MY_REPLACE_EXT | MY_UNPACK_FILENAME);
+ unlink(heartbeat_filename);
+ con->heartbeat_file= my_open(heartbeat_filename, O_CREAT|O_RDWR, MYF(0));
+
+ /*
+ No threads exist at this point in time, so this is thread safe.
+ */
+ localtime_r(&result, &tm_tmp);
+ my_snprintf(buffer, sizeof(buffer),
+ "Starting up at %02d%02d%02d %2d:%02d:%02d\n",
+ tm_tmp.tm_year % 100,
+ tm_tmp.tm_mon+1,
+ tm_tmp.tm_mday,
+ tm_tmp.tm_hour,
+ tm_tmp.tm_min,
+ tm_tmp.tm_sec);
+ my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr,
+ PTHREAD_CREATE_JOINABLE);
+
+
+ /* now create the thread */
+ if (pthread_create(&con->heartbeat_thread, &attr, mysql_heartbeat,
+ (void *)con) != 0)
+ {
+ fprintf(stderr,"Could not create heartbeat thread!\n");
+ exit(0);
+ }
+ plugin->data= (void *)con;
+
+ DBUG_RETURN(0);
}
@@ -59,11 +147,36 @@
*/
-static int daemon_example_plugin_deinit(void *p __attribute__ ((unused)))
+static int daemon_example_plugin_deinit(void *p)
{
- return(0);
+ DBUG_ENTER("daemon_example_plugin_deinit");
+ char buffer[HEART_STRING_BUFFER];
+ struct st_plugin_int *plugin= (struct st_plugin_int *)p;
+ struct mysql_heartbeat_context *con=
+ (struct mysql_heartbeat_context *)plugin->data;
+ time_t result= time(NULL);
+ struct tm tm_tmp;
+
+ pthread_cancel(con->heartbeat_thread);
+
+ localtime_r(&result, &tm_tmp);
+ my_snprintf(buffer, sizeof(buffer),
+ "Shutting down at %02d%02d%02d %2d:%02d:%02d\n",
+ tm_tmp.tm_year % 100,
+ tm_tmp.tm_mon+1,
+ tm_tmp.tm_mday,
+ tm_tmp.tm_hour,
+ tm_tmp.tm_min,
+ tm_tmp.tm_sec);
+ my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
+ my_close(con->heartbeat_file, MYF(0));
+
+ my_free((char *)con, MYF(0));
+
+ DBUG_RETURN(0);
}
+
struct st_mysql_daemon daemon_example_plugin=
{ MYSQL_DAEMON_INTERFACE_VERSION };
@@ -77,7 +190,7 @@
&daemon_example_plugin,
"daemon_example",
"Brian Aker",
- "Daemon example that tests init and deinit of a plugin",
+ "Daemon example, creates a heartbeat beat file in mysql-heartbeat.log",
PLUGIN_LICENSE_GPL,
daemon_example_plugin_init, /* Plugin Init */
daemon_example_plugin_deinit, /* Plugin Deinit */
--- 1.43/sql/sql_plugin.cc 2007-01-27 01:36:36 +02:00
+++ 1.44/sql/sql_plugin.cc 2007-02-03 00:22:15 +02:00
@@ -53,12 +53,15 @@
0,ha_finalize_handlerton,0,0,finalize_schema_table
};
+#ifdef HAVE_DLOPEN
static const char *plugin_interface_version_sym=
"_mysql_plugin_interface_version_";
static const char *sizeof_st_plugin_sym=
"_mysql_sizeof_struct_st_plugin_";
static const char *plugin_declarations_sym= "_mysql_plugin_declarations_";
static int min_plugin_interface_version= MYSQL_PLUGIN_INTERFACE_VERSION & ~0xFF;
+#endif
+
/* Note that 'int version' must be the first field of every plugin
sub-structure (plugin->info).
*/
@@ -91,6 +94,8 @@
my_bool plugin_register_builtin(struct st_mysql_plugin *plugin);
void plugin_load(void);
+#ifdef HAVE_DLOPEN
+
static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl)
{
uint i;
@@ -128,6 +133,8 @@
DBUG_RETURN(dynamic_element(&plugin_dl_array, plugin_dl_array.elements - 1,
struct st_plugin_dl *));
}
+#endif /* HAVE_DLOPEN */
+
static inline void free_plugin_mem(struct st_plugin_dl *p)
{
@@ -545,6 +552,8 @@
DBUG_VOID_RETURN;
}
+#ifdef NOT_USED
+
static void plugin_del(const LEX_STRING *name)
{
struct st_plugin_int *plugin;
@@ -553,6 +562,8 @@
plugin_del(plugin);
DBUG_VOID_RETURN;
}
+
+#endif
void plugin_unlock(struct st_plugin_int *plugin)
{
--- 1.128/libmysqld/lib_sql.cc 2007-01-27 03:46:39 +02:00
+++ 1.129/libmysqld/lib_sql.cc 2007-02-03 00:22:12 +02:00
@@ -538,6 +538,11 @@
sql_print_error("Warning: Can't create thread to manage maintenance");
}
+ // FIXME initialize binlog_filter and rpl_filter if not already done
+ // corresponding delete is in clean_up()
+ if(!binlog_filter) binlog_filter = new Rpl_filter;
+ if(!rpl_filter) rpl_filter = new Rpl_filter;
+
if (opt_init_file)
{
if (read_init_file(opt_init_file))
@@ -593,7 +598,7 @@
thd->set_time();
thd->init_for_queries();
thd->client_capabilities= client_flag;
- thd->real_id= (pthread_t) thd;
+ thd->real_id= pthread_self();
thd->db= NULL;
thd->db_length= 0;
--- 1.69/BUILD/SETUP.sh 2007-01-29 01:57:04 +02:00
+++ 1.70/BUILD/SETUP.sh 2007-02-03 00:22:11 +02:00
@@ -143,8 +143,16 @@
#
base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex "
-base_configs="$base_configs --enable-thread-safe-client --with-readline "
+base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables"
+
+if test -d "$path/../cmd-line-utils/readline"
+then
+ base_configs="$base_configs --with-readline"
+elif test -d "$path/../cmd-line-utils/libedit"
+then
+ base_configs="$base_configs --with-libedit"
+fi
static_link="--with-mysqld-ldflags=-all-static "
static_link="$static_link --with-client-ldflags=-all-static"
| Thread |
|---|
| • bk commit into 5.1 tree (jani:1.2418) | jani | 2 Feb |