Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed May 31, 2020
2 parents 0bf843c + 6da14d7 commit 4a0b56f
Show file tree
Hide file tree
Showing 141 changed files with 3,168 additions and 950 deletions.
3 changes: 2 additions & 1 deletion cmake/build_configurations/mysql_release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ ELSEIF(DEB)
SET(WITH_PCRE system CACHE STRING "")
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_PCRE bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
Expand Down Expand Up @@ -145,7 +146,7 @@ IF(UNIX)
RedHat/Fedora/Oracle Linux: yum install libaio-devel
SuSE: zypper install libaio-devel
If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
If you really do not want it, pass -DIGNORE_AIO_CHECK=ON to cmake.
")
ENDIF()

Expand Down
1 change: 1 addition & 0 deletions cmake/cpack_source_ignore_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

SET(CPACK_SOURCE_IGNORE_FILES
\\\\.git/
\\\\.git$
\\\\.gitignore$
\\\\.gitattributes$
CMakeCache\\\\.txt$
Expand Down
4 changes: 2 additions & 2 deletions cmake/submodules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
SET(update_result 0)
ELSEIF (cmake_update_submodules MATCHES force)
MESSAGE(STATUS "Updating submodules (forced)")
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive --depth=1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSEIF (cmake_update_submodules MATCHES yes)
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive --depth=1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSE()
Expand Down
1 change: 1 addition & 0 deletions extra/comp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'x':
case 's':
case 'M':
case 'T':
start= 0; /* Not in format specifier anymore */
break;
}
Expand Down
99 changes: 77 additions & 22 deletions include/intrusive_list.h → include/ilist.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,28 @@
#include <cstddef>
#include <iterator>

namespace intrusive
{

// Derive your class from this struct to insert to a linked list.
template <class Tag= void> struct list_node
template <class Tag= void> struct ilist_node
{
list_node(list_node *next= NULL, list_node *prev= NULL)
: next(next), prev(prev)
ilist_node()
#ifndef DBUG_OFF
:
next(NULL), prev(NULL)
#endif
{
}

list_node *next;
list_node *prev;
ilist_node(ilist_node *next, ilist_node *prev) : next(next), prev(prev) {}

ilist_node *next;
ilist_node *prev;
};

// Modelled after std::list<T>
template <class T, class Tag= void> class list
template <class T, class Tag= void> class ilist
{
public:
typedef list_node<Tag> ListNode;
typedef ilist_node<Tag> ListNode;
class Iterator;

// All containers in C++ should define these types to implement generic
Expand Down Expand Up @@ -103,10 +105,10 @@ template <class T, class Tag= void> class list
private:
ListNode *node_;

friend class list;
friend class ilist;
};

list() : sentinel_(&sentinel_, &sentinel_), size_(0) {}
ilist() : sentinel_(&sentinel_, &sentinel_) {}

reference front() { return *begin(); }
reference back() { return *--end(); }
Expand All @@ -129,14 +131,18 @@ template <class T, class Tag= void> class list
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const { return reverse_iterator(begin()); }

bool empty() const { return size_ == 0; }
size_type size() const { return size_; }
bool empty() const { return sentinel_.next == &sentinel_; }

// Not implemented because it's O(N)
// size_type size() const
// {
// return static_cast<size_type>(std::distance(begin(), end()));
// }

void clear()
{
sentinel_.next= &sentinel_;
sentinel_.prev= &sentinel_;
size_= 0;
}

iterator insert(iterator pos, reference value)
Expand All @@ -150,7 +156,6 @@ template <class T, class Tag= void> class list
static_cast<ListNode &>(value).prev= prev;
static_cast<ListNode &>(value).next= curr;

++size_;
return iterator(&value);
}

Expand All @@ -162,13 +167,12 @@ template <class T, class Tag= void> class list
prev->next= next;
next->prev= prev;

