mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Added new mutex for hostname lookup
Added free of io_cache when using ALTER TABLE ... ORDER BY Docs/manual.texi: Updated from user comments sql/ha_berkeley.cc: Fixed wrong cast sql/hostname.cc: Added new mutex for hostname lookup sql/sql_table.cc: Added free of io_cache when using ALTER TABLE ... ORDER BY
This commit is contained in:
@@ -15172,7 +15172,8 @@ mysql> select BIT_COUNT(29);
|
||||
@node Logical functions, Comparison functions, Bit functions, Functions
|
||||
@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
|
||||
@findex NOT, logical
|
||||
@@ -18416,7 +18417,7 @@ swap two tables names, you have to:
|
||||
@example
|
||||
RENAME TABLE old_table TO backup_table,
|
||||
new_table TO old_table,
|
||||
backup_table TO old_table;
|
||||
backup_table TO new_table;
|
||||
@end example
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
@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}.
|
||||
@item
|
||||
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
|
||||
at once and not only strings. This will enable users to use the translated
|
||||
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
|
||||
|
||||
@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);
|
||||
|
||||
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,
|
||||
(void* (*)(unsigned int)) sql_alloc)))
|
||||
(void* (*)(size_t)) sql_alloc)))
|
||||
{
|
||||
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
|
||||
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
};
|
||||
|
||||
static hash_filo *hostname_cache;
|
||||
static pthread_mutex_t LOCK_hostname;
|
||||
|
||||
void hostname_cache_refresh()
|
||||
{
|
||||
@@ -56,6 +57,7 @@ void hostname_cache_refresh()
|
||||
|
||||
bool hostname_cache_init()
|
||||
{
|
||||
(void) pthread_mutex_init(&LOCK_hostname,NULL);
|
||||
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
|
||||
sizeof(struct in_addr),NULL,
|
||||
(void (*)(void*)) free)))
|
||||
@@ -66,6 +68,7 @@ bool hostname_cache_init()
|
||||
|
||||
void hostname_cache_free()
|
||||
{
|
||||
(void) pthread_mutex_destroy(&LOCK_hostname);
|
||||
delete hostname_cache;
|
||||
}
|
||||
|
||||
@@ -180,26 +183,26 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
|
||||
DBUG_RETURN(0); // out of memory
|
||||
|
||||
#else
|
||||
VOID(pthread_mutex_lock(&hostname_cache->lock));
|
||||
VOID(pthread_mutex_lock(&LOCK_hostname));
|
||||
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));
|
||||
goto err;
|
||||
}
|
||||
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"));
|
||||
goto err;
|
||||
}
|
||||
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
|
||||
}
|
||||
check=gethostbyname(name);
|
||||
VOID(pthread_mutex_unlock(&hostname_cache->lock));
|
||||
VOID(pthread_mutex_unlock(&LOCK_hostname));
|
||||
if (!check)
|
||||
{
|
||||
DBUG_PRINT("error",("gethostbyname returned %d",errno));
|
||||
|
||||
@@ -1690,6 +1690,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
found_count++;
|
||||
}
|
||||
end_read_record(&info);
|
||||
free_io_cache(from);
|
||||
delete [] copy;
|
||||
uint tmp_error;
|
||||
if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE)))
|
||||
|
||||
Reference in New Issue
Block a user