Skip to content

Commit b94e8e4

Browse files
author
Varun Gupta
committed
MDEV-23867: insert... select crash in compute_window_func
There are 2 issues here: Issue #1: memory allocation. An IO_CACHE that uses encryption uses a larger buffer (it needs space for the encrypted data, decrypted data, IO_CACHE_CRYPT struct to describe encryption parameters etc). Issue #2: IO_CACHE::seek_not_done When IO_CACHE objects are cloned, they still share the file descriptor. This means, operation on one IO_CACHE may change the file read position which will confuse other IO_CACHEs using it. The fix of these issues would be: Allocate the buffer to also include the extra size needed for encryption. Perform seek again after one IO_CACHE reads the file.
1 parent 5a9df15 commit b94e8e4

File tree

6 files changed

+3946
-7
lines changed

6 files changed

+3946
-7
lines changed

include/my_sys.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,18 +476,19 @@ typedef struct st_io_cache /* Used when cacheing files */
476476
partial.
477477
*/
478478
int seek_not_done,error;
479-
/* buffer_length is memory size allocated for buffer or write_buffer */
479+
/* length of the buffer used for storing un-encrypted data */
480480
size_t buffer_length;
481481
/* read_length is the same as buffer_length except when we use async io */
482482
size_t read_length;
483483
myf myflags; /* Flags used to my_read/my_write */
484484
/*
485-
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
486-
0 if it was supplied by the user.
485+
alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
486+
Includes the overhead(storing key to ecnrypt and decrypt) for encryption.
487+
Set to 0 if nothing is allocated.
487488
Currently READ_NET is the only one that will use a buffer allocated
488489
somewhere else
489490
*/
490-
my_bool alloced_buffer;
491+
size_t alloced_buffer;
491492
#ifdef HAVE_AIOWAIT
492493
/*
493494
As inidicated by ifdef, this is for async I/O, which is not currently

0 commit comments

Comments
 (0)