// This is not required for list functioning. But maybe it'll prevent bugs
// and ease debugging.
#ifndef DBUG_OFF
ListNode *curr= pos.node_;
curr->prev= NULL;
curr->next= NULL;
#endif

--size_;
return next;
}

Expand All @@ -179,12 +183,63 @@ template <class T, class Tag= void> class list
void pop_front() { erase(begin()); }

// STL version is O(n) but this is O(1) because an element can't be inserted
// several times in the same intrusive list.
// several times in the same ilist.
void remove(reference value) { erase(iterator(&value)); }

private:
ListNode sentinel_;
size_type size_;
};

} // namespace intrusive
// Similar to ilist but also has O(1) size() method.
template <class T, class Tag= void> class sized_ilist : public ilist<T, Tag>
{
typedef ilist<T, Tag> BASE;

public:
// All containers in C++ should define these types to implement generic
// container interface.
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef value_type &reference;
typedef const value_type &const_reference;
typedef T *pointer;
typedef const T *const_pointer;
typedef typename BASE::Iterator iterator;
typedef const typename BASE::Iterator const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const iterator> const_reverse_iterator;

sized_ilist() : size_(0) {}

size_type size() const { return size_; }

void clear()
{
BASE::clear();
size_= 0;
}

iterator insert(iterator pos, reference value)
{
++size_;
return BASE::insert(pos, value);
}

iterator erase(iterator pos)
{
--size_;
return BASE::erase(pos);
}

void push_back(reference value) { insert(BASE::end(), value); }
void pop_back() { erase(BASE::end()); }

void push_front(reference value) { insert(BASE::begin(), value); }
void pop_front() { erase(BASE::begin()); }

void remove(reference value) { erase(iterator(&value)); }

private:
size_type size_;
};
6 changes: 5 additions & 1 deletion include/mysql/service_my_snprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
Supported formats are 's' (null pointer is accepted, printed as
"(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o',
'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below).
'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below),
'T' (extension, see below).
Standard syntax for positional arguments $n is supported.
Expand All @@ -69,6 +70,9 @@
Format 'M': takes one integer, prints this integer, space, double quote
error message, double quote. In other words
printf("%M", n) === printf("%d \"%s\"", n, strerror(n))
Format 'T': takes string and print it like s but if the strints should be
truncated puts "..." at the end.
*/

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
60 changes: 45 additions & 15 deletions mysql-test/lib/mtr_report.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,20 @@ use My::Platform;
use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;

use Term::ANSIColor;
use English;

my $tot_real_time= 0;
my $tests_done= 0;
my $tests_failed= 0;

our $timestamp= 0;
our $timediff= 0;
our $name;
our $verbose;
our $verbose_restart= 0;
our $timer= 1;
our $tests_total;

my %color_map = qw/pass green
retry-pass green
Expand All @@ -47,20 +59,39 @@ my %color_map = qw/pass green
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 $set_titlebar;
my $set_color= sub { };

if (-t STDOUT) {
if (IS_WINDOWS) {
eval {
require Win32::Console;
$set_titlebar = sub { &Win32::Console::Title($_[0]);};
}
} elsif ($ENV{TERM} =~ /xterm/) {
$set_titlebar = sub { syswrite STDOUT, "\e]0;$_[0]\a"; };
$set_color = sub { syswrite STDOUT, color($color_map{$_[0]}); }
}
}

my $tot_real_time= 0;
sub titlebar_stat($) {

our $timestamp= 0;
our $timediff= 0;
our $name;
our $verbose;
our $verbose_restart= 0;
our $timer= 1;
sub time_format($) {
sprintf '%d:%02d:%02d', $_[0]/3600, ($_[0]/60)%60, $_[0]%60;
}

$tests_done++;
$tests_failed++ if $_[0] =~ /fail/;
$tests_total++ if $_[0] =~ /retry/;

my $spent = time - $BASETIME;
my $left = $tests_total - $tests_done;

&$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left, %d failed",
time_format($spent), $tests_done,
time_format($spent/$tests_done * $left), $left, $tests_failed);
}

