summaryrefslogtreecommitdiff
path: root/sql/ha_berkeley.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-11-08 01:13:54 +0200
committermonty@mysql.com <>2004-11-08 01:13:54 +0200
commitb903a129e26e217cf3c891a604ec1733df8fa9ff (patch)
tree7a3852793309c847d2ee83023b9429b28913b390 /sql/ha_berkeley.cc
parente93450d4421c3794d569f529b1f123cd3ca2eaf7 (diff)
downloadmariadb-git-b903a129e26e217cf3c891a604ec1733df8fa9ff.tar.gz
Simpler arena swapping code
Now thd->mem_root is a pointer to thd->main_mem_root and THR_MALLOC is a pointer to thd->mem_root. This gives us the following benefits: - Allow us to easily detect if arena has already been swapped before (this fixes a bug in setup_conds() where arena was swaped twice in some cases) - Faster swaps of arenas (as we don't have to copy the whole MEM_ROOT) - We don't anymore have to call my_pthread_setspecific_ptr(THR_MALLOC,...) to change where memory is alloced. Now it's enough to set thd->mem_root
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r--sql/ha_berkeley.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 09b3e340d1f..2c7cce4bcd0 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -234,13 +234,13 @@ int berkeley_show_logs(Protocol *protocol)
{
char **all_logs, **free_logs, **a, **f;
int error=1;
- MEM_ROOT show_logs_root;
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ MEM_ROOT **root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
+ MEM_ROOT show_logs_root, *old_mem_root= *root_ptr;
DBUG_ENTER("berkeley_show_logs");
init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE,
BDB_LOG_ALLOC_BLOCK_SIZE);
- my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
+ *root_ptr= &show_logs_root;
if ((error= db_env->log_archive(db_env, &all_logs,
DB_ARCH_ABS | DB_ARCH_LOG)) ||
@@ -277,15 +277,17 @@ int berkeley_show_logs(Protocol *protocol)
}
err:
free_root(&show_logs_root,MYF(0));
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_mem_root;
DBUG_RETURN(error);
}
+
static void berkeley_print_error(const char *db_errpfx, char *buffer)
{
sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */
}
+
static void berkeley_noticecall(DB_ENV *db_env, db_notices notice)
{
switch (notice)