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 Mar 17, 2020
2 parents 023d986 + 097e2f9 commit c7ba923
Show file tree
Hide file tree
Showing 17 changed files with 220 additions and 96 deletions.
14 changes: 7 additions & 7 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
Copyright (c) 2009, 2020, 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
Expand Down Expand Up @@ -184,7 +184,7 @@ enum Exit_status {
*/
static Annotate_rows_log_event *annotate_event= NULL;

void free_annotate_event()
static void free_annotate_event()
{
if (annotate_event)
{
Expand Down Expand Up @@ -930,7 +930,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
}
}

/*
/*
end of statement check:
i) destroy/free ignored maps
ii) if skip event
Expand All @@ -941,21 +941,21 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/
if (is_stmt_end)
{
/*
/*
Now is safe to clear ignored map (clear_tables will also
delete original table map events stored in the map).
*/
if (print_event_info->m_table_map_ignored.count() > 0)
print_event_info->m_table_map_ignored.clear_tables();

/*
/*
If there is a kept Annotate event and all corresponding
rbr-events were filtered away, the Annotate event was not
freed and it is just the time to do it.
*/
free_annotate_event();
free_annotate_event();

/*
/*
One needs to take into account an event that gets
filtered but was last event in the statement. If this is
the case, previous rows events that were written into
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/plugins/t/server_audit.test
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ set global server_audit_logging= off;
set global server_audit_incl_users='root';
set global server_audit_logging= on;
disconnect cn1;
let $count_sessions=1;
source include/wait_until_count_sessions.inc;

drop user user1@localhost;

set global server_audit_events='';
Expand Down
89 changes: 89 additions & 0 deletions mysql-test/suite/sys_vars/r/alter_algorithm_basic.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
SET @start_global_value = @@global.alter_algorithm;
SET GLOBAL alter_algorithm=1.1;
ERROR 42000: Incorrect argument type to variable 'alter_algorithm'
SET GLOBAL alter_algorithm=-1;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '-1'
SET GLOBAL alter_algorithm=weird;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of 'weird'
SET GLOBAL alter_algorithm=4;
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
INSTANT
SET GLOBAL alter_algorithm=3;
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
NOCOPY
SET GLOBAL alter_algorithm=0;
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
DEFAULT
SET GLOBAL alter_algorithm=1;
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
COPY
SET GLOBAL alter_algorithm=2;
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
INPLACE
SET GLOBAL alter_algorithm=5;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '5'
SELECT @@global.alter_algorithm;
@@global.alter_algorithm
INPLACE
SET GLOBAL alter_algorithm=NOCOPY;
SET alter_algorithm=1.1;
ERROR 42000: Incorrect argument type to variable 'alter_algorithm'
SET alter_algorithm=-1;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '-1'
SET alter_algorithm=weird;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of 'weird'
SET alter_algorithm=4;
SELECT @@alter_algorithm;
@@alter_algorithm
INSTANT
SET alter_algorithm=3;
SELECT @@alter_algorithm;
@@alter_algorithm
NOCOPY
SET alter_algorithm=0;
SELECT @@alter_algorithm;
@@alter_algorithm
DEFAULT
SET alter_algorithm=1;
SELECT @@alter_algorithm;
@@alter_algorithm
COPY
SET alter_algorithm=2;
SELECT @@alter_algorithm;
@@alter_algorithm
INPLACE
SET alter_algorithm=5;
ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '5'
SELECT @@alter_algorithm;
@@alter_algorithm
INPLACE
SET SESSION alter_algorithm=INSTANT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm INSTANT
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm NOCOPY
SET SESSION alter_algorithm='DEFAULT';
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm DEFAULT
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm NOCOPY
SET GLOBAL alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm NOCOPY
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
Variable_name Value
alter_algorithm DEFAULT
SET GLOBAL alter_algorithm = @start_global_value;
58 changes: 58 additions & 0 deletions mysql-test/suite/sys_vars/t/alter_algorithm_basic.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
SET @start_global_value = @@global.alter_algorithm;

--error ER_WRONG_TYPE_FOR_VAR
SET GLOBAL alter_algorithm=1.1;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL alter_algorithm=-1;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL alter_algorithm=weird;
SET GLOBAL alter_algorithm=4;
SELECT @@global.alter_algorithm;
SET GLOBAL alter_algorithm=3;
SELECT @@global.alter_algorithm;
SET GLOBAL alter_algorithm=0;
SELECT @@global.alter_algorithm;
SET GLOBAL alter_algorithm=1;
SELECT @@global.alter_algorithm;
SET GLOBAL alter_algorithm=2;
SELECT @@global.alter_algorithm;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL alter_algorithm=5;
SELECT @@global.alter_algorithm;

SET GLOBAL alter_algorithm=NOCOPY;

--error ER_WRONG_TYPE_FOR_VAR
SET alter_algorithm=1.1;
--error ER_WRONG_VALUE_FOR_VAR
SET alter_algorithm=-1;
--error ER_WRONG_VALUE_FOR_VAR
SET alter_algorithm=weird;
SET alter_algorithm=4;
SELECT @@alter_algorithm;
SET alter_algorithm=3;
SELECT @@alter_algorithm;
SET alter_algorithm=0;
SELECT @@alter_algorithm;
SET alter_algorithm=1;
SELECT @@alter_algorithm;
SET alter_algorithm=2;
SELECT @@alter_algorithm;
--error ER_WRONG_VALUE_FOR_VAR
SET alter_algorithm=5;
SELECT @@alter_algorithm;

SET SESSION alter_algorithm=INSTANT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
SET SESSION alter_algorithm='DEFAULT';
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
SET GLOBAL alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';
SET SESSION alter_algorithm=DEFAULT;
SHOW SESSION VARIABLES LIKE 'alter_algorithm';

SET GLOBAL alter_algorithm = @start_global_value;
2 changes: 1 addition & 1 deletion sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
query_name_consts= 0;
semisync_info= 0;
db_charset= global_system_variables.collation_database;
bzero(ha_data, sizeof(ha_data));
bzero((void*) ha_data, sizeof(ha_data));
mysys_var=0;
binlog_evt_union.do_union= FALSE;
enable_slow_log= 0;
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5575,7 +5575,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
for (i= 0; i < join->table_count ; i++)
if (double rr= join->best_positions[i].records_read)
records= COST_MULT(records, rr);
ha_rows rows= records > HA_ROWS_MAX ? HA_ROWS_MAX : (ha_rows) records;
ha_rows rows= records > (double) HA_ROWS_MAX ? HA_ROWS_MAX : (ha_rows) records;
set_if_smaller(rows, unit->lim.get_select_limit());
join->select_lex->increase_derived_records(rows);
}
Expand Down
3 changes: 2 additions & 1 deletion storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3483,7 +3483,8 @@ buf_zip_decompress(
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
<< ", none: "
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_NONE);
frame, size, SRV_CHECKSUM_ALGORITHM_NONE)
<< " (algorithm: " << srv_checksum_algorithm << ")";
goto err_exit;
}

Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/dict/dict0load.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation.
Copyright (c) 2016, 2020, MariaDB Corporation.
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 the Free Software
Expand Down Expand Up @@ -780,7 +780,7 @@ dict_process_sys_datafiles(
@param[in] space_id Tablespace ID
@return First filepath (caller must invoke ut_free() on it)
@retval NULL if no SYS_DATAFILES entry was found. */
char*
static char*
dict_get_first_path(
ulint space_id)
{
Expand Down Expand Up @@ -838,7 +838,7 @@ dict_get_first_path(
ut_ad(len > 0);
ut_ad(len < OS_FILE_MAX_PATH);

if (len > 0 && len != UNIV_SQL_NULL) {
if (len > 0 && len < UNIV_SQL_NULL) {
filepath = mem_strdupl(
reinterpret_cast<const char*>(field),
len);
Expand Down
26 changes: 10 additions & 16 deletions storage/innobase/handler/i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6559,31 +6559,24 @@ i_s_dict_fill_sys_tablespaces(
OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
fil_space_t::physical_size(cflags), true));

char* filepath = NULL;
if (FSP_FLAGS_HAS_DATA_DIR(cflags)) {
mutex_enter(&dict_sys.mutex);
filepath = dict_get_first_path(space);
mutex_exit(&dict_sys.mutex);
}

if (filepath == NULL) {
filepath = fil_make_filepath(NULL, name, IBD, false);
}

os_file_stat_t stat;
os_file_size_t file;

memset(&file, 0xff, sizeof(file));
memset(&stat, 0x0, sizeof(stat));

if (filepath != NULL) {
if (fil_space_t* s = fil_space_acquire_silent(space)) {
const char *filepath = s->chain.start
? s->chain.start->name : NULL;
if (!filepath) {
goto file_done;
}

file = os_file_get_size(filepath);

/* Get the file system (or Volume) block size. */
dberr_t err = os_file_get_status(filepath, &stat, false, false);

switch(err) {
switch (dberr_t err = os_file_get_status(filepath, &stat,
false, false)) {
case DB_FAIL:
ib::warn()
<< "File '" << filepath << "', failed to get "
Expand All @@ -6601,7 +6594,8 @@ i_s_dict_fill_sys_tablespaces(
break;
}

ut_free(filepath);
file_done:
s->release();
}

if (file.m_total_size == os_offset_t(~0)) {
Expand Down
10 changes: 1 addition & 9 deletions storage/innobase/include/dict0load.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
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 the Free Software
Expand Down Expand Up @@ -79,14 +79,6 @@ dict_get_first_table_name_in_db(
/*============================*/
const char* name); /*!< in: database name which ends to '/' */

/** Get the first filepath from SYS_DATAFILES for a given space_id.
@param[in] space_id Tablespace ID
@return First filepath (caller must invoke ut_free() on it)
@retval NULL if no SYS_DATAFILES entry was found. */
char*
dict_get_first_path(
ulint space_id);

/** Make sure the data_file_name is saved in dict_table_t if needed.
Try to read it from the fil_system first, then from SYS_DATAFILES.
@param[in] table Table object
Expand Down
11 changes: 5 additions & 6 deletions storage/innobase/include/page0zip.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,11 @@ page_zip_calc_checksum(
ulint size,
srv_checksum_algorithm_t algo);

/** Verify a compressed page's checksum.
@param[in] data compressed page
@param[in] size size of compressed page
@return whether the stored checksum is valid according to the value of
innodb_checksum_algorithm */
bool page_zip_verify_checksum(const void* data, ulint size);
/** Validate the checksum on a ROW_FORMAT=COMPRESSED page.
@param data ROW_FORMAT=COMPRESSED page
@param size size of the page, in bytes
@return whether the stored checksum matches innodb_checksum_algorithm */
bool page_zip_verify_checksum(const void *data, size_t size);

#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Expand Down

0 comments on commit c7ba923

Please sign in to comment.