1. 11 Dec, 2007 1 commit
    • unknown's avatar
      Post review fix (serg). · fed1d21b
      unknown authored
      Added more checks.
      
      
      storage/maria/ha_maria.cc:
        Let control size to my_get_opts().
      storage/maria/ma_loghandler.c:
        Let control size to my_get_opts().
        Removed unused function.
        Assert to check log file size.
        Additional compilation warnings.
      storage/maria/ma_loghandler.h:
        New log size bounds.
        Removed unused function.
      storage/maria/unittest/ma_test_loghandler-t.c:
        Fixed test to confirm new log size bounds.
      fed1d21b
  2. 09 Dec, 2007 2 commits
    • unknown's avatar
      Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria · 1ec645bd
      unknown authored
      into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-logpurge
      
      
      mysql-test/r/maria.result:
        Auto merged
      storage/maria/ma_checkpoint.c:
        Auto merged
      storage/maria/ma_recovery.c:
        Auto merged
      storage/maria/ha_maria.cc:
        Merge
      storage/maria/ma_loghandler.c:
        Merge
      storage/maria/ma_loghandler.h:
        Merge
      1ec645bd
    • unknown's avatar
      Manageable transactional log purge and file size · 771296eb
      unknown authored
      support added to maria.
      
      
      mysql-test/r/maria.result:
        New variables added.
      storage/maria/ha_maria.cc:
        Variable for transactional log purge method added.
        Variable for transactional log size added.
        SHOW for engine logs added.
        Log flush purge logs in case of "ondemand" type of
          log processing.
      storage/maria/ma_checkpoint.c:
        log purge call enabled.
      storage/maria/ma_loghandler.c:
        Support for different methods of log purge added.
        Functions for getting information about logs state added.
        Functions for getting/setting log size.
      storage/maria/ma_loghandler.h:
        Fixed defines.
        Functions for for transactional log mannegment added.
      storage/maria/ma_recovery.c:
        Dependence on TRANSLOG_FILE_SIZE removed.
      mysql-test/r/maria-purge.result:
        New BitKeeper file ``mysql-test/r/maria-purge.result''
      mysql-test/t/maria-purge.test:
        New BitKeeper file ``mysql-test/t/maria-purge.test''
      771296eb
  3. 06 Dec, 2007 3 commits
    • unknown's avatar
      Post-review fixes + some locking cleanup. · f8b7f8be
      unknown authored
      
      storage/maria/ma_loghandler.c:
        translog_lock() made safe (non-mutex-protected operation is atomic now).
        Fixed translog_destroy() because it will not work to be
          called several times.
      f8b7f8be
    • unknown's avatar
      Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria · 593bb24d
      unknown authored
      into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-controlfile
      
      
      593bb24d
    • unknown's avatar
      Trivial postreview changes. · 21f63e41
      unknown authored
      
      storage/maria/ma_blockrec.c:
        Layout fix.
      storage/maria/ma_loghandler.c:
        Renamed struct variable 'class' to avoid problems with c++ compiler.
        Renamed translog_init_scanner to fit othere init functions naming pattern.
        translog_relative_LSN_encode can't return error for now.
        Other trivial postreview changes.
      storage/maria/ma_loghandler_lsn.h:
        trivial postreview changes.
      storage/maria/ma_recovery.c:
        Renamed translog_init_scanner to fit othere init functions naming pattern.
      storage/maria/unittest/ma_loghandler_examples.c:
        Renamed struct variable 'class' to avoid problems with c++ compiler.
      storage/maria/unittest/ma_test_loghandler-t.c:
        Renamed translog_init_scanner to fit othere init functions naming pattern.
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Renamed translog_init_scanner to fit othere init functions naming pattern.
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Renamed translog_init_scanner to fit othere init functions naming pattern.
      21f63e41
  4. 05 Dec, 2007 5 commits
  5. 04 Dec, 2007 3 commits
    • unknown's avatar
      Don't give warnings when reading blocks when we know the block may not exist (in maria_read_log) · 74b8abc6
      unknown authored
      Don't give warnings when opening a wrong control file in ma_control_file_t (unit test)
      
      
      BitKeeper/deleted/.del-ma_key_redo.c:
        Delete: storage/maria/ma_key_redo.c
      storage/maria/ma_blockrec.c:
        Don't give warnings when reading blocks when we know the block may not exist
      storage/maria/ma_pagecache.c:
        Keep a convinience copy of readwrite_flags
      storage/maria/ma_pagecache.h:
        Keep a convinience copy of readwrite_flags
      storage/maria/unittest/ma_control_file-t.c:
        Don't give warnings when opening a wrong control file
      74b8abc6
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-maria · b9734f0d
      unknown authored
      into  mysql.com:/home/my/mysql-maria
      
      
      storage/maria/ha_maria.cc:
        Auto merged
      storage/maria/ma_loghandler.c:
        Auto merged
      storage/maria/ma_loghandler.h:
        Auto merged
      storage/maria/unittest/ma_test_loghandler-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        Auto merged
      storage/maria/unittest/test_file.c:
        Auto merged
      storage/maria/unittest/ma_pagecache_single.c:
        SCCS merged
      b9734f0d
    • unknown's avatar
      Added error HA_ERR_FILE_TOO_SHORT to be used when files are shorter than... · ebf7ab7b
      unknown authored
      Added error HA_ERR_FILE_TOO_SHORT to be used when files are shorter than expected (by my_read/my_pread)
      Added debugger hook _my_dbug_put_break_here() that is called if we get a CRC that matches --debug-crc-break (my_crc_dbug_break)
      Fixed REDO_REPAIR to use all repair modes (repair, repair_by_sort, repair_paralell
      REDO_REPAIR now also logs used key map
      Fixed some bugs in REDO logging of key pages
      Better error messages from maria_read_log
      Added my_readwrite_flags to init_pagecache() to be able to get better error messages and simplify code.
      Don't allow pagecaches with less than 8 blocks (Causes strange crashes)
      Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums (these are calculated and checked in DBUG mode, ignored otherwise)
      Fixed bug in ma_pagecache unit tests that caused program to sometimes fail
      Added some missing calls to MY_INIT() that caused some unit tests to fail
      Fixed that TRUNCATE works properly on temporary MyISAM files
      Updates some result files to new table checksums results (checksum when NULL fields are ignored)
      perl test-insert can be replayed with maria_read_log!
      
      
      sql/share/Makefile.am:
        Change mode to -rw-rw-r--
      BitKeeper/etc/ignore:
        added storage/maria/unittest/page_cache_test_file_1 storage/maria/unittest/pagecache_debug.log
      include/maria.h:
        Added maria_tmpdir
      include/my_base.h:
        Added error HA_ERR_FILE_TOO_SHORT
      include/my_sys.h:
        Added variable my_crc_dbug_check
        Added function my_dbug_put_break_here()
      include/myisamchk.h:
        Added org_key_map (Needed for writing REDO record for REPAIR)
      mysql-test/r/innodb.result:
        Updated to new checksum algorithm (NULL ignored)
      mysql-test/r/mix2_myisam.result:
        Updated to new checksum algorithm (NULL ignored)
      mysql-test/r/myisam.result:
        Updated to new checksum algorithm (NULL ignored)
      mysql-test/t/myisam.test:
        Added used table
      mysys/checksum.c:
        Added DBUG for checksum results
        Added debugger hook so that _my_dbug_put_break_here() is called if we get matching CRC
      mysys/lf_alloc-pin.c:
        Fixed compiler warning
      mysys/my_handler.c:
        Added new error message
      mysys/my_init.c:
        If my_progname is not given, use 'unknown' form my_progname_short
        Added debugger function my_debug_put_break_here()
      mysys/my_pread.c:
        In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
      mysys/my_read.c:
        In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
      sql/mysqld.cc:
        Added debug option --debug-crc-break
      sql/sql_parse.cc:
        Trivial optimization
      storage/maria/ha_maria.cc:
        Renamed variable to be more logical
        Ensure that param.testflag is correct when calling repair
        Added extra argument to init_pagecache
        Set default value for maria_tempdir
      storage/maria/ma_blockrec.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/maria/ma_cache.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/maria/ma_check.c:
        Set param->testflag to match how repair is run (needed for REDO logging)
        Simple optimization
        Moved flag if page is node from pagelength to keypage-flag byte
        Log used key map in REDO log.
      storage/maria/ma_delete.c:
        Remember previous UNDO entry when writing undo (for future CLR records)
        Moved flag if page is node from pagelength to keypage-flag byte
        Fixed some bugs in redo logging
        Added CRC for some translog REDO_INDEX entries
      storage/maria/ma_dynrec.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/maria/ma_ft_update.c:
        Fixed call to _ma_store_page_used()
      storage/maria/ma_key_recover.c:
        Added CRC for some translog REDO_INDEX entries
        Removed not needed pagecache_write() in _ma_apply_redo_index()
      storage/maria/ma_locking.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/maria/ma_loghandler.c:
        Added used key map to REDO_REPAIR_TABLE
      storage/maria/ma_loghandler.h:
        Added operation for checksum of key pages
      storage/maria/ma_open.c:
        Allocate storage for undo lsn pointers
      storage/maria/ma_pagecache.c:
        Remove not needed include file
        Change logging to use fd: for file descritors as other code
        Added my_readwrite_flags to init_pagecache() to be able to get better error messages for maria_chk/maria_read_log
        Don't allow pagecaches with less than 8 blocks
        Remove wrong DBUG_ASSERT()
      storage/maria/ma_pagecache.h:
        Added readwrite_flags
      storage/maria/ma_recovery.c:
        Better error messages for maria_read_log:
        - Added eprint() for printing error messages
        - Print extra \n before error message if we are printing %0 %10 ...
        
        Added used key_map to REDO_REPAIR log entry
        More DBUG
        Call same repair method that was used by mysqld
      storage/maria/ma_rt_index.c:
        Moved flag if page is node from pagelength to keypage-flag byte
      storage/maria/ma_rt_key.c:
        Fixed call to _ma_store_page_used()
      storage/maria/ma_rt_split.c:
        Moved flag if page is node from pagelength to keypage-flag byte
      storage/maria/ma_static.c:
        Added maria_tmpdir
      storage/maria/ma_test1.c:
        Updated call to init_pagecache()
      storage/maria/ma_test2.c:
        Updated call to init_pagecache()
      storage/maria/ma_test3.c:
        Updated call to init_pagecache()
      storage/maria/ma_write.c:
        Removed #ifdef NOT_YET
        Moved flag if page is node from pagelength to keypage-flag byte
        Fixed bug in  _ma_log_del_prefix()
      storage/maria/maria_chk.c:
        Fixed wrong min limit for page_buffer_size
        Updated call to init_pagecache()
      storage/maria/maria_def.h:
        Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums
        Moved flag if page is node from pagelength to keypage-flag byte
      storage/maria/maria_ftdump.c:
        Updated call to init_pagecache()
      storage/maria/maria_pack.c:
        Updated call to init_pagecache()
        Reset share->state.create_rename_lsn & share->state.is_of_horizon
      storage/maria/maria_read_log.c:
        Better error messages
        Added --tmpdir option (needed to set temporary directory for REDO_REPAIR)
        Added --start-from-lsn
        Changed option for --display-only to 'd' (wanted to use -o for 'offset')
      storage/maria/unittest/lockman2-t.c:
        Added missing call to MY_INIT()
      storage/maria/unittest/ma_pagecache_consist.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_pagecache_single.c:
        Fixed bug that caused program to sometimes fail
        Added some DBUG_ASSERTS()
        Changed some calls to malloc()/free() to my_malloc()/my_free()
        Create extra file to expose original hard-to-find bug
      storage/maria/unittest/ma_test_loghandler-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        Updated call to init_pagecache()
      storage/maria/unittest/test_file.c:
        Changed malloc()/free() to my_malloc()/my_free()
        Fixed memory leak
        Changd logic a bit while trying to find bug in reset_file()
      storage/maria/unittest/trnman-t.c:
        Added missing call to MY_INIT()
      storage/myisam/mi_cache.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/myisam/mi_create.c:
        Removed O_EXCL to get TRUNCATE to work for temporary files
      storage/myisam/mi_dynrec.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      storage/myisam/mi_locking.c:
        Test for HA_ERR_FILE_TOO_SHORT instead for -1
      mysql-test/r/old-mode.result:
        New BitKeeper file ``mysql-test/r/old-mode.result''
      mysql-test/t/old-mode-master.opt:
        New BitKeeper file ``mysql-test/t/old-mode-master.opt''
      mysql-test/t/old-mode.test:
        New BitKeeper file ``mysql-test/t/old-mode.test''
      ebf7ab7b
  6. 03 Dec, 2007 1 commit
    • unknown's avatar
      Added variable to control log directory syncs. · 3e90f0d8
      unknown authored
      Part of postreview fixes added.
      
      
      mysql-test/r/maria.result:
        Added variable to control log directory syncs.
      storage/maria/ha_maria.cc:
        Added variable to control log directory syncs.
      storage/maria/ma_loghandler.h:
        Added variable to control log directory syncs.
      storage/maria/ma_loghandler_lsn.h:
        postreview fix
      storage/maria/unittest/Makefile.am:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        New file with logrecord descriptors for tests.
      storage/maria/unittest/ma_loghandler_examples.c:
        New BitKeeper file ``storage/maria/unittest/ma_loghandler_examples.c''
      3e90f0d8
  7. 01 Dec, 2007 1 commit
  8. 30 Nov, 2007 1 commit
    • unknown's avatar
      Fix bug with skipped syncing. · b7ae94d8
      unknown authored
      Fix of unit tests.
      2 new tests for new features.
      
      
      storage/maria/ma_control_file.c:
        Getting the definition from the file for unit-test.
      storage/maria/ma_loghandler.c:
        Fix bug with skipped syncing.
      storage/maria/unittest/ma_control_file-t.c:
        Fix of unit test of control file.
        2 new tests for new features of control file.
      b7ae94d8
  9. 29 Nov, 2007 1 commit
  10. 28 Nov, 2007 1 commit
    • unknown's avatar
      Fixed repair_by_sort to work with BLOCK_RECORD · 4e0964cb
      unknown authored
      Fixed bugs in undo logging
      Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read)
      Reserved place for reference-transid on key pages (for packing of transids)
      ALTER TABLE and INSERT ... SELECT now uses fast creation of index
          
      Known bugs:
      ma_test_recovery fails because of a bug in redo handling when log is cut directly after a redo (Guilhem knows how to fix)
      ma_test_recovery.excepted is not totally correct, because of the above bug
      mysqld sometimes fails to restart; Fails with error "end_of_redo_phase: Assertion `long_trid != 0' failed"; Guilhem to investigate
      
      
      include/maria.h:
        Prototype changes
        Added current_filepos to st_maria_sort_info
      mysql-test/r/maria.result:
        Updated results that changes as alter table and insert ... select now uses fast creation of index
      mysys/mf_iocache.c:
        Reset variable to gurard against double invocation
      storage/maria/ma_bitmap.c:
        Added _ma_bitmap_reset_cache() (needed for repair)
      storage/maria/ma_blockrec.c:
        Simplify code
        More initial allocations
        Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read)
      storage/maria/ma_blockrec.h:
        Moved TRANSID_SIZE to maria_def.h
        Added prototype for new functions
      storage/maria/ma_check.c:
        Simplicy code
        Fixed repair_by_sort to work with BLOCK_RECORD
        - When using BLOCK_RECORD or UNPACK create new Maria handle
        - Use common initializer function
        - Align code with maria_repair()
        
        Made some changes to maria_repair_parallel() to use common initializer function
        Removed ASK_MONTY section by fixing noted problem
      storage/maria/ma_close.c:
        Moved check for readonly to _ma_state_info_write()
      storage/maria/ma_key_recover.c:
        Use different log entries if key root changes or not.
        This fixed some bugs when tree grows
      storage/maria/ma_key_recover.h:
        Added keynr to st_msg_to_write_hook_for_undo_key
      storage/maria/ma_loghandler.c:
        Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT
      storage/maria/ma_loghandler.h:
        Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT
      storage/maria/ma_open.c:
        Added TRANSID to all key pages (for future compressing of trans id's)
        For compressed records, alloc a bit bigger buffer to avoid valgrind warnings
        If table is opened readonly, don't update state
      storage/maria/ma_packrec.c:
        Allocate bigger array for bit unpacking to avoid valgrind errors
      storage/maria/ma_recovery.c:
        Added UNDO_KEY_INSERT_WITH_ROOT & UNDO_KEY_DELETE_WITH_ROOT
      storage/maria/ma_sort.c:
        More logging
      storage/maria/ma_test_all.sh:
        More tests
      storage/maria/ma_test_recovery.expected:
        Update results
        Note that this is not complete becasue of a bug in recovery
      storage/maria/ma_test_recovery:
        Removed recreation of index (not needed when we have redo for index pages)
      storage/maria/maria_chk.c:
        When using flag --read-only, don't update status for files
        When using --unpack, don't use REPAIR_BY_SORT if other repair option is given
        Enable repair_by_sort for BLOCK records
        Removed not needed newline at start of --describe
      storage/maria/maria_def.h:
        Support for TRANSID_SIZE to key pages
      storage/maria/maria_read_log.c:
        renamed --only-display to --display-only
      4e0964cb
  11. 21 Nov, 2007 1 commit
    • unknown's avatar
      Fixed errors found by valgrind · 63cd7bdc
      unknown authored
      Changed bitmaps to be written before unpinning of pages in write_block_record()
      Log handler now assumes we never call it for not transactional tables
      Fixed bug in ma_test_all that caused it to fail
      
      
      sql/unireg.cc:
        Removed 'at', as this makes it hard to find valgrind errors from the debug log
      storage/maria/ma_blockrec.c:
        Changed bzero() of blocks to get rid of a (non critical) valgrind error
        Changed bitmaps to be written before unpinning of pages in write_block_record()
        fixed that we don't log tails if table isn't transactional
      storage/maria/ma_key_recover.c:
        Fixed wrong log_data[] that caused us to log uninitialized data
      storage/maria/ma_loghandler.c:
        Replaced not needed test with DBUG_ASSERT()
      storage/maria/ma_test_all.sh:
        Remove control file if block size changes
      63cd7bdc
  12. 20 Nov, 2007 2 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-maria · 9f1aaeff
      unknown authored
      into  mysql.com:/home/my/mysql-maria
      
      
      include/my_sys.h:
        Auto merged
      sql/mysqld.cc:
        Auto merged
      storage/maria/ma_checkpoint.c:
        Auto merged
      storage/maria/ma_pagecache.c:
        Auto merged
      storage/maria/ma_pagecache.h:
        Auto merged
      storage/maria/maria_chk.c:
        Auto merged
      storage/maria/ma_recovery.c:
        SCCS merged
      9f1aaeff
    • unknown's avatar
      Fixes for redo/undo logging of key pages · 6b3743f0
      unknown authored
      New extendable format for maria_log_control file
      Fixed some compiler warnings
      
      
      include/maria.h:
        Added maria_disable_logging() and maria_enable_logging()
      mysql-test/include/maria_verify_recovery.inc:
        Updated tests now when key redo/undo works
      mysql-test/r/maria-recovery.result:
        Updated tests now when key redo/undo works
      storage/maria/ma_blockrec.c:
        Use unified CLR code
        Added rec_lsn for full pages
        Moved clr write hook to ma_key_recover.c
        Changed REDO code to keep pages pinned until undo
        Mark page_link's as changed
      storage/maria/ma_blockrec.h:
        Moved write_hook_for_clr_end() to ma_key_recover.c
      storage/maria/ma_check.c:
        Changed key check code to use PAGECACHE_READ_UNKNOWN_PAGE
        Fixed wrong warning when checking files after maria_pack
        When unpacking files, we have to use new keypos_to_recpos method
        When doing repair, we can disregard index key file pages in page cache
      storage/maria/ma_commit.c:
        Added simple enable/disable logging functions
        (Needed for recovery)
      storage/maria/ma_control_file.c:
        Make maria control file extendable without having to make it incompatible for older versions
      storage/maria/ma_control_file.h:
        New error messages
        Added CONTROL_FILE_VERSION
      storage/maria/ma_delete.c:
        Added redo/undo for key pages
        change_length -> changed_length to make things similar
        More comments & more DBUG
      storage/maria/ma_key_recover.c:
        Unified CLR method
        Moved here write_hook_for_clr_end() and common keypage log functions
        Changed REDO to keep pages pinned until undo
        Changed UNDO code to change key_root under log mutex
      storage/maria/ma_key_recover.h:
        New structures and functions
      storage/maria/ma_loghandler.c:
        Include needed files
      storage/maria/ma_open.c:
        Change maria_open() to use pread() instead of read()
      storage/maria/ma_page.c:
        Fixed bug in key_del handling
        Clear pages if IDENTICAL_PAGES_AFTER_RECOVERY is defined
      storage/maria/ma_pagecache.c:
        Indentation and spelling fixes
        More DBUG
        Added helper function: pagecache_block_link_to_buffer()
      storage/maria/ma_pagecache.h:
        Added pagecache_block_link_to_buffer()
      storage/maria/ma_recovery.c:
        Fixed state.changed
        Fixed that REDO keeps pages pinned until UNDO
        Some bug fixes from previous commit
        Fixes for UNDO/REDO of key pages
      storage/maria/ma_search.c:
        Fixed packing and storing of keys to provide more information to caller so
        that we can do efficent REDO logging of the changes.
      storage/maria/ma_test1.c:
        Fixed bug with not initialized variable
      storage/maria/ma_test2.c:
        Removed not used code
      storage/maria/ma_test_all.res:
        Updated results
      storage/maria/ma_test_all.sh:
        Changed one test to test more
        Removed timing tests as not relevant here
      storage/maria/ma_test_recovery.expected:
        Updated test result after redo/undo if key pages works
      storage/maria/ma_test_recovery:
        Updated test after redo/undo if key pages works
      storage/maria/ma_write.c:
        Moved some general log functions to ma_key_recover.c
        Fixed some bugs in undo
        Moved ma_log_split() to _ma_split_page()
        Small changes in some function arguments to be able to do redo logging
      storage/maria/maria_chk.c:
        disable logging while doing repair table
      storage/maria/maria_def.h:
        New function prototypes
        Move some structs and functions to ma_key_recover.c
      storage/maria/unittest/ma_control_file-t.c:
        Updated with patch from Sanja
        NOTE: This is not complete and need to be updated to new control file format
      storage/maria/unittest/ma_test_loghandler-t.c:
        Fixed compiler warning
      6b3743f0
  13. 16 Nov, 2007 3 commits
    • unknown's avatar
      WL#3071 Maria checkpoint, WL#3072 Maria recovery · fc0a25ec
      unknown authored
      instead of fprintf(stderr) when a task (with no user connected) gets
      an error, use my_printf_error(). Flags ME_JUST_WARNING and ME_JUST_INFO
      added to my_error()/my_printf_error(), which pass it to
      my_message_sql() which is modified to call the appropriate
      sql_print_*(). This way recovery can signal its start and end with
      [Note] and not [ERROR] (but failure with [ERROR]).
      Recovery's detailed progress (percents etc) still uses stderr as they
      have to stay on one single line.
      sql_print_error() changed to use my_progname_short (nicer display).
      mysql-test-run.pl --gdb/--ddd does not run mysqld, because
      a breakpoint in mysql_parse is too late to debug startup problems;
      instead, dev should set the breakpoints it wants and then "run" ("r").
      
      
      include/my_sys.h:
        new flags to tell error_handler_hook that this is not an error
        but an information or warning
      mysql-test/mysql-test-run.pl:
        when running with --gdb/--ddd to debug mysqld, breaking at mysql_parse
        is too late to debug startup problems; now, it does not run mysqld,
        does not set breakpoints, developer can set as early breakpoints
        as it wants and is responsible for typing "run" (or "r")
      mysys/my_init.c:
        set my_progname_short
      mysys/my_static.c:
        my_progname_short added
      sql/mysqld.cc:
        * my_message_sql() can now receive info or warning, not only error;
        this allows mysys to tell the user (or the error log if no user)
        about an info or warning. Used from Maria.
        * plugins (or engines like Maria) may want to call my_error(), so
        set up the error handler hook (my_message_sql) before initializing
        plugins; otherwise they get my_message_no_curses which is less
        integrated into mysqld (is just fputs())
        * using my_progname_short instead of my_progname, in my_message_sql()
        (less space on screen)
      storage/maria/ma_checkpoint.c:
        fprintf(stderr) -> ma_message_no_user()
      storage/maria/ma_checkpoint.h:
        function for any Maria task, not connected to a user (example:
        checkpoint, recovery; soon could be deleted records purger)
        to report a message (calls my_printf_error() which, when inside ha_maria,
        leads to sql_print_*(), and when outside, leads to
        my_message_no_curses i.e. stderr).
      storage/maria/ma_recovery.c:
        To tell that recovery starts and ends we use ma_message_no_user()
        (sql_print_*() in practice). Detailed progress info still uses
        stderr as sql_print() cannot put several messages on one line.
        071116 18:42:16 [Note] mysqld: Maria engine: starting recovery
        recovered pages: 0% 67% 100% (0.0 seconds); transactions to roll back: 1 0 (0.0
        seconds); tables to flush: 1 0 (0.0 seconds);
        071116 18:42:16 [Note] mysqld: Maria engine: recovery done
      storage/maria/maria_chk.c:
        my_progname_short moved to mysys
      storage/maria/maria_read_log.c:
        my_progname_short moved to mysys
      storage/myisam/myisamchk.c:
        my_progname_short moved to mysys
      fc0a25ec
    • unknown's avatar
      WL#3071 Maria checkpoint · ce2fbd9e
      unknown authored
      background page flushing was using dfile even when it wanted to flush
      the index file.
      
      
      storage/maria/ma_checkpoint.c:
        * filter_flush_data_file* functions are in fact for the index file too,
        renaming them.
        * flush of index file was using dfile (bad copy-paste)
      ce2fbd9e
    • unknown's avatar
      Flush status differentiation between error and skipping pinned pages. · f134f91f
      unknown authored
      
      storage/maria/ma_checkpoint.c:
        React only on errors during the flush.
      f134f91f
  14. 14 Nov, 2007 3 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-maria · 422375fc
      unknown authored
      into  mysql.com:/home/my/mysql-maria
      
      
      storage/maria/ha_maria.cc:
        Auto merged
      storage/maria/ma_bitmap.c:
        Auto merged
      storage/maria/ma_checkpoint.c:
        Auto merged
      storage/maria/ma_close.c:
        Auto merged
      storage/maria/ma_loghandler.c:
        Auto merged
      storage/maria/ma_loghandler.h:
        Auto merged
      storage/maria/ma_open.c:
        Auto merged
      storage/maria/ma_pagecache.h:
        Auto merged
      storage/maria/ma_write.c:
        Auto merged
      storage/maria/maria_def.h:
        Auto merged
      storage/maria/unittest/ma_pagecache_single.c:
        Auto merged
      storage/maria/ma_blockrec.c:
        Manual merge
      storage/maria/ma_page.c:
        Manual merge
      storage/maria/ma_pagecache.c:
        Manual merge
      storage/maria/ma_preload.c:
        Manual merge
      storage/maria/ma_recovery.c:
        Manual merge
        Add _ma_unpin_all_pages() to all new UNDO redo_exec_hook's
      422375fc
    • unknown's avatar
      First part of redo/undo for key pages · 21fd2a5a
      unknown authored
      Added key_nr to st_maria_keydef for faster keyinfo->keynr conversion
      For transactional tables, shift record number in keys up with 1 bit to have place to indicate if transid follows
      Checksum for MyISAM now ignores NULL and not used part of VARCHAR
      Renamed some variables that caused shadow compiler warnings
      Moved extra() call when waiting for tables to not be used to after tables are removed from cache.
      Fixed crashing bugs when using Maria TEMPORARY tables with TRUNCATE. Removed 'hack' code in sql directory to go around this bug.
      pagecache_unlock_by_ulink() now has extra argument to say if page was changed.
      Give error message if we fail to open control file
      Mark page cache variables as not flushable
      
      
      include/maria.h:
        Made min page cache larger (needed for pinning key page)
        Added key_nr to st_maria_keydef for faster keyinfo->keynr conversion
        Added write_comp_flag to move some runtime code to maria_open()
      include/my_base.h:
        Added new error message to be used when handler initialization failed
      include/my_global.h:
        Renamed dummy to swap_dummy to avoid conflicts with local 'dummy' variables
      include/my_handler.h:
        Added const to some parameters
      mysys/array.c:
        More DBUG
      mysys/my_error.c:
        Fixed indentation
      mysys/my_handler.c:
        Added const to some parameters
        Added missing error messages
      sql/field.h:
        Renamed variables to avoid variable shadowing
      sql/handler.h:
        Renamed parameter to avoid variable name conflict
      sql/item.h:
        Renamed variables to avoid variable shadowing
      sql/log_event_old.h:
        Renamed variables to avoid variable shadowing
      sql/set_var.h:
        Renamed variables to avoid variable shadowing
      sql/sql_delete.cc:
        Removed maria hack for temporary tables
        Fixed indentation
      sql/sql_table.cc:
        Moved extra() call when waiting for tables to not be used to after tables are removed from cache.
        This was needed to ensure we don't do a PREPARE_FOR_DROP or similar call while the table is still in use.
      sql/table.cc:
        Copy page_checksum from share
        Removed Maria hack
      storage/maria/Makefile.am:
        Added new files
      storage/maria/ha_maria.cc:
        Renamed records -> record_count and info -> create_info to avoid variable name conflicts
        Mark page cache variables as not flushable
      storage/maria/ma_blockrec.c:
        Moved _ma_unpin_all_pages() to ma_key_recover.c
        Moved init of info->pinned_pages to ma_open.c
        Moved _ma_finalize_row() to maria_key_recover.h
        Renamed some variables to avoid variable name conflicts
        Mark page_link.changed for blocks we change directly
        Simplify handling of undo link when writing LOGREC_UNDO_ROW_INSERT (old code crashed when having redo for index)
      storage/maria/ma_blockrec.h:
        Removed extra empty line
      storage/maria/ma_checkpoint.c:
        Remove not needed trnman.h
      storage/maria/ma_close.c:
        Free pinned pages (which are now always allocated)
      storage/maria/ma_control_file.c:
        Give error message if we fail to open control file
      storage/maria/ma_delete.c:
        Changes for redo logging (first part, logging of underflow not yet done)
        - Log undo-key-delete
        - Log delete of key
        - Updated arguments to _ma_fetch_keypage(), _ma_dispose(), _ma_write_keypage(), _ma_insert()
        - Added new arguments to some functions to be able to write redo information
        - Mark key pages as changed when we write with PAGECACHE_LOCK_LEFT_WRITELOCKED
        
        Remove one not needed _ma_write_keypage() in d_search() when upper level will do the write anyway
        Changed 2 bmove_upp() to bmove() as this made code easer to understand
        More function comments
        Indentation fixes
      storage/maria/ma_ft_update.c:
        New arguments to _ma_write_keypage()
      storage/maria/ma_loghandler.c:
        Fixed some DBUG_PRINT messages
        Simplify code
        Added new log entrys for key page redo
        Renamed some variables to avoid variable name shadowing
      storage/maria/ma_loghandler.h:
        Moved some defines here
        Added define for storing key number on key pages
        Added new translog record types
        Added enum for type of operations in LOGREC_REDO_INDEX
      storage/maria/ma_open.c:
        Always allocate info.pinned_pages (we need now also for normal key page usage)
        Update keyinfo->key_nr
        Added virtual functions to convert record position o number to be stored on key pages
        Update keyinfo->write_comp_flag to value of search flag to be used when writing key
      storage/maria/ma_page.c:
        Added redo for key pages
        - Extended _ma_fetch_keypage() with type of lock to put on page and address to used MARIA_PINNED_PAGE
        - _ma_fetch_keypage() now pin's pages if needed
        - Extended _ma_write_keypage() with type of locks to be used
        - ma_dispose() now locks info->s->state.key_del from other threads
        - ma_dispose() writes redo log record
        - ma_new() locks info->s->state.key_del from other threads if it was used
        - ma_new() now pins read page
        
        Other things:
        - Removed some not needed arguments from _ma_new() and _ma_dispose)
        - Added some new variables to simplify code
        - If EXTRA_DEBUG is used, do crc on full page to catch not unitialized bytes
      storage/maria/ma_pagecache.h:
        Applied patch from Sanja to add extra argument to pagecache_unlock_by_ulink() to mark if page was changed
        Added some defines for pagecache priority levels that one can use
      storage/maria/ma_range.c:
        Added new arguments for call to _ma_fetch_keypage()
      storage/maria/ma_recovery.c:
        - Added hooks for new translog types:
          REDO_INDEX, REDO_INDEX_NEW_PAGE, REDO_INDEX_FREE_PAGE, UNDO_KEY_INSERT, UNDO_KEY_DELETE and
          UNDO_KEY_DELETE_WITH_ROOT.
        - Moved variable declarations to start of function (portability fixes)
        - Removed some not needed initializations
        - Set only relevant state changes for each redo/undo entry
      storage/maria/lockman.c:
        Removed end space
      storage/maria/ma_check.c:
        Removed end space
      storage/maria/ma_create.c:
        Removed end space
      storage/maria/ma_locking.c:
        Removed end space
      storage/maria/ma_packrec.c:
        Removed end space
      storage/maria/ma_pagecache.c:
        Removed end space
      storage/maria/ma_panic.c:
        Removed end space
      storage/maria/ma_rt_index.c:
        Added new arguments for call to _ma_fetch_keypage(), _ma_write_keypage(), _ma_dispose() and _ma_new()
        Fixed indentation
      storage/maria/ma_rt_key.c:
        Added new arguments for call to _ma_fetch_keypage()
      storage/maria/ma_rt_split.c:
        Added new arguments for call to _ma_new()
        Use new keypage header
        Added new arguments for call to _ma_write_keypage()
      storage/maria/ma_search.c:
        Updated comments & indentation
        Added new arguments for call to _ma_fetch_keypage()
        Made some variables and arguments const
        Added virtual functions for converting row position to number to be stored in key
        use MARIA_RECORD_POS of record position instead of my_off_t
        Record in MARIA_KEY_PARAM how page was changed one key insert (needed for REDO)
      storage/maria/ma_sort.c:
        Removed end space
      storage/maria/ma_statrec.c:
        Updated arguments for call to _ma_rec_pos()
      storage/maria/ma_test1.c:
        Fixed too small buffer to init_pagecache()
        Fixed bug when using insert_count and test_flag
      storage/maria/ma_test2.c:
        Use more resonable pagecache size
        Remove not used code
        Reset blob_length to fix wrong output message
      storage/maria/ma_test_all.sh:
        Fixed wrong test
      storage/maria/ma_write.c:
        Lots of new code to handle REDO of key pages
        No logic changes because of REDO code, mostly adding new arguments and adding new code for logging 
        
        Added new arguments for calls to _ma_fetch_keypage(), _ma_write_keypage() and similar functions
        Move setting of comp_flag in ma_ck_wrte_btree() from runtime to maria_open()
        Zerofill new used pages for:
        - To remove possible sensitive data left in buffer
        - To get idenitical data on pages after running redo
        - Better compression of pages if archived
      storage/maria/maria_chk.c:
        Added information if table is crash safe
      storage/maria/maria_def.h:
        New virtual function to convert between record position on key and normal record position
        Aded mutex and extra variables to handle locking of share->state.key_del
        Moved some structure variables to get things more aligned
        Added extra arguments to MARIA_KEY_PARAM to be able to remember what was changed on key page on key insert
        Added argument to MARIA_PINNED_PAGE to indicate if page was changed
        Updated prototypes for functions
        Added some structures for signaling changes in REDO handling
      storage/maria/unittest/ma_pagecache_single.c:
        Updated arguments for changed function calls
      storage/myisam/mi_check.c:
        Made calc_check_checksum virtual
      storage/myisam/mi_checksum.c:
        Update checksums to ignore null columns
      storage/myisam/mi_create.c:
        Mark if table has null column (to know when we have to use mi_checksum())
      storage/myisam/mi_open.c:
        Added virtual function for calculating checksum to be able to easily ignore NULL fields
      storage/myisam/mi_test2.c:
        Fixed bug
      storage/myisam/myisamdef.h:
        Added virtual function for calculating checksum during check table
        Removed ha_key_cmp() as this is in handler.h
      storage/maria/ma_key_recover.c:
        New BitKeeper file ``storage/maria/ma_key_recover.c''
      storage/maria/ma_key_recover.h:
        New BitKeeper file ``storage/maria/ma_key_recover.h''
      storage/maria/ma_key_redo.c:
        New BitKeeper file ``storage/maria/ma_key_redo.c''
      21fd2a5a
    • unknown's avatar
      WL#3072 - Maria recovery · 1bc5e3b9
      unknown authored
      maria_read_log used to always print a warning message at startup
      to say it is unsafe if ALTER TABLE was used. Now it prints it only
      if the log does show the problem (=ALTER TABLE or CREATE SELECT, which
      both disable logging of REDO_INSERT*).
      For that, when ha_maria::external_lock() disables transactionality
      it writes a LOGREC_INCOMPLETE_LOG to the log, which "maria_read_log -a"
      picks up to write a warning.
      REPAIR TABLE also disables those REDO_INSERT* but as maria_read_log
      executes LOGREC_REDO_REPAIR no warning is needed.
      
      
      storage/maria/ha_maria.cc:
        as we now log a record when disabling transactionility, we need the
        TRN to be set up first
      storage/maria/ma_blockrec.c:
        comment
      storage/maria/ma_loghandler.c:
        new type of log record
      storage/maria/ma_loghandler.h:
        new type of log record
      storage/maria/ma_recovery.c:
        * maria_apply_log() now returns a count of warnings. What currently
        produces warnings is:
        - skipping applying UNDOs though there are some (=> inconsistent table)
        - replaying log (in maria_read_log) though the log contains some
        ALTER TABLE or CREATE SELECT (log misses REDO_INSERT* for those
        and is so incomplete).
        Count of warnings affects the final message of maria_read_log and
        recovery (though in recovery none of the two conditions above should
        happen).
        * maria_read_log used to always print a warning message at startup
        to say it is unsafe if ALTER TABLE was used. Now it prints it only
        if the log does show the problem, i.e. ALTER TABLE or CREATE SELECT
        was used (both disable logging of REDO_INSERT* as those records are
        not needed for recovery; those missing records in turn make
        recreation-from-scratch, via maria_read_log, impossible). For that,
        when ha_maria::external_lock() disables transactionality,
        _ma_tmp_disable_logging_for_table() writes a LOGREC_INCOMPLETE_LOG to
        the log, which maria_apply_log() picks up to write a warning.
      storage/maria/ma_recovery.h:
        maria_apply_log() returns a count of warnings
      storage/maria/maria_def.h:
        _ma_tmp_disable_logging_for_table() grows so becomes a function
      storage/maria/maria_read_log.c:
        maria_apply_log can now return a count of warnings, to temper the
        "SUCCESS" message printed in the end by maria_read_log.
        Advise users to make a backup first.
      1bc5e3b9
  15. 13 Nov, 2007 2 commits
    • unknown's avatar
      Addendum to WL#4137 "Maria- Framework for testing recovery in mysql-test-run": · ac590d9c
      unknown authored
      possibility, if requested in the test, to do byte-for-byte comparison
      of data files after recovery. This makes sense only when testing
      REDOs, as UNDO phase generates new log records thus data pages get
      new LSNs. First test of maria-recovery.test is changed to test only
      REDOs and do byte-for-byte comparison.
      
      
      mysql-test/include/maria_make_snapshot.inc:
        possibility to compare physically the data files (makes sense
        only if testing REDO phase).
      mysql-test/include/maria_verify_recovery.inc:
        allow physical comparison of data files after recovery if requested
      mysql-test/r/maria-recovery.result:
        result update (first test tests REDO only now)
      mysql-test/t/maria-recovery.test:
        first test tests REDO only now, and thus can do byte-for-byte
        comparison of data files.
      ac590d9c
    • unknown's avatar
      * WL#4137 Maria- Framework for testing recovery in mysql-test-run · 5fbd5daf
      unknown authored
      See test maria-recovery.test for a model; all include scripts have
      an "API" section at start if they do take parameters from outside.
      * Fixing bug reported by Jani and Monty (when two REDOs about the same
      page in one group, see ma_blockrec.c). 
      * Fixing small bugs in recovery
      
      
      mysql-test/include/wait_until_connected_again.inc:
        be sure to enter the loop (the previous query by the caller may not have
        failed: it could be
        query;
        mysqladmin shutdown;
        call this script).
      mysql-test/lib/mtr_process.pl:
        * Through the "expect" file a test can tell mtr that a server crash
        is expected. What the file contains is irrelevant. Now if its last
        line starts with "wait", mtr will wait before restarting (it will
        wait for the last line to not start with "wait"). This is for
        tests which need to mangle files under the feet of a dead mysqld.
        * Remove "expect" file before restarting; otherwise there could be a
        race condition: tests sees server restarted, does something, writes
        an "expect" file, and then mtr removes that file, then
        test kills mysqld, and then mtr will never restart it.
      storage/maria/ma_blockrec.c:
        - when applying a REDO in recovery, we don't anymore put UNDO's LSN on the page
        at once; indeed if in this REDO's group there comes another REDO
        for the same page it would be wrongly skipped. Instead, we keep
        pages pinned, don't change their LSN. When done with all REDOs
        of the group we unpin them and stamp them with UNDO's LSN.
        - fixing bug in applying of REDO_PURGE_BLOCKS in recovery: page_range
        sometimes has TAIL_BIT set, need to turn it down to know the real page
        range.
        - Both bugs are covered in maria-recovery.test
      storage/maria/ma_checkpoint.c:
        Capability to, in debug builds only, do some special operations
        (flush all bitmap and data pages, flush state, flush log)
        and crash mysqld, to later test recovery.
         Driven by some --debug=d, symbols.
      storage/maria/ma_open.c:
        debugging info
      storage/maria/ma_pagecache.c:
        Now that we can _ma_unpin_all_pages() during the REDO phase
        to set page's LSN, the assertion needs to be relaxed.
      storage/maria/ma_recovery.c:
        - open trace file in append mode (useful when a test triggers several
        recoveries, we see them all).
        - fixing wrong error detection, it's possible that during recovery
        we want to open an already open table.
        - when applying a REDO in recovery, we don't anymore put UNDO's LSN on the page
        at once; indeed if in this REDO's group there comes another REDO
        for the same page it would be wrongly skipped. Instead, we keep
        pages pinned, don't change their LSN. When done with all REDOs
        of the group we unpin them and stamp them with UNDO's LSN.
        - we verify that all log records of a group are about the same table,
        for debugging.
      mysql-test/r/maria-recovery.result:
        result
      mysql-test/t/maria-recovery-master.opt:
        crash is expected, core file would take room, stack trace would
        wake pushbuild up.
      mysql-test/t/maria-recovery.test:
        Test of recovery from mysql-test (it is already tested as unit tests
        in ma_test_recovery) (WL#4137)
        - test that, if recovery is made to start on an empty table it can
        replay the effects of committed and uncommitted statements (having only
        the committed ones in the end result). This should be the first test
        for someone writing code of new REDOs.
        - test that, if mysqld is crashed and recovery runs we have only
        committed statements in the end result. Crashes are done in different
        ways: flush nothing (so, uncommitted statement is often missing
        from the log => no rollback to do); flush pagecache (implicitely flushes
        log (WAL)) and flush log, both causes rollbacks; flush log can also
        flush state (state.records etc) to test recovery of the state
        (not tested well now as we repair the index anyway).
        - test of bug found by Jani and Monty in recovery (two REDO about
        the same page in one group).
      mysql-test/include/maria_empty_logs.inc:
        removes logs, to have a clean sheet for testing recovery.
      mysql-test/include/maria_make_snapshot.inc:
        copies a table to another directory, or back, or compares both
        (comparison is not implemented as physical comparison is impossible
        if an UNDO phase happened).
      mysql-test/include/maria_make_snapshot_for_comparison.inc:
        copies tables to another directory so that they can later
        serve as a comparison reference (they are the good tables,
        recovery should produce similar ones).
      mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
        When we want to force recovery to start on old tables, we prepare
        old tables with this script: we put them in a spare directory.
        They are later copied back over mysqltest tables while mysqld is dead.
        We also need to copy back the control file, otherwise mysqld,
        in recovery, would start from the latest checkpoint: latest
        checkpoint plus old tables is not a recovery-possible scenario of course.
      mysql-test/include/maria_verify_recovery.inc:
        causes mysqld to crash, restores old tables if requested,
        lets recovery run, compares resulting tables with reference tables
        by using CHECKSUM TABLE.
        We don't do any sanity checks on page's LSN in resulting tables, yet.
      5fbd5daf
  16. 11 Nov, 2007 2 commits
    • unknown's avatar
      comments · 5e2aaf69
      unknown authored
      5e2aaf69
    • unknown's avatar
      WL#3071 Maria checkpoint · 086b34c9
      unknown authored
      Fixing bad comments (I remember my maths' teacher "one late night you'll
      obey to the simplifications made by your tired neurons"; exactly
      what happened here). In Checkpoint, when we flush a table's state
      we must flush all log records (WAL), not only those before checkpoint
      started.
      
      
      storage/maria/ma_bitmap.c:
        there was a flaw in reasoning, bug does exist.
      storage/maria/ma_blockrec.c:
        moving piece of comment to ma_checkpoint.c
      storage/maria/ma_checkpoint.c:
        Comments.
        When checkpoint flushes a state, WAL imposes that all records up
        to this state have been flushed, not only up to checkpoint_start_log_horizon.
      storage/maria/ma_recovery.c:
        finishing comment.
      086b34c9
  17. 09 Nov, 2007 2 commits
    • unknown's avatar
      WL#3071 - Maria checkpoint · c2084d2a
      unknown authored
      Observe WAL for the table's state: all log records needed for undoing
      uncommitted state must be in the log before we flush state.
      
      
      storage/maria/ha_maria.cc:
        comments
      storage/maria/ma_bitmap.c:
        Comment for why there is no bug
      storage/maria/ma_blockrec.c:
        comment for why there is no bug
      storage/maria/ma_checkpoint.c:
        Observe WAL for the table's state: all log records needed for undoing
        uncommitted state must be in the log before we flush state. I tested
        by hand that the bug existed (create table, insert one row into it
        but let that insert pause after increasing data_file_length, let
        checkpoint start but kill it after it has flushed state).
        Log contains nothing, table is not recovered though it has
        a too big data_file_length. With this bugfix, the log contains
        REDO so table is opened so data_file_length is corrected.
      storage/maria/ma_close.c:
        If table is read-only we must never write to it.
        Should be a no-change in fact, as if read-only, share->changed is
        normally always false.
      storage/maria/ma_recovery.c:
        documenting bug found by Monty. Print when fixing data_file_length.
      c2084d2a
    • unknown's avatar
      Infinite loop in case of given address more then last LSN fixed. · 81e84a75
      unknown authored
      
      storage/maria/ma_loghandler.c:
        Infinite loop in case of given address more then last LSN fixed
        (now it means just flush all log).
        Removed unneeded ASSERT.
      storage/maria/unittest/ma_test_loghandler-t.c:
        The test case of flushing all log added.
      81e84a75
  18. 05 Nov, 2007 1 commit
  19. 19 Oct, 2007 5 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-maria · 301ee8d9
      unknown authored
      into  mysql.com:/home/my/mysql-maria
      
      
      include/my_sys.h:
        Auto merged
      mysql-test/r/maria.result:
        Auto merged
      mysql-test/t/maria.test:
        Auto merged
      sql/handler.h:
        Auto merged
      sql/mysqld.cc:
        Auto merged
      storage/maria/ha_maria.cc:
        Auto merged
      storage/maria/ma_bitmap.c:
        Auto merged
      storage/maria/ma_blockrec.c:
        Auto merged
      storage/maria/ma_loghandler.c:
        Auto merged
      storage/maria/ma_pagecache.c:
        Auto merged
      storage/maria/ma_test1.c:
        Auto merged
      storage/maria/ma_test_recovery.expected:
        Auto merged
      storage/maria/ma_test_recovery:
        Auto merged
      sql/mysql_priv.h:
        manual merge
      storage/maria/ma_recovery.c:
        manual merge
      storage/maria/ma_test2.c:
        manual merge
      301ee8d9
    • unknown's avatar
      Merge some changes from sql directory in 5.1 tree · 13d53bf6
      unknown authored
      Changed format for REDO_INSERT_ROWS_BLOBS
      Fixed several bugs in handling of big blobs
      Added redo_free_head_or_tail() & redo_insert_row_blobs()
      Added uuid to control file
      maria_checks now verifies that not used part of bitmap is 0
      REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS
      Added REDO_FREE_HEAD_OR_TAIL
      Fixes problem when trying to read block outside of file during REDO
      
      
      include/my_global.h:
        STACK_DIRECTION is already set by configure
      mysql-test/r/maria.result:
        Updated results
      mysql-test/t/maria.test:
        Test shrinking of VARCHAR
      mysys/my_realloc.c:
        Fixed indentation
      mysys/safemalloc.c:
        Fixed indentation
      sql/filesort.cc:
        Removed some casts
      sql/mysqld.cc:
        Added missing setting of myisam_stats_method_str
      sql/uniques.cc:
        Removed some casts
      storage/maria/ma_bitmap.c:
        Added printing of bitmap (for debugging)
        Renamed _ma_print_bitmap() -> _ma_print_bitmap_changes()
        Added _ma_set_full_page_bits()
        Fixed bug in ma_bitmap_find_new_place() (affecting updates) when using big files
      storage/maria/ma_blockrec.c:
        Changed format for REDO_INSERT_ROWS_BLOBS
        Fixed several bugs in handling of big blobs
        Added code to fix some cases where redo when using blobs didn't produce idenital .MAD files as normal usage
        REDO_FREE_ROW_BLOCKS doesn't anymore change pages; We only mark things free in bitmap
        Remove TAIL and filler extents from REDO_FREE_BLOCKS log entry. (Fixed some asserts)
        REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS
        Delete tails in update. (Fixed bug when doing update that shrinks blob/varchar length)
        Fixed bug when doing insert in block outside of file size.
        Added redo_free_head_or_tail() & redo_insert_row_blobs()
        Added pagecache_unlock_by_link() when read fails.
        Much more comments, DBUG and ASSERT entries
      storage/maria/ma_blockrec.h:
        Prototypes of new functions
        Define of SUB_RANGE_SIZE & BLOCK_FILLER_SIZE
      storage/maria/ma_check.c:
        Verify that not used part of bitmap is 0
      storage/maria/ma_control_file.c:
        Added uuid to control file
      storage/maria/ma_loghandler.c:
        REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS
        Added REDO_FREE_HEAD_OR_TAIL
      storage/maria/ma_loghandler.h:
        REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS
        Added REDO_FREE_HEAD_OR_TAIL
      storage/maria/ma_pagecache.c:
        If we write full block, remove error flag for block.
        (Fixes problem when trying to read block outside of file)
      storage/maria/ma_recovery.c:
        REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS
        Added REDO_FREE_HEAD_OR_TAIL
      storage/maria/ma_test1.c:
        Allow option after 'b' to be compatible with ma_test2
        (This is just to simplify test scripts like ma_test_recovery)
      storage/maria/ma_test2.c:
        Default size of blob is now 1000 instead of 1
      storage/maria/ma_test_all.sh:
        Added test for bigger blobs
      storage/maria/ma_test_recovery.expected:
        Updated results
      storage/maria/ma_test_recovery:
        Added test for bigger blobs
      13d53bf6
    • unknown's avatar
      WL#3071 - Maria checkpoint · 1cede432
      unknown authored
      don't take a checkpoint at end of REDO phase because blocks' rec_lsn
      are not set. Fixes some assertion failures during tests of killing
      the UNDO phase (recovery then started from the end-of-REDO-phase
      checkpoint, wrongly ignoring REDOs before that record).
      
      
      storage/maria/ma_blockrec.c:
        note for a bug (mail sent to colleagues, put on todo)
      storage/maria/ma_recovery.c:
        this checkpoint at end of REDO phase is incorrect, disabling it.
        The one at end of UNDO phase remains.
      1cede432
    • unknown's avatar
      Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria · 155365f0
      unknown authored
      into  gbichot4.local:/home/mysql_src/mysql-maria-for-undo-phase
      
      
      155365f0
    • unknown's avatar
      WL#3071 - Maria checkpoint · 77017191
      unknown authored
      - serializing calls to flush_pagecache_blocks_int() on the same file
      to avoid known concurrency bugs
      - having that, we can now enable the background thread, as the
      flushes it does are now supposedly safe in concurrent situations.
      - new type of flush FLUSH_KEEP_LAZY: when the background checkpoint
      thread is flushing a packet of dirty pages between two checkpoints,
      it uses this flush type, indeed if a file is already being flushed
      by another thread it's smarter to move on to the next file than wait.
      - maria_checkpoint_frequency renamed to maria_checkpoint_interval.
      
      
      include/my_sys.h:
        new type of flushing for the page cache: FLUSH_KEEP_LAZY
      mysql-test/r/maria.result:
        result update
      mysys/mf_keycache.c:
        indentation. No FLUSH_KEEP_LAZY support in key cache.
      storage/maria/ha_maria.cc:
        maria_checkpoint_frequency was somehow a hidden part of the
        Checkpoint API and that was not good. Now we have checkpoint_interval,
        local to ha_maria.cc, which serves as container for the user-visible
        maria_checkpoint_interval global variable; setting it calls
        update_checkpoint_interval which passes the new value to
        ma_checkpoint_init(). There is no hiding anymore.
        By default, enable background thread which does checkpoints
        every 30 seconds, and dirty page flush in between. That thread takes
        a checkpoint when it ends, so no need for maria_hton_panic to take one.
        The | is | and not ||, because maria_panic() must always be called.
        frequency->interval.
      storage/maria/ma_checkpoint.c:
        Use FLUSH_KEEP_LAZY for background thread when it flushes packets of
        dirty pages between two checkpoints: it is smarter to move on to
        the next file than wait for it to have been completely flushed, which
        may take long.
        Comments about flush concurrency bugs moved from ma_pagecache.c.
        Removing out-of-date comment.
        frequency->interval.
        create_background_thread -> (interval>0).
        In ma_checkpoint_background(), some variables need to be preserved
        between iterations.
      storage/maria/ma_checkpoint.h:
        new prototype
      storage/maria/ma_pagecache.c:
        - concurrent calls of flush_pagecache_blocks_int() on the same file
        cause bugs (see @note in that function); we fix them by serializing
        in this situation. For that we use a global hash of (file, wqueue).
        When flush_pagecache_blocks_int() starts it looks into the hash,
        using the file as key. If not found, it inserts (file,wqueue) into the
        hash, flushes the file, and finally removes itself from the hash and
        wakes up any waiter in the queue. If found, it adds itself to the
        wqueue and waits.
        - As a by-product, we can remove changed_blocks_is_incomplete
        and replace it by scanning the hash, replace the sleep() by a queue wait.
        - new type of flush FLUSH_KEEP_LAZY: when flushing a file, if it's
        already being flushed by another thread (even partially), return
        immediately.
      storage/maria/ma_pagecache.h:
        In pagecache, a hash of files currently being flushed (i.e. there
        is a call to flush_pagecache_blocks_int() for them).
      storage/maria/ma_recovery.c:
        new prototype
      storage/maria/ma_test1.c:
        new prototype
      storage/maria/ma_test2.c:
        new prototype
      77017191