Skip to content

Commit

Permalink
Merge bb-10.2-ext into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jul 7, 2017
2 parents 7fee164 + 9e53a6b commit 57fea53
Show file tree
Hide file tree
Showing 380 changed files with 19,560 additions and 17,411 deletions.
50 changes: 39 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,50 @@ matrix:
include:
- os: linux
compiler: gcc
# disable cache - was out of disk space
cache: false
addons:
apt:
packages: # make sure these match debian/control contents
- bison
- chrpath
- cmake
- debhelper
- dh-apparmor
- dpatch
- gdb
- libaio-dev
- libboost-dev
- libcurl3-dev
- libdbd-mysql
- libjudy-dev
- libncurses5-dev
- libpam0g-dev
- libpcre3-dev
- libreadline-gplv2-dev
- libstemmer-dev
- libssl-dev
- libnuma-dev
- libxml2-dev
- lsb-release
- perl
- po-debconf
- psmisc
- zlib1g-dev
- libcrack2-dev
- libjemalloc-dev
- libsnappy-dev
- liblzma-dev
- libzmq-dev
- libdistro-info-perl
- uuid-dev
- devscripts
- fakeroot
script:
- ${CC} --version ; ${CXX} --version
- source .travis.compiler.sh
# https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable
# in trusty containers
- export MTR_MEM=/tmp
- env DEB_BUILD_OPTIONS="parallel=6" MYSQL_BUILD_PATH=/usr/local/bin:/usr/bin:/bin debian/autobake-deb.sh;
- env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh;
- ccache --show-stats
# Until OSX becomes a bit more stable: MDEV-12435
allow_failures:
Expand Down Expand Up @@ -103,7 +138,7 @@ addons:
- llvm-toolchain-trusty
- llvm-toolchain-trusty-3.9
- llvm-toolchain-trusty-4.0
packages: # make sure these match debian/control contents
packages: # make sure these match the build requirements
- gcc-5
- g++-5
- gcc-6
Expand All @@ -116,9 +151,6 @@ addons:
- bison
- chrpath
- cmake
- debhelper
- dh-apparmor
- dpatch
- gdb
- libaio-dev
- libboost-dev
Expand All @@ -135,18 +167,14 @@ addons:
- libxml2-dev
- lsb-release
- perl
- po-debconf
- psmisc
- zlib1g-dev
- libcrack2-dev
- libjemalloc-dev
- libsnappy-dev
- liblzma-dev
- libzmq-dev
- libdistro-info-perl
- uuid-dev
- devscripts # implicit for any build on Ubuntu
- fakeroot

# libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882

Expand Down
24 changes: 13 additions & 11 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ organization registered in the USA.
The current main sponsors of the MariaDB Foundation are:

Alibaba Cloud https://intl.aliyun.com (2017)
Booking.com https://www.booking.com (2013 - 2017)
Development Bank of Singapore https://dbs.com (2016 - 2017)
MariaDB Corporation https://www.mariadb.com (2013 - 2017)
Visma https://visma.com (2015 - 2017)
Acronis http://acronis.com (2016 - 2017)
Nexedi https://www.nexedi.com (2016 - 2017)
Automattic https://automattic.com (2014 - 2017)
Tencent Game DBA http://tencentdba.com/about (2016 - 2017)
Tencent TDSQL http://tdsql.org/ (2016 - 2017)
Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2017)
Virtuozzo https://virtuozzo.com (2016 - 2017)
Booking.com https://www.booking.com (2013)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
MariaDB Corporation https://www.mariadb.com (2013)
Visma https://visma.com (2015)
Acronis http://acronis.com (2016)
Nexedi https://www.nexedi.com (2016)
Automattic https://automattic.com (2014)
Tencent Game DBA http://tencentdba.com/about (2016)
Tencent TDSQL http://tdsql.org (2016)
Verkkokauppa.com https://www.verkkokauppa.com (2015)
Virtuozzo https://virtuozzo.com (2016)

For a full list of sponsors, see
https://mariadb.org/about/supporters/
Expand Down
14 changes: 9 additions & 5 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,6 @@ int main(int argc,char *argv[])
outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given

mysql_init(&mysql);

