1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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

This commit is contained in:
Jan Lindström
2019-02-28 13:08:11 +02:00
7 changed files with 73 additions and 33 deletions

View File

@ -77,3 +77,12 @@ Note 1976 Can't drop role 'role_1'; it doesn't exist
DROP ROLE role_1; DROP ROLE role_1;
ERROR HY000: Operation DROP ROLE failed for 'role_1' ERROR HY000: Operation DROP ROLE failed for 'role_1'
DROP USER u1@localhost; DROP USER u1@localhost;
CREATE ROLE r;
GRANT SHOW DATABASES ON *.* TO r;
CREATE USER foo;
CREATE USER bar;
GRANT r TO foo;
CREATE OR REPLACE USER foo IDENTIFIED WITH non_existing_plugin;
ERROR HY000: Plugin 'non_existing_plugin' is not loaded
DROP ROLE r;
DROP USER bar;

View File

@ -54,3 +54,14 @@ DROP ROLE IF EXISTS role_1;
DROP ROLE role_1; DROP ROLE role_1;
DROP USER u1@localhost; DROP USER u1@localhost;
# MDEV-17942
CREATE ROLE r;
GRANT SHOW DATABASES ON *.* TO r;
CREATE USER foo;
CREATE USER bar;
GRANT r TO foo;
--error ER_PLUGIN_IS_NOT_LOADED
CREATE OR REPLACE USER foo IDENTIFIED WITH non_existing_plugin;
DROP ROLE r;
DROP USER bar;

View File

@ -3064,7 +3064,7 @@ int handler::update_auto_increment()
bool append= FALSE; bool append= FALSE;
THD *thd= table->in_use; THD *thd= table->in_use;
struct system_variables *variables= &thd->variables; struct system_variables *variables= &thd->variables;
int tmp; int result=0, tmp;
enum enum_check_fields save_count_cuted_fields; enum enum_check_fields save_count_cuted_fields;
DBUG_ENTER("handler::update_auto_increment"); DBUG_ENTER("handler::update_auto_increment");
@ -3201,18 +3201,27 @@ int handler::update_auto_increment()
*/ */
if (thd->killed == KILL_BAD_DATA || if (thd->killed == KILL_BAD_DATA ||
nr > table->next_number_field->get_max_int_value()) nr > table->next_number_field->get_max_int_value())
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); {
/* /*
Field refused this value (overflow) and truncated it, use the result It's better to return an error here than getting a confusing
of the truncation (which is going to be inserted); however we try to 'duplicate key error' later.
decrease it to honour auto_increment_* variables. */
That will shift the left bound of the reserved interval, we don't result= HA_ERR_AUTOINC_ERANGE;
bother shifting the right bound (anyway any other value from this }
interval will cause a duplicate key). else
*/ {
nr= prev_insert_id(table->next_number_field->val_int(), variables); /*
if (unlikely(table->next_number_field->store((longlong)nr, TRUE))) Field refused this value (overflow) and truncated it, use the result
nr= table->next_number_field->val_int(); of the truncation (which is going to be inserted); however we try to
decrease it to honour auto_increment_* variables.
That will shift the left bound of the reserved interval, we don't
bother shifting the right bound (anyway any other value from this
interval will cause a duplicate key).
*/
nr= prev_insert_id(table->next_number_field->val_int(), variables);
if (unlikely(table->next_number_field->store((longlong)nr, TRUE)))
nr= table->next_number_field->val_int();
}
} }
if (append) if (append)
{ {
@ -3237,6 +3246,9 @@ int handler::update_auto_increment()
*/ */
insert_id_for_cur_row= nr; insert_id_for_cur_row= nr;
if (result) // overflow
DBUG_RETURN(result);
/* /*
Set next insert id to point to next auto-increment value to be able to Set next insert id to point to next auto-increment value to be able to
handle multi-row statements. handle multi-row statements.

View File

@ -10116,6 +10116,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
LEX_USER *user_name; LEX_USER *user_name;
List_iterator <LEX_USER> user_list(list); List_iterator <LEX_USER> user_list(list);
bool binlog= false; bool binlog= false;
bool some_users_dropped= false;
DBUG_ENTER("mysql_create_user"); DBUG_ENTER("mysql_create_user");
DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user")); DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user"));
@ -10182,6 +10183,8 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
result= true; result= true;
continue; continue;
} }
else
some_users_dropped= true;
// Proceed with the creation // Proceed with the creation
} }
else if (thd->lex->create_info.if_not_exists()) else if (thd->lex->create_info.if_not_exists())
@ -10250,12 +10253,21 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
} }
} }
if (result && some_users_dropped && !handle_as_role)
{
/* Rebuild in-memory structs, since 'acl_users' has been modified */
rebuild_check_host();
rebuild_role_grants();
}
mysql_mutex_unlock(&acl_cache->lock); mysql_mutex_unlock(&acl_cache->lock);
if (result) if (result)
{
my_error(ER_CANNOT_USER, MYF(0), my_error(ER_CANNOT_USER, MYF(0),
(handle_as_role) ? "CREATE ROLE" : "CREATE USER", (handle_as_role) ? "CREATE ROLE" : "CREATE USER",
wrong_users.c_ptr_safe()); wrong_users.c_ptr_safe());
}
if (binlog) if (binlog)
result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length()); result |= write_bin_log(thd, FALSE, thd->query(), thd->query_length());

View File

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2006, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -63,14 +64,10 @@ ib_wqueue_add(
mem_heap_t* heap); /*!< in: memory heap to use for mem_heap_t* heap); /*!< in: memory heap to use for
allocating the list node */ allocating the list node */
/******************************************************************** /** Check if queue is empty.
Check if queue is empty. */ @param wq wait queue
ibool @return whether the queue is empty */
ib_wqueue_is_empty( bool ib_wqueue_is_empty(ib_wqueue_t* wq);
/*===============*/
/* out: TRUE if queue empty
else FALSE */
const ib_wqueue_t* wq); /* in: work queue */
/****************************************************************//** /****************************************************************//**
Wait for a work item to appear in the queue. Wait for a work item to appear in the queue.

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2006, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2006, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -201,16 +201,15 @@ ib_wqueue_nowait(
return (node ? node->data : NULL); return (node ? node->data : NULL);
} }
/******************************************************************** /** Check if queue is empty.
Check if queue is empty. */ @param wq wait queue
ibool @return whether the queue is empty */
ib_wqueue_is_empty( bool ib_wqueue_is_empty(ib_wqueue_t* wq)
/*===============*/
/* out: TRUE if queue empty
else FALSE */
const ib_wqueue_t* wq) /* in: work queue */
{ {
return(ib_list_is_empty(wq->items)); mutex_enter(&wq->mutex);
bool is_empty = ib_list_is_empty(wq->items);
mutex_exit(&wq->mutex);
return is_empty;
} }
/******************************************************************** /********************************************************************

View File

@ -67,10 +67,10 @@ wsrep_slave_threads=1
wsrep_certify_nonPK=1 wsrep_certify_nonPK=1
# Maximum number of rows in write set # Maximum number of rows in write set
wsrep_max_ws_rows=131072 wsrep_max_ws_rows=0
# Maximum size of write set # Maximum size of write set
wsrep_max_ws_size=1073741824 wsrep_max_ws_size=2147483647
# to enable debug level logging, set this to 1 # to enable debug level logging, set this to 1
wsrep_debug=0 wsrep_debug=0