Commit 2c1553e5 authored by Jan Lindström's avatar Jan Lindström

MDEV-8774: Test innodb.innodb_bug53290 failures on buildbot

Fixed unsafe reference to null pointer.
parent de269f2f
...@@ -457,5 +457,5 @@ row_merge_read_rec( ...@@ -457,5 +457,5 @@ row_merge_read_rec(
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */ ulint space) /*!< in: space id */
__attribute__((nonnull, warn_unused_result)); __attribute__((nonnull(1,2,3,4,6,7,8), warn_unused_result));
#endif /* row0merge.h */ #endif /* row0merge.h */
...@@ -2131,7 +2131,7 @@ wait_again: ...@@ -2131,7 +2131,7 @@ wait_again:
of->fd, &of->offset, \ of->fd, &of->offset, \
mrec##N, offsets##N, \ mrec##N, offsets##N, \
crypt_data, \ crypt_data, \
&crypt_block[2 * srv_sort_buf_size], \ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL , \
space); \ space); \
if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \ if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \ goto corrupt; \
...@@ -2141,7 +2141,7 @@ wait_again: ...@@ -2141,7 +2141,7 @@ wait_again:
file->fd, foffs##N, \ file->fd, foffs##N, \
&mrec##N, offsets##N, \ &mrec##N, offsets##N, \
crypt_data, \ crypt_data, \
&crypt_block[N * srv_sort_buf_size], \ crypt_block ? &crypt_block[N * srv_sort_buf_size] : NULL, \
space); \ space); \
\ \
if (UNIV_UNLIKELY(!b##N)) { \ if (UNIV_UNLIKELY(!b##N)) { \
...@@ -2155,7 +2155,7 @@ wait_again: ...@@ -2155,7 +2155,7 @@ wait_again:
/*************************************************************//** /*************************************************************//**
Merge two blocks of records on disk and write a bigger block. Merge two blocks of records on disk and write a bigger block.
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(1,2,3,4,5,6), warn_unused_result))
dberr_t dberr_t
row_merge_blocks( row_merge_blocks(
/*=============*/ /*=============*/
...@@ -2204,9 +2204,9 @@ row_merge_blocks( ...@@ -2204,9 +2204,9 @@ row_merge_blocks(
file in two halves, which can be merged on the following pass. */ file in two halves, which can be merged on the following pass. */
if (!row_merge_read(file->fd, *foffs0, &block[0], if (!row_merge_read(file->fd, *foffs0, &block[0],
crypt_data, &crypt_block[0], space) crypt_data, crypt_block ? &crypt_block[0] : NULL, space)
|| !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size], || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size],
crypt_data, &crypt_block[srv_sort_buf_size], space)) { crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space)) {
corrupt: corrupt:
mem_heap_free(heap); mem_heap_free(heap);
return(DB_CORRUPTION); return(DB_CORRUPTION);
...@@ -2219,13 +2219,13 @@ corrupt: ...@@ -2219,13 +2219,13 @@ corrupt:
b0 = row_merge_read_rec( b0 = row_merge_read_rec(
&block[0], &buf[0], b0, dup->index, &block[0], &buf[0], b0, dup->index,
file->fd, foffs0, &mrec0, offsets0, file->fd, foffs0, &mrec0, offsets0,
crypt_data, &crypt_block[0], space); crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
b1 = row_merge_read_rec( b1 = row_merge_read_rec(
&block[srv_sort_buf_size], &block[srv_sort_buf_size],
&buf[srv_sort_buf_size], b1, dup->index, &buf[srv_sort_buf_size], b1, dup->index,
file->fd, foffs1, &mrec1, offsets1, file->fd, foffs1, &mrec1, offsets1,
crypt_data, &crypt_block[srv_sort_buf_size], space); crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space);
if (UNIV_UNLIKELY(!b0 && mrec0) if (UNIV_UNLIKELY(!b0 && mrec0)
|| UNIV_UNLIKELY(!b1 && mrec1)) { || UNIV_UNLIKELY(!b1 && mrec1)) {
...@@ -2271,7 +2271,7 @@ done1: ...@@ -2271,7 +2271,7 @@ done1:
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size], b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset, b2, of->fd, &of->offset,
crypt_data, &crypt_block[2 * srv_sort_buf_size], space); crypt_data, crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space);
return(b2 ? DB_SUCCESS : DB_CORRUPTION); return(b2 ? DB_SUCCESS : DB_CORRUPTION);
} }
...@@ -2279,7 +2279,7 @@ done1: ...@@ -2279,7 +2279,7 @@ done1:
/*************************************************************//** /*************************************************************//**
Copy a block of index entries. Copy a block of index entries.
@return TRUE on success, FALSE on failure */ @return TRUE on success, FALSE on failure */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(1,2,3,4,5), warn_unused_result))
ibool ibool
row_merge_blocks_copy( row_merge_blocks_copy(
/*==================*/ /*==================*/
...@@ -2318,7 +2318,7 @@ row_merge_blocks_copy( ...@@ -2318,7 +2318,7 @@ row_merge_blocks_copy(
file in two halves, which can be merged on the following pass. */ file in two halves, which can be merged on the following pass. */
if (!row_merge_read(file->fd, *foffs0, &block[0], if (!row_merge_read(file->fd, *foffs0, &block[0],
crypt_data, &crypt_block[0], space)) { crypt_data, crypt_block ? &crypt_block[0] : NULL, space)) {
corrupt: corrupt:
mem_heap_free(heap); mem_heap_free(heap);
return(FALSE); return(FALSE);
...@@ -2330,7 +2330,7 @@ corrupt: ...@@ -2330,7 +2330,7 @@ corrupt:
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, b0 = row_merge_read_rec(&block[0], &buf[0], b0, index,
file->fd, foffs0, &mrec0, offsets0, file->fd, foffs0, &mrec0, offsets0,
crypt_data, &crypt_block[0], space); crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
if (UNIV_UNLIKELY(!b0 && mrec0)) { if (UNIV_UNLIKELY(!b0 && mrec0)) {
...@@ -2353,14 +2353,15 @@ done0: ...@@ -2353,14 +2353,15 @@ done0:
return(row_merge_write_eof(&block[2 * srv_sort_buf_size], return(row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset, b2, of->fd, &of->offset,
crypt_data, &crypt_block[2 * srv_sort_buf_size], space) crypt_data,
crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space)
!= NULL); != NULL);
} }
/*************************************************************//** /*************************************************************//**
Merge disk files. Merge disk files.
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
static __attribute__((nonnull)) static __attribute__((nonnull(1,2,3,4,5,6,7)))
dberr_t dberr_t
row_merge( row_merge(
/*======*/ /*======*/
...@@ -2648,7 +2649,7 @@ row_merge_copy_blobs( ...@@ -2648,7 +2649,7 @@ row_merge_copy_blobs(
Read sorted file containing index data tuples and insert these data Read sorted file containing index data tuples and insert these data
tuples to the index tuples to the index
@return DB_SUCCESS or error number */ @return DB_SUCCESS or error number */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(2,3,5), warn_unused_result))
dberr_t dberr_t
row_merge_insert_index_tuples( row_merge_insert_index_tuples(
/*==========================*/ /*==========================*/
......
...@@ -457,5 +457,5 @@ row_merge_read_rec( ...@@ -457,5 +457,5 @@ row_merge_read_rec(
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */ fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */ ulint space) /*!< in: space id */
__attribute__((nonnull, warn_unused_result)); __attribute__((nonnull(1,2,3,4,6,7,8), warn_unused_result));
#endif /* row0merge.h */ #endif /* row0merge.h */
...@@ -2139,7 +2139,7 @@ wait_again: ...@@ -2139,7 +2139,7 @@ wait_again:
of->fd, &of->offset, \ of->fd, &of->offset, \
mrec##N, offsets##N, \ mrec##N, offsets##N, \
crypt_data, \ crypt_data, \
&crypt_block[2 * srv_sort_buf_size], \ crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL , \
space); \ space); \
if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \ if (UNIV_UNLIKELY(!b2 || ++of->n_rec > file->n_rec)) { \
goto corrupt; \ goto corrupt; \
...@@ -2149,7 +2149,7 @@ wait_again: ...@@ -2149,7 +2149,7 @@ wait_again:
file->fd, foffs##N, \ file->fd, foffs##N, \
&mrec##N, offsets##N, \ &mrec##N, offsets##N, \
crypt_data, \ crypt_data, \
&crypt_block[N * srv_sort_buf_size], \ crypt_block ? &crypt_block[N * srv_sort_buf_size] : NULL, \
space); \ space); \
\ \
if (UNIV_UNLIKELY(!b##N)) { \ if (UNIV_UNLIKELY(!b##N)) { \
...@@ -2163,7 +2163,7 @@ wait_again: ...@@ -2163,7 +2163,7 @@ wait_again:
/*************************************************************//** /*************************************************************//**
Merge two blocks of records on disk and write a bigger block. Merge two blocks of records on disk and write a bigger block.
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(1,2,3,4,5,6), warn_unused_result))
dberr_t dberr_t
row_merge_blocks( row_merge_blocks(
/*=============*/ /*=============*/
...@@ -2212,9 +2212,9 @@ row_merge_blocks( ...@@ -2212,9 +2212,9 @@ row_merge_blocks(
file in two halves, which can be merged on the following pass. */ file in two halves, which can be merged on the following pass. */
if (!row_merge_read(file->fd, *foffs0, &block[0], if (!row_merge_read(file->fd, *foffs0, &block[0],
crypt_data, &crypt_block[0], space) crypt_data, crypt_block ? &crypt_block[0] : NULL, space)
|| !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size], || !row_merge_read(file->fd, *foffs1, &block[srv_sort_buf_size],
crypt_data, &crypt_block[srv_sort_buf_size], space)) { crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space)) {
corrupt: corrupt:
mem_heap_free(heap); mem_heap_free(heap);
return(DB_CORRUPTION); return(DB_CORRUPTION);
...@@ -2227,13 +2227,13 @@ corrupt: ...@@ -2227,13 +2227,13 @@ corrupt:
b0 = row_merge_read_rec( b0 = row_merge_read_rec(
&block[0], &buf[0], b0, dup->index, &block[0], &buf[0], b0, dup->index,
file->fd, foffs0, &mrec0, offsets0, file->fd, foffs0, &mrec0, offsets0,
crypt_data, &crypt_block[0], space); crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
b1 = row_merge_read_rec( b1 = row_merge_read_rec(
&block[srv_sort_buf_size], &block[srv_sort_buf_size],
&buf[srv_sort_buf_size], b1, dup->index, &buf[srv_sort_buf_size], b1, dup->index,
file->fd, foffs1, &mrec1, offsets1, file->fd, foffs1, &mrec1, offsets1,
crypt_data, &crypt_block[srv_sort_buf_size], space); crypt_data, crypt_block ? &crypt_block[srv_sort_buf_size] : NULL, space);
if (UNIV_UNLIKELY(!b0 && mrec0) if (UNIV_UNLIKELY(!b0 && mrec0)
|| UNIV_UNLIKELY(!b1 && mrec1)) { || UNIV_UNLIKELY(!b1 && mrec1)) {
...@@ -2279,7 +2279,7 @@ done1: ...@@ -2279,7 +2279,7 @@ done1:
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size], b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset, b2, of->fd, &of->offset,
crypt_data, &crypt_block[2 * srv_sort_buf_size], space); crypt_data, crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space);
return(b2 ? DB_SUCCESS : DB_CORRUPTION); return(b2 ? DB_SUCCESS : DB_CORRUPTION);
} }
...@@ -2287,7 +2287,7 @@ done1: ...@@ -2287,7 +2287,7 @@ done1:
/*************************************************************//** /*************************************************************//**
Copy a block of index entries. Copy a block of index entries.
@return TRUE on success, FALSE on failure */ @return TRUE on success, FALSE on failure */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(1,2,3,4,5), warn_unused_result))
ibool ibool
row_merge_blocks_copy( row_merge_blocks_copy(
/*==================*/ /*==================*/
...@@ -2326,7 +2326,7 @@ row_merge_blocks_copy( ...@@ -2326,7 +2326,7 @@ row_merge_blocks_copy(
file in two halves, which can be merged on the following pass. */ file in two halves, which can be merged on the following pass. */
if (!row_merge_read(file->fd, *foffs0, &block[0], if (!row_merge_read(file->fd, *foffs0, &block[0],
crypt_data, &crypt_block[0], space)) { crypt_data, crypt_block ? &crypt_block[0] : NULL, space)) {
corrupt: corrupt:
mem_heap_free(heap); mem_heap_free(heap);
return(FALSE); return(FALSE);
...@@ -2338,7 +2338,7 @@ corrupt: ...@@ -2338,7 +2338,7 @@ corrupt:
b0 = row_merge_read_rec(&block[0], &buf[0], b0, index, b0 = row_merge_read_rec(&block[0], &buf[0], b0, index,
file->fd, foffs0, &mrec0, offsets0, file->fd, foffs0, &mrec0, offsets0,
crypt_data, &crypt_block[0], space); crypt_data, crypt_block ? &crypt_block[0] : NULL, space);
if (UNIV_UNLIKELY(!b0 && mrec0)) { if (UNIV_UNLIKELY(!b0 && mrec0)) {
...@@ -2361,14 +2361,15 @@ done0: ...@@ -2361,14 +2361,15 @@ done0:
return(row_merge_write_eof(&block[2 * srv_sort_buf_size], return(row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset, b2, of->fd, &of->offset,
crypt_data, &crypt_block[2 * srv_sort_buf_size], space) crypt_data,
crypt_block ? &crypt_block[2 * srv_sort_buf_size] : NULL, space)
!= NULL); != NULL);
} }
/*************************************************************//** /*************************************************************//**
Merge disk files. Merge disk files.
@return DB_SUCCESS or error code */ @return DB_SUCCESS or error code */
static __attribute__((nonnull)) static __attribute__((nonnull(1,2,3,4,5,6,7)))
dberr_t dberr_t
row_merge( row_merge(
/*======*/ /*======*/
...@@ -2656,7 +2657,7 @@ row_merge_copy_blobs( ...@@ -2656,7 +2657,7 @@ row_merge_copy_blobs(
Read sorted file containing index data tuples and insert these data Read sorted file containing index data tuples and insert these data
tuples to the index tuples to the index
@return DB_SUCCESS or error number */ @return DB_SUCCESS or error number */
static __attribute__((nonnull, warn_unused_result)) static __attribute__((nonnull(2,3,5), warn_unused_result))
dberr_t dberr_t
row_merge_insert_index_tuples( row_merge_insert_index_tuples(
/*==========================*/ /*==========================*/
......
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