diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-02-26 21:17:33 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-03-04 13:34:53 +0400 |
commit | 9c8165fdb46737c5a7205849e9197c4d35f7b5d8 (patch) | |
tree | 42864e6780ecbd68ba2b018771d7e14178bfae0d /include/lf.h | |
parent | f5bd1d012653f074b7eca7f5bc136e2bcb988980 (diff) | |
download | mariadb-git-9c8165fdb46737c5a7205849e9197c4d35f7b5d8.tar.gz |
MDEV-6089 - MySQL WL#7305 "Improve MDL scalability by using lock-free hash"
Added initializer callback to lf-hash. Needed to initialize properly non-POD
types.
Diffstat (limited to 'include/lf.h')
-rw-r--r-- | include/lf.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/lf.h b/include/lf.h index 27de5653db9..c37b7ebf567 100644 --- a/include/lf.h +++ b/include/lf.h @@ -130,22 +130,26 @@ C_MODE_END C_MODE_START +typedef struct st_lf_hash LF_HASH; +typedef void (*lf_hash_initializer)(LF_HASH *hash, void *dst, const void *src); + #define LF_HASH_UNIQUE 1 /* lf_hash overhead per element (that is, sizeof(LF_SLIST) */ extern const int LF_HASH_OVERHEAD; -typedef struct { +struct st_lf_hash { LF_DYNARRAY array; /* hash itself */ LF_ALLOCATOR alloc; /* allocator for elements */ my_hash_get_key get_key; /* see HASH */ + lf_hash_initializer initializer; /* called when an element is inserted */ CHARSET_INFO *charset; /* see HASH */ uint key_offset, key_length; /* see HASH */ uint element_size; /* size of memcpy'ed area on insert */ uint flags; /* LF_HASH_UNIQUE, etc */ int32 volatile size; /* size of array */ int32 volatile count; /* number of elements in the hash */ -} LF_HASH; +}; void lf_hash_init(LF_HASH *hash, uint element_size, uint flags, uint key_offset, uint key_length, my_hash_get_key get_key, |