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
2a729b5f
Commit
2a729b5f
authored
Feb 17, 2016
by
sjaakola
Committed by
Jan Lindström
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs MW-245 - merged wsrep_dirty_reads and wsrep_reject_queries from PXC
parent
e390f7b6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
131 additions
and
18 deletions
+131
-18
mysql-test/suite/galera/r/galera_defaults.result
mysql-test/suite/galera/r/galera_defaults.result
+2
-1
mysql-test/suite/galera/r/galera_schema_dirty_reads.result
mysql-test/suite/galera/r/galera_schema_dirty_reads.result
+13
-0
mysql-test/suite/galera/r/galera_var_cluster_address.result
mysql-test/suite/galera/r/galera_var_cluster_address.result
+2
-1
mysql-test/suite/galera/r/galera_var_dirty_reads.result
mysql-test/suite/galera/r/galera_var_dirty_reads.result
+4
-3
mysql-test/suite/galera/t/galera_schema_dirty_reads.test
mysql-test/suite/galera/t/galera_schema_dirty_reads.test
+13
-0
mysql-test/suite/galera/t/galera_var_cluster_address.test
mysql-test/suite/galera/t/galera_var_cluster_address.test
+0
-1
mysql-test/suite/galera/t/galera_var_dirty_reads.test
mysql-test/suite/galera/t/galera_var_dirty_reads.test
+0
-3
mysql-test/suite/sys_vars/r/sysvars_wsrep.result
mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+14
-0
sql/sql_class.h
sql/sql_class.h
+8
-0
sql/sql_parse.cc
sql/sql_parse.cc
+33
-8
sql/sys_vars.cc
sql/sys_vars.cc
+9
-1
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+7
-0
sql/wsrep_var.cc
sql/wsrep_var.cc
+25
-0
sql/wsrep_var.h
sql/wsrep_var.h
+1
-0
No files found.
mysql-test/suite/galera/r/galera_defaults.result
View file @
2a729b5f
SELECT COUNT(*) = 43 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
COUNT(*) = 43
1
0
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
...
...
@@ -40,6 +40,7 @@ WSREP_NOTIFY_CMD
WSREP_ON ON
WSREP_OSU_METHOD TOI
WSREP_RECOVER OFF
WSREP_REJECT_QUERIES NONE
WSREP_REPLICATE_MYISAM OFF
WSREP_RESTART_SLAVE OFF
WSREP_RETRY_AUTOCOMMIT 1
...
...
mysql-test/suite/galera/r/galera_schema_dirty_reads.result
0 → 100644
View file @
2a729b5f
USE information_schema;
SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
VARIABLE_NAME VARIABLE_VALUE
WSREP_DIRTY_READS OFF
SET GLOBAL wsrep_reject_queries=ALL;
SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
VARIABLE_NAME VARIABLE_VALUE
WSREP_DIRTY_READS OFF
SET GLOBAL wsrep_reject_queries=NONE;
SET SESSION wsrep_dirty_reads=TRUE;
SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
VARIABLE_NAME VARIABLE_VALUE
WSREP_DIRTY_READS ON
mysql-test/suite/galera/r/galera_var_cluster_address.result
View file @
2a729b5f
SET GLOBAL wsrep_cluster_address = 'foo://';
SET SESSION wsrep_sync_wait=0;
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
ERROR 08S01: WSREP has not yet prepared node for application use
COUNT(*) > 0
1
SHOW STATUS LIKE 'wsrep_ready';
Variable_name Value
wsrep_ready OFF
...
...
mysql-test/suite/galera/r/galera_var_dirty_reads.result
View file @
2a729b5f
...
...
@@ -33,11 +33,12 @@ SELECT 1;
1
1
USE information_schema;
ERROR 08S01: WSREP has not yet prepared node for application use
SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
ERROR 08S01: WSREP has not yet prepared node for application use
VARIABLE_NAME VARIABLE_VALUE
WSREP_DIRTY_READS OFF
SELECT COUNT(*) >= 10 FROM performance_schema.events_statements_history;
ERROR 08S01: WSREP has not yet prepared node for application use
COUNT(*) >= 10
1
USE test;
SELECT * FROM t1;
i
...
...
mysql-test/suite/galera/t/galera_schema_dirty_reads.test
0 → 100644
View file @
2a729b5f
#
# Dirty reads from INFORMATION_SCHEMA tables.
#
--
source
include
/
galera_cluster
.
inc
--
source
include
/
have_innodb
.
inc
--
disable_info
USE
information_schema
;
SELECT
*
FROM
SESSION_VARIABLES
WHERE
VARIABLE_NAME
LIKE
"wsrep_dirty_reads"
;
SET
GLOBAL
wsrep_reject_queries
=
ALL
;
SELECT
*
FROM
SESSION_VARIABLES
WHERE
VARIABLE_NAME
LIKE
"wsrep_dirty_reads"
;
SET
GLOBAL
wsrep_reject_queries
=
NONE
;
SET
SESSION
wsrep_dirty_reads
=
TRUE
;
SELECT
*
FROM
SESSION_VARIABLES
WHERE
VARIABLE_NAME
LIKE
"wsrep_dirty_reads"
;
mysql-test/suite/galera/t/galera_var_cluster_address.test
View file @
2a729b5f
...
...
@@ -24,7 +24,6 @@ SET GLOBAL wsrep_cluster_address = 'foo://';
SET
SESSION
wsrep_sync_wait
=
0
;
--
error
ER_UNKNOWN_COM_ERROR
SELECT
COUNT
(
*
)
>
0
FROM
INFORMATION_SCHEMA
.
GLOBAL_STATUS
;
# Must return 'OFF'
...
...
mysql-test/suite/galera/t/galera_var_dirty_reads.test
View file @
2a729b5f
...
...
@@ -49,13 +49,10 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
SELECT
1
;
--
error
ER_UNKNOWN_COM_ERROR
USE
information_schema
;
--
error
ER_UNKNOWN_COM_ERROR
SELECT
*
FROM
information_schema
.
session_variables
WHERE
variable_name
LIKE
"wsrep_dirty_reads"
;
--
error
ER_UNKNOWN_COM_ERROR
SELECT
COUNT
(
*
)
>=
10
FROM
performance_schema
.
events_statements_history
;
--
disable_query_log
...
...
mysql-test/suite/sys_vars/r/sysvars_wsrep.result
View file @
2a729b5f
...
...
@@ -421,6 +421,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME WSREP_REJECT_QUERIES
SESSION_VALUE NULL
GLOBAL_VALUE NONE
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NONE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT Variable to set to reject queries
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NONE,ALL,ALL_KILL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME WSREP_REPLICATE_MYISAM
SESSION_VALUE NULL
GLOBAL_VALUE OFF
...
...
sql/sql_class.h
View file @
2a729b5f
...
...
@@ -5475,6 +5475,14 @@ class select_dumpvar :public select_result_interceptor {
sent by the user (ie: stored procedure).
*/
#define CF_SKIP_QUESTIONS (1U << 1)
#ifdef WITH_WSREP
/**
Do not check that wsrep snapshot is ready before allowing this command
*/
#define CF_SKIP_WSREP_CHECK (1U << 2)
#else
#define CF_SKIP_WSREP_CHECK 0
#endif
/* WITH_WSREP */
/**
Do not check that wsrep snapshot is ready before allowing this command
...
...
sql/sql_parse.cc
View file @
2a729b5f
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 201
7
, MariaDB
Copyright (c) 2008, 201
8
, MariaDB
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
...
...
@@ -284,6 +284,8 @@ void init_update_queries(void)
server_command_flags
[
COM_QUERY
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_SET_OPTION
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_PREPARE
]
=
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_EXECUTE
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_FETCH
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_CLOSE
]
=
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_RESET
]
=
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_EXECUTE
]
=
CF_SKIP_WSREP_CHECK
;
...
...
@@ -887,6 +889,25 @@ void cleanup_items(Item *item)
}
#ifdef WITH_WSREP
static
bool
wsrep_tables_accessible_when_detached
(
const
TABLE_LIST
*
tables
)
{
for
(
const
TABLE_LIST
*
table
=
tables
;
table
;
table
=
table
->
next_global
)
{
TABLE_CATEGORY
c
;
LEX_STRING
db
,
tn
;
lex_string_set
(
&
db
,
table
->
db
);
lex_string_set
(
&
tn
,
table
->
table_name
);
c
=
get_table_category
(
&
db
,
&
tn
);
if
(
c
!=
TABLE_CATEGORY_INFORMATION
&&
c
!=
TABLE_CATEGORY_PERFORMANCE
)
{
return
false
;
}
}
return
true
;
}
#endif
/* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY
#ifdef WITH_WSREP
...
...
@@ -2659,14 +2680,18 @@ mysql_execute_command(THD *thd)
We additionally allow all other commands that do not change data in
case wsrep_dirty_reads is enabled.
*/
if
(
lex
->
sql_command
!=
SQLCOM_SET_OPTION
&&
!
wsrep_is_show_query
(
lex
->
sql_command
)
&&
!
(
thd
->
variables
.
wsrep_dirty_reads
&&
!
is_update_query
(
lex
->
sql_command
))
&&
!
(
lex
->
sql_command
==
SQLCOM_SELECT
&&
!
all_tables
)
&&
!
wsrep_node_is_ready
(
thd
))
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
(
wsrep_ready
||
(
thd
->
variables
.
wsrep_dirty_reads
&&
(
sql_command_flags
[
lex
->
sql_command
]
&
CF_CHANGES_DATA
)
==
0
)
||
wsrep_tables_accessible_when_detached
(
all_tables
))
&&
lex
->
sql_command
!=
SQLCOM_SET_OPTION
&&
!
wsrep_is_show_query
(
lex
->
sql_command
))
{
my_message
(
ER_UNKNOWN_COM_ERROR
,
"WSREP has not yet prepared node for application use"
,
MYF
(
0
));
goto
error
;
}
}
#endif
/* WITH_WSREP */
status_var_increment
(
thd
->
status_var
.
com_stat
[
lex
->
sql_command
]);
...
...
sql/sys_vars.cc
View file @
2a729b5f
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2012, 201
5
, MariaDB
Copyright (c) 2012, 201
8
, MariaDB
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
...
...
@@ -4967,6 +4967,14 @@ static Sys_var_mybool Sys_wsrep_desync (
ON_CHECK(wsrep_desync_check),
ON_UPDATE(wsrep_desync_update));
static const char *wsrep_reject_queries_names[]= { "
NONE
", "
ALL
", "
ALL_KILL
", NullS };
static Sys_var_enum Sys_wsrep_reject_queries(
"
wsrep_reject_queries
", "
Variable
to
set
to
reject
queries
",
GLOBAL_VAR(wsrep_reject_queries), CMD_LINE(OPT_ARG),
wsrep_reject_queries_names, DEFAULT(WSREP_REJECT_NONE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_reject_queries_update));
static const char *wsrep_binlog_format_names[]=
{"
MIXED
", "
STATEMENT
", "
ROW
", "
NONE
", NullS};
static Sys_var_enum Sys_wsrep_forced_binlog_format(
...
...
sql/wsrep_mysqld.h
View file @
2a729b5f
...
...
@@ -80,6 +80,7 @@ extern const char* wsrep_notify_cmd;
extern
long
wsrep_max_protocol_version
;
extern
ulong
wsrep_forced_binlog_format
;
extern
my_bool
wsrep_desync
;
extern
ulong
wsrep_reject_queries
;
extern
my_bool
wsrep_replicate_myisam
;
extern
ulong
wsrep_mysql_replication_bundle
;
extern
my_bool
wsrep_restart_slave
;
...
...
@@ -92,6 +93,12 @@ extern bool wsrep_gtid_mode;
extern
uint32
wsrep_gtid_domain_id
;
extern
bool
wsrep_dirty_reads
;
enum
enum_wsrep_reject_types
{
WSREP_REJECT_NONE
,
/* nothing rejected */
WSREP_REJECT_ALL
,
/* reject all queries, with UNKNOWN_COMMAND error */
WSREP_REJECT_ALL_KILL
/* kill existing connections and reject all queries*/
};
enum
enum_wsrep_OSU_method
{
WSREP_OSU_TOI
,
WSREP_OSU_RSU
,
...
...
sql/wsrep_var.cc
View file @
2a729b5f
...
...
@@ -34,6 +34,7 @@ const char* wsrep_node_name = 0;
const
char
*
wsrep_node_address
=
0
;
const
char
*
wsrep_node_incoming_address
=
0
;
const
char
*
wsrep_start_position
=
0
;
ulong
wsrep_reject_queries
;
static
long
wsrep_prev_slave_threads
=
wsrep_slave_threads
;
...
...
@@ -384,6 +385,30 @@ void wsrep_provider_options_init(const char* value)
wsrep_provider_options
=
(
value
)
?
my_strdup
(
value
,
MYF
(
0
))
:
NULL
;
}
bool
wsrep_reject_queries_update
(
sys_var
*
self
,
THD
*
thd
,
enum_var_type
type
)
{
switch
(
wsrep_reject_queries
)
{
case
WSREP_REJECT_NONE
:
wsrep_ready_set
(
TRUE
);
WSREP_INFO
(
"Allowing client queries due to manual setting"
);
break
;
case
WSREP_REJECT_ALL
:
wsrep_ready_set
(
FALSE
);
WSREP_INFO
(
"Rejecting client queries due to manual setting"
);
break
;
case
WSREP_REJECT_ALL_KILL
:
wsrep_ready_set
(
FALSE
);
wsrep_close_client_connections
(
FALSE
);
WSREP_INFO
(
"Rejecting client queries and killing connections due to manual setting"
);
break
;
default:
WSREP_INFO
(
"Unknown value for wsrep_reject_queries: %lu"
,
wsrep_reject_queries
);
return
true
;
}
return
false
;
}
static
int
wsrep_cluster_address_verify
(
const
char
*
cluster_address_str
)
{
/* There is no predefined address format, it depends on provider. */
...
...
sql/wsrep_var.h
View file @
2a729b5f
...
...
@@ -93,6 +93,7 @@ extern bool wsrep_desync_update UPDATE_ARGS;
extern
bool
wsrep_max_ws_size_check
CHECK_ARGS
;
extern
bool
wsrep_max_ws_size_update
UPDATE_ARGS
;
extern
bool
wsrep_reject_queries_update
UPDATE_ARGS
;
#else
/* WITH_WSREP */
...
...
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