Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2020-01-20 16:48:56 +02:00
commit ded128aa9b
295 changed files with 4824 additions and 1063 deletions

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
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
@ -784,18 +784,6 @@ btr_rec_copy_externally_stored_field(
ulint* len,
mem_heap_t* heap);
/** Flag the data tuple fields that are marked as extern storage in the
update vector. We use this function to remember which fields we must
mark as extern storage in a record inserted for an update.
@param[in,out] tuple clustered index record
@param[in] n number of fields in tuple, before any btr_cur_trim()
@param[in] update update vector
@param[in,out] heap memory heap
@return number of flagged external columns */
ulint
btr_push_update_extern_fields(dtuple_t* tuple, ulint n, const upd_t* update,
mem_heap_t* heap)
MY_ATTRIBUTE((nonnull));
/***********************************************************//**
Sets a secondary index record's delete mark to the given value. This
function is only used by the insert buffer merge mechanism. */

View file

@ -303,8 +303,7 @@ public:
#ifdef UNIV_DEBUG
ulint total_size = 0;
for (typename list_t::iterator it = m_list.begin(),
end = m_list.end();
for (list_t::iterator it = m_list.begin(), end = m_list.end();
it != end; ++it) {
total_size += it->used();
}
@ -320,8 +319,7 @@ public:
template <typename Functor>
bool for_each_block(Functor& functor) const
{
for (typename list_t::iterator it = m_list.begin(),
end = m_list.end();
for (list_t::iterator it = m_list.begin(), end = m_list.end();
it != end; ++it) {
if (!functor(&*it)) {
@ -338,8 +336,8 @@ public:
template <typename Functor>
bool for_each_block_in_reverse(Functor& functor) const
{
for (typename list_t::reverse_iterator it = m_list.rbegin(),
end = m_list.rend();
for (list_t::reverse_iterator it = m_list.rbegin(),
end = m_list.rend();
it != end; ++it) {
if (!functor(&*it)) {
@ -356,8 +354,8 @@ public:
template <typename Functor>
bool for_each_block_in_reverse(const Functor& functor) const
{
for (typename list_t::reverse_iterator it = m_list.rbegin(),
end = m_list.rend();
for (list_t::reverse_iterator it = m_list.rbegin(),
end = m_list.rend();
it != end; ++it) {
if (!functor(&*it)) {
@ -425,8 +423,7 @@ private:
{
ut_ad(!m_list.empty());
for (typename list_t::iterator it = m_list.begin(),
end = m_list.end();
for (list_t::iterator it = m_list.begin(), end = m_list.end();
it != end; ++it) {
if (pos < it->used()) {

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 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
@ -848,6 +848,22 @@ page_rec_is_last(
const page_t* page) /*!< in: page */
MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
true if distance between the records (measured in number of times we have to
move to the next record) is at most the specified value
@param[in] left_rec lefter record
@param[in] right_rec righter record
@param[in] val specified value to compare
@return true if the distance is smaller than the value */
UNIV_INLINE
bool
page_rec_distance_is_at_most(
/*=========================*/
const rec_t* left_rec,
const rec_t* right_rec,
ulint val)
MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
true if the record is the second last user record on a page.
@return true if the second last user record */

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2019, MariaDB Corporation.
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
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
@ -322,6 +322,26 @@ page_rec_is_last(
return(page_rec_get_next_const(rec) == page_get_supremum_rec(page));
}
/************************************************************//**
true if distance between the records (measured in number of times we have to
move to the next record) is at most the specified value */
UNIV_INLINE
bool
page_rec_distance_is_at_most(
/*=========================*/
const rec_t* left_rec,
const rec_t* right_rec,
ulint val)
{
for (ulint i = 0; i <= val; i++) {
if (left_rec == right_rec) {
return (true);
}
left_rec = page_rec_get_next_const(left_rec);
}
return (false);
}
/************************************************************//**
true if the record is the second last user record on a page.
@return true if the second last user record */

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
@ -80,7 +80,7 @@ cmp_dfield_dfield(
/** Compare a GIS data tuple to a physical record.
@param[in] dtuple data tuple
@param[in] rec B-tree record
@param[in] rec R-tree record
@param[in] offsets rec_get_offsets(rec)
@param[in] mode compare mode
@retval negative if dtuple is less than rec */
@ -190,43 +190,23 @@ cmp_rec_rec_simple(
duplicate key value if applicable,
or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
/** Compare two B-tree records.
@param[in] rec1 B-tree record
@param[in] rec2 B-tree record
@param[in] offsets1 rec_get_offsets(rec1, index)
@param[in] offsets2 rec_get_offsets(rec2, index)
@param[in] index B-tree index
@param[in] nulls_unequal true if this is for index cardinality
statistics estimation, and innodb_stats_method=nulls_unequal
or innodb_stats_method=nulls_ignored
@param[out] matched_fields number of completely matched fields
within the first field not completely matched
@return the comparison result
@retval 0 if rec1 is equal to rec2
@retval negative if rec1 is less than rec2
@retval positive if rec2 is greater than rec2 */
int
cmp_rec_rec_with_match(
const rec_t* rec1,
const rec_t* rec2,
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
bool nulls_unequal,
ulint* matched_fields);
/** Compare two B-tree records.
/** Compare two B-tree or R-tree records.
Only the common first fields are compared, and externally stored field
are treated as equal.
@param[in] rec1 B-tree record
@param[in] rec2 B-tree record
@param[in] rec1 record (possibly not on an index page)
@param[in] rec2 B-tree or R-tree record in an index page
@param[in] offsets1 rec_get_offsets(rec1, index)
@param[in] offsets2 rec_get_offsets(rec2, index)
@param[in] nulls_unequal true if this is for index cardinality
statistics estimation with
innodb_stats_method=nulls_unequal
or innodb_stats_method=nulls_ignored
@param[out] matched_fields number of completely matched fields
within the first field not completely matched
@return positive, 0, negative if rec1 is greater, equal, less, than rec2,
respectively */
UNIV_INLINE
@retval 0 if rec1 is equal to rec2
@retval negative if rec1 is less than rec2
@retval positive if rec1 is greater than rec2 */
int
cmp_rec_rec(
const rec_t* rec1,
@ -234,7 +214,9 @@ cmp_rec_rec(
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
ulint* matched_fields = NULL);
bool nulls_unequal = false,
ulint* matched_fields = NULL)
MY_ATTRIBUTE((nonnull(1,2,3,4,5)));
/** Compare two data fields.
@param[in] dfield1 data field

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 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
@ -52,40 +53,6 @@ cmp_dfield_dfield(
dfield_get_len(dfield2)));
}
/** Compare two B-tree records.
Only the common first fields are compared, and externally stored field
are treated as equal.
@param[in] rec1 B-tree record
@param[in] rec2 B-tree record
@param[in] offsets1 rec_get_offsets(rec1, index)
@param[in] offsets2 rec_get_offsets(rec2, index)
@param[out] matched_fields number of completely matched fields
within the first field not completely matched
@return positive, 0, negative if rec1 is greater, equal, less, than rec2,
respectively */
UNIV_INLINE
int
cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
const offset_t* offsets1,
const offset_t* offsets2,
const dict_index_t* index,
ulint* matched_fields)
{
ulint match_f;
int ret;
ret = cmp_rec_rec_with_match(
rec1, rec2, offsets1, offsets2, index, false, &match_f);
if (matched_fields != NULL) {
*matched_fields = match_f;
}
return(ret);
}
/** Compare two data fields.
@param[in] dfield1 data field
@param[in] dfield2 data field

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
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
@ -1390,6 +1390,7 @@ rec_get_converted_size(
data_size = dtuple_get_data_size(dtuple, 0);
ut_ad(n_ext == dtuple_get_n_ext(dtuple));
extra_size = rec_get_converted_extra_size(
data_size, dtuple_get_n_fields(dtuple), n_ext);

View file

@ -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
@ -208,8 +208,6 @@ row_rec_to_index_entry_low(
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result));
@ -223,8 +221,6 @@ row_rec_to_index_entry(
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */
ulint* n_ext, /*!< out: number of externally
stored columns */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result));
@ -233,7 +229,6 @@ row_rec_to_index_entry(
@param[in] rec metadata record
@param[in] index clustered index after instant ALTER TABLE
@param[in] offsets rec_get_offsets(rec)
@param[out] n_ext number of externally stored fields
@param[in,out] heap memory heap for allocations
@param[in] info_bits the info_bits after an update
@param[in] pad whether to pad to index->n_fields */
@ -242,7 +237,6 @@ row_metadata_to_tuple(
const rec_t* rec,
const dict_index_t* index,
const offset_t* offsets,
ulint* n_ext,
mem_heap_t* heap,
ulint info_bits,
bool pad)

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by