Commit 056ec4ab authored by Marko Mäkelä's avatar Marko Mäkelä

Fix some compilation warnings.

parent e5b155a4
...@@ -426,15 +426,12 @@ class IORequest { ...@@ -426,15 +426,12 @@ class IORequest {
} }
} }
/** Punch a hole in the file if it was a write /** Free storage space associated with a section of the file.
@param[in] fh Open file handle @param[in] fh Open file handle
@param[in] len Compressed buffer length for write @param[in] off Starting offset (SEEK_SET)
@param[in] len Size of the hole
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
dberr_t punch_hole(os_file_t fh, os_offset_t off, ulint len);
dberr_t punch_hole(
os_file_t fh,
os_offset_t offset,
os_offset_t len);
private: private:
/** Page to be written on write operation. */ /** Page to be written on write operation. */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
...@@ -223,8 +224,8 @@ row_count_rtree_recs( ...@@ -223,8 +224,8 @@ row_count_rtree_recs(
/*******************************************************************//** /*******************************************************************//**
Checks if MySQL at the moment is allowed for this table to retrieve a Checks if MySQL at the moment is allowed for this table to retrieve a
consistent read result, or store it to the query cache. consistent read result, or store it to the query cache.
@return TRUE if storing or retrieving from the query cache is permitted */ @return whether storing or retrieving from the query cache is permitted */
ibool bool
row_search_check_if_query_cache_permitted( row_search_check_if_query_cache_permitted(
/*======================================*/ /*======================================*/
trx_t* trx, /*!< in: transaction object */ trx_t* trx, /*!< in: transaction object */
......
...@@ -2726,18 +2726,16 @@ recv_scan_log_recs( ...@@ -2726,18 +2726,16 @@ recv_scan_log_recs(
stored to the hash table; this is reset stored to the hash table; this is reset
if just debug checking is needed, or if just debug checking is needed, or
when the available_memory runs out */ when the available_memory runs out */
const byte* buf, /*!< in: buffer containing a log const byte* log_block, /*!< in: log segment */
segment or garbage */
ulint len, /*!< in: buffer length */
lsn_t checkpoint_lsn, /*!< in: latest checkpoint LSN */ lsn_t checkpoint_lsn, /*!< in: latest checkpoint LSN */
lsn_t start_lsn, /*!< in: buffer start lsn */ lsn_t start_lsn, /*!< in: buffer start LSN */
lsn_t end_lsn, /*!< in: buffer end LSN */
lsn_t* contiguous_lsn, /*!< in/out: it is known that all log lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
groups contain contiguous log data up groups contain contiguous log data up
to this lsn */ to this lsn */
lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
this lsn */ this lsn */
{ {
const byte* log_block = buf;
lsn_t scanned_lsn = start_lsn; lsn_t scanned_lsn = start_lsn;
bool finished = false; bool finished = false;
ulint data_len; ulint data_len;
...@@ -2745,8 +2743,11 @@ recv_scan_log_recs( ...@@ -2745,8 +2743,11 @@ recv_scan_log_recs(
bool apply = recv_sys->mlog_checkpoint_lsn != 0; bool apply = recv_sys->mlog_checkpoint_lsn != 0;
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(end_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len >= OS_FILE_LOG_BLOCK_SIZE); ut_ad(end_lsn >= start_lsn + OS_FILE_LOG_BLOCK_SIZE);
const byte* const log_end = log_block
+ ulint(end_lsn - start_lsn);
do { do {
ut_ad(!finished); ut_ad(!finished);
...@@ -2842,7 +2843,7 @@ recv_scan_log_recs( ...@@ -2842,7 +2843,7 @@ recv_scan_log_recs(
} else { } else {
log_block += OS_FILE_LOG_BLOCK_SIZE; log_block += OS_FILE_LOG_BLOCK_SIZE;
} }
} while (log_block < buf + len); } while (log_block < log_end);
*group_scanned_lsn = scanned_lsn; *group_scanned_lsn = scanned_lsn;
...@@ -2938,9 +2939,9 @@ recv_group_scan_log_recs( ...@@ -2938,9 +2939,9 @@ recv_group_scan_log_recs(
} while (end_lsn != start_lsn } while (end_lsn != start_lsn
&& !recv_scan_log_recs( && !recv_scan_log_recs(
available_mem, &store_to_hash, log_sys->buf, available_mem, &store_to_hash, log_sys->buf,
end_lsn - start_lsn,
checkpoint_lsn, checkpoint_lsn,
start_lsn, contiguous_lsn, &group->scanned_lsn)); start_lsn, end_lsn,
contiguous_lsn, &group->scanned_lsn));
if (recv_sys->found_corrupt_log || recv_sys->found_corrupt_fs) { if (recv_sys->found_corrupt_log || recv_sys->found_corrupt_fs) {
DBUG_RETURN(false); DBUG_RETURN(false);
......
...@@ -1920,8 +1920,7 @@ LinuxAIOHandler::collect() ...@@ -1920,8 +1920,7 @@ LinuxAIOHandler::collect()
slot->err = slot->type.punch_hole( slot->err = slot->type.punch_hole(
slot->file, slot->file,
slot->offset, slot->offset, slot->len);
static_cast<os_offset_t>(slot->len));
} else { } else {
slot->err = DB_SUCCESS; slot->err = DB_SUCCESS;
} }
...@@ -4881,9 +4880,7 @@ os_file_io( ...@@ -4881,9 +4880,7 @@ os_file_io(
&& !type.is_log() && !type.is_log()
&& type.is_write() && type.is_write()
&& type.punch_hole()) { && type.punch_hole()) {
*err = type.punch_hole(file, *err = type.punch_hole(file, offset, n);
offset,
static_cast<os_offset_t>(n));
} else { } else {
*err = DB_SUCCESS; *err = DB_SUCCESS;
...@@ -5541,10 +5538,7 @@ os_file_punch_hole( ...@@ -5541,10 +5538,7 @@ os_file_punch_hole(
@param[in] len Size of the hole @param[in] len Size of the hole
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
dberr_t dberr_t
IORequest::punch_hole( IORequest::punch_hole(os_file_t fh, os_offset_t off, ulint len)
os_file_t fh,
os_offset_t off,
os_offset_t len)
{ {
/* In this debugging mode, we act as if punch hole is supported, /* In this debugging mode, we act as if punch hole is supported,
and then skip any calls to actually punch a hole here. and then skip any calls to actually punch a hole here.
...@@ -5553,7 +5547,7 @@ IORequest::punch_hole( ...@@ -5553,7 +5547,7 @@ IORequest::punch_hole(
return(DB_SUCCESS); return(DB_SUCCESS);
); );
os_offset_t trim_len = static_cast<os_offset_t>(get_trim_length(len)); ulint trim_len = get_trim_length(len);
if (trim_len == 0) { if (trim_len == 0) {
return(DB_SUCCESS); return(DB_SUCCESS);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2015, MariaDB Corporation. Copyright (c) 2015, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -3260,7 +3260,9 @@ row_sel_store_mysql_rec( ...@@ -3260,7 +3260,9 @@ row_sel_store_mysql_rec(
getting selected. The non-key virtual columns may getting selected. The non-key virtual columns may
not be materialized and we should skip them. */ not be materialized and we should skip them. */
if (dfield_get_type(dfield)->mtype == DATA_MISSING) { if (dfield_get_type(dfield)->mtype == DATA_MISSING) {
#ifdef UNIV_DEBUG
ulint prefix; ulint prefix;
#endif /* UNIV_DEBUG */
ut_ad(prebuilt->m_read_virtual_key); ut_ad(prebuilt->m_read_virtual_key);
/* If it is part of index key the data should /* If it is part of index key the data should
...@@ -5947,23 +5949,20 @@ row_count_rtree_recs( ...@@ -5947,23 +5949,20 @@ row_count_rtree_recs(
/*******************************************************************//** /*******************************************************************//**
Checks if MySQL at the moment is allowed for this table to retrieve a Checks if MySQL at the moment is allowed for this table to retrieve a
consistent read result, or store it to the query cache. consistent read result, or store it to the query cache.
@return TRUE if storing or retrieving from the query cache is permitted */ @return whether storing or retrieving from the query cache is permitted */
ibool bool
row_search_check_if_query_cache_permitted( row_search_check_if_query_cache_permitted(
/*======================================*/ /*======================================*/
trx_t* trx, /*!< in: transaction object */ trx_t* trx, /*!< in: transaction object */
const char* norm_name) /*!< in: concatenation of database name, const char* norm_name) /*!< in: concatenation of database name,
'/' char, table name */ '/' char, table name */
{ {
dict_table_t* table; dict_table_t* table = dict_table_open_on_name(
ibool ret = FALSE;
table = dict_table_open_on_name(
norm_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); norm_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
if (table == NULL) { if (table == NULL) {
return(FALSE); return(false);
} }
/* Start the transaction if it is not started yet */ /* Start the transaction if it is not started yet */
...@@ -5975,18 +5974,16 @@ row_search_check_if_query_cache_permitted( ...@@ -5975,18 +5974,16 @@ row_search_check_if_query_cache_permitted(
read/write from/to the cache. read/write from/to the cache.
If a read view has not been created for the transaction then it doesn't If a read view has not been created for the transaction then it doesn't
really matter what this transactin sees. If a read view was created really matter what this transaction sees. If a read view was created
then the view low_limit_id is the max trx id that this transaction then the view low_limit_id is the max trx id that this transaction
saw at the time of the read view creation. */ saw at the time of the read view creation. */
if (lock_table_get_n_locks(table) == 0 const bool ret = lock_table_get_n_locks(table) == 0
&& ((trx->id != 0 && trx->id >= table->query_cache_inv_id) && ((trx->id != 0 && trx->id >= table->query_cache_inv_id)
|| !MVCC::is_view_active(trx->read_view) || !MVCC::is_view_active(trx->read_view)
|| trx->read_view->low_limit_id() || trx->read_view->low_limit_id()
>= table->query_cache_inv_id)) { >= table->query_cache_inv_id);
if (ret) {
ret = TRUE;
/* If the isolation level is high, assign a read view for the /* If the isolation level is high, assign a read view for the
transaction if it does not yet have one */ transaction if it does not yet have one */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment