Merge 10.4 into 10.5
This commit is contained in:
commit
c7ba92372b
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -184,7 +184,7 @@ enum Exit_status {
|
|||||||
*/
|
*/
|
||||||
static Annotate_rows_log_event *annotate_event= NULL;
|
static Annotate_rows_log_event *annotate_event= NULL;
|
||||||
|
|
||||||
void free_annotate_event()
|
static void free_annotate_event()
|
||||||
{
|
{
|
||||||
if (annotate_event)
|
if (annotate_event)
|
||||||
{
|
{
|
||||||
@ -930,7 +930,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
end of statement check:
|
end of statement check:
|
||||||
i) destroy/free ignored maps
|
i) destroy/free ignored maps
|
||||||
ii) if skip event
|
ii) if skip event
|
||||||
@ -941,21 +941,21 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
|||||||
*/
|
*/
|
||||||
if (is_stmt_end)
|
if (is_stmt_end)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Now is safe to clear ignored map (clear_tables will also
|
Now is safe to clear ignored map (clear_tables will also
|
||||||
delete original table map events stored in the map).
|
delete original table map events stored in the map).
|
||||||
*/
|
*/
|
||||||
if (print_event_info->m_table_map_ignored.count() > 0)
|
if (print_event_info->m_table_map_ignored.count() > 0)
|
||||||
print_event_info->m_table_map_ignored.clear_tables();
|
print_event_info->m_table_map_ignored.clear_tables();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If there is a kept Annotate event and all corresponding
|
If there is a kept Annotate event and all corresponding
|
||||||
rbr-events were filtered away, the Annotate event was not
|
rbr-events were filtered away, the Annotate event was not
|
||||||
freed and it is just the time to do it.
|
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
|
One needs to take into account an event that gets
|
||||||
filtered but was last event in the statement. If this is
|
filtered but was last event in the statement. If this is
|
||||||
the case, previous rows events that were written into
|
the case, previous rows events that were written into
|
||||||
|
@ -157,6 +157,9 @@ set global server_audit_logging= off;
|
|||||||
set global server_audit_incl_users='root';
|
set global server_audit_incl_users='root';
|
||||||
set global server_audit_logging= on;
|
set global server_audit_logging= on;
|
||||||
disconnect cn1;
|
disconnect cn1;
|
||||||
|
let $count_sessions=1;
|
||||||
|
source include/wait_until_count_sessions.inc;
|
||||||
|
|
||||||
drop user user1@localhost;
|
drop user user1@localhost;
|
||||||
|
|
||||||
set global server_audit_events='';
|
set global server_audit_events='';
|
||||||
|
89
mysql-test/suite/sys_vars/r/alter_algorithm_basic.result
Normal file
89
mysql-test/suite/sys_vars/r/alter_algorithm_basic.result
Normal file
@ -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
mysql-test/suite/sys_vars/t/alter_algorithm_basic.test
Normal file
58
mysql-test/suite/sys_vars/t/alter_algorithm_basic.test
Normal file
@ -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;
|
@ -794,7 +794,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
|||||||
query_name_consts= 0;
|
query_name_consts= 0;
|
||||||
semisync_info= 0;
|
semisync_info= 0;
|
||||||
db_charset= global_system_variables.collation_database;
|
db_charset= global_system_variables.collation_database;
|
||||||
bzero(ha_data, sizeof(ha_data));
|
bzero((void*) ha_data, sizeof(ha_data));
|
||||||
mysys_var=0;
|
mysys_var=0;
|
||||||
binlog_evt_union.do_union= FALSE;
|
binlog_evt_union.do_union= FALSE;
|
||||||
enable_slow_log= 0;
|
enable_slow_log= 0;
|
||||||
|
@ -5575,7 +5575,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
|
|||||||
for (i= 0; i < join->table_count ; i++)
|
for (i= 0; i < join->table_count ; i++)
|
||||||
if (double rr= join->best_positions[i].records_read)
|
if (double rr= join->best_positions[i].records_read)
|
||||||
records= COST_MULT(records, rr);
|
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());
|
set_if_smaller(rows, unit->lim.get_select_limit());
|
||||||
join->select_lex->increase_derived_records(rows);
|
join->select_lex->increase_derived_records(rows);
|
||||||
}
|
}
|
||||||
|
@ -3483,7 +3483,8 @@ buf_zip_decompress(
|
|||||||
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
|
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
|
||||||
<< ", none: "
|
<< ", none: "
|
||||||
<< page_zip_calc_checksum(
|
<< page_zip_calc_checksum(
|
||||||
frame, size, SRV_CHECKSUM_ALGORITHM_NONE);
|
frame, size, SRV_CHECKSUM_ALGORITHM_NONE)
|
||||||
|
<< " (algorithm: " << srv_checksum_algorithm << ")";
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
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
|
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
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -780,7 +780,7 @@ err_len:
|
|||||||
@param[in] space_id Tablespace ID
|
@param[in] space_id Tablespace ID
|
||||||
@return First filepath (caller must invoke ut_free() on it)
|
@return First filepath (caller must invoke ut_free() on it)
|
||||||
@retval NULL if no SYS_DATAFILES entry was found. */
|
@retval NULL if no SYS_DATAFILES entry was found. */
|
||||||
char*
|
static char*
|
||||||
dict_get_first_path(
|
dict_get_first_path(
|
||||||
ulint space_id)
|
ulint space_id)
|
||||||
{
|
{
|
||||||
@ -838,7 +838,7 @@ dict_get_first_path(
|
|||||||
ut_ad(len > 0);
|
ut_ad(len > 0);
|
||||||
ut_ad(len < OS_FILE_MAX_PATH);
|
ut_ad(len < OS_FILE_MAX_PATH);
|
||||||
|
|
||||||
if (len > 0 && len != UNIV_SQL_NULL) {
|
if (len > 0 && len < UNIV_SQL_NULL) {
|
||||||
filepath = mem_strdupl(
|
filepath = mem_strdupl(
|
||||||
reinterpret_cast<const char*>(field),
|
reinterpret_cast<const char*>(field),
|
||||||
len);
|
len);
|
||||||
|
@ -6559,31 +6559,24 @@ i_s_dict_fill_sys_tablespaces(
|
|||||||
OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
|
OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
|
||||||
fil_space_t::physical_size(cflags), true));
|
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_stat_t stat;
|
||||||
os_file_size_t file;
|
os_file_size_t file;
|
||||||
|
|
||||||
memset(&file, 0xff, sizeof(file));
|
memset(&file, 0xff, sizeof(file));
|
||||||
memset(&stat, 0x0, sizeof(stat));
|
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);
|
file = os_file_get_size(filepath);
|
||||||
|
|
||||||
/* Get the file system (or Volume) block size. */
|
/* Get the file system (or Volume) block size. */
|
||||||
dberr_t err = os_file_get_status(filepath, &stat, false, false);
|
switch (dberr_t err = os_file_get_status(filepath, &stat,
|
||||||
|
false, false)) {
|
||||||
switch(err) {
|
|
||||||
case DB_FAIL:
|
case DB_FAIL:
|
||||||
ib::warn()
|
ib::warn()
|
||||||
<< "File '" << filepath << "', failed to get "
|
<< "File '" << filepath << "', failed to get "
|
||||||
@ -6601,7 +6594,8 @@ i_s_dict_fill_sys_tablespaces(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_free(filepath);
|
file_done:
|
||||||
|
s->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.m_total_size == os_offset_t(~0)) {
|
if (file.m_total_size == os_offset_t(~0)) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
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
|
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
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -79,14 +79,6 @@ dict_get_first_table_name_in_db(
|
|||||||
/*============================*/
|
/*============================*/
|
||||||
const char* name); /*!< in: database name which ends to '/' */
|
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.
|
/** 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.
|
Try to read it from the fil_system first, then from SYS_DATAFILES.
|
||||||
@param[in] table Table object
|
@param[in] table Table object
|
||||||
|
@ -371,12 +371,11 @@ page_zip_calc_checksum(
|
|||||||
ulint size,
|
ulint size,
|
||||||
srv_checksum_algorithm_t algo);
|
srv_checksum_algorithm_t algo);
|
||||||
|
|
||||||
/** Verify a compressed page's checksum.
|
/** Validate the checksum on a ROW_FORMAT=COMPRESSED page.
|
||||||
@param[in] data compressed page
|
@param data ROW_FORMAT=COMPRESSED page
|
||||||
@param[in] size size of compressed page
|
@param size size of the page, in bytes
|
||||||
@return whether the stored checksum is valid according to the value of
|
@return whether the stored checksum matches innodb_checksum_algorithm */
|
||||||
innodb_checksum_algorithm */
|
bool page_zip_verify_checksum(const void *data, size_t size);
|
||||||
bool page_zip_verify_checksum(const void* data, ulint size);
|
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
/**********************************************************************//**
|
/**********************************************************************//**
|
||||||
|
@ -4663,56 +4663,31 @@ page_zip_calc_checksum(
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Verify a compressed page's checksum.
|
/** Validate the checksum on a ROW_FORMAT=COMPRESSED page.
|
||||||
@param[in] data compressed page
|
@param data ROW_FORMAT=COMPRESSED page
|
||||||
@param[in] size size of compressed page
|
@param size size of the page, in bytes
|
||||||
@return whether the stored checksum is valid according to the value of
|
@return whether the stored checksum matches innodb_checksum_algorithm */
|
||||||
innodb_checksum_algorithm */
|
bool page_zip_verify_checksum(const void *data, size_t size)
|
||||||
bool page_zip_verify_checksum(const void* data, ulint size)
|
|
||||||
{
|
{
|
||||||
const uint32_t stored = mach_read_from_4(
|
|
||||||
static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM);
|
|
||||||
|
|
||||||
compile_time_assert(!(FIL_PAGE_LSN % 8));
|
|
||||||
|
|
||||||
/* Check if page is empty */
|
|
||||||
if (stored == 0
|
|
||||||
&& *reinterpret_cast<const ib_uint64_t*>(static_cast<const char*>(
|
|
||||||
data)
|
|
||||||
+ FIL_PAGE_LSN) == 0) {
|
|
||||||
/* make sure that the page is really empty */
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
|
||||||
ulint i;
|
|
||||||
for (i = 0; i < size; i++) {
|
|
||||||
if (*((const char*) data + i) != 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i >= size) {
|
|
||||||
if (log_file) {
|
|
||||||
fprintf(log_file, "Page::%llu is empty and"
|
|
||||||
" uncorrupted\n", cur_page_num);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
for (ulint i = 0; i < size; i++) {
|
|
||||||
if (*((const char*) data + i) != 0) {
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Empty page */
|
|
||||||
return(TRUE);
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
}
|
|
||||||
|
|
||||||
const srv_checksum_algorithm_t curr_algo =
|
const srv_checksum_algorithm_t curr_algo =
|
||||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||||
|
|
||||||
if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
|
if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
|
||||||
return(TRUE);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < size; i++) {
|
||||||
|
if (static_cast<const byte*>(data)[i] != 0) {
|
||||||
|
goto not_all_zeroes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
not_all_zeroes:
|
||||||
|
const uint32_t stored = mach_read_from_4(
|
||||||
|
static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM);
|
||||||
|
|
||||||
uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
|
uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
#ifdef UNIV_INNOCHECKSUM
|
||||||
@ -4727,7 +4702,6 @@ bool page_zip_verify_checksum(const void* data, ulint size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strict_verify) {
|
if (!strict_verify) {
|
||||||
|
|
||||||
const uint32_t crc32 = page_zip_calc_checksum(
|
const uint32_t crc32 = page_zip_calc_checksum(
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||||
|
Copyright (c) 2020, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -112,7 +113,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
|
|||||||
|
|
||||||
if (lock != PAGECACHE_LOCK_LEFT_UNLOCKED)
|
if (lock != PAGECACHE_LOCK_LEFT_UNLOCKED)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || PAGECACHE_LOCK_READ);
|
DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || lock == PAGECACHE_LOCK_READ);
|
||||||
page_link.unlock= (lock == PAGECACHE_LOCK_WRITE ?
|
page_link.unlock= (lock == PAGECACHE_LOCK_WRITE ?
|
||||||
PAGECACHE_LOCK_WRITE_UNLOCK :
|
PAGECACHE_LOCK_WRITE_UNLOCK :
|
||||||
PAGECACHE_LOCK_READ_UNLOCK);
|
PAGECACHE_LOCK_READ_UNLOCK);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
||||||
|
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -104,7 +105,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx,
|
|||||||
: (double) info->state->records);
|
: (double) info->state->records);
|
||||||
res= (end_pos < start_pos ? (ha_rows) 0 :
|
res= (end_pos < start_pos ? (ha_rows) 0 :
|
||||||
(end_pos == start_pos ? (ha_rows) 1 : (ha_rows) (end_pos-start_pos)));
|
(end_pos == start_pos ? (ha_rows) 1 : (ha_rows) (end_pos-start_pos)));
|
||||||
if (start_pos == HA_POS_ERROR || end_pos == HA_POS_ERROR)
|
if (start_pos == (double) HA_POS_ERROR || end_pos == (double) HA_POS_ERROR)
|
||||||
res=HA_POS_ERROR;
|
res=HA_POS_ERROR;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
Copyright (c) 2000, 2011, Oracle and/or its affiliates
|
||||||
|
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -39,7 +40,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
|
|||||||
uint files= 0, i, UNINIT_VAR(key_parts), min_keys= 0;
|
uint files= 0, i, UNINIT_VAR(key_parts), min_keys= 0;
|
||||||
size_t length, dir_length;
|
size_t length, dir_length;
|
||||||
ulonglong file_offset=0;
|
ulonglong file_offset=0;
|
||||||
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
|
char name_buff[FN_REFLEN*2],buff[FN_REFLEN];
|
||||||
MYRG_INFO *m_info=0;
|
MYRG_INFO *m_info=0;
|
||||||
File fd;
|
File fd;
|
||||||
IO_CACHE file;
|
IO_CACHE file;
|
||||||
@ -63,8 +64,9 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
|
|||||||
dir_length=dirname_part(name_buff, name, &name_buff_length);
|
dir_length=dirname_part(name_buff, name, &name_buff_length);
|
||||||
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
|
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
|
||||||
{
|
{
|
||||||
if ((end=buff+length)[-1] == '\n')
|
char *end= &buff[length - 1];
|
||||||
end[-1]='\0';
|
if (*end == '\n')
|
||||||
|
*end= '\0';
|
||||||
if (buff[0] && buff[0] != '#')
|
if (buff[0] && buff[0] != '#')
|
||||||
files++;
|
files++;
|
||||||
}
|
}
|
||||||
@ -72,8 +74,9 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
|
|||||||
my_b_seek(&file, 0);
|
my_b_seek(&file, 0);
|
||||||
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
|
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
|
||||||
{
|
{
|
||||||
if ((end=buff+length)[-1] == '\n')
|
char *end= &buff[length - 1];
|
||||||
*--end='\0';
|
if (*end == '\n')
|
||||||
|
*end= '\0';
|
||||||
if (!buff[0])
|
if (!buff[0])
|
||||||
continue; /* Skip empty lines */
|
continue; /* Skip empty lines */
|
||||||
if (buff[0] == '#')
|
if (buff[0] == '#')
|
||||||
|
@ -1007,7 +1007,8 @@ static void init_instr_class(PFS_instr_class *klass,
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(name_length <= PFS_MAX_INFO_NAME_LENGTH);
|
DBUG_ASSERT(name_length <= PFS_MAX_INFO_NAME_LENGTH);
|
||||||
memset(klass, 0, sizeof(PFS_instr_class));
|
memset(klass, 0, sizeof(PFS_instr_class));
|
||||||
memcpy(klass->m_name, name, name_length);
|
strncpy(klass->m_name, name, name_length);
|
||||||
|
klass->m_name[PFS_MAX_INFO_NAME_LENGTH - 1]= '\0';
|
||||||
klass->m_name_length= name_length;
|
klass->m_name_length= name_length;
|
||||||
klass->m_flags= flags;
|
klass->m_flags= flags;
|
||||||
klass->m_enabled= true;
|
klass->m_enabled= true;
|
||||||
|
@ -1885,7 +1885,15 @@ static enum json_types smart_read_value(json_engine_t *je,
|
|||||||
*value_len= (int) ((char *) je->s.c_str - *value);
|
*value_len= (int) ((char *) je->s.c_str - *value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (enum json_types)je->value_type;
|
compile_time_assert((int) JSON_VALUE_OBJECT == (int) JSV_OBJECT);
|
||||||
|
compile_time_assert((int) JSON_VALUE_ARRAY == (int) JSV_ARRAY);
|
||||||
|
compile_time_assert((int) JSON_VALUE_STRING == (int) JSV_STRING);
|
||||||
|
compile_time_assert((int) JSON_VALUE_NUMBER == (int) JSV_NUMBER);
|
||||||
|
compile_time_assert((int) JSON_VALUE_TRUE == (int) JSV_TRUE);
|
||||||
|
compile_time_assert((int) JSON_VALUE_FALSE == (int) JSV_FALSE);
|
||||||
|
compile_time_assert((int) JSON_VALUE_NULL == (int) JSV_NULL);
|
||||||
|
|
||||||
|
return (enum json_types) je->value_type;
|
||||||
|
|
||||||
err_return:
|
err_return:
|
||||||
return JSV_BAD_JSON;
|
return JSV_BAD_JSON;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user