mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Pagecache integration for review.
storage/maria/unittest/ma_pagecache_single.c: Rename: storage/maria/unittest/mf_pagecache_single.c -> storage/maria/unittest/ma_pagecache_single.c include/maria.h: Pagecache integration. include/myisamchk.h: Pagecache integration. include/pagecache.h: removed WRITE_NOW mode Pagecache parameters management. mysys/Makefile.am: Safe hash procedures moved to the separate file. Pagecache moved to maria engine directory. mysys/mf_keycaches.c: Safe hash procedures moved to the separate file. sql/handler.cc: Pageccahe integration. sql/handler.h: Pagecache integration. sql/mysql_priv.h: pagecache integration sql/mysqld.cc: pagecache integration sql/set_var.cc: Pagecache integration. sql/set_var.h: Pagecache integration. storage/maria/Makefile.am: Pagecache integration and moving to maria engine directory. storage/maria/ha_maria.cc: File changed on PAGECCAHE_FILE. storage/maria/ma_bitmap.c: Pagecache integration. storage/maria/ma_blockrec.c: Pagecache integration. storage/maria/ma_check.c: File changed on PAGECCAHE_FILE. Pagecache integration. storage/maria/ma_close.c: File changed on PAGECCAHE_FILE. storage/maria/ma_delete_all.c: File changed on PAGECCAHE_FILE. storage/maria/ma_dynrec.c: File changed on PAGECCAHE_FILE. storage/maria/ma_extra.c: File changed on PAGECCAHE_FILE. storage/maria/ma_info.c: File changed on PAGECCAHE_FILE. storage/maria/ma_keycache.c: Pagecache integration. storage/maria/ma_locking.c: File changed on PAGECCAHE_FILE. storage/maria/ma_loghandler.c: Assert added. storage/maria/ma_loghandler.h: extern specifier added. storage/maria/ma_open.c: Pagecache integration. File changed on PAGECCAHE_FILE. storage/maria/ma_packrec.c: File changed on PAGECCAHE_FILE. storage/maria/ma_page.c: Pagecache integration. storage/maria/ma_pagecache.c: Pagecache renamed and moved to the maria directory. BLOCK_* defines renamed to avoid conflict with BLOCK_ERROR defined in maria_def.h storage/maria/ma_panic.c: File changed on PAGECCAHE_FILE. storage/maria/ma_preload.c: Pagecache integration. File changed on PAGECCAHE_FILE. storage/maria/ma_static.c: Pagecache integration. storage/maria/ma_test1.c: Pagecache integration. storage/maria/ma_test2.c: Pagecache integration. storage/maria/ma_test3.c: Pagecache integration. storage/maria/ma_write.c: File changed on PAGECCAHE_FILE. storage/maria/maria_chk.c: Pagecache integration. File changed on PAGECCAHE_FILE. storage/maria/maria_def.h: Pagecache integration. File changed on PAGECCAHE_FILE. storage/maria/maria_ftdump.c: Pagecache integration. storage/maria/maria_pack.c: File changed on PAGECCAHE_FILE. storage/maria/unittest/Makefile.am: Pagecache moved to the maria directory. storage/maria/unittest/ma_pagecache_consist.c: fixed using uninitialized variable storage/maria/ma_pagecaches.c: New BitKeeper file ``storage/maria/ma_pagecaches.c'' mysys/my_safehash.h: New BitKeeper file ``mysys/my_safehash.h''
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
#include <myisampack.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WITH_MARIA_STORAGE_ENGINE
|
||||
#include <maria.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
#include "ha_partition.h"
|
||||
#endif
|
||||
@@ -2773,6 +2777,99 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
pagecache handling.
|
||||
|
||||
This code is only relevant for maria tables
|
||||
|
||||
pagecache->cache may be 0 only in the case where a key cache is not
|
||||
initialized or when we where not able to init the key cache in a previous
|
||||
call to ha_init_pagecache() (probably out of memory)
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifdef WITH_MARIA_STORAGE_ENGINE
|
||||
|
||||
/* Init a pagecache if it has not been initied before */
|
||||
|
||||
int ha_init_pagecache(const char *name, PAGECACHE *pagecache)
|
||||
{
|
||||
DBUG_ENTER("ha_init_key_cache");
|
||||
|
||||
if (!pagecache->inited)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
long tmp_buff_size= (long) pagecache->param_buff_size;
|
||||
long tmp_block_size= (long) pagecache->param_block_size;
|
||||
uint division_limit= pagecache->param_division_limit;
|
||||
uint age_threshold= pagecache->param_age_threshold;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
DBUG_RETURN(!init_pagecache(pagecache,
|
||||
tmp_buff_size, division_limit, age_threshold,
|
||||
tmp_block_size));
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
/* Resize key cache */
|
||||
/*
|
||||
TODO: uncomment when resize will be implemented
|
||||
int ha_resize_pagecache(PAGECACHE *pagecache)
|
||||
{
|
||||
DBUG_ENTER("ha_resize_pagecache");
|
||||
|
||||
if (pagecache->inited)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
long tmp_buff_size= (long) pagecache->param_buff_size;
|
||||
long tmp_block_size= (long) pagecache->param_block_size;
|
||||
uint division_limit= pagecache->param_division_limit;
|
||||
uint age_threshold= pagecache->param_age_threshold;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
DBUG_RETURN(!resize_pagecache(pagecache, tmp_block_size,
|
||||
tmp_buff_size,
|
||||
division_limit, age_threshold));
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* Change parameters for key cache (like size) */
|
||||
|
||||
int ha_change_pagecache_param(PAGECACHE *pagecache)
|
||||
{
|
||||
if (pagecache->inited)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
uint division_limit= pagecache->param_division_limit;
|
||||
uint age_threshold= pagecache->param_age_threshold;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
change_pagecache_param(pagecache, division_limit, age_threshold);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Free memory allocated by a key cache */
|
||||
|
||||
int ha_end_pagecache(PAGECACHE *pagecache)
|
||||
{
|
||||
end_pagecache(pagecache, 1); // Can never fail
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Move all tables from one key cache to another one */
|
||||
|
||||
int ha_change_pagecache(PAGECACHE *old_pagecache,
|
||||
PAGECACHE *new_pagecache)
|
||||
{
|
||||
maria_change_pagecache(old_pagecache, new_pagecache);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* WITH_MARIA_STORAGE_ENGINE */
|
||||
|
||||
/*
|
||||
Try to discover one table from handler(s)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user