summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-01-23 01:25:07 +0200
committerunknown <monty@donna.mysql.com>2001-01-23 01:25:07 +0200
commit6370f97b2c9d2fe26be653d1031b918cf097d08e (patch)
tree8bbe5c1f42df3580477789560dc9f52df1d4a2fc /sql
parent3e54e5393293426a9bfb7e6036f7e12bdb71d3b5 (diff)
downloadmariadb-git-6370f97b2c9d2fe26be653d1031b918cf097d08e.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_berkeley.cc4
-rw-r--r--sql/hostname.cc13
-rw-r--r--sql/sql_table.cc1
3 files changed, 11 insertions, 7 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 0c5f09c4b36..944b335016e 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -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");
diff --git a/sql/hostname.cc b/sql/hostname.cc
index fcf8d2753b8..0112bb884f3 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -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));
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3e1a0eb9fa1..a666fa26545 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -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)))