summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache.c
Commit message (Collapse)AuthorAgeFilesLines
* fix MDEV-18750: failed to flashback large-size binlog fileZicheng Huang2019-06-051-4/+4
| | | | | | | | fix MDEV-18750: failed to flashback large-size binlog file fix mysqlbinlog flashback failure caused by reading io_cache without MY_FULL_IO flag fix MDEV-18750: mysqlbinlog flashback failure on large binlog
* Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
|\
| * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| |\
| | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | * Update wrong zip-code
* | | Merge 10.1 into 10.2Marko Mäkelä2018-11-071-0/+4
|\ \ \ | |/ /
| * | Merge 10.0 into 10.1Marko Mäkelä2018-11-071-0/+4
| |\ \
| | * \ Merge 5.5 into 10.0Marko Mäkelä2018-11-071-0/+4
| | |\ \ | | | |/
| | | * MDEV-17401: LOAD DATA from very big file into MyISAM table results in EOF ↵Oleksandr Byelkin2018-11-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | error and corrupt index my_read fixed as in higher versions. my_pread made as my_read aware of partial read of huge chunks of files MY_FULL_IO enabled for file operations
* | | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-2/+5
|\ \ \ \ | |/ / /
| * | | MDEV-17133 dump thread reads from a past positionAndrei Elkin2018-10-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to logs analysis the Dump thread attempted to read again data which was already sent. The reason of regressed read turns out in an _my_b_cache_read() early exit branch which missed to distinguish between total zero size read (e.g ineffective read when Count argument is zero) from a case when the requested amount of data is fully read out by sole accessing the cache's file. In the latter case such then *effective* reading was not reflected in the cache's state to screw the cache's state. Fixed with a check introduced of whether the file reading was effective prior to early exit. When this is the case conduct standard cache state change to account the actual read size. Notice the bug can show up also as an error to read binlog event e.g through BINLOG_GTID_POS() (of MDEV-16886).
* | | | MDEV-12779 Oracle/DB2 Compatibility Implicit Ordering for ROW_NUMBER OVERVicențiu Ciorbaru2018-11-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users expect window functions to produce a certain ordering of rows in the final result set. Although the standard does not require this, we already have the filesort result done for when we computed the window function. If there is no ORDER BY attached to the query, just keep it till the SELECT is completely evaluated and use that to print the result. Update test cases as many did not take care to guarantee a stable result.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-02-111-1/+1
|\ \ \ \ | |/ / /
| * | | MDEV-14868 MariaDB server crashes after using ROLLBACK TO when ↵Sergei Golubchik2018-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | encrypt_tmp_files=ON Fix reinit_io_cache(WRITE_CACHE) with non-zero seek_offset. Run encryption.tempfiles with and without binlog checksums.
* | | | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.0 into 10.1Marko Mäkelä2018-02-031-1/+1
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'origin/5.5' into 10.0Vicențiu Ciorbaru2018-02-021-1/+1
| | |\ \ | | | |/
| | | * Fix an out of scope bzeroVicențiu Ciorbaru2018-01-301-1/+1
| | | |
* | | | MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.Vladislav Vaintroub2017-09-281-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix win64 pointer truncation warnings (usually coming from misusing 0x%lx and long cast in DBUG) - Also fix printf-format warnings Make the above mentioned warnings fatal. - fix pthread_join on Windows to set return value.
* | | | Simplify IO_CACHE by removing current_pos and end_pos as self-referencesVicențiu Ciorbaru2017-06-281-38/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These self references were previously used to avoid having to check the IO_CACHE's type. However, a benchmark shows that on x86 5930k stock, the type comparison is marginally faster than the double pointer dereference. For 40 billion my_b_tell calls, the difference is .1 seconds in favor of performing the type check. (Basically there is no measurable difference) To prevent bugs from copying the structure using the equals(=) operator, and having to do the bookkeeping manually, remove these "convenience" variables.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2017-03-301-5/+8
|\ \ \ \ | |/ / /
| * | | spelling fixesklemens2017-03-071-4/+4
| | | |
| * | | Merge 10.0 into 10.1Marko Mäkelä2017-03-031-1/+4
| |\ \ \ | | |/ /
| | * | MDEV-9573 'Stop slave' hangs on replication slaveMonty2017-02-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for this is that stop slave takes LOCK_active_mi over the whole operation while some slave operations will also need LOCK_active_mi which causes deadlocks. Fixed by introducing object counting for Master_info and not taking LOCK_active_mi over stop slave or even stop_all_slaves() Another benefit of this approach is that it allows: - Multiple threads can run SHOW SLAVE STATUS at the same time - START/STOP/RESET/SLAVE STATUS on a slave will not block other slaves - Simpler interface for handling get_master_info() - Added some missing unlock of 'log_lock' in error condtions - Moved rpl_parallel_inactivate_pool(&global_rpl_thread_pool) to end of stop_slave() to not have to use LOCK_active_mi inside terminate_slave_threads() - Changed argument for remove_master_info() to Master_info, as we always have this available - Fixed core dump when doing FLUSH TABLES WITH READ LOCK and parallel replication. Problem was that waiting for pause_for_ftwrl was not done when deleting rpt->current_owner after a force_abort.
* | | | MDEV-10092: Server crashes in in ha_heap::rnd_pos / Table_read_cursor::get_nextVicențiu Ciorbaru2017-02-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was caused by several issues. 2 problems in seek_io_cache. Due to wrong offsets used, we would end up seeking way too much (first change), or over the intended seek point (second change). Fixing it requires correctly detecting available data in buffer (first change), and not using "IO_SIZE alligned" reads. The second is needed because _my_b_cache_read adjusts the pos_in_file itself based on read_pos and read_end. Pretending buffer is empty when we want to force a read will aleviate this problem. Secondly, the big-table cursors didn't repect the interface definitions of always returning the rownumber that Table_read_cursor::fetch() would activate. At the same time, next(), prev() and move_to() should not perform any row activation.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-12-291-2/+2
|\ \ \ \ | |/ / /
| * | | MDEV-10508 Mariadb crash on out of disk space during dump importSergei Golubchik2016-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | update info->write_end and info->write_pos together, with no "return on error" in between, otherwise write_end might end up being smaller than write_pos
* | | | MDEV-9736: Window functions: multiple cursors to read filesort resultSergei Petrunia2016-09-241-14/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for having multiple IO_CACHEs with type=READ_CACHE to share the file they are reading from. Each IO_CACHE keeps its own in-memory buffer. When doing a read or seek operation on the file, it notifies other IO_CACHEs that the file position has been changed. Make Rowid_seq_cursor use cloned IO_CACHE when reading filesort result.
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-06-301-0/+4
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2016-06-281-0/+4
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into bb-10.0Sergei Golubchik2016-06-211-0/+1
| | |\ \ | | | |/
| | | * MDEV-9433: [PATCH} cppcheck reported a number of minor coding errorsDaniel Black2016-06-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix cppwarning of va_args being opened but not closed. Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
| | * | MDEV-10001 my_b_seek() may not work correctly after my_b_read() hits EOFSergei Golubchik2016-06-151-0/+3
| | | | | | | | | | | | | | | | applied the patch from David Gow
* | | | Fixed compiler warnings and test failures found by buildbotMonty2016-06-241-2/+2
|/ / / | | | | | | | | | Fixed ccfilter to detect errors where the column is included in the error message
* | | MDEV-9044 : Binlog corruption in GaleraNirbhay Choubey2015-12-181-1/+5
| | | | | | | | | | | | | | | While refreshing the IO_CACHE, do not update its parameters (read_pos, read_end & pos_in_file) if there is nothing left to read.
* | | New encryption API. Piece-wise encryption.Sergei Golubchik2015-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of encrypt(src, dst, key, iv) that encrypts all data in one go, now we have encrypt_init(key,iv), encrypt_update(src,dst), and encrypt_finish(dst). This also causes collateral changes in the internal my_crypt.cc encryption functions and in the encryption service. There are wrappers to provide the old all-at-once encryption functionality. But binlog events are often written piecewise, they'll need the new api.
* | | my_aes_get_size()Sergei Golubchik2015-06-021-1/+1
| | | | | | | | | | | | | | | return unsigned, not signed. return a value large enough for GCM
* | | MDEV-8126 encryption for temp filesSergei Golubchik2015-06-021-4/+55
| | | | | | | | | | | | IO_CACHE tempfiles encryption
* | | misc IO_CACHE cleanupsSergei Golubchik2015-06-021-170/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove unused (and not implemented) WRITE_NET type * remove cast in my_b_write() macro. my_b_* macros are function-like, casts are responsibility of the caller * replace hackish _my_b_write(info,0,0) with the explicit my_b_flush_io_cache() in my_b_write_byte() * remove unused my_b_fill_cache() * replace pbool -> my_bool * make internal IO_CACHE functions static * reformat comments, correct typos, remove obsolete comments (ISAM) * assert valid cache type in init_functions() * use IO_ROUND_DN() macro where appropriate * remove unused DBUG_EXECUTE_IF in _my_b_cache_write() * remove unnecessary __attribute__((unused)) * fix goto error in parse_file.cc * remove redundant reinit_io_cache() in uniques.cc * don't do reinit_io_cache() if the cache was not initialized in ma_check.c * extract duplicate functionality from various _my_b_*_read functions into a common wrapper. Same for _my_b_*_write * create _my_b_cache_write_r instead of having if's in _my_b_cache_write (similar to existing _my_b_cache_read and _my_b_cache_read_r) * don't call mysql_file_write() from my_b_flush_io_cache(), call info->write_function() instead
* | | cleanup: LOAD DATA replication support in IO_CACHESergei Golubchik2015-06-021-13/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove some 14-year old code that added support for LOAD DATA replication to IO_CACHE: * three callbacks, of which only two were actually used and that were only needed for LOAD DATA replication but were tested in every IO_CACHE instance * an additional opaque void * argument in IO_CACHE, also only used for LOAD DATA replication, but present everywhere * the code to close IO_CACHE prematurely in LOAD DATA to have these callbacks called in the correct order and a long comment explaining what will happen if IO_CACHE is not closed prematurely * a variable to track whether IO_CACHE was closed prematurely (to avoid double-closing it)
* | Merge MDEV-5657 (parallel replication) to 10.0unknown2014-02-261-4/+0
|\ \
| * | MDEV-5657: Parallel replication.unknown2014-02-261-4/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up and improve the parallel implementation code, mainly related to scheduling of work to threads and handling of stop and errors. Fix a lot of bugs in various corner cases that could lead to crashes or corruption. Fix that a single replication domain could easily grab all worker threads and stall all other domains; now a configuration variable --slave-domain-parallel-threads allows to limit the number of workers. Allow next event group to start as soon as previous group begins the commit phase (as opposed to when it ends it); this allows multiple event groups on the slave to participate in group commit, even when no other opportunities for parallelism are available. Various fixes: - Fix some races in the rpl.rpl_parallel test case. - Fix an old incorrect assertion in Log_event iocache read. - Fix repeated malloc/free of wait_for_commit and rpl_group_info objects. - Simplify wait_for_commit wakeup logic. - Fix one case in queue_for_group_commit() where killing one thread would fail to correctly signal the error to the next, causing loss of the transaction after slave restart. - Fix leaking of pthreads (and their allocated stack) due to missing PTHREAD_CREATE_DETACHED attribute. - Fix how one batch of group-committed transactions wait for the previous batch before starting to execute themselves. The old code had a very complex scheduling where the first transaction was handled differently, with subtle bugs in corner cases. Now each event group is always scheduled for a new worker (in a round-robin fashion amongst available workers). Keep a count of how many transactions have started to commit, and wait for that counter to reach the appropriate value. - Fix slave stop to wait for all workers to actually complete processing; before, the wait was for update of last_committed_sub_id, which happens a bit earlier, and could leave worker threads potentially accessing bits of the replication state that is no longer valid after slave stop. - Fix a couple of places where the test suite would kill a thread waiting inside enter_cond() in connection with debug_sync; debug_sync + kill can crash in rare cases due to a race with mysys_var_current_mutex in this case. - Fix some corner cases where we had enter_cond() but no exit_cond(). - Fix that we could get failure in wait_for_prior_commit() but forget to flag the error with my_error(). - Fix slave stop (both for normal stop and stop due to error). Now, at stop we pick a specific safe point (in terms of event groups executed) and make sure that all event groups before that point are executed to completion, and that no event group after start executing; this ensures a safe place to restart replication, even for non-transactional stuff/DDL. In error stop, make sure that all prior event groups are allowed to execute to completion, and that any later event groups that have started are rolled back, if possible. The old code could leave eg. T1 and T3 committed but T2 not, or it could even leave half a transaction not rolled back in some random worker, which would cause big problems when that worker was later reused after slave restart. - Fix the accounting of amount of events queued for one worker. Before, the amount was reduced immediately as soon as the events were dequeued (which happens all at once); this allowed twice the amount of events to be queued in memory for each single worker, which is not what users would expect. - Fix that an error set during execution of one event was sometimes not cleared before executing the next, causing problems with the error reporting. - Fix incorrect handling of thd->killed in worker threads.
* | MDEV-5314 - Compiling fails on OSX using clangSergey Vojtovich2014-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This is port of fix for MySQL BUG#17647863. revno: 5572 revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj committer: Jon Olav Hauglid <jon.hauglid@oracle.com> timestamp: Thu 2013-10-31 00:22:43 +0100 message: Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM Rename test() macro to MY_TEST() to avoid conflict with libc++.
* | Temporary commit of 10.0-mergeMichael Widenius2013-03-261-4/+4
|/
* mysql-5.5.28Sergei Golubchik2012-10-161-1/+6
|\
| * Follow up patch for BUG#13961678. Fixing compilation warning given below.Sujatha Sivakumar2012-07-251-1/+1
| | | | | | | | "warning: integer constant is too large for 'long' type"
| * Bug#13961678:MULTI-STATEMENT TRANSACTION REQUIRED MORE THANSujatha Sivakumar2012-07-241-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'MAX_BINLOG_CACHE_SIZE' ERROR Problem: ======= MySQL returns following error in win64. "ERROR 1197 (HY000): Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again" when user tries to load >4G file even if max_binlog_cache_size set to maximum value. On Linux everything works fine. Analysis: ======== The `max_binlog_cache_size' variable is of type `ulonglong'. This value is set to `ULONGLONG_MAX' at the time of server start up. The above value is stored in an intermediate variable named `saved_max_binlog_cache_size' which is of type `ulong'. In visual c++ complier the `ulong' type is of 4bytes in size and hence the value is getting truncated to '4GB' and the cache is not able to grow beyond 4GB size. The same limitation is observed with "max_binlog_stmt_cache_size" as well. Similar fix has been applied. Fix: === As part of fix the type "ulong" is replaced with "my_off_t" which is of type "ulonglong". mysys/mf_iocache.c: Added debug statement to simulate a scenario where the cache file's current position is set to >4GB sql/log.cc: Replaced the type of `saved_max_binlog_cache_size' from "ulong" to "my_off_t", which is a type def for "ulonglong".
* | 5.3 mergeSergei Golubchik2012-01-131-1/+2
|\ \
| * \ Merge with 5.2.Michael Widenius2011-12-111-2/+4
| |\ \ | | | | | | | | | | | | no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
| | * \ Merge with MariaDB 5.1Michael Widenius2011-11-241-2/+4
| | |\ \
| | | * \ Initail merge with MySQL 5.1 (XtraDB still needs to be merged)Michael Widenius2011-11-211-2/+4
| | | |\ \ | | | | | | | | | | | | | | | | | | Fixed up copyright messages.