{
char *tmp=getenv("PAGER");
if (tmp && strlen(tmp))
Expand Down Expand Up @@ -1183,7 +1181,11 @@ int main(int argc,char *argv[])
}
defaults_argv=argv;
if ((status.exit_status= get_options(argc, (char **) argv)))
mysql_end(-1);
{
free_defaults(defaults_argv);
my_end(0);
exit(status.exit_status);
}

if (status.batch && !status.line_buff &&
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
Expand Down Expand Up @@ -2319,8 +2321,10 @@ static bool add_line(String &buffer, char *line, ulong line_length,
continue;
}
#endif
if (!*ml_comment && inchar == '\\' &&
!(*in_string &&
if (!*ml_comment && inchar == '\\' && *in_string != '`' &&
!(*in_string == '"' &&
(mysql.server_status & SERVER_STATUS_ANSI_QUOTES)) &&
!(*in_string &&
(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)))
{
// Found possbile one character command like \c
Expand Down
67 changes: 64 additions & 3 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;

/* Needed for Flashback */
DYNAMIC_ARRAY binlog_events; // Storing the events output string
DYNAMIC_ARRAY events_in_stmt; // Storing the events that in one statement
String stop_event_string; // Storing the STOP_EVENT output string

char server_version[SERVER_VERSION_LENGTH];
Expand Down Expand Up @@ -894,6 +895,25 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->m_table_map_ignored.get_table(table_id);
bool skip_event= (ignored_map != NULL);

if (opt_flashback)
{
Rows_log_event *e= (Rows_log_event*) ev;
// The last Row_log_event will be the first event in Flashback
if (is_stmt_end)
e->clear_flags(Rows_log_event::STMT_END_F);
// The first Row_log_event will be the last event in Flashback
if (events_in_stmt.elements == 0)
e->set_flags(Rows_log_event::STMT_END_F);
// Update the temp_buf
e->update_flags();

if (insert_dynamic(&events_in_stmt, (uchar *) &ev))
{
error("Out of memory: can't allocate memory to store the flashback events.");
exit(1);
}
}

/*
end of statement check:
i) destroy/free ignored maps
Expand Down Expand Up @@ -945,7 +965,36 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
if (skip_event)
return 0;

return print_base64(print_event_info, ev);
if (!opt_flashback)
return print_base64(print_event_info, ev);
else
{
if (is_stmt_end)
{
bool res= false;
Log_event *e= NULL;

// Print the row_event from the last one to the first one
for (uint i= events_in_stmt.elements; i > 0; --i)
{
e= *(dynamic_element(&events_in_stmt, i - 1, Log_event**));
res= res || print_base64(print_event_info, e);
}
// Copy all output into the Log_event
ev->output_buf.copy(e->output_buf);
// Delete Log_event
for (uint i= 0; i < events_in_stmt.elements-1; ++i)
{
e= *(dynamic_element(&events_in_stmt, i, Log_event**));
delete e;
}
reset_dynamic(&events_in_stmt);

return res;
}
}

return 0;
}


Expand Down Expand Up @@ -1386,6 +1435,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
}
if (print_base64(print_event_info, ev))
goto err;
if (opt_flashback)
reset_dynamic(&events_in_stmt);
break;
}
case WRITE_ROWS_EVENT:
Expand All @@ -1402,19 +1453,25 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case DELETE_ROWS_COMPRESSED_EVENT_V1:
{
Rows_log_event *e= (Rows_log_event*) ev;
bool is_stmt_end= e->get_flags(Rows_log_event::STMT_END_F);
if (print_row_event(print_event_info, ev, e->get_table_id(),
e->get_flags(Rows_log_event::STMT_END_F)))
goto err;
if (!is_stmt_end)
destroy_evt= FALSE;
break;
}
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
{
Old_rows_log_event *e= (Old_rows_log_event*) ev;
bool is_stmt_end= e->get_flags(Rows_log_event::STMT_END_F);
if (print_row_event(print_event_info, ev, e->get_table_id(),
e->get_flags(Old_rows_log_event::STMT_END_F)))
goto err;
if (!is_stmt_end)
destroy_evt= FALSE;
break;
}
case START_ENCRYPTION_EVENT:
Expand Down Expand Up @@ -1459,7 +1516,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
&my_charset_bin);
else
{
if (push_dynamic(&binlog_events, (uchar *) &tmp_str))
if (insert_dynamic(&binlog_events, (uchar *) &tmp_str))
{
error("Out of memory: can't allocate memory to store the flashback events.");
exit(1);
Expand Down Expand Up @@ -2915,9 +2972,12 @@ int main(int argc, char** argv)
my_set_max_open_files(open_files_limit);

if (opt_flashback)
{
my_init_dynamic_array(&binlog_events, sizeof(LEX_STRING), 1024, 1024,
MYF(0));

my_init_dynamic_array(&events_in_stmt, sizeof(Rows_log_event*), 1024, 1024,
MYF(0));
}
if (opt_stop_never)
to_last_remote_log= TRUE;

Expand Down Expand Up @@ -3031,6 +3091,7 @@ int main(int argc, char** argv)
}
fprintf(result_file, "COMMIT\n/*!*/;\n");
delete_dynamic(&binlog_events);
delete_dynamic(&events_in_stmt);
}

/* Set delimiter back to semicolon */
Expand Down
37 changes: 29 additions & 8 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64

#define DIE_BUFF_SIZE 8192
#define DIE_BUFF_SIZE 256*1024

/* Flags controlling send and reap */
#define QUERY_SEND_FLAG 1
Expand Down Expand Up @@ -1720,12 +1720,23 @@ void log_msg(const char *fmt, ...)
int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
int len;
char buff[16384];
size_t len;
char *buff;

if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
return 1;
while((len= (int)my_read(fd, (uchar*)&buff, sizeof(buff)-1, MYF(0))) > 0)

len= (size_t) my_seek(fd, 0, SEEK_END, MYF(0));
my_seek(fd, 0, SEEK_SET, MYF(0));
if (len == (size_t)MY_FILEPOS_ERROR ||
!(buff= (char*)my_malloc(len + 1, MYF(0))))
{
my_close(fd, MYF(0));
return 1;
}
len= my_read(fd, (uchar*)buff, len, MYF(0));
my_close(fd, MYF(0));

{
char *p= buff, *start= buff,*end=buff+len;
while (p < end)
Expand All @@ -1748,7 +1759,7 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
*p= 0;
replace_dynstr_append_mem(ds, start, p-start);
}
my_close(fd, MYF(0));
my_free(buff);
return 0;
}

Expand Down Expand Up @@ -6490,6 +6501,16 @@ my_bool end_of_query(int c)
}


static inline bool is_escape_char(char c, char in_string)
{
if (c != '\\' || in_string == '`') return false;
if (!cur_con) return true;
uint server_status= cur_con->mysql->server_status;
if (server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) return false;
return !(server_status & SERVER_STATUS_ANSI_QUOTES && in_string == '"');
}


/*
Read one "line" from the file
Expand All @@ -6516,7 +6537,7 @@ my_bool end_of_query(int c)

int read_line(char *buf, int size)
{
char c, UNINIT_VAR(last_quote), last_char= 0;
char c, last_quote=0, last_char= 0;
char *p= buf, *buf_end= buf + size - 1;
int skip_char= 0;
my_bool have_slash= FALSE;
Expand Down Expand Up @@ -6598,7 +6619,7 @@ int read_line(char *buf, int size)
state= R_Q;
}
}
have_slash= (c == '\\');
have_slash= is_escape_char(c, last_quote);
break;

case R_COMMENT:
Expand Down Expand Up @@ -6668,7 +6689,7 @@ int read_line(char *buf, int size)
case R_Q:
if (c == last_quote)
state= R_NORMAL;
else if (c == '\\')
else if (is_escape_char(c, last_quote))
state= R_SLASH_IN_Q;
break;

Expand Down
7 changes: 6 additions & 1 deletion cmake/cpack_rpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
)

SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
IF(CMAKE_VERSION VERSION_LESS "3.6.0")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
ELSE()
SET(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
SET(CPACK_RPM_DEBUGINFO_PACKAGE ON)
ENDIF()

SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
Expand Down
Loading

0 comments on commit 57fea53

Please sign in to comment.