summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-20 18:08:16 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-20 18:12:17 +0200
commit44298e4dea39280187c587c6e776ce8d04e350de (patch)
tree15f8bac3c985c4f07fd6af066439d046dbb13c35 /storage
parentdd68db0c17d674f1b64e70ff7ea9e3f4abe4ee3e (diff)
parent9f7b8625e698da6b7eba7c26e765c66635571919 (diff)
downloadmariadb-git-44298e4dea39280187c587c6e776ce8d04e350de.tar.gz
Merge 10.2 into 10.3
Also, clean up the test innodb_gis.geometry a little further.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/buf/buf0buf.cc22
-rw-r--r--storage/innobase/buf/buf0rea.cc8
-rw-r--r--storage/innobase/dict/dict0dict.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc18
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/fil0fil.h9
-rw-r--r--storage/innobase/include/log0recv.h8
-rw-r--r--storage/innobase/include/row0merge.h14
-rw-r--r--storage/innobase/log/log0recv.cc18
-rw-r--r--storage/innobase/os/os0file.cc4
-rw-r--r--storage/innobase/row/row0import.cc17
-rw-r--r--storage/innobase/row/row0merge.cc1
-rw-r--r--storage/innobase/row/row0mysql.cc13
-rw-r--r--storage/maria/ma_loghandler.c7
-rw-r--r--storage/maria/ma_packrec.c49
-rw-r--r--storage/myisam/mi_packrec.c49
16 files changed, 106 insertions, 135 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index fe2a09f0a21..54b527007c6 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -2689,23 +2689,6 @@ buf_pool_resize_hash(
buf_pool->zip_hash = new_hash_table;
}
-#ifndef DBUG_OFF
-/** This is a debug routine to inject an memory allocation failure error. */
-static
-void
-buf_pool_resize_chunk_make_null(buf_chunk_t** new_chunks)
-{
- static int count = 0;
-
- if (count == 1) {
- ut_free(*new_chunks);
- *new_chunks = NULL;
- }
-
- count++;
-}
-#endif // DBUG_OFF
-
/** Resize the buffer pool based on srv_buf_pool_size from
srv_buf_pool_old_size. */
static
@@ -2973,7 +2956,8 @@ withdraw_retry:
ut_zalloc_nokey_nofatal(new_chunks_size));
DBUG_EXECUTE_IF("buf_pool_resize_chunk_null",
- buf_pool_resize_chunk_make_null(&new_chunks););
+ ut_free(new_chunks);
+ new_chunks = NULL;);
if (new_chunks == NULL) {
ib::error() << "buffer pool " << i
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 5c8b98746c8..7877087dd4a 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 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
@@ -925,8 +925,12 @@ buf_read_recv_pages(
ulint count = 0;
buf_pool = buf_pool_get(cur_page_id);
- while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
+ ulint limit = 0;
+ for (ulint j = 0; j < buf_pool->n_chunks; j++) {
+ limit += buf_pool->chunks[j].size / 2;
+ }
+ while (buf_pool->n_pend_reads >= limit) {
os_aio_simulated_wake_handler_threads();
os_thread_sleep(10000);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index eb7280b8673..a0f2b5f3972 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1605,7 +1605,7 @@ dict_table_rename_in_cache(
return(DB_OUT_OF_MEMORY);
}
- fil_delete_tablespace(table->space_id);
+ fil_delete_tablespace(table->space_id, !table->space);
/* Delete any temp file hanging around. */
if (os_file_status(filepath, &exists, &ftype)
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 434490c002c..3484de8787a 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2509,14 +2509,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- )
+dberr_t fil_delete_tablespace(ulint id, bool if_exists)
{
char* path = 0;
fil_space_t* space = 0;
@@ -2527,10 +2522,11 @@ fil_delete_tablespace(
id, FIL_OPERATION_DELETE, &space, &path);
if (err != DB_SUCCESS) {
-
- ib::error() << "Cannot delete tablespace " << id
- << " because it is not found in the tablespace"
- " memory cache.";
+ if (!if_exists) {
+ ib::error() << "Cannot delete tablespace " << id
+ << " because it is not found"
+ " in the tablespace memory cache.";
+ }
return(err);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 79051b9c247..63267a3c5cb 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14619,7 +14619,7 @@ ha_innobase::optimize(
calls to OPTIMIZE, which is undesirable. */
bool try_alter = true;
- if (srv_defragment) {
+ if (!m_prebuilt->table->is_temporary() && srv_defragment) {
int err= defragment_table(
m_prebuilt->table->name.m_name, NULL, false);
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d9840ea80f5..ee4c12b4134 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -907,14 +907,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi = false /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- );
+dberr_t fil_delete_tablespace(ulint id, bool if_exists= false);
/** Prepare to truncate an undo tablespace.
@param[in] space_id undo tablespace id
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 280f7840d50..6c5bb2551cf 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 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
@@ -329,10 +329,4 @@ times! */
roll-forward */
#define RECV_SCAN_SIZE (4U << srv_page_size_shift)
-/** This many frames must be left free in the buffer pool when we scan
-the log and store the scanned log records in the buffer pool: we will
-use these free frames to read in pages when we start applying the
-log records to the database. */
-extern ulint recv_n_pool_free_frames;
-
#endif
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index fd9050d0a48..2543b57c18e 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 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
@@ -203,18 +203,6 @@ row_merge_file_destroy_low(
const pfs_os_file_t& fd); /*!< in: merge file descriptor */
/*********************************************************************//**
-Provide a new pathname for a table that is being renamed if it belongs to
-a file-per-table tablespace. The caller is responsible for freeing the
-memory allocated for the return value.
-@return new pathname of tablespace file, or NULL if space = 0 */
-char*
-row_make_new_pathname(
-/*==================*/
- dict_table_t* table, /*!< in: table to be renamed */
- const char* new_name) /*!< in: new name */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
-/*********************************************************************//**
Rename the tables in the data dictionary. The data dictionary must
have been locked exclusively by the caller, because the transaction
will not be committed.
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 862c5636c53..d2e0e6118c7 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+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
@@ -103,14 +103,6 @@ static ulint recv_previous_parsed_rec_offset;
/** The 'multi' flag of the previous parsed redo log record */
static ulint recv_previous_parsed_rec_is_multi;
-/** This many frames must be left free in the buffer pool when we scan
-the log and store the scanned log records in the buffer pool: we will
-use these free frames to read in pages when we start applying the
-log records to the database.
-This is the default value. If the actual size of the buffer pool is
-larger than 10 MB we'll set this value to 512. */
-ulint recv_n_pool_free_frames;
-
/** The maximum lsn we see for a page during the recovery process. If this
is bigger than the lsn we are able to scan up to, that is an indication that
the recovery failed and the database may be corrupt. */
@@ -842,9 +834,6 @@ recv_sys_init()
recv_sys->flush_end = os_event_create(0);
}
- recv_n_pool_free_frames =
- buf_pool_get_n_pages() / 3;
-
recv_sys->buf = static_cast<byte*>(
ut_malloc_dontdump(RECV_PARSING_BUF_SIZE));
recv_sys->buf_size = RECV_PARSING_BUF_SIZE;
@@ -3413,9 +3402,8 @@ recv_group_scan_log_recs(
lsn_t end_lsn;
store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0
? STORE_NO : (last_phase ? STORE_IF_EXISTS : STORE_YES);
- ulint available_mem = srv_page_size
- * (buf_pool_get_n_pages()
- - (recv_n_pool_free_frames * srv_buf_pool_instances));
+ ulint available_mem = (buf_pool_get_n_pages() * 2 / 3)
+ << srv_page_size_shift;
log_sys.log.scanned_lsn = end_lsn = *contiguous_lsn =
ut_uint64_align_down(*contiguous_lsn, OS_FILE_LOG_BLOCK_SIZE);
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 9a1276ef364..2031dcb1ef3 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2414,12 +2414,12 @@ AIO::is_linux_native_aio_supported()
/** Retrieves the last error number if an error occurs in a file io function.
The number should be retrieved before any other OS calls (because they may
overwrite the error number). If the number is not known to this program,
-the OS error number + 100 is returned.
+the OS error number + OS_FILE_ERROR_MAX is returned.
@param[in] report_all_errors true if we want an error message
printed of all errors
@param[in] on_error_silent true then don't print any diagnostic
to the log
-@return error number, or OS error number + 100 */
+@return error number, or OS error number + OS_FILE_ERROR_MAX */
static
ulint
os_file_get_last_error_low(
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 268d196036a..54a1f5f492e 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1887,6 +1887,23 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
+ if (m_index && block->page.id.page_no() == m_index->m_page_no) {
+ byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE
+ + page;
+ mach_write_to_4(b, block->page.id.space());
+
+ memcpy(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + FSEG_HDR_SPACE
+ + page, b, 4);
+ if (UNIV_LIKELY_NULL(block->page.zip.data)) {
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_TOP
+ + FSEG_HDR_SPACE], b, 4);
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_LEAF
+ + FSEG_HDR_SPACE], b, 4);
+ }
+ }
+
#ifdef UNIV_ZIP_DEBUG
ut_a(!is_compressed_table()
|| page_zip_validate(m_page_zip_ptr, page, m_index->m_srv_index));
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 68166705a3b..1bca8a65532 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4270,6 +4270,7 @@ Provide a new pathname for a table that is being renamed if it belongs to
a file-per-table tablespace. The caller is responsible for freeing the
memory allocated for the return value.
@return new pathname of tablespace file, or NULL if space = 0 */
+static
char*
row_make_new_pathname(
/*==================*/
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 6bdc8ce4904..c14be0e8260 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3757,10 +3757,11 @@ do_drop:
dict_table_t. */
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
dict_get_and_save_data_dir_path(table, true);
- ut_a(table->data_dir_path);
+ ut_ad(table->data_dir_path || !space);
filepath = space ? NULL : fil_make_filepath(
table->data_dir_path,
- table->name.m_name, IBD, true);
+ table->name.m_name, IBD,
+ table->data_dir_path != NULL);
} else {
filepath = space ? NULL : fil_make_filepath(
NULL, table->name.m_name, IBD, false);
@@ -4338,14 +4339,14 @@ row_rename_table_for_mysql(
/* SYS_TABLESPACES and SYS_DATAFILES need to be updated if
the table is in a single-table tablespace. */
- if (err == DB_SUCCESS
- && dict_table_is_file_per_table(table)) {
- /* Make a new pathname to update SYS_DATAFILES. */
+ if (err != DB_SUCCESS || !dict_table_is_file_per_table(table)) {
+ } else if (table->space) {
/* If old path and new path are the same means tablename
has not changed and only the database name holding the table
has changed so we need to make the complete filepath again. */
char* new_path = dict_tables_have_same_db(old_name, new_name)
- ? row_make_new_pathname(table, new_name)
+ ? os_file_make_new_pathname(
+ table->space->chain.start->name, new_name)
: fil_make_filepath(NULL, new_name, IBD, false);
info = pars_info_create();
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 9443e7bc506..f6a2919ddf5 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2007 MySQL AB & Sanja Belkin. 2010 Monty Program Ab.
+ 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
@@ -5443,15 +5444,15 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
src + 1 + LSN_STORE_SIZE));
DBUG_RETURN(src + 1 + LSN_STORE_SIZE);
}
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src));
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) | *((uint8*)src));
break;
case 1:
diff= uint2korr(src);
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) + diff);
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) | diff);
break;
case 2:
diff= uint3korr(src);
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) + diff);
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) | diff);
break;
case 3:
{
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index 2e7add8f61d..e42e9300d14 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1,4 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
@@ -1157,10 +1158,10 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
bit_buff->error=1;
return; /* Can't be right */
}
- bit_buff->current_byte= (bit_buff->current_byte << 32) +
- ((((uint) bit_buff->pos[3])) +
- (((uint) bit_buff->pos[2]) << 8) +
- (((uint) bit_buff->pos[1]) << 16) +
+ bit_buff->current_byte= (bit_buff->current_byte << 32) |
+ ((((uint) bit_buff->pos[3])) |
+ (((uint) bit_buff->pos[2]) << 8) |
+ (((uint) bit_buff->pos[1]) << 16) |
(((uint) bit_buff->pos[0]) << 24));
bit_buff->pos+=4;
bits+=32;
@@ -1251,23 +1252,23 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
return; /* Can't be right */
}
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
if (bits) /* We must have at leasts 9 bits */
{
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos++;
bits+=8;
}
else
{
- bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
+ bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
((uint) ((uchar) bit_buff->pos[1]));
bit_buff->pos+=2;
bits+=16;
@@ -1291,14 +1292,14 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
if (bits < 8)
{ /* We don't need to check end */
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos+=1;
bits+=8;
@@ -1488,25 +1489,25 @@ static void fill_buffer(MARIA_BIT_BUFF *bit_buff)
return;
}
#if BITS_SAVED == 64
- bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
- (((uint) ((uchar) bit_buff->pos[6])) << 8) +
- (((uint) ((uchar) bit_buff->pos[5])) << 16) +
- (((uint) ((uchar) bit_buff->pos[4])) << 24) +
+ bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
+ (((uint) ((uchar) bit_buff->pos[6])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[5])) << 16) |
+ (((uint) ((uchar) bit_buff->pos[4])) << 24) |
((ulonglong)
- ((((uint) ((uchar) bit_buff->pos[3]))) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ ((((uint) ((uchar) bit_buff->pos[3]))) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
bit_buff->pos+=8;
#else
#if BITS_SAVED == 32
- bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24));
bit_buff->pos+=4;
#else
- bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
+ bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
(((uint) ((uchar) bit_buff->pos[0])) << 8));
bit_buff->pos+=2;
#endif
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index b28eaf21090..6197c083c52 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2013, 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
@@ -1111,10 +1112,10 @@ static void decode_bytes(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,uchar *to,
bit_buff->error=1;
return; /* Can't be right */
}
- bit_buff->current_byte= (bit_buff->current_byte << 32) +
- ((((uint) bit_buff->pos[3])) +
- (((uint) bit_buff->pos[2]) << 8) +
- (((uint) bit_buff->pos[1]) << 16) +
+ bit_buff->current_byte= (bit_buff->current_byte << 32) |
+ ((((uint) bit_buff->pos[3])) |
+ (((uint) bit_buff->pos[2]) << 8) |
+ (((uint) bit_buff->pos[1]) << 16) |
(((uint) bit_buff->pos[0]) << 24));
bit_buff->pos+=4;
bits+=32;
@@ -1205,23 +1206,23 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
return; /* Can't be right */
}
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
if (bits) /* We must have at leasts 9 bits */
{
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos++;
bits+=8;
}
else
{
- bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
+ bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
((uint) ((uchar) bit_buff->pos[1]));
bit_buff->pos+=2;
bits+=16;
@@ -1245,14 +1246,14 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
if (bits < 8)
{ /* We don't need to check end */
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos+=1;
bits+=8;
@@ -1439,25 +1440,25 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
}
#if BITS_SAVED == 64
- bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
- (((uint) ((uchar) bit_buff->pos[6])) << 8) +
- (((uint) ((uchar) bit_buff->pos[5])) << 16) +
- (((uint) ((uchar) bit_buff->pos[4])) << 24) +
+ bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
+ (((uint) ((uchar) bit_buff->pos[6])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[5])) << 16) |
+ (((uint) ((uchar) bit_buff->pos[4])) << 24) |
((ulonglong)
- ((((uint) ((uchar) bit_buff->pos[3]))) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ ((((uint) ((uchar) bit_buff->pos[3]))) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
bit_buff->pos+=8;
#else
#if BITS_SAVED == 32
- bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24));
bit_buff->pos+=4;
#else
- bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
+ bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
(((uint) ((uchar) bit_buff->pos[0])) << 8));
bit_buff->pos+=2;
#endif