Commit ddeeb42e authored by Eugene Kosov's avatar Eugene Kosov

Merge 10.1 into 10.2

parents 75833ef9 cf403934
SpaceBeforeAssignmentOperators: false
SpaceAfterCStyleCast: true
BreakBeforeBraces: Custom
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...
......@@ -36,6 +36,21 @@ use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;
use Term::ANSIColor;
my %color_map = qw/pass green
retry-pass green
fail red
retry-fail red
disabled bright_black
skipped yellow
reset reset/;
sub xterm_color {
if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
syswrite STDOUT, color($color_map{$_[0]});
}
}
my $tot_real_time= 0;
our $timestamp= 0;
......@@ -498,7 +513,16 @@ sub mtr_print (@) {
sub mtr_report (@) {
if (defined $verbose)
{
print _name(). join(" ", @_). "\n";
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
xterm_color($s[1]);
print "[ $s[1] ]";
xterm_color('reset');
print $s[2];
} else {
print $s[0];
}
}
}
......
......@@ -2510,6 +2510,40 @@ WHERE tb1.pk = 40
ORDER BY tb1.i1;
v2
DROP TABLE t1,t2;
#
# MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
# inner tables of outer joins
#
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
a b
3 3
7 7
1 NULL
select * from t1 left join t2 on a=b where (b > 3) is not true;
a b
3 3
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not true;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not true
select * from t1 left join t2 on a=b where (b > 3) is not false;
a b
7 7
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not false;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not false
drop table t1,t2;
# end of 5.5 tests
#
# MDEV-19258: chained right joins all converted to inner joins
......
......@@ -2521,6 +2521,40 @@ WHERE tb1.pk = 40
ORDER BY tb1.i1;
v2
DROP TABLE t1,t2;
#
# MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
# inner tables of outer joins
#
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
a b
7 7
3 3
1 NULL
select * from t1 left join t2 on a=b where (b > 3) is not true;
a b
3 3
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not true;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not true
select * from t1 left join t2 on a=b where (b > 3) is not false;
a b
7 7
1 NULL
explain extended select * from t1 left join t2 on a=b where (b > 3) is not false;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not false
drop table t1,t2;
# end of 5.5 tests
#
# MDEV-19258: chained right joins all converted to inner joins
......
......@@ -2040,6 +2040,29 @@ ORDER BY tb1.i1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-19790 : IS NOT TRUE / IS NOT FALSE predicates over
--echo # inner tables of outer joins
--echo #
create table t1 (a int);
create table t2 (b int);
insert into t1 values (3), (7), (1);
insert into t2 values (7), (4), (3);
select * from t1 left join t2 on a=b;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not true;
eval $q;
eval explain extended $q;
let $q=
select * from t1 left join t2 on a=b where (b > 3) is not false;
eval $q;
eval explain extended $q;
drop table t1,t2;
--echo # end of 5.5 tests
--echo #
......
......@@ -19,6 +19,7 @@
#include <mntent.h>
#include <sql_class.h>
#include <table.h>
#include <sql_acl.h> /* check_global_access() */
bool schema_table_store_record(THD *thd, TABLE *table);
......@@ -83,6 +84,9 @@ int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
int rv = 1;
TABLE* pTable = pTables->table;
if (check_global_access(pThd, FILE_ACL, true))
return 0;
FILE* pFile = setmntent("/etc/mtab", "r");
if (pFile)
......@@ -144,11 +148,11 @@ maria_declare_plugin(disks)
PLUGIN_LICENSE_GPL, /* license type */
disks_table_init, /* init function */
NULL, /* deinit function */
0x0100, /* version = 1.0 */
0x0101, /* version = 1.1 */
NULL, /* no status variables */
NULL, /* no system variables */
"1.0", /* String version representation */
MariaDB_PLUGIN_MATURITY_BETA /* Maturity (see include/mysql/plugin.h)*/
"1.1", /* String version representation */
MariaDB_PLUGIN_MATURITY_STABLE /* Maturity (see include/mysql/plugin.h)*/
}
mysql_declare_plugin_end;
......
#
# MDEV-18328: Make DISKS plugin check some privilege to access
# information_schema.DISKS table
#
CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
NULL NULL
disconnect con1;
connection default;
GRANT FILE ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
1 1
connection default;
DROP USER user1@localhost;
# End of 10.1 tests
source include/not_embedded.inc;
--echo #
--echo # MDEV-18328: Make DISKS plugin check some privilege to access
--echo # information_schema.DISKS table
--echo #
CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
disconnect con1;
connection default;
GRANT FILE ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
connection default;
DROP USER user1@localhost;
--echo # End of 10.1 tests
This diff is collapsed.
......@@ -268,6 +268,8 @@ class Item_func_isnottrue : public Item_func_truth
virtual const char* func_name() const { return "isnottrue"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_isnottrue>(thd, mem_root, this); }
bool eval_not_null_tables(void *opt_arg)
{ not_null_tables_cache= 0; return false; }
};
......@@ -299,6 +301,8 @@ class Item_func_isnotfalse : public Item_func_truth
virtual const char* func_name() const { return "isnotfalse"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_isnotfalse>(thd, mem_root, this); }
bool eval_not_null_tables(void *opt_arg)
{ not_null_tables_cache= 0; return false; }
};
......
......@@ -118,11 +118,26 @@ void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask)
{
plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask);
add_audit_mask(thd->audit_class_mask, event_class_mask);
thd->audit_plugin_version= global_plugin_version;
}
DBUG_VOID_RETURN;
}
/**
Check if there were changes in the state of plugins
so we need to do the mysql_audit_release asap.
@param[in] thd
*/
my_bool mysql_audit_release_required(THD *thd)
{
return thd && (thd->audit_plugin_version != global_plugin_version);
}
/**
Release any resources associated with the current thd.
......@@ -158,6 +173,7 @@ void mysql_audit_release(THD *thd)
/* Reset the state of thread values */
reset_dynamic(&thd->audit_class_plugins);
bzero(thd->audit_class_mask, sizeof(thd->audit_class_mask));
thd->audit_plugin_version= -1;
}
......
......@@ -60,6 +60,7 @@ static inline void mysql_audit_notify(THD *thd, uint event_class,
#define mysql_audit_connection_enabled() 0
#define mysql_audit_table_enabled() 0
#endif
extern my_bool mysql_audit_release_required(THD *thd);
extern void mysql_audit_release(THD *thd);
static inline unsigned int strlen_uint(const char *s)
......
......@@ -628,6 +628,9 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
waiting_on_group_commit(FALSE), has_waiter(FALSE),
spcont(NULL),
m_parser_state(NULL),
#ifndef EMBEDDED_LIBRARY
audit_plugin_version(-1),
#endif
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */
......
......@@ -3163,6 +3163,7 @@ class THD :public Statement,
added to the list of audit plugins which are currently in use.
*/
unsigned long audit_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
int audit_plugin_version;
#endif
#if defined(ENABLED_DEBUG_SYNC)
......
......@@ -1331,7 +1331,8 @@ void do_handle_one_connection(CONNECT *connect)
while (thd_is_connection_alive(thd))
{
mysql_audit_release(thd);
if (mysql_audit_release_required(thd))
mysql_audit_release(thd);
if (do_command(thd))
break;
}
......
......@@ -228,6 +228,7 @@ static DYNAMIC_ARRAY plugin_array;
static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM];
static MEM_ROOT plugin_mem_root;
static bool reap_needed= false;
volatile int global_plugin_version= 1;
static bool initialized= 0;
ulong dlopen_count;
......@@ -2193,6 +2194,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
reap_plugins();
}
err:
global_plugin_version++;
mysql_mutex_unlock(&LOCK_plugin);
if (argv)
free_defaults(argv);
......@@ -2340,6 +2342,7 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
}
reap_plugins();
global_plugin_version++;
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(error);
......
......@@ -37,6 +37,7 @@ enum enum_plugin_load_option { PLUGIN_OFF, PLUGIN_ON, PLUGIN_FORCE,
PLUGIN_FORCE_PLUS_PERMANENT };
extern const char *global_plugin_typelib_names[];
extern volatile int global_plugin_version;
extern ulong dlopen_count;
#include <my_sys.h>
......
......@@ -361,7 +361,8 @@ static int threadpool_process_request(THD *thd)
{
Vio *vio;
thd->net.reading_or_writing= 0;
mysql_audit_release(thd);
if (mysql_audit_release_required(thd))
mysql_audit_release(thd);
if ((retval= do_command(thd)) != 0)
goto end;
......
UseTab: Always
TabWidth: 8
IndentWidth: 8
BreakBeforeBinaryOperators: All
PointerAlignment: Left
AlwaysBreakAfterReturnType: TopLevel
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
AccessModifierOffset: -8
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