sub report_option {
my ($opt, $value)= @_;
Expand Down Expand Up @@ -321,8 +352,6 @@ sub mtr_report_stats ($$$$) {

if ( $timer )
{
use English;

mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
time - $BASETIME, "seconds executing testcases");
}
Expand Down Expand Up @@ -620,10 +649,11 @@ sub mtr_report (@) {
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
xterm_color($s[1]);
&$set_color($s[1]);
print "[ $s[1] ]";
xterm_color('reset');
&$set_color('reset');
print $s[2];
titlebar_stat($s[1]) if $set_titlebar;
} else {
print $s[0];
}
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/main/alter_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,11 @@ alter table person_principal add column if not exists date_mask tinyint null;
update person_principal set date_mask = 0;
alter table person_principal modify column date_mask tinyint not null;
drop tables person_principal_hist, person_principal;
CREATE OR REPLACE TABLE `t1` ( `id` varchar(64) NOT NULL, `name` varchar(255) NOT NULL, `extra` text DEFAULT NULL, `password` varchar(128) DEFAULT NULL, `enabled` tinyint(1) DEFAULT NULL, `domain_id` varchar(64) NOT NULL, `default_project_id` varchar(64) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `CONSTRAINT_1` CHECK (`enabled` in (0,1)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into t1 (id,name,enabled,domain_id) values (1,"Monty",1,"domain_id");
insert into t1 (id,name,enabled,domain_id) values (2,"Monty2",1,"domain_id2");
ALTER TABLE t1 ADD CONSTRAINT ixu_user2_name_domain_id UNIQUE (domain_id, name);
DROP TABLE t1;
#
# End of 10.4 tests
#
Expand Down Expand Up @@ -3306,3 +3311,6 @@ t2 CREATE TABLE `t2` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
#
# End of 10.5 tests
#
14 changes: 14 additions & 0 deletions mysql-test/main/alter_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -2111,6 +2111,16 @@ update person_principal set date_mask = 0;
alter table person_principal modify column date_mask tinyint not null;
drop tables person_principal_hist, person_principal;

#
# The following ALTER TABLE caused crash in 10.4.13 (Reported on freenode)
#

CREATE OR REPLACE TABLE `t1` ( `id` varchar(64) NOT NULL, `name` varchar(255) NOT NULL, `extra` text DEFAULT NULL, `password` varchar(128) DEFAULT NULL, `enabled` tinyint(1) DEFAULT NULL, `domain_id` varchar(64) NOT NULL, `default_project_id` varchar(64) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `CONSTRAINT_1` CHECK (`enabled` in (0,1)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into t1 (id,name,enabled,domain_id) values (1,"Monty",1,"domain_id");
insert into t1 (id,name,enabled,domain_id) values (2,"Monty2",1,"domain_id2");
ALTER TABLE t1 ADD CONSTRAINT ixu_user2_name_domain_id UNIQUE (domain_id, name);
DROP TABLE t1;

--echo #
--echo # End of 10.4 tests
--echo #
Expand Down Expand Up @@ -2506,3 +2516,7 @@ alter table if exists t9 rename t1;
alter table if exists t1 rename t2;
show create table t2;
drop table t2;

--echo #
--echo # End of 10.5 tests
--echo #
5 changes: 4 additions & 1 deletion mysql-test/main/comment_table.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DROP TABLE IF EXISTS t1;
create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
Expand Down Expand Up @@ -125,3 +124,7 @@ SELECT table_comment,char_length(table_comment) FROM information_schema.tables W
table_comment char_length(table_comment)
SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
column_comment char_length(column_comment)
set names utf8;
create table t1 (x int comment 'a�');
ERROR HY000: Invalid utf8 character string: 'a'
set names latin1;
Loading

0 comments on commit 4a0b56f

Please sign in to comment.