mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
merge
This commit is contained in:
commit
6c3bbb2800
66 changed files with 1308 additions and 624 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2006 MySQL AB
|
||||
/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -39,6 +39,10 @@ int heap_init(void *p)
|
|||
{
|
||||
handlerton *heap_hton;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
init_heap_psi_keys();
|
||||
#endif
|
||||
|
||||
heap_hton= (handlerton *)p;
|
||||
heap_hton->state= SHOW_OPTION_YES;
|
||||
heap_hton->db_type= DB_TYPE_HEAP;
|
||||
|
|
@ -106,9 +110,9 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
|
|||
if (!file)
|
||||
{
|
||||
/* Couldn't open table; Remove the newly created table */
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
hp_free(internal_share);
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
}
|
||||
implicit_emptied= 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2002, 2004 MySQL AB
|
||||
/* Copyright (C) 2000-2002, 2004 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -103,9 +103,14 @@ extern void hp_clear_keys(HP_SHARE *info);
|
|||
extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
|
||||
key_part_map keypart_map);
|
||||
#ifdef THREAD
|
||||
extern pthread_mutex_t THR_LOCK_heap;
|
||||
#else
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
extern mysql_mutex_t THR_LOCK_heap;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#ifdef THREAD
|
||||
extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
|
||||
#endif /* THREAD */
|
||||
void init_heap_psi_keys();
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
C_MODE_END
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2002 MySQL AB
|
||||
/* Copyright (C) 2000-2002 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -24,9 +24,9 @@ int heap_close(HP_INFO *info)
|
|||
{
|
||||
int tmp;
|
||||
DBUG_ENTER("heap_close");
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
tmp= hp_close(info);
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(tmp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2006 MySQL AB
|
||||
/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -32,7 +32,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
|
|||
|
||||
if (!create_info->internal_table)
|
||||
{
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
if ((share= hp_find_named_heap(name)) && share->open_count == 0)
|
||||
{
|
||||
hp_free(share);
|
||||
|
|
@ -194,7 +194,8 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
|
|||
}
|
||||
#ifdef THREAD
|
||||
thr_lock_init(&share->lock);
|
||||
pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock,
|
||||
&share->intern_lock, MY_MUTEX_INIT_FAST);
|
||||
#endif
|
||||
if (!create_info->internal_table)
|
||||
{
|
||||
|
|
@ -205,14 +206,14 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
|
|||
share->delete_on_close= 1;
|
||||
}
|
||||
if (!create_info->internal_table)
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
|
||||
*res= share;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
if (!create_info->internal_table)
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(1);
|
||||
} /* heap_create */
|
||||
|
||||
|
|
@ -266,7 +267,7 @@ int heap_delete_table(const char *name)
|
|||
reg1 HP_SHARE *share;
|
||||
DBUG_ENTER("heap_delete_table");
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
if ((share= hp_find_named_heap(name)))
|
||||
{
|
||||
heap_try_free(share);
|
||||
|
|
@ -276,7 +277,7 @@ int heap_delete_table(const char *name)
|
|||
{
|
||||
result= my_errno=ENOENT;
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
|
@ -284,9 +285,9 @@ int heap_delete_table(const char *name)
|
|||
void heap_drop_table(HP_INFO *info)
|
||||
{
|
||||
DBUG_ENTER("heap_drop_table");
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
heap_try_free(info->s);
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ void hp_free(HP_SHARE *share)
|
|||
hp_clear(share); /* Remove blocks from memory */
|
||||
#ifdef THREAD
|
||||
thr_lock_delete(&share->lock);
|
||||
pthread_mutex_destroy(&share->intern_lock);
|
||||
mysql_mutex_destroy(&share->intern_lock);
|
||||
#endif
|
||||
my_free((uchar*) share->name, MYF(0));
|
||||
my_free((uchar*) share, MYF(0));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2004, 2006 MySQL AB
|
||||
/* Copyright (C) 2000-2004, 2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -69,13 +69,13 @@ HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode)
|
|||
HP_INFO *info;
|
||||
DBUG_ENTER("heap_open_from_share_and_register");
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
if ((info= heap_open_from_share(share, mode)))
|
||||
{
|
||||
info->open_list.data= (void*) info;
|
||||
heap_open_list= list_add(heap_open_list,&info->open_list);
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(info);
|
||||
}
|
||||
|
||||
|
|
@ -94,11 +94,11 @@ HP_INFO *heap_open(const char *name, int mode)
|
|||
HP_SHARE *share;
|
||||
DBUG_ENTER("heap_open");
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
if (!(share= hp_find_named_heap(name)))
|
||||
{
|
||||
my_errno= ENOENT;
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if ((info= heap_open_from_share(share, mode)))
|
||||
|
|
@ -106,7 +106,7 @@ HP_INFO *heap_open(const char *name, int mode)
|
|||
info->open_list.data= (void*) info;
|
||||
heap_open_list= list_add(heap_open_list,&info->open_list);
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(info);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2002 MySQL AB
|
||||
/* Copyright (C) 2000-2002 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -23,7 +23,7 @@ int hp_panic(enum ha_panic_function flag)
|
|||
LIST *element,*next_open;
|
||||
DBUG_ENTER("hp_panic");
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
for (element=heap_open_list ; element ; element=next_open)
|
||||
{
|
||||
HP_INFO *info=(HP_INFO*) element->data;
|
||||
|
|
@ -51,6 +51,6 @@ int hp_panic(enum ha_panic_function flag)
|
|||
break;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(0);
|
||||
} /* hp_panic */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2002 MySQL AB
|
||||
/* Copyright (C) 2000-2002 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -25,17 +25,17 @@ int heap_rename(const char *old_name, const char *new_name)
|
|||
char *name_buff;
|
||||
DBUG_ENTER("heap_rename");
|
||||
|
||||
pthread_mutex_lock(&THR_LOCK_heap);
|
||||
mysql_mutex_lock(&THR_LOCK_heap);
|
||||
if ((info = hp_find_named_heap(old_name)))
|
||||
{
|
||||
if (!(name_buff=(char*) my_strdup(new_name,MYF(MY_WME))))
|
||||
{
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(my_errno);
|
||||
}
|
||||
my_free(info->name,MYF(0));
|
||||
info->name=name_buff;
|
||||
}
|
||||
pthread_mutex_unlock(&THR_LOCK_heap);
|
||||
mysql_mutex_unlock(&THR_LOCK_heap);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2001 MySQL AB
|
||||
/* Copyright (C) 2000-2001 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -23,3 +23,34 @@
|
|||
#endif
|
||||
|
||||
LIST *heap_open_list=0,*heap_share_list=0;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#ifdef THREAD
|
||||
PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock;
|
||||
|
||||
static PSI_mutex_info all_heap_mutexes[]=
|
||||
{
|
||||
{ & hp_key_mutex_HP_SHARE_intern_lock, "HP_SHARE::intern_lock", 0}
|
||||
/*
|
||||
Note:
|
||||
THR_LOCK_heap is part of mysys, not storage/heap.
|
||||
*/
|
||||
};
|
||||
#endif /* THREAD */
|
||||
|
||||
void init_heap_psi_keys()
|
||||
{
|
||||
#ifdef THREAD
|
||||
const char* category= "memory";
|
||||
int count;
|
||||
|
||||
if (PSI_server == NULL)
|
||||
return;
|
||||
|
||||
count= array_elements(all_heap_mutexes);
|
||||
PSI_server->register_mutex(category, all_heap_mutexes, count);
|
||||
#endif /* THREAD */
|
||||
}
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue