diff options
author | unknown <bell@pwbook.sanja.is.com.ua> | 2007-04-04 23:37:09 +0300 |
---|---|---|
committer | unknown <bell@pwbook.sanja.is.com.ua> | 2007-04-04 23:37:09 +0300 |
commit | 39d64a1d2565b09307d11b2a665f3f2c6bc8106e (patch) | |
tree | f06eaccb6a5b46b3894e7939c81911d30e765fd5 /mysys/my_safehash.h | |
parent | a3f9083bb4649530b210423e21589803c075bb9e (diff) | |
download | mariadb-git-39d64a1d2565b09307d11b2a665f3f2c6bc8106e.tar.gz |
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''
Diffstat (limited to 'mysys/my_safehash.h')
-rw-r--r-- | mysys/my_safehash.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mysys/my_safehash.h b/mysys/my_safehash.h new file mode 100644 index 00000000000..53845a5fec7 --- /dev/null +++ b/mysys/my_safehash.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2003 MySQL AB + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Handling of multiple key caches + + The idea is to have a thread safe hash on the table name, + with a default key cache value that is returned if the table name is not in + the cache. +*/ + +#include <hash.h> + +/* + Struct to store a key and pointer to object +*/ + +typedef struct st_safe_hash_entry +{ + byte *key; + uint length; + byte *data; + struct st_safe_hash_entry *next, **prev; +} SAFE_HASH_ENTRY; + + +typedef struct st_safe_hash_with_default +{ +#ifdef THREAD + rw_lock_t mutex; +#endif + HASH hash; + byte *default_value; + SAFE_HASH_ENTRY *root; +} SAFE_HASH; + + +my_bool safe_hash_init(SAFE_HASH *hash, uint elements, + byte *default_value); +void safe_hash_free(SAFE_HASH *hash); +byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length, + byte *def); +my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length, + byte *data); +void safe_hash_change(SAFE_HASH *hash, byte *old_data, byte *new_data); |