Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4d33f9dc
Commit
4d33f9dc
authored
Sep 25, 2015
by
Nirbhay Choubey
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '5.5-galera' into 10.0-galera
parents
eac8e435
13615c5e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
119 additions
and
34 deletions
+119
-34
debian/mariadb-galera-server-10.0.mysql.init
debian/mariadb-galera-server-10.0.mysql.init
+11
-1
mysql-test/suite/galera/r/galera_read_only.result
mysql-test/suite/galera/r/galera_read_only.result
+10
-0
mysql-test/suite/galera/t/galera_read_only.test
mysql-test/suite/galera/t/galera_read_only.test
+17
-1
mysys/my_alloc.c
mysys/my_alloc.c
+4
-1
sql/mysqld.cc
sql/mysqld.cc
+58
-13
sql/sql_parse.cc
sql/sql_parse.cc
+2
-18
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+8
-0
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+1
-0
support-files/mysql.server.sh
support-files/mysql.server.sh
+8
-0
No files found.
debian/mariadb-galera-server-10.0.mysql.init
View file @
4d33f9dc
...
@@ -17,6 +17,9 @@ set -e
...
@@ -17,6 +17,9 @@ set -e
set
-u
set
-u
${
DEBIAN_SCRIPT_DEBUG
:+
set -v -x
}
${
DEBIAN_SCRIPT_DEBUG
:+
set -v -x
}
# Prevent Debian's init scripts from calling systemctl
_SYSTEMCTL_SKIP_REDIRECT
=
true
test
-x
/usr/sbin/mysqld
||
exit
0
test
-x
/usr/sbin/mysqld
||
exit
0
.
/lib/lsb/init-functions
.
/lib/lsb/init-functions
...
@@ -179,8 +182,15 @@ case "${1:-''}" in
...
@@ -179,8 +182,15 @@ case "${1:-''}" in
fi
fi
;;
;;
'bootstrap'
)
# Bootstrap the cluster, start the first node
# that initiates the cluster
log_daemon_msg
"Bootstrapping the cluster"
"mysqld"
$SELF
start
"
${
@
:2
}
"
--wsrep-new-cluster
;;
*
)
*
)
echo
"Usage:
$SELF
start|stop|restart|reload|force-reload|status"
echo
"Usage:
$SELF
start|stop|restart|reload|force-reload|status
|bootstrap
"
exit
1
exit
1
;;
;;
esac
esac
...
...
mysql-test/suite/galera/r/galera_read_only.result
View file @
4d33f9dc
...
@@ -4,5 +4,15 @@ INSERT INTO t1 VALUES (1);
...
@@ -4,5 +4,15 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
COUNT(*) = 1
1
1
CREATE USER foo@localhost;
# Open connection to node 2 using 'foo' user.
# Connect with foo_node_2
INSERT INTO t1 VALUES (2);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SET GLOBAL read_only=FALSE;
SET GLOBAL read_only=FALSE;
DROP TABLE t1;
DROP TABLE t1;
DROP USER foo@localhost;
mysql-test/suite/galera/t/galera_read_only.test
View file @
4d33f9dc
...
@@ -17,7 +17,23 @@ INSERT INTO t1 VALUES (1);
...
@@ -17,7 +17,23 @@ INSERT INTO t1 VALUES (1);
--
connection
node_2
--
connection
node_2
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
SET
GLOBAL
read_only
=
FALSE
;
CREATE
USER
foo
@
localhost
;
--
echo
# Open connection to node 2 using 'foo' user.
--
let
$port_2
=
\
$NODE_MYPORT_2
--
connect
(
foo_node_2
,
127.0
.
0.1
,
foo
,,
test
,
$port_2
,)
--
echo
--
echo
# Connect with foo_node_2
--
connection
foo_node_2
--
error
ER_OPTION_PREVENTS_STATEMENT
INSERT
INTO
t1
VALUES
(
2
);
--
connection
node_2
SELECT
COUNT
(
*
)
=
1
FROM
t1
;
# Cleanup
SET
GLOBAL
read_only
=
FALSE
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
USER
foo
@
localhost
;
mysys/my_alloc.c
View file @
4d33f9dc
...
@@ -104,6 +104,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
...
@@ -104,6 +104,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
void
reset_root_defaults
(
MEM_ROOT
*
mem_root
,
size_t
block_size
,
void
reset_root_defaults
(
MEM_ROOT
*
mem_root
,
size_t
block_size
,
size_t
pre_alloc_size
__attribute__
((
unused
)))
size_t
pre_alloc_size
__attribute__
((
unused
)))
{
{
DBUG_ENTER
(
"reset_root_defaults"
);
DBUG_ASSERT
(
alloc_root_inited
(
mem_root
));
DBUG_ASSERT
(
alloc_root_inited
(
mem_root
));
mem_root
->
block_size
=
(((
block_size
-
ALLOC_ROOT_MIN_BLOCK_SIZE
)
&
~
1
)
|
mem_root
->
block_size
=
(((
block_size
-
ALLOC_ROOT_MIN_BLOCK_SIZE
)
&
~
1
)
|
...
@@ -126,7 +127,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
...
@@ -126,7 +127,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
{
{
/* We found a suitable block, no need to do anything else */
/* We found a suitable block, no need to do anything else */
mem_root
->
pre_alloc
=
mem
;
mem_root
->
pre_alloc
=
mem
;
return
;
DBUG_VOID_RETURN
;
}
}
if
(
mem
->
left
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
))
==
mem
->
size
)
if
(
mem
->
left
+
ALIGN_SIZE
(
sizeof
(
USED_MEM
))
==
mem
->
size
)
{
{
...
@@ -156,6 +157,8 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
...
@@ -156,6 +157,8 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
else
else
#endif
#endif
mem_root
->
pre_alloc
=
0
;
mem_root
->
pre_alloc
=
0
;
DBUG_VOID_RETURN
;
}
}
...
...
sql/mysqld.cc
View file @
4d33f9dc
...
@@ -5104,6 +5104,39 @@ static int init_server_components()
...
@@ -5104,6 +5104,39 @@ static int init_server_components()
}
}
plugins_are_initialized
=
TRUE
;
/* Don't separate from init function */
plugins_are_initialized
=
TRUE
;
/* Don't separate from init function */
#ifdef WITH_WSREP
/* Wait for wsrep threads to get created. */
if
(
wsrep_creating_startup_threads
==
1
)
{
mysql_mutex_lock
(
&
LOCK_thread_count
);
while
(
wsrep_running_threads
<
2
)
{
mysql_cond_wait
(
&
COND_thread_count
,
&
LOCK_thread_count
);
}
/* Now is the time to initialize threads for queries. */
THD
*
tmp
;
I_List_iterator
<
THD
>
it
(
threads
);
while
((
tmp
=
it
++
))
{
if
(
tmp
->
wsrep_applier
==
true
)
{
/*
Set THR_THD to temporally point to this THD to register all the
variables that allocates memory for this THD.
*/
THD
*
current_thd_saved
=
current_thd
;
set_current_thd
(
tmp
);
tmp
->
init_for_queries
();
/* Restore current_thd. */
set_current_thd
(
current_thd_saved
);
}
}
mysql_mutex_unlock
(
&
LOCK_thread_count
);
}
#endif
/* we do want to exit if there are any other unknown options */
/* we do want to exit if there are any other unknown options */
if
(
remaining_argc
>
1
)
if
(
remaining_argc
>
1
)
{
{
...
@@ -5340,16 +5373,11 @@ pthread_handler_t start_wsrep_THD(void *arg)
...
@@ -5340,16 +5373,11 @@ pthread_handler_t start_wsrep_THD(void *arg)
THD
*
thd
;
THD
*
thd
;
wsrep_thd_processor_fun
processor
=
(
wsrep_thd_processor_fun
)
arg
;
wsrep_thd_processor_fun
processor
=
(
wsrep_thd_processor_fun
)
arg
;
if
(
my_thread_init
())
if
(
my_thread_init
()
||
(
!
(
thd
=
new
THD
(
true
)))
)
{
{
WSREP_ERROR
(
"Could not initialize thread"
);
goto
error
;
return
(
NULL
);
}
}
if
(
!
(
thd
=
new
THD
(
true
)))
{
return
(
NULL
);
}
mysql_mutex_lock
(
&
LOCK_thread_count
);
mysql_mutex_lock
(
&
LOCK_thread_count
);
thd
->
thread_id
=
thread_id
++
;
thd
->
thread_id
=
thread_id
++
;
...
@@ -5374,13 +5402,13 @@ pthread_handler_t start_wsrep_THD(void *arg)
...
@@ -5374,13 +5402,13 @@ pthread_handler_t start_wsrep_THD(void *arg)
mysql_thread_set_psi_id
(
thd
->
thread_id
);
mysql_thread_set_psi_id
(
thd
->
thread_id
);
thd
->
thr_create_utime
=
microsecond_interval_timer
();
thd
->
thr_create_utime
=
microsecond_interval_timer
();
if
(
MYSQL_CALLBACK_ELSE
(
thread_scheduler
,
init_new_connection_thread
,
(),
0
))
if
(
MYSQL_CALLBACK_ELSE
(
thread_scheduler
,
init_new_connection_thread
,
(),
0
))
{
{
close_connection
(
thd
,
ER_OUT_OF_RESOURCES
);
close_connection
(
thd
,
ER_OUT_OF_RESOURCES
);
statistic_increment
(
aborted_connects
,
&
LOCK_status
);
statistic_increment
(
aborted_connects
,
&
LOCK_status
);
MYSQL_CALLBACK
(
thread_scheduler
,
end_thread
,
(
thd
,
0
));
MYSQL_CALLBACK
(
thread_scheduler
,
end_thread
,
(
thd
,
0
));
goto
error
;
return
(
NULL
);
}
}
// </5.1.17>
// </5.1.17>
...
@@ -5403,8 +5431,7 @@ pthread_handler_t start_wsrep_THD(void *arg)
...
@@ -5403,8 +5431,7 @@ pthread_handler_t start_wsrep_THD(void *arg)
statistic_increment
(
aborted_connects
,
&
LOCK_status
);
statistic_increment
(
aborted_connects
,
&
LOCK_status
);
MYSQL_CALLBACK
(
thread_scheduler
,
end_thread
,
(
thd
,
0
));
MYSQL_CALLBACK
(
thread_scheduler
,
end_thread
,
(
thd
,
0
));
delete
thd
;
delete
thd
;
goto
error
;
return
(
NULL
);
}
}
thd
->
system_thread
=
SYSTEM_THREAD_SLAVE_SQL
;
thd
->
system_thread
=
SYSTEM_THREAD_SLAVE_SQL
;
...
@@ -5414,12 +5441,21 @@ pthread_handler_t start_wsrep_THD(void *arg)
...
@@ -5414,12 +5441,21 @@ pthread_handler_t start_wsrep_THD(void *arg)
//thd->version= refresh_version;
//thd->version= refresh_version;
thd
->
proc_info
=
0
;
thd
->
proc_info
=
0
;
thd
->
set_command
(
COM_SLEEP
);
thd
->
set_command
(
COM_SLEEP
);
thd
->
set_time
();
thd
->
init_for_queries
();
if
(
wsrep_creating_startup_threads
==
0
)
{
thd
->
init_for_queries
();
}
mysql_mutex_lock
(
&
LOCK_thread_count
);
mysql_mutex_lock
(
&
LOCK_thread_count
);
wsrep_running_threads
++
;
wsrep_running_threads
++
;
mysql_cond_broadcast
(
&
COND_thread_count
);
mysql_cond_broadcast
(
&
COND_thread_count
);
if
(
wsrep_running_threads
>
2
)
{
wsrep_creating_startup_threads
=
0
;
}
mysql_mutex_unlock
(
&
LOCK_thread_count
);
mysql_mutex_unlock
(
&
LOCK_thread_count
);
processor
(
thd
);
processor
(
thd
);
...
@@ -5457,6 +5493,15 @@ pthread_handler_t start_wsrep_THD(void *arg)
...
@@ -5457,6 +5493,15 @@ pthread_handler_t start_wsrep_THD(void *arg)
mysql_mutex_unlock
(
&
LOCK_thread_count
);
mysql_mutex_unlock
(
&
LOCK_thread_count
);
}
}
return
(
NULL
);
return
(
NULL
);
error:
WSREP_ERROR
(
"Failed to create/initialize system thread"
);
/* Abort if its the first applier/rollbacker thread. */
if
(
wsrep_creating_startup_threads
<
2
)
unireg_abort
(
1
);
else
return
NULL
;
}
}
/**/
/**/
...
...
sql/sql_parse.cc
View file @
4d33f9dc
...
@@ -1199,22 +1199,6 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
...
@@ -1199,22 +1199,6 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
}
}
#ifdef WITH_WSREP
#ifdef WITH_WSREP
static
my_bool
wsrep_read_only_option
(
THD
*
thd
,
TABLE_LIST
*
all_tables
)
{
int
opt_readonly_saved
=
opt_readonly
;
ulong
flag_saved
=
(
ulong
)(
thd
->
security_ctx
->
master_access
&
SUPER_ACL
);
opt_readonly
=
0
;
thd
->
security_ctx
->
master_access
&=
~
SUPER_ACL
;
my_bool
ret
=
!
deny_updates_if_read_only_option
(
thd
,
all_tables
);
opt_readonly
=
opt_readonly_saved
;
thd
->
security_ctx
->
master_access
|=
flag_saved
;
return
ret
;
}
static
void
wsrep_copy_query
(
THD
*
thd
)
static
void
wsrep_copy_query
(
THD
*
thd
)
{
{
thd
->
wsrep_retry_command
=
thd
->
get_command
();
thd
->
wsrep_retry_command
=
thd
->
get_command
();
...
@@ -1228,6 +1212,7 @@ static void wsrep_copy_query(THD *thd)
...
@@ -1228,6 +1212,7 @@ static void wsrep_copy_query(THD *thd)
thd
->
wsrep_retry_query
[
thd
->
wsrep_retry_query_len
]
=
'\0'
;
thd
->
wsrep_retry_query
[
thd
->
wsrep_retry_query_len
]
=
'\0'
;
}
}
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
/**
/**
Perform one connection-level (COM_XXXX) command.
Perform one connection-level (COM_XXXX) command.
...
@@ -6989,8 +6974,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
...
@@ -6989,8 +6974,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
bool
is_autocommit
=
bool
is_autocommit
=
!
thd
->
in_multi_stmt_transaction_mode
()
&&
!
thd
->
in_multi_stmt_transaction_mode
()
&&
thd
->
wsrep_conflict_state
==
NO_CONFLICT
&&
thd
->
wsrep_conflict_state
==
NO_CONFLICT
&&
!
thd
->
wsrep_applier
&&
!
thd
->
wsrep_applier
;
wsrep_read_only_option
(
thd
,
thd
->
lex
->
query_tables
);
do
do
{
{
...
...
sql/wsrep_mysqld.cc
View file @
4d33f9dc
...
@@ -71,6 +71,13 @@ my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
...
@@ -71,6 +71,13 @@ my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
// restart will be needed
// restart will be needed
my_bool
wsrep_slave_UK_checks
=
0
;
// slave thread does UK checks
my_bool
wsrep_slave_UK_checks
=
0
;
// slave thread does UK checks
my_bool
wsrep_slave_FK_checks
=
0
;
// slave thread does FK checks
my_bool
wsrep_slave_FK_checks
=
0
;
// slave thread does FK checks
/*
Set during the creation of first wsrep applier and rollback threads.
Since these threads are critical, abort if the thread creation fails.
*/
my_bool
wsrep_creating_startup_threads
=
0
;
/*
/*
* End configuration options
* End configuration options
*/
*/
...
@@ -671,6 +678,7 @@ void wsrep_init_startup (bool first)
...
@@ -671,6 +678,7 @@ void wsrep_init_startup (bool first)
if
(
!
wsrep_start_replication
())
unireg_abort
(
1
);
if
(
!
wsrep_start_replication
())
unireg_abort
(
1
);
wsrep_creating_startup_threads
=
1
;
wsrep_create_rollbacker
();
wsrep_create_rollbacker
();
wsrep_create_appliers
(
1
);
wsrep_create_appliers
(
1
);
...
...
sql/wsrep_mysqld.h
View file @
4d33f9dc
...
@@ -107,6 +107,7 @@ extern my_bool wsrep_restart_slave_activated;
...
@@ -107,6 +107,7 @@ extern my_bool wsrep_restart_slave_activated;
extern
my_bool
wsrep_slave_FK_checks
;
extern
my_bool
wsrep_slave_FK_checks
;
extern
my_bool
wsrep_slave_UK_checks
;
extern
my_bool
wsrep_slave_UK_checks
;
extern
bool
wsrep_new_cluster
;
// bootstrap the cluster ?
extern
bool
wsrep_new_cluster
;
// bootstrap the cluster ?
extern
my_bool
wsrep_creating_startup_threads
;
enum
enum_wsrep_OSU_method
{
enum
enum_wsrep_OSU_method
{
WSREP_OSU_TOI
,
WSREP_OSU_TOI
,
...
...
support-files/mysql.server.sh
View file @
4d33f9dc
...
@@ -24,6 +24,14 @@
...
@@ -24,6 +24,14 @@
# Short-Description: start and stop MySQL
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
### END INIT INFO
# Prevent OpenSUSE's init scripts from calling systemd, so that
# both 'bootstrap' and 'start' are handled entirely within this
# script
SYSTEMD_NO_WRAP
=
1
# Prevent Debian's init scripts from calling systemctl
_SYSTEMCTL_SKIP_REDIRECT
=
true
# If you install MySQL on some other places than @prefix@, then you
# If you install MySQL on some other places than @prefix@, then you
# have to do one of the following things for this script to work:
# have to do one of the following things for this script to work:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment