summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2003-08-26 00:13:22 -0700
committerunknown <igor@rurik.mysql.com>2003-08-26 00:13:22 -0700
commitf6758b47fb75fb7f39e4883d53523bfda589adfd (patch)
tree8f6c56f59666be1b54701f57e779e904575b1a4a /include
parent3b799e8fd8eb13c7ad6e2bb01a922e37d9101ea7 (diff)
parentb9a90dffb6c429ab405d036734b3b04b98df69d6 (diff)
downloadmariadb-git-f6758b47fb75fb7f39e4883d53523bfda589adfd.tar.gz
Manual merge
include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged myisam/mi_check.c: Auto merged myisam/mi_extra.c: Auto merged myisam/mi_locking.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/r/key_cache.result: Auto merged mysql-test/t/key_cache.test: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/table.h: Auto merged
Diffstat (limited to 'include')
-rw-r--r--include/my_base.h4
-rw-r--r--include/my_global.h3
-rw-r--r--include/my_sys.h63
-rw-r--r--include/myisam.h2
4 files changed, 58 insertions, 14 deletions
diff --git a/include/my_base.h b/include/my_base.h
index 972a02e65cd..b0c14822483 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -46,6 +46,7 @@
#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
#define HA_OPEN_ABORT_IF_CRASHED 16
#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
+#define HA_OPEN_TO_ASSIGN 64 /* Open for key cache assignment */
/* The following is parameter to ha_rkey() how to use key */
@@ -124,7 +125,8 @@ enum ha_extra_function {
HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */
HA_EXTRA_PREPARE_FOR_DELETE,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
- HA_EXTRA_PRELOAD_BUFFER_SIZE /* Set buffer size for preloading */
+ HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
+ HA_EXTRA_SET_KEY_CACHE /* Set ref to assigned key cache */
};
/* The following is parameter to ha_panic() */
diff --git a/include/my_global.h b/include/my_global.h
index 0e576730ca3..fece87f2423 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -558,6 +558,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD)
/* Typical key cash */
#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD)
+ /* Default size of a key cache block */
+#define KEY_CACHE_BLOCK_SIZE (uint) 1024
+
/* Some things that this system doesn't have */
diff --git a/include/my_sys.h b/include/my_sys.h
index 688e8bfc9e3..9e0f02416f0 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -111,8 +111,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
-#define DEFAULT_KEYCACHE_BLOCK_SIZE 1024
-#define MAX_KEYCACHE_BLOCK_SIZE 16384
/* root_alloc flags */
#define MY_KEEP_PREALLOC 1
@@ -501,11 +499,40 @@ my_off_t my_b_append_tell(IO_CACHE* info);
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
*(info)->current_pos)
-/* key_cache_variables */
-typedef struct st_keycache
+/* Pointer to a key cache data structure (see the key cache module) */
+typedef struct st_key_cache* KEY_CACHE_HANDLE;
+
+/* Key cache variable structure */
+/*
+ The structure contains the parameters of a key cache that can
+ be set and undated by regular set global statements.
+ It also contains read-only statistics parameters.
+ If the corresponding key cache data structure has been already
+ created the variable contains the key cache handle.
+ The variables are put into a named list called key_caches.
+ At present the variables are only added to this list.
+*/
+typedef struct st_key_cache_var
{
- ulonglong size;
-} KEY_CACHE;
+ ulonglong buff_size; /* size the memory allocated for the cache */
+ ulong block_size; /* size of the blocks in the key cache */
+ ulong division_limit; /* min. percentage of warm blocks */
+ ulong age_threshold; /* determines when hot block is downgraded */
+ KEY_CACHE_HANDLE cache; /* handles for the current and registered */
+ ulong blocks_used; /* number of currently used blocks */
+ ulong blocks_changed; /* number of currently dirty blocks */
+ ulong cache_w_requests; /* number of write requests (write hits) */
+ ulong cache_write; /* number of writes from the cache to files */
+ ulong cache_r_requests; /* number of read requests (read hits) */
+ ulong cache_read; /* number of reads from files to the cache */
+ int blocks; /* max number of blocks in the cache */
+ struct st_key_cache_asmt *assign_list; /* list of assignments to the cache */
+} KEY_CACHE_VAR;
+
+#define DEFAULT_KEY_CACHE_NAME "default"
+extern KEY_CACHE_HANDLE *dflt_keycache;
+extern KEY_CACHE_VAR dflt_key_cache_var;
+#define DFLT_INIT_HITS 3
#include <my_alloc.h>
@@ -645,16 +672,26 @@ extern int flush_write_cache(RECORD_CACHE *info);
extern long my_clock(void);
extern sig_handler sigtstp_handler(int signal_number);
extern void handle_recived_signals(void);
-extern int init_key_cache(ulong use_mem);
-extern int resize_key_cache(ulong use_mem);
-extern byte *key_cache_read(File file,my_off_t filepos,byte* buff,uint length,
+extern int init_key_cache(KEY_CACHE_HANDLE *pkeycache,
+ uint key_cache_block_size,
+ ulong use_mem, KEY_CACHE_VAR* env);
+extern int resize_key_cache(KEY_CACHE_HANDLE *pkeycache,
+ uint key_cache_block_size, ulong use_mem);
+extern void change_key_cache_param(KEY_CACHE_HANDLE keycache);
+extern byte *key_cache_read(KEY_CACHE_HANDLE keycache,
+ File file, my_off_t filepos, int level,
+ byte* buff, uint length,
uint block_length,int return_buffer);
-extern int key_cache_insert(File file, my_off_t filepos,
+extern int key_cache_insert(KEY_CACHE_HANDLE keycache,
+ File file, my_off_t filepos, int level,
byte *buff, uint length);
-extern int key_cache_write(File file,my_off_t filepos,byte* buff,uint length,
+extern int key_cache_write(KEY_CACHE_HANDLE keycache,
+ File file, my_off_t filepos, int level,
+ byte* buff, uint length,
uint block_length,int force_write);
-extern int flush_key_blocks(int file, enum flush_type type);
-extern void end_key_cache(void);
+extern int flush_key_blocks(KEY_CACHE_HANDLE keycache,
+ int file, enum flush_type type);
+extern void end_key_cache(KEY_CACHE_HANDLE *pkeycache,my_bool cleanup);
extern sig_handler my_set_alarm_variable(int signo);
extern void my_string_ptr_sort(void *base,uint items,size_s size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
diff --git a/include/myisam.h b/include/myisam.h
index e85d3057672..b0c9e198dae 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -410,6 +410,8 @@ my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map,
int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows);
void mi_flush_bulk_insert(MI_INFO *info, uint inx);
void mi_end_bulk_insert(MI_INFO *info);
+int mi_assign_to_keycache(MI_INFO *info, ulonglong key_map,
+ KEY_CACHE_HANDLE *reg_keycache);
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves);
#ifdef __cplusplus