WL#3072 - Maria Recovery: recovery of state.auto_increment.
When we log UNDO_KEY_INSERT for an auto_inc key, we update state.auto_increment (not anymore at the end of maria_write() except if this is a non-transactional table). When Recovery sees UNDO_KEY_INSERT in the REDO phase, it reads the auto_inc value from it and updates state.auto_increment. mysql-test/r/maria-recovery.result: Without the code fix, there would be in CHECK TABLE: "Auto-increment value: 0 is smaller than max used value: 3" and no AUTO_INCREMENT= clause in SHOW CREATE TABLE. mysql-test/t/maria-recovery.test: Test of recovery of state.auto_increment: from an old table, does the replaying of the log set state.auto_increment to what it should be. storage/maria/ma_check.c: new way of calling ma_retrieve_auto_increment(): pass key storage/maria/ma_key.c: ma_retrieve_auto_increment() now operates directly with a pointer to the key and not on the record. storage/maria/ma_key_recover.c: dedicated write_hook_for_undo_key_insert(): sets state.auto_increment under log's mutex. storage/maria/ma_key_recover.h: Dedicated hook for UNDO_KEY_INSERT, to set state.auto_increment. Such hook needs a new member st_msg_write_hook_for_undo_key::auto_increment, which contains the auto_increment value inserted. storage/maria/ma_loghandler.c: UNDO_KEY_INSERT gets a dedicated write_hook, to set auto_increment. storage/maria/ma_recovery.c: When in the REDO phase we see UNDO_KEY_INSERT: if the state is older than this record, and the key is the auto_increment one, read the key's value from the log record and update state.auto_increment. storage/maria/ma_test_all.sh: use $maria_path to be able to run from /dev/shm (faster) storage/maria/ma_update.c: bool is more of C++, using my_bool. If table is transactional, state.auto_increment is already updated in write_hook_for_undo_key_insert(). storage/maria/ma_write.c: If table is transactional, state.auto_increment is not updated at the end of maria_write() but rather in write_hook_for_undo_key_insert() (under log's mutex, so that a concurrent checkpoint does not read state.auto_increment while it is changing - corrupted). _ma_ck_write_btree_with_log() extracts the auto_increment value from the key, puts it into msg.auto_increment, and this is passed to write_hook_for_undo_key_insert(). storage/maria/maria_def.h: change of prototype of ma_retrieve_auto_increment() storage/maria/maria_read_log.c: use default log file size. Use separate page caches for table and logs (needed if maria_block_size!=TRANSLOG_PAGE_SIZE).
Showing
Please register or sign in to comment