Commit 46977e0a authored by Sergei Golubchik's avatar Sergei Golubchik

5.5.55-38.8

parent cba2ac6e
......@@ -2958,7 +2958,7 @@ Removes a page from the level list of pages.
/*************************************************************//**
Removes a page from the level list of pages. */
static __attribute__((nonnull))
static
void
btr_level_list_remove_func(
/*=======================*/
......
......@@ -112,13 +112,13 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 3/*TYPE*/);
ptr = mem_heap_alloc(heap, 4);
if (table->flags & (~DICT_TF_COMPACT & ~(~0 << DICT_TF_BITS))) {
if (table->flags & (~DICT_TF_COMPACT & ~(~0U << DICT_TF_BITS))) {
ut_a(table->flags & DICT_TF_COMPACT);
ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
ut_a((table->flags & DICT_TF_ZSSIZE_MASK)
<= (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT));
ut_a(!(table->flags & (~0 << DICT_TF2_BITS)));
mach_write_to_4(ptr, table->flags & ~(~0 << DICT_TF_BITS));
ut_a(!(table->flags & (~0U << DICT_TF2_BITS)));
mach_write_to_4(ptr, table->flags & ~(~0U << DICT_TF_BITS));
} else {
mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
}
......@@ -306,7 +306,7 @@ dict_build_table_def_step(
ut_ad(!dict_table_zip_size(table)
|| dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
flags = table->flags & ~(~0 << DICT_TF_BITS);
flags = table->flags & ~(~0U << DICT_TF_BITS);
error = fil_create_new_single_table_tablespace(
space, path_or_name, is_path,
flags == DICT_TF_COMPACT ? 0 : flags,
......@@ -325,7 +325,7 @@ dict_build_table_def_step(
mtr_commit(&mtr);
} else {
/* Create in the system tablespace: disallow new features */
table->flags &= (~0 << DICT_TF_BITS) | DICT_TF_COMPACT;
table->flags &= (~0U << DICT_TF_BITS) | DICT_TF_COMPACT;
}
row = dict_create_sys_tables_tuple(table, node->heap);
......
......@@ -717,7 +717,7 @@ dict_sys_tables_get_flags(
return(ULINT_UNDEFINED);
}
if (UNIV_UNLIKELY(flags & (~0 << DICT_TF_BITS))) {
if (UNIV_UNLIKELY(flags & (~0U << DICT_TF_BITS))) {
/* Some unused bits are set. */
return(ULINT_UNDEFINED);
}
......@@ -1406,7 +1406,7 @@ dict_load_index_low(
goto err_len;
}
type = mach_read_from_4(field);
if (UNIV_UNLIKELY(type & (~0 << DICT_IT_BITS))) {
if (UNIV_UNLIKELY(type & (~0U << DICT_IT_BITS))) {
return("unknown SYS_INDEXES.TYPE bits");
}
......@@ -1771,7 +1771,7 @@ dict_load_table_low(
flags2 = mach_read_from_4(field);
if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
if (flags2 & (~0U << (DICT_TF2_BITS - DICT_TF2_SHIFT))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: table ", stderr);
ut_print_filename(stderr, name);
......@@ -1780,7 +1780,7 @@ dict_load_table_low(
" has unknown flags %lx.\n",
(ulong) flags2);
flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT));
flags2 &= ~(~0U << (DICT_TF2_BITS - DICT_TF2_SHIFT));
}
flags |= flags2 << DICT_TF2_SHIFT;
......@@ -1913,7 +1913,7 @@ dict_load_table(
if (!fil_open_single_table_tablespace(
TRUE, table->space,
table->flags == DICT_TF_COMPACT ? 0 :
table->flags & ~(~0 << DICT_TF_BITS), name, NULL)) {
table->flags & ~(~0U << DICT_TF_BITS), name, NULL)) {
/* We failed to find a sensible
tablespace file */
......
......@@ -69,7 +69,7 @@ dict_mem_table_create(
DBUG_ENTER("dict_mem_table_create");
ut_ad(name);
ut_a(!(flags & (~0 << DICT_TF2_BITS)));
ut_a(!(flags & (~0U << DICT_TF2_BITS)));
heap = mem_heap_create(DICT_HEAP_SIZE);
......
......@@ -3868,7 +3868,7 @@ fil_open_single_table_tablespace(
}
if (space_id != id
|| space_flags != (flags & ~(~0 << DICT_TF_BITS))) {
|| space_flags != (flags & ~(~0U << DICT_TF_BITS))) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: tablespace id and flags in file ",
......
......@@ -249,8 +249,7 @@ fsp_fill_free_list(
then we do not allocate more extents */
ulint space, /*!< in: space */
fsp_header_t* header, /*!< in/out: space header */
mtr_t* mtr) /*!< in/out: mini-transaction */
__attribute__((nonnull));
mtr_t* mtr); /*!< in/out: mini-transaction */
/**********************************************************************//**
Allocates a single free page from a segment. This function implements
the intelligent allocation strategy which tries to minimize file space
......@@ -279,7 +278,7 @@ fseg_alloc_free_page_low(
in which the page should be initialized.
If init_mtr!=mtr, but the page is already
latched in mtr, do not initialize the page. */
__attribute__((warn_unused_result, nonnull));
__attribute__((warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
......@@ -1572,7 +1571,7 @@ Allocates a single free page from a space. The page is marked as used.
@retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded
(init_mtr == mtr, or the page was not previously freed in mtr)
@retval block (not allocated or initialized) otherwise */
static __attribute__((nonnull, warn_unused_result))
static __attribute__((warn_unused_result))
buf_block_t*
fsp_alloc_free_page(
/*================*/
......
......@@ -7544,29 +7544,7 @@ i_s_innodb_changed_pages_fill(
while(log_online_bitmap_iterator_next(&i) &&
(!srv_max_changed_pages ||
output_rows_num < srv_max_changed_pages) &&
/*
There is no need to compare both start LSN and end LSN fields
with maximum value. It's enough to compare only start LSN.
Example:
max_lsn = 100
\\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1
I------I I-------I I-------------I I----I
////////////////// | - Query 2
1 2 3 4
Query 1:
SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100
will select 1,2,3 bitmaps
Query 2:
SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100
will select 1,2 bitmaps
The condition start_lsn <= 100 will be false after reading
1,2,3 bitmaps which suits for both cases.
*/
LOG_BITMAP_ITERATOR_START_LSN(i) <= max_lsn)
output_rows_num < srv_max_changed_pages))
{
if (!LOG_BITMAP_ITERATOR_PAGE_CHANGED(i))
continue;
......
......@@ -261,7 +261,7 @@ btr_cur_update_alloc_zip(
FALSE=update-in-place */
mtr_t* mtr, /*!< in: mini-transaction */
trx_t* trx) /*!< in: NULL or transaction */
__attribute__((nonnull (1, 2, 3, 6), warn_unused_result));
__attribute__((warn_unused_result));
/*************************************************************//**
Updates a record when the update causes no size changes in its fields.
@return DB_SUCCESS or error number */
......@@ -345,8 +345,7 @@ btr_cur_del_mark_set_clust_rec(
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
ibool val, /*!< in: value to set */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
__attribute__((nonnull));
mtr_t* mtr); /*!< in: mtr */
/***********************************************************//**
Sets a secondary index record delete mark to TRUE or FALSE.
@return DB_SUCCESS, DB_LOCK_WAIT, or error number */
......@@ -499,8 +498,7 @@ btr_cur_disown_inherited_fields(
dict_index_t* index, /*!< in: index of the page */
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
__attribute__((nonnull(2,3,4,5,6)));
mtr_t* mtr); /*!< in/out: mini-transaction */
/** Operation code for btr_store_big_rec_extern_fields(). */
enum blob_op {
......@@ -545,7 +543,7 @@ btr_store_big_rec_extern_fields(
mtr_t* btr_mtr, /*!< in: mtr containing the
latches to the clustered index */
enum blob_op op) /*! in: operation code */
__attribute__((nonnull, warn_unused_result));
__attribute__((warn_unused_result));
/*******************************************************************//**
Frees the space in an externally stored field to the file space
......@@ -621,8 +619,7 @@ btr_push_update_extern_fields(
/*==========================*/
dtuple_t* tuple, /*!< in/out: data tuple */
const upd_t* update, /*!< in: update vector */
mem_heap_t* heap) /*!< in: memory heap */
__attribute__((nonnull));
mem_heap_t* heap); /*!< in: memory heap */
/***********************************************************//**
Sets a secondary index record's delete mark to the given value. This
function is only used by the insert buffer merge mechanism. */
......
......@@ -205,14 +205,14 @@ hash_table_t*
btr_search_get_hash_table(
/*======================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull,pure,warn_unused_result));
__attribute__((warn_unused_result));
UNIV_INLINE
rw_lock_t*
btr_search_get_latch(
/*=================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull,pure,warn_unused_result));
__attribute__((warn_unused_result));
/*********************************************************************//**
Returns the AHI partition number corresponding to a given index ID. */
......@@ -229,8 +229,7 @@ UNIV_INLINE
void
btr_search_index_init(
/*===============*/
dict_index_t* index) /*!< in: index */
__attribute__((nonnull));
dict_index_t* index); /*!< in: index */
UNIV_INLINE
void
......
......@@ -51,7 +51,7 @@ buf_buddy_alloc_low(
buf_pool->mutex was temporarily
released */
ibool have_page_hash_mutex)
__attribute__((malloc, nonnull));
__attribute__((malloc));
/**********************************************************************//**
Deallocate a block. */
......
......@@ -274,8 +274,7 @@ buf_relocate(
buf_page_t* bpage, /*!< in/out: control block being relocated;
buf_page_get_state(bpage) must be
BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */
buf_page_t* dpage) /*!< in/out: destination control block */
__attribute__((nonnull));
buf_page_t* dpage); /*!< in/out: destination control block */
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
......
......@@ -605,7 +605,7 @@ ulint
dict_index_is_clust(
/*================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Check whether the index is unique.
@return nonzero for unique index, zero for other indexes */
......@@ -614,7 +614,7 @@ ulint
dict_index_is_unique(
/*=================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Check whether the index is the insert buffer tree.
@return nonzero for insert buffer, zero for other indexes */
......@@ -623,7 +623,7 @@ ulint
dict_index_is_ibuf(
/*===============*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Check whether the index is a secondary index or the insert buffer tree.
@return nonzero for insert buffer, zero for other indexes */
......@@ -632,7 +632,7 @@ ulint
dict_index_is_sec_or_ibuf(
/*======================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Gets the number of user-defined columns in a table in the dictionary
......@@ -643,7 +643,7 @@ ulint
dict_table_get_n_user_cols(
/*=======================*/
const dict_table_t* table) /*!< in: table */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Gets the number of system columns in a table in the dictionary cache.
@return number of system (e.g., ROW_ID) columns of a table */
......@@ -662,7 +662,7 @@ ulint
dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
#ifdef UNIV_DEBUG
/********************************************************************//**
Gets the nth column of a table.
......@@ -1313,7 +1313,7 @@ ulint
dict_index_is_corrupted(
/*====================*/
const dict_index_t* index) /*!< in: index */
__attribute__((nonnull, pure, warn_unused_result));
__attribute__((warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
/**********************************************************************//**
......@@ -1324,7 +1324,7 @@ void
dict_set_corrupted(
/*===============*/
dict_index_t* index) /*!< in/out: index */
UNIV_COLD __attribute__((nonnull));
UNIV_COLD;
/**********************************************************************//**
Flags an index corrupted in the data dictionary cache only. This
......
......@@ -87,7 +87,7 @@ combination of types */
/* @{ */
#define DICT_TF_FORMAT_SHIFT 5 /* file format */
#define DICT_TF_FORMAT_MASK \
((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
((~(~0U << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
#define DICT_TF_FORMAT_51 0 /*!< InnoDB/MySQL up to 5.1 */
#define DICT_TF_FORMAT_ZIP 1 /*!< InnoDB plugin for 5.1:
compressed tables,
......
......@@ -47,9 +47,8 @@ UNIV_INLINE
dyn_array_t*
dyn_array_create(
/*=============*/
dyn_array_t* arr) /*!< in/out memory buffer of
dyn_array_t* arr); /*!< in/out memory buffer of
size sizeof(dyn_array_t) */
__attribute__((nonnull));
/************************************************************//**
Frees a dynamic array. */
UNIV_INLINE
......@@ -70,7 +69,7 @@ dyn_array_open(
dyn_array_t* arr, /*!< in: dynamic array */
ulint size) /*!< in: size in bytes of the buffer; MUST be
smaller than DYN_ARRAY_DATA_SIZE! */
__attribute__((nonnull, warn_unused_result));
__attribute__((warn_unused_result));
/*********************************************************************//**
Closes the buffer returned by dyn_array_open. */
UNIV_INLINE
......@@ -78,8 +77,7 @@ void
dyn_array_close(
/*============*/
dyn_array_t* arr, /*!< in: dynamic array */
const byte* ptr) /*!< in: end of used space */
__attribute__((nonnull));
const byte* ptr); /*!< in: end of used space */
/*********************************************************************//**
Makes room on top of a dyn array and returns a pointer to
the added element. The caller must copy the element to
......@@ -91,7 +89,7 @@ dyn_array_push(
/*===========*/
dyn_array_t* arr, /*!< in/out: dynamic array */
ulint size) /*!< in: size in bytes of the element */
__attribute__((nonnull, warn_unused_result));
__attribute__((warn_unused_result));
/************************************************************//**
Returns pointer to an element in dyn array.
@return pointer to element */
......@@ -102,7 +100,7 @@ dyn_array_get_element(
const dyn_array_t* arr, /*!< in: dyn array */
ulint pos) /*!< in: position of element
in bytes from array start */
__attribute__((nonnull, warn_unused_result));
__attribute__((warn_unused_result));
/************************************************************//**
Returns the size of stored data in a dyn array.
@return data size in bytes */
......@@ -111,7 +109,7 @@ ulint
dyn_array_get_data_size(
/*====================*/
const dyn_array_t* arr) /*!< in: dyn array */
__attribute__((nonnull, warn_unused_result, pure));
__attribute__((warn_unused_result));
/************************************************************//**
Gets the first block in a dyn array.
@param arr dyn array
......@@ -145,7 +143,7 @@ ulint
dyn_block_get_used(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
__attribute__((nonnull, warn_unused_result, pure));
__attribute__((warn_unused_result));
/********************************************************************//**
Gets pointer to the start of data in a dyn array block.
@return pointer to data */
......@@ -154,7 +152,7 @@ byte*
dyn_block_get_data(
/*===============*/
const dyn_block_t* block) /*!< in: dyn array block */
__attribute__((nonnull, warn_unused_result, pure));
__attribute__((warn_unused_result));
/********************************************************//**
Pushes n bytes to a dyn array. */
UNIV_INLINE
......
......@@ -36,7 +36,7 @@ dyn_block_t*
dyn_array_add_block(
/*================*/
dyn_array_t* arr) /*!< in/out: dyn array */
__attribute__((nonnull, warn_unused_result));
__attribute__((warn_unused_result));
/********************************************************************//**
Gets the number of used bytes in a dyn array block.
......
......@@ -42,7 +42,7 @@ Created 12/18/1995 Heikki Tuuri
#define FSP_FLAGS_POS_PAGE_SSIZE 6
/** Bit mask of the PAGE_SSIZE field */
#define FSP_FLAGS_MASK_PAGE_SSIZE \
((~(~0 << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
((~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \
<< FSP_FLAGS_POS_PAGE_SSIZE)
/** Return the value of the PAGE_SSIZE field */
#define FSP_FLAGS_GET_PAGE_SSIZE(flags) \
......
......@@ -37,19 +37,25 @@ log_online_bitmap_file_range_t;
/** An iterator over changed page info */
typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
/*********************************************************************//**
Initializes the online log following subsytem. */
/** Initialize the constant part of the log tracking subsystem */
UNIV_INTERN
void
log_online_init(void);
/** Initialize the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_init(void);
/*=======================*/
/*********************************************************************//**
Shuts down the online log following subsystem. */
/** Shut down the dynamic part of the log tracking subsystem */
UNIV_INTERN
void
log_online_read_shutdown(void);
/*===========================*/
/** Shut down the constant part of the log tracking subsystem */
UNIV_INTERN
void
log_online_shutdown(void);
/*********************************************************************//**
Reads and parses the redo log up to last checkpoint LSN to build the changed
......@@ -159,6 +165,8 @@ struct log_online_bitmap_file_range_struct {
/** Struct for an iterator through all bits of changed pages bitmap blocks */
struct log_bitmap_iterator_struct
{
ib_uint64_t max_lsn; /*!< End LSN of the
range */
ibool failed; /*!< Has the iteration
stopped prematurely */
log_online_bitmap_file_range_t in_files; /*!< The bitmap files
......
......@@ -51,7 +51,7 @@ ulint
mach_read_from_1(
/*=============*/
const byte* b) /*!< in: pointer to byte */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*******************************************************//**
The following function is used to store data in two consecutive
bytes. We store the most significant byte to the lower address. */
......@@ -112,7 +112,7 @@ ulint
mach_read_from_3(
/*=============*/
const byte* b) /*!< in: pointer to 3 bytes */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*******************************************************//**
The following function is used to store data in four consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -131,7 +131,7 @@ ulint
mach_read_from_4(
/*=============*/
const byte* b) /*!< in: pointer to four bytes */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*********************************************************//**
Writes a ulint in a compressed form (1..5 bytes).
@return stored size in bytes */
......@@ -158,7 +158,7 @@ ulint
mach_read_compressed(
/*=================*/
const byte* b) /*!< in: pointer to memory from where to read */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 6 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -177,7 +177,7 @@ ib_uint64_t
mach_read_from_6(
/*=============*/
const byte* b) /*!< in: pointer to 6 bytes */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -196,7 +196,7 @@ ib_uint64_t
mach_read_from_7(
/*=============*/
const byte* b) /*!< in: pointer to 7 bytes */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*******************************************************//**
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
......@@ -241,7 +241,7 @@ ib_uint64_t
mach_ull_read_compressed(
/*=====================*/
const byte* b) /*!< in: pointer to memory from where to read */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*********************************************************//**
Writes a 64-bit integer in a compressed form (1..11 bytes).
@return size in bytes */
......@@ -268,7 +268,7 @@ ib_uint64_t
mach_ull_read_much_compressed(
/*==========================*/
const byte* b) /*!< in: pointer to memory from where to read */
__attribute__((nonnull, pure));
__attribute__((warn_unused_result));
/*********************************************************//**
Reads a ulint in a compressed form if the log record fully contains it.
@return pointer to end of the stored field, NULL if not complete */
......
......@@ -205,8 +205,7 @@ UNIV_INTERN
void
mtr_commit(
/*=======*/
mtr_t* mtr) /*!< in/out: mini-transaction */
__attribute__((nonnull));
mtr_t* mtr); /*!< in/out: mini-transaction */
/**********************************************************//**
Sets and returns a savepoint in mtr.
@return savepoint */
......@@ -311,7 +310,7 @@ mtr_memo_contains(
mtr_t* mtr, /*!< in: mtr */
const void* object, /*!< in: object to search */
ulint type) /*!< in: type of object */
__attribute__((warn_unused_result, nonnull));
__attribute__((warn_unused_result));
/**********************************************************//**
Checks if memo contains the given page.
......
......@@ -515,9 +515,10 @@ os_file_create_simple_no_error_handling_func(
it would be enabled otherwise). */
ibool* success);/*!< out: TRUE if succeed, FALSE if error */
/****************************************************************//**
Tries to disable OS caching on an opened file descriptor. */
Tries to disable OS caching on an opened file descriptor.
@return TRUE if operation is success and FALSE otherwise */
UNIV_INTERN
void
ibool
os_file_set_nocache(
/*================*/
int fd, /*!< in: file descriptor to alter */
......
......@@ -231,8 +231,7 @@ ulint
page_header_get_offs(
/*=================*/
const page_t* page, /*!< in: page */
ulint field) /*!< in: PAGE_FREE, ... */
__attribute__((nonnull, pure));
ulint field); /*!< in: PAGE_FREE, ... */
/*************************************************************//**
Returns the pointer stored in the given header field, or NULL. */
......@@ -792,8 +791,7 @@ page_copy_rec_list_end(
buf_block_t* block, /*!< in: index page containing rec */
rec_t* rec, /*!< in: record on page */
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
__attribute__((nonnull));
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Copies records from page to new_page, up to the given record, NOT
including that record. Infimum and supremum records are not copied.
......@@ -808,8 +806,7 @@ page_copy_rec_list_start(
buf_block_t* block, /*!< in: index page containing rec */
rec_t* rec, /*!< in: record on page */
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
__attribute__((nonnull));
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Deletes records from a page from a given record onward, including that record.
The infimum and supremum records are not deleted. */
......@@ -852,8 +849,7 @@ page_move_rec_list_end(
buf_block_t* block, /*!< in: index page from where to move */
rec_t* split_rec, /*!< in: first record to move */
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
__attribute__((nonnull(1, 2, 4, 5)));
mtr_t* mtr); /*!< in: mtr */
/*************************************************************//**
Moves record list start to another page. Moved records do not include
split_rec.
......@@ -877,8 +873,7 @@ page_dir_split_slot(
page_t* page, /*!< in: index page */
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be written, or NULL */
ulint slot_no)/*!< in: the directory slot */
__attribute__((nonnull(1)));
ulint slot_no);/*!< in: the directory slot */
/*************************************************************//**
Tries to balance the given directory slot with too few records
with the upper neighbor, so that there are at least the minimum number
......@@ -890,8 +885,7 @@ page_dir_balance_slot(
/*==================*/
page_t* page, /*!< in/out: index page */
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
ulint slot_no)/*!< in: the directory slot */
__attribute__((nonnull(1)));
ulint slot_no);/*!< in: the directory slot */
/**********************************************************//**
Parses a log record of a record list end or start deletion.
@return end of log record or NULL */
......
......@@ -402,8 +402,7 @@ page_zip_reorganize(
out: data, n_blobs,
m_start, m_end, m_nonempty */
dict_index_t* index, /*!< in: index of the B-tree node */
mtr_t* mtr) /*!< in: mini-transaction */
__attribute__((nonnull));
mtr_t* mtr); /*!< in: mini-transaction */
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Copy the records of a page byte for byte. Do not copy the page header
......@@ -436,7 +435,7 @@ page_zip_parse_compress(
byte* end_ptr,/*!< in: buffer end */
page_t* page, /*!< out: uncompressed page */
page_zip_des_t* page_zip)/*!< out: compressed page */
__attribute__((nonnull(1,2)));
__attribute__((warn_unused_result));
/**********************************************************************//**
Calculate the compressed page checksum.
......
......@@ -626,8 +626,7 @@ rec_copy(
/*=====*/
void* buf, /*!< in: buffer */
const rec_t* rec, /*!< in: physical record */
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
__attribute__((nonnull));
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Determines the size of a data tuple prefix in a temporary file.
......
......@@ -232,9 +232,8 @@ row_upd_index_replace_new_col_vals_index_pos(
/*!< in: if TRUE, limit the replacement to
ordering fields of index; note that this
does not work for non-clustered indexes. */
mem_heap_t* heap) /*!< in: memory heap for allocating and
mem_heap_t* heap); /*!< in: memory heap for allocating and
copying the new values */
__attribute__((nonnull));
/***********************************************************//**
Replaces the new column values stored in the update vector to the index entry
given. */
......@@ -295,7 +294,7 @@ row_upd_changes_ord_field_binary_func(
compile time */
const row_ext_t*ext) /*!< NULL, or prefixes of the externally
stored columns in the old row */
__attribute__((nonnull(1,2), warn_unused_result));
__attribute__((warn_unused_result));
#ifdef UNIV_DEBUG
# define row_upd_changes_ord_field_binary(index,update,thr,row,ext) \
row_upd_changes_ord_field_binary_func(index,update,thr,row,ext)
......
......@@ -90,7 +90,7 @@ trx_t*
trx_create(
/*=======*/
sess_t* sess) /*!< in: session */
__attribute__((nonnull));
__attribute__((warn_unused_result));
/********************************************************************//**
Creates a transaction object for MySQL.
@return own: transaction object */
......@@ -119,7 +119,7 @@ void
trx_free_prepared(
/*==============*/
trx_t* trx) /*!< in, own: trx object */
UNIV_COLD __attribute__((nonnull));
UNIV_COLD;
/********************************************************************//**
Frees a transaction object for MySQL. */
UNIV_INTERN
......
......@@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
#ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 38.5
#define PERCONA_INNODB_VERSION 38.8
#endif
#define INNODB_VERSION_STR MYSQL_SERVER_VERSION
......
This diff is collapsed.
/*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -55,7 +55,6 @@ mach_parse_compressed(
if (flag < 0x80UL) {
*val = flag;
return(ptr + 1);
}
/* Workaround GCC bug
......@@ -64,7 +63,11 @@ mach_parse_compressed(
function, causing and out-of-bounds read if we are reading a short
integer close to the end of buffer. */
#if defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__clang__)
asm volatile("": : :"memory");
#define DEPLOY_FENCE
#endif
#ifdef DEPLOY_FENCE
__atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
if (flag < 0xC0UL) {
......@@ -75,8 +78,13 @@ mach_parse_compressed(
*val = mach_read_from_2(ptr) & 0x7FFFUL;
return(ptr + 2);
}
} else if (flag < 0xE0UL) {
#ifdef DEPLOY_FENCE
__atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
if (flag < 0xE0UL) {
if (end_ptr < ptr + 3) {
return(NULL);
}
......@@ -84,7 +92,13 @@ mach_parse_compressed(
*val = mach_read_from_3(ptr) & 0x3FFFFFUL;
return(ptr + 3);
} else if (flag < 0xF0UL) {
}
#ifdef DEPLOY_FENCE
__atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
if (flag < 0xF0UL) {
if (end_ptr < ptr + 4) {
return(NULL);
}
......@@ -92,14 +106,20 @@ mach_parse_compressed(
*val = mach_read_from_4(ptr) & 0x1FFFFFFFUL;
return(ptr + 4);
} else {
ut_ad(flag == 0xF0UL);
}
if (end_ptr < ptr + 5) {
return(NULL);
}
#ifdef DEPLOY_FENCE
__atomic_thread_fence(__ATOMIC_ACQUIRE);
#endif
*val = mach_read_from_4(ptr + 1);
return(ptr + 5);
#undef DEPLOY_FENCE
ut_ad(flag == 0xF0UL);
if (end_ptr < ptr + 5) {
return(NULL);
}
*val = mach_read_from_4(ptr + 1);
return(ptr + 5);
}
......@@ -961,50 +961,15 @@ os_file_readdir_next_file(
char* full_path;
int ret;
struct stat statinfo;
#ifdef HAVE_READDIR_R
char dirent_buf[sizeof(struct dirent)
+ _POSIX_PATH_MAX + 100];
/* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
the max file name len; but in most standards, the
length is NAME_MAX; we add 100 to be even safer */
#endif
next_file:
#ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
if (ret != 0
#ifdef UNIV_AIX
/* On AIX, only if we got non-NULL 'ent' (result) value and
a non-zero 'ret' (return) value, it indicates a failed
readdir_r() call. An NULL 'ent' with an non-zero 'ret'
would indicate the "end of the directory" is reached. */
&& ent != NULL
#endif
) {
fprintf(stderr,
"InnoDB: cannot read directory %s, error %lu\n",
dirname, (ulong)ret);
return(-1);
}
if (ent == NULL) {
/* End of directory */
return(1);
}
ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
#else
ent = readdir(dir);
if (ent == NULL) {
return(1);
}
#endif
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
......@@ -1382,9 +1347,10 @@ os_file_create_simple_no_error_handling_func(
}
/****************************************************************//**
Tries to disable OS caching on an opened file descriptor. */
Tries to disable OS caching on an opened file descriptor.
@return TRUE if operation is success and FALSE otherwise */
UNIV_INTERN
void
ibool
os_file_set_nocache(
/*================*/
int fd /*!< in: file descriptor to alter */
......@@ -1405,6 +1371,7 @@ os_file_set_nocache(
" InnoDB: Failed to set DIRECTIO_ON "
"on file %s: %s: %s, continuing anyway\n",
file_name, operation_name, strerror(errno_save));
return FALSE;
}
#elif defined(O_DIRECT)
if (fcntl(fd, F_SETFL, O_DIRECT) == -1) {
......@@ -1422,8 +1389,10 @@ os_file_set_nocache(
"'Invalid argument' on Linux on tmpfs, "
"see MySQL Bug#26662\n");
}
return FALSE;
}
#endif
return TRUE;
}
/****************************************************************//**
......@@ -1699,7 +1668,11 @@ os_file_create_func(
/* ALL_O_DIRECT: O_DIRECT also for transaction log file */
if (srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT) {
os_file_set_nocache(file, name, mode_str);
/* Do fsync() on log files when setting O_DIRECT fails.
See log_io_complete() */
if (!os_file_set_nocache(file, name, mode_str)) {
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
}
}
#ifdef USE_FILE_LOCK
......
......@@ -774,7 +774,7 @@ rec_get_nth_field_offs_old(
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2)))
UNIV_INLINE __attribute__((warn_unused_result))
ulint
rec_get_converted_size_comp_prefix_low(
/*===================================*/
......
......@@ -802,7 +802,7 @@ row_merge_write(
/********************************************************************//**
Read a merge record.
@return pointer to next record, or NULL on I/O error or end of list */
static __attribute__((nonnull))
static __attribute__((warn_unused_result))
const byte*
row_merge_read_rec(
/*===============*/
......@@ -1168,7 +1168,7 @@ row_merge_cmp(
Reads clustered index of the table and create temporary files
containing the index entries for the indexes to be built.
@return DB_SUCCESS or error */
static __attribute__((nonnull))
static __attribute__((warn_unused_result))
ulint
row_merge_read_clustered_index(
/*===========================*/
......
......@@ -742,7 +742,7 @@ row_purge_parse_undo_rec(
Fetches an undo log record and does the purge for the recorded operation.
If none left, or the current purge completed, returns the control to the
parent node, which is always a query thread node. */
static __attribute__((nonnull))
static
void
row_purge(
/*======*/
......
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
......@@ -3208,10 +3208,8 @@ srv_redo_log_follow_thread(
} while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE);
srv_track_changed_pages = FALSE;
log_online_read_shutdown();
os_event_set(srv_redo_log_thread_finished_event);
srv_redo_log_thread_started = FALSE; /* Defensive, not required */
my_thread_end();
os_thread_exit(NULL);
......@@ -3390,6 +3388,7 @@ srv_master_thread(
ib_uint64_t oldest_lsn;
ib_time_t last_print_time;
my_thread_init();
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Master thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
......@@ -4093,6 +4092,7 @@ srv_master_thread(
os_event_wait(slot->event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
my_thread_end();
os_thread_exit(NULL);
}
......@@ -4117,6 +4117,7 @@ srv_purge_thread(
ulint n_total_purged = ULINT_UNDEFINED;
ulint next_itr_time;
my_thread_init();
ut_a(srv_n_purge_threads == 1);
#ifdef UNIV_PFS_THREAD
......@@ -4222,6 +4223,8 @@ srv_purge_thread(
os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
......
......@@ -1619,6 +1619,7 @@ innobase_start_or_create_for_mysql(void)
fsp_init();
log_init();
log_online_init();
lock_sys_create(srv_lock_table_size);
......@@ -2465,6 +2466,7 @@ innobase_shutdown_for_mysql(void)
btr_search_disable();
ibuf_close();
log_online_shutdown();
log_shutdown();
trx_sys_file_format_close();
trx_sys_close();
......
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2017, Oracle and/or its affiliates. All Rights Reserved.
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
......@@ -610,12 +611,15 @@ trx_rollback_or_clean_all_recovered(
/*!< in: a dummy parameter required by
os_thread_create */
{
my_thread_init();
#ifdef UNIV_PFS_THREAD
pfs_register_thread(trx_rollback_clean_thread_key);
#endif /* UNIV_PFS_THREAD */
trx_rollback_or_clean_recovered(TRUE);
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
......
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