mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 15:15:34 +02:00
Added new mutex for hostname lookup
Added free of io_cache when using ALTER TABLE ... ORDER BY
This commit is contained in:
parent
b3392db290
commit
877386602a
4 changed files with 23 additions and 10 deletions
|
|
@ -15172,7 +15172,8 @@ mysql> select BIT_COUNT(29);
|
||||||
@node Logical functions, Comparison functions, Bit functions, Functions
|
@node Logical functions, Comparison functions, Bit functions, Functions
|
||||||
@subsection Logical Operations
|
@subsection Logical Operations
|
||||||
|
|
||||||
All logical functions return @code{1} (TRUE) or @code{0} (FALSE):
|
All logical functions return @code{1} (TRUE), @code{0} (FALSE) or
|
||||||
|
@code{NULL} (unknown, which is in most cases the same as FALSE):
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@findex NOT, logical
|
@findex NOT, logical
|
||||||
|
|
@ -18416,7 +18417,7 @@ swap two tables names, you have to:
|
||||||
@example
|
@example
|
||||||
RENAME TABLE old_table TO backup_table,
|
RENAME TABLE old_table TO backup_table,
|
||||||
new_table TO old_table,
|
new_table TO old_table,
|
||||||
backup_table TO old_table;
|
backup_table TO new_table;
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
As long as two databases are on the same disk you can also rename
|
As long as two databases are on the same disk you can also rename
|
||||||
|
|
@ -24566,7 +24567,8 @@ mysql> SELECT 1 IS NULL, 1 IS NOT NULL;
|
||||||
+-----------+---------------+
|
+-----------+---------------+
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
In @strong{MySQL}, 0 means false and 1 means true.
|
In @strong{MySQL}, 0 or @code{NULL} means false and anything else means true.
|
||||||
|
The default trueth value from a boolean operation is 1.
|
||||||
|
|
||||||
This special treatment of @code{NULL} is why, in the previous section, it
|
This special treatment of @code{NULL} is why, in the previous section, it
|
||||||
was necessary to determine which animals are no longer alive using
|
was necessary to determine which animals are no longer alive using
|
||||||
|
|
@ -40639,6 +40641,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
Allow @code{SELECT expression LIMIT ...}.
|
||||||
|
@item
|
||||||
|
Added @code{IDENTITY} as a synonym for @code{AUTO_INCREMENT} (like SyBase).
|
||||||
|
@item
|
||||||
Added @code{ORDER BY} syntax to @code{UPDATE} and @code{DELETE}.
|
Added @code{ORDER BY} syntax to @code{UPDATE} and @code{DELETE}.
|
||||||
@item
|
@item
|
||||||
Added @code{SELECT .. WITH UPDATE} and @code{SELECT ... IN SHARE MODE} to
|
Added @code{SELECT .. WITH UPDATE} and @code{SELECT ... IN SHARE MODE} to
|
||||||
|
|
@ -45638,6 +45644,9 @@ New key cache
|
||||||
When using @code{SET CHARACTER SET} we should translate the whole query
|
When using @code{SET CHARACTER SET} we should translate the whole query
|
||||||
at once and not only strings. This will enable users to use the translated
|
at once and not only strings. This will enable users to use the translated
|
||||||
characters in database, table and column names.
|
characters in database, table and column names.
|
||||||
|
@item
|
||||||
|
Add a portable interface over @code{gethostbyaddr_r()} so that we can change
|
||||||
|
@code{ip_to_hostname()} to not block other threads while doing DNS lookups.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@node TODO future, TODO sometime, TODO MySQL 4.0, TODO
|
@node TODO future, TODO sometime, TODO MySQL 4.0, TODO
|
||||||
|
|
|
||||||
|
|
@ -247,9 +247,9 @@ int berkeley_show_logs(THD *thd)
|
||||||
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
|
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
|
||||||
|
|
||||||
if ((error= log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG,
|
if ((error= log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG,
|
||||||
(void* (*)(unsigned int)) sql_alloc)) ||
|
(void* (*)(size_t)) sql_alloc)) ||
|
||||||
(error= log_archive(db_env, &free_logs, DB_ARCH_ABS,
|
(error= log_archive(db_env, &free_logs, DB_ARCH_ABS,
|
||||||
(void* (*)(unsigned int)) sql_alloc)))
|
(void* (*)(size_t)) sql_alloc)))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
|
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
|
||||||
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
|
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static hash_filo *hostname_cache;
|
static hash_filo *hostname_cache;
|
||||||
|
static pthread_mutex_t LOCK_hostname;
|
||||||
|
|
||||||
void hostname_cache_refresh()
|
void hostname_cache_refresh()
|
||||||
{
|
{
|
||||||
|
|
@ -56,6 +57,7 @@ void hostname_cache_refresh()
|
||||||
|
|
||||||
bool hostname_cache_init()
|
bool hostname_cache_init()
|
||||||
{
|
{
|
||||||
|
(void) pthread_mutex_init(&LOCK_hostname,NULL);
|
||||||
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
|
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
|
||||||
sizeof(struct in_addr),NULL,
|
sizeof(struct in_addr),NULL,
|
||||||
(void (*)(void*)) free)))
|
(void (*)(void*)) free)))
|
||||||
|
|
@ -66,6 +68,7 @@ bool hostname_cache_init()
|
||||||
|
|
||||||
void hostname_cache_free()
|
void hostname_cache_free()
|
||||||
{
|
{
|
||||||
|
(void) pthread_mutex_destroy(&LOCK_hostname);
|
||||||
delete hostname_cache;
|
delete hostname_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,26 +183,26 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
|
||||||
DBUG_RETURN(0); // out of memory
|
DBUG_RETURN(0); // out of memory
|
||||||
|
|
||||||
#else
|
#else
|
||||||
VOID(pthread_mutex_lock(&hostname_cache->lock));
|
VOID(pthread_mutex_lock(&LOCK_hostname));
|
||||||
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
|
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
|
||||||
{
|
{
|
||||||
VOID(pthread_mutex_unlock(&hostname_cache->lock));
|
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||||
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
|
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!hp->h_name[0]) // Don't allow empty hostnames
|
if (!hp->h_name[0]) // Don't allow empty hostnames
|
||||||
{
|
{
|
||||||
VOID(pthread_mutex_unlock(&hostname_cache->lock));
|
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||||
DBUG_PRINT("error",("Got an empty hostname"));
|
DBUG_PRINT("error",("Got an empty hostname"));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!(name=my_strdup(hp->h_name,MYF(0))))
|
if (!(name=my_strdup(hp->h_name,MYF(0))))
|
||||||
{
|
{
|
||||||
VOID(pthread_mutex_unlock(&hostname_cache->lock));
|
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||||
DBUG_RETURN(0); // out of memory
|
DBUG_RETURN(0); // out of memory
|
||||||
}
|
}
|
||||||
check=gethostbyname(name);
|
check=gethostbyname(name);
|
||||||
VOID(pthread_mutex_unlock(&hostname_cache->lock));
|
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||||
if (!check)
|
if (!check)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error",("gethostbyname returned %d",errno));
|
DBUG_PRINT("error",("gethostbyname returned %d",errno));
|
||||||
|
|
|
||||||
|
|
@ -1690,6 +1690,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
found_count++;
|
found_count++;
|
||||||
}
|
}
|
||||||
end_read_record(&info);
|
end_read_record(&info);
|
||||||
|
free_io_cache(from);
|
||||||
delete [] copy;
|
delete [] copy;
|
||||||
uint tmp_error;
|
uint tmp_error;
|
||||||
if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE)))
|
if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue