Commit 3e2afcb3 authored by Daniel Black's avatar Daniel Black

Merge remote-tracking branch 'origin/10.2' into 10.3

parents bf6484e7 577c970c
...@@ -3,3 +3,4 @@ usr/lib/mysql/plugin/client_ed25519.so ...@@ -3,3 +3,4 @@ usr/lib/mysql/plugin/client_ed25519.so
usr/lib/mysql/plugin/dialog.so usr/lib/mysql/plugin/dialog.so
usr/lib/mysql/plugin/mysql_clear_password.so usr/lib/mysql/plugin/mysql_clear_password.so
usr/lib/mysql/plugin/sha256_password.so usr/lib/mysql/plugin/sha256_password.so
usr/lib/mysql/plugin/caching_sha2_password.so
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
/* An element of the list */ /* An element of the list */
typedef struct { typedef struct {
intptr volatile link; /* a pointer to the next element in a list and a flag */ intptr link; /* a pointer to the next element in a list and a flag */
uint32 hashnr; /* reversed hash number, for sorting */
const uchar *key; const uchar *key;
size_t keylen; size_t keylen;
uint32 hashnr; /* reversed hash number, for sorting */
/* /*
data is stored here, directly after the keylen. data is stored here, directly after the keylen.
thus the pointer to data is (void*)(slist_element_ptr+1) thus the pointer to data is (void*)(slist_element_ptr+1)
...@@ -48,7 +48,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); ...@@ -48,7 +48,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
in a list) from l_find to l_insert/l_delete in a list) from l_find to l_insert/l_delete
*/ */
typedef struct { typedef struct {
intptr volatile *prev; intptr *prev;
LF_SLIST *curr, *next; LF_SLIST *curr, *next;
} CURSOR; } CURSOR;
...@@ -85,8 +85,8 @@ typedef struct { ...@@ -85,8 +85,8 @@ typedef struct {
0 - ok 0 - ok
1 - error (callbck returned 1) 1 - error (callbck returned 1)
*/ */
static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int l_find(LF_SLIST **head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, size_t keylen, CURSOR *cursor, LF_PINS *pins, const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins,
my_hash_walk_action callback) my_hash_walk_action callback)
{ {
uint32 cur_hashnr; uint32 cur_hashnr;
...@@ -168,7 +168,7 @@ static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -168,7 +168,7 @@ static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
it uses pins[0..2], on return all pins are removed. it uses pins[0..2], on return all pins are removed.
if there're nodes with the same key value, a new node is added before them. if there're nodes with the same key value, a new node is added before them.
*/ */
static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs, static LF_SLIST *l_insert(LF_SLIST **head, CHARSET_INFO *cs,
LF_SLIST *node, LF_PINS *pins, uint flags) LF_SLIST *node, LF_PINS *pins, uint flags)
{ {
CURSOR cursor; CURSOR cursor;
...@@ -220,7 +220,7 @@ static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs, ...@@ -220,7 +220,7 @@ static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
NOTE NOTE
it uses pins[0..2], on return all pins are removed. it uses pins[0..2], on return all pins are removed.
*/ */
static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, static int l_delete(LF_SLIST **head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, LF_PINS *pins) const uchar *key, uint keylen, LF_PINS *pins)
{ {
CURSOR cursor; CURSOR cursor;
...@@ -278,7 +278,7 @@ static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, ...@@ -278,7 +278,7 @@ static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
it uses pins[0..2], on return the pin[2] keeps the node found it uses pins[0..2], on return the pin[2] keeps the node found
all other pins are removed. all other pins are removed.
*/ */
static LF_SLIST *l_search(LF_SLIST * volatile *head, CHARSET_INFO *cs, static LF_SLIST *l_search(LF_SLIST **head, CHARSET_INFO *cs,
uint32 hashnr, const uchar *key, uint keylen, uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins) LF_PINS *pins)
{ {
...@@ -319,7 +319,7 @@ static inline my_hash_value_type calc_hash(CHARSET_INFO *cs, ...@@ -319,7 +319,7 @@ static inline my_hash_value_type calc_hash(CHARSET_INFO *cs,
#define MAX_LOAD 1.0 /* average number of elements in a bucket */ #define MAX_LOAD 1.0 /* average number of elements in a bucket */
static int initialize_bucket(LF_HASH *, LF_SLIST * volatile*, uint, LF_PINS *); static int initialize_bucket(LF_HASH *, LF_SLIST **, uint, LF_PINS *);
static void default_initializer(LF_HASH *hash, void *dst, const void *src) static void default_initializer(LF_HASH *hash, void *dst, const void *src)
{ {
...@@ -398,7 +398,7 @@ void lf_hash_destroy(LF_HASH *hash) ...@@ -398,7 +398,7 @@ void lf_hash_destroy(LF_HASH *hash)
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
{ {
int csize, bucket, hashnr; int csize, bucket, hashnr;
LF_SLIST *node, * volatile *el; LF_SLIST *node, **el;
node= (LF_SLIST *)lf_alloc_new(pins); node= (LF_SLIST *)lf_alloc_new(pins);
if (unlikely(!node)) if (unlikely(!node))
...@@ -437,7 +437,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) ...@@ -437,7 +437,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
*/ */
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{ {
LF_SLIST * volatile *el; LF_SLIST **el;
uint bucket, hashnr; uint bucket, hashnr;
hashnr= hash->hash_function(hash->charset, (uchar *)key, keylen) & INT_MAX32; hashnr= hash->hash_function(hash->charset, (uchar *)key, keylen) & INT_MAX32;
...@@ -473,7 +473,7 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins, ...@@ -473,7 +473,7 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
my_hash_value_type hashnr, my_hash_value_type hashnr,
const void *key, uint keylen) const void *key, uint keylen)
{ {
LF_SLIST * volatile *el, *found; LF_SLIST **el, *found;
uint bucket; uint bucket;
/* hide OOM errors - if we cannot initialize a bucket, try the previous one */ /* hide OOM errors - if we cannot initialize a bucket, try the previous one */
...@@ -507,7 +507,7 @@ int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins, ...@@ -507,7 +507,7 @@ int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
CURSOR cursor; CURSOR cursor;
uint bucket= 0; uint bucket= 0;
int res; int res;
LF_SLIST * volatile *el; LF_SLIST **el;
el= lf_dynarray_lvalue(&hash->array, bucket); el= lf_dynarray_lvalue(&hash->array, bucket);
if (unlikely(!el)) if (unlikely(!el))
...@@ -539,13 +539,13 @@ static const uchar *dummy_key= (uchar*)""; ...@@ -539,13 +539,13 @@ static const uchar *dummy_key= (uchar*)"";
0 - ok 0 - ok
-1 - out of memory -1 - out of memory
*/ */
static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, static int initialize_bucket(LF_HASH *hash, LF_SLIST **node,
uint bucket, LF_PINS *pins) uint bucket, LF_PINS *pins)
{ {
uint parent= my_clear_highest_bit(bucket); uint parent= my_clear_highest_bit(bucket);
LF_SLIST *dummy= (LF_SLIST *)my_malloc(sizeof(LF_SLIST), MYF(MY_WME)); LF_SLIST *dummy= (LF_SLIST *)my_malloc(sizeof(LF_SLIST), MYF(MY_WME));
LF_SLIST **tmp= 0, *cur; LF_SLIST **tmp= 0, *cur;
LF_SLIST * volatile *el= lf_dynarray_lvalue(&hash->array, parent); LF_SLIST **el= lf_dynarray_lvalue(&hash->array, parent);
if (unlikely(!el || !dummy)) if (unlikely(!el || !dummy))
return -1; return -1;
if (*el == NULL && bucket && if (*el == NULL && bucket &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment