An error occurred fetching the project authors.
  1. 14 Oct, 2008 1 commit
    • Michael Widenius's avatar
      Merging of changes from myisam -> maria missing in last 5.1 - 5.1->maria merge · 32718418
      Michael Widenius authored
      MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF
      
      include/maria.h:
        Remove MARIA_MAX_MSG_BUF; We are now using HA_MAX_MSG_BUF
        Added maria_test_invalid_symlink
      storage/maria/ha_maria.cc:
        MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF
      storage/maria/ma_check.c:
        Removed tab in string constant
        Add extra argument to ma_open_datafile()
      storage/maria/ma_create.c:
        Set error number if table is in use
      storage/maria/ma_open.c:
        Added name argument to open functions for security check if filename is linked to another file in database directory
      storage/maria/ma_static.c:
        Default functions for checking if wrong symlink
      storage/maria/maria_chk.c:
        Add extra argument to _ma_open_datafile()
      storage/maria/maria_def.h:
        Add extra argument to _ma_open_datafile()
      32718418
  2. 25 Aug, 2008 1 commit
    • Michael Widenius's avatar
      Changed all file names in maria to LEX_STRING and removed some calls to strlen() · 1a5de5bc
      Michael Widenius authored
      Ensure that pagecache gives correct error number even if error for block happend
      
      
      mysys/my_pread.c:
        Indentation fix
      storage/maria/ha_maria.cc:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_check.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_checkpoint.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_create.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_dbug.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_delete.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_info.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_keycache.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_locking.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_loghandler.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_open.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_pagecache.c:
        Store error number for last failed operation in the page block
        This should fix some asserts() when errno was not properly set after failure to read block in another thread
      storage/maria/ma_recovery.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_update.c:
        filenames changed to be of type LEX_STRING
      storage/maria/ma_write.c:
        filenames changed to be of type LEX_STRING
      storage/maria/maria_def.h:
        filenames changed to be of type LEX_STRING
      storage/maria/maria_ftdump.c:
        filenames changed to be of type LEX_STRING
      storage/maria/maria_pack.c:
        filenames changed to be of type LEX_STRING
      1a5de5bc
  3. 10 Jul, 2008 1 commit
  4. 09 Jul, 2008 1 commit
    • Guilhem Bichot's avatar
      Fix for BUG#37876 "Importing Maria table from other server via binary copy does not work": · 60b88ce4
      Guilhem Bichot authored
      - after auto-zerofill (ha_maria::check_and_repair()) kepts its state's LSNs unchanged, which could
      be the same as the create_rename_lsn of another pre-existing table, which would break versioning as this LSN
      serves as unique identifier in the versioning code (in maria_open()). Even the state pieces which
      maria_zerofill() did change were lost (because they didn't go to disk).
      - after this fix, if two tables were auto-zerofilled at the same time (by _ma_mark_changed())
      they could receive the same create_rename_lsn, which would break versioning again. Fix is to write a log
      record each time a table is imported.
      - Print state's LSNs (create_rename_lsn, is_of_horizon, skip_redo_lsn) and UUID in maria_chk -dvv.
      
      mysql-test/r/maria-autozerofill.result:
        result
      mysql-test/t/maria-autozerofill.test:
        Test for auto-zerofilling
      storage/maria/ha_maria.cc:
        The state changes done by auto-zerofilling never reached disk.
      storage/maria/ma_check.c:
        When zerofilling a table, including its pages' LSNs, new state LSNs are needed next time the table
        is imported into a Maria instance.
      storage/maria/ma_create.c:
        Write LOGREC_IMPORTED_TABLE when importing a table. This is informative and ensures
        that the table gets a unique create_rename_lsn even though multiple tables
        are imported by concurrent threads (it advances the log's end LSN).
      storage/maria/ma_key_recover.c:
        comment
      storage/maria/ma_locking.c:
        instead of using translog_get_horizon() for state's LSNs of imported table,
        use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
      storage/maria/ma_loghandler.c:
        New type of log record
      storage/maria/ma_loghandler.h:
        New type of log record
      storage/maria/ma_loghandler_lsn.h:
        New name for constant as can be used not only by maria_chk but auto-zerofill now too.
      storage/maria/ma_open.c:
        instead of using translog_get_horizon() for state's LSNs of imported table,
        use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
      storage/maria/ma_recovery.c:
        print content of LOGREC_IMPORTED_TABLE in maria_read_log.
      storage/maria/maria_chk.c:
        print info about LSNs of the table's state, and UUID, when maria_chk -dvv
      storage/maria/maria_pack.c:
        new name for constant
      storage/maria/unittest/ma_test_recovery.pl:
        Now that maria_chk -dvv shows state LSNs and UUID those need to be filtered out,
        as maria_read_log -a does not use the same as at original run.
      60b88ce4
  5. 05 Jul, 2008 1 commit
    • Michael Widenius's avatar
      Bug#37276 maria crash on insert around the time check table is run · 82d79389
      Michael Widenius authored
      Fixed several (but not all) issues found by the test program:
      - ASSERT on row_length in ma_blockrec.c::_ma_compact_block_page()
      - Fixed bug when splitting node pages
      - Fixed hang in 'closeing tables' (conflicting mutex order) by ensuring we first take trnman lock and then share->intern_lock
      
      storage/maria/ma_blockrec.c:
        When compacting a row page when allocating space for a new row, the min length of a the new block may be temporarly smaller than 'min_block_length'.
      storage/maria/ma_check.c:
        More DBUG output
      storage/maria/ma_checkpoint.c:
        Call new function _ma_remove_not_visible_states_with_lock() to ensure we first take lock on trnman and then on share->intern_lock
        +
      storage/maria/ma_close.c:
        Added comment
      storage/maria/ma_open.c:
        Added comment
      storage/maria/ma_search.c:
        Copy also node data; Caused bug when splitting node pages
      storage/maria/ma_state.c:
        Added _ma_remove_not_visible_states_with_lock() to ensure we take locks in right order
      storage/maria/ma_state.h:
        Added new prototype
      storage/maria/trnman.c:
        Added trnman_lock() and trnman_unlock().
        Needed by _ma_remove_not_visible_states_with_lock() to get mutex in right order
      storage/maria/trnman_public.h:
        Added new prototypes
      82d79389
  6. 30 Jun, 2008 2 commits
  7. 28 Jun, 2008 1 commit
    • Michael Widenius's avatar
      Fix for Bug #36578 Maria: maria-recover may fail to autorepair a table · 9f589947
      Michael Widenius authored
      Fixed also some similar issues in MyISAM. This was not noticed before as MyISAM did a second retry without key cache (which just made the second repair attempty slower)
      
      storage/maria/ha_maria.cc:
        Print information if we retry without quick in case of CHECK TABLE table_name QUICK
        Remove T_QUICK flag when retrying repair, but set T_SAFE_REPAIR to ensure we don't loose any rows
        Remember T_RETRY_WITH_QUICK flag when restoring repair flags
        Don't print 'checking table' if we are not checking table in auto-repair
        Don't use T_QUICK in auto repair (safer)
        Changed parameter of type HA_PARAM &param to HA_PARAM *param
      storage/maria/ha_maria.h:
        Changed parameter of type HA_PARAM &param to HA_PARAM *param
      storage/maria/ma_check.c:
        Added retry without T_QUICK if there is a problem reading a row in BLOCK_RECORD
      storage/myisam/ha_myisam.cc:
        Remove T_QUICK flag when retrying repair, but set T_SAFE_REPAIR to ensure we don't loose any rows
        Remember T_RETRY_WITH_QUICK flag when restoring repair flags
      9f589947
  8. 26 Jun, 2008 2 commits
    • Guilhem Bichot's avatar
      Fixes for build errors under Windows and compiler warning under Linux · f0c53638
      Guilhem Bichot authored
      include/m_string.h:
        new macro like LINT_INIT but for struct. In m_string.h because bzero() becomes available only there
      storage/maria/ma_check.c:
        compiler error under Windows (declaration after statements...)
      storage/maria/ma_key.c:
        trnman.h is not in include/ but in storage/maria
      storage/maria/ma_sp_key.c:
        trnman.h is not in include/ but in storage/maria
      storage/maria/ma_write.c:
        avoid compiler warning (org_key.flag may be used uninitialized)
      f0c53638
    • Michael Widenius's avatar
      Added versioning of Maria index · 52cb0c24
      Michael Widenius authored
      Store max_trid in index file as state.create_trid. This is used to pack all transids in the index pages relative to max possible transid for file.
      Enable versioning for transactional tables with index. Tables with an auto-increment key, rtree or fulltext keys are not versioned.
      Changed info->lastkey to type MARIA_KEY. Removed info->lastkey_length as this is now part of info->lastkey
      Renamed old info->lastkey to info->lastkey_buff
      Use exact key lenghts for keys, not USE_WHOLE_KEY
      For partial key searches, use SEARCH_PART_KEY
      When searching to insert new key on page, use SEARCH_INSERT to mark that key has rowid
      
      Changes done in a lot of files:
      - Modified functions to use MARIA_KEY instead of key pointer and key length
      - Use keyinfo->root_lock instead of share->key_root_lock[keynr]
      - Simplify code by using local variable keyinfo instead if share->keyinfo[i]
      - Added #fdef EXTERNAL_LOCKING around removed state elements
      - HA_MAX_KEY_BUFF -> MARIA_MAX_KEY_BUFF (to reserve space for transid)
      - Changed type of 'nextflag' to uint32 to ensure all SEARCH_xxx flags fits into it
      
      .bzrignore:
        Added missing temporary directory
      extra/Makefile.am:
        comp_err is now deleted on make distclean
      include/maria.h:
        Added structure MARIA_KEY, which is used for intern key objects in Maria.
        Changed functions to take MARIA_KEY as an argument instead of pointer to packed key.
        Changed some functions that always return true or false to my_bool.
        Added virtual function make_key() to avoid if in _ma_make_key()
        Moved rw_lock_t for locking trees from share->key_root_lock to MARIA_KEYDEF. This makes usage of the locks simpler and faster
      include/my_base.h:
        Added HA_RTREE_INDEX flag to mark rtree index. Used for easier checks in ma_check()
        Added SEARCH_INSERT to be used when inserting new keys
        Added SEARCH_PART_KEY for partial searches
        Added SEARCH_USER_KEY_HAS_TRANSID to be used when key we use for searching in btree has a TRANSID
        Added SEARCH_PAGE_KEY_HAS_TRANSID to be used when key we found in btree has a transid
      include/my_handler.h:
        Make next_flag 32 bit to make sure we can handle all SEARCH_ bits
      mysql-test/include/maria_empty_logs.inc:
        Read and restore current database; Don't assume we are using mysqltest.
        Don't log use databasename to log. Using this include should not cause any result changes.
      mysql-test/r/maria-gis-rtree-dynamic.result:
        Updated results after adding some check table commands to help pinpoint errors
      mysql-test/r/maria-mvcc.result:
        New tests
      mysql-test/r/maria-purge.result:
        New result after adding removal of logs
      mysql-test/r/maria-recovery-big.result:
        maria_empty_logs doesn't log 'use mysqltest' anymore
      mysql-test/r/maria-recovery-bitmap.result:
        maria_empty_logs doesn't log 'use mysqltest' anymore
      mysql-test/r/maria-recovery-rtree-ft.result:
        maria_empty_logs doesn't log 'use mysqltest' anymore
      mysql-test/r/maria-recovery.result:
        maria_empty_logs doesn't log 'use mysqltest' anymore
      mysql-test/r/maria.result:
        New tests
      mysql-test/r/variables-big.result:
        Don't log id as it's not predictable
      mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb_2.result:
        Updated results to new binlog results. (Test has not been run in a long time as it requires --big)
      mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt:
        Moved file to ndb replication test directory
      mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test:
        Fixed wrong path to included tests
      mysql-test/t/maria-gis-rtree-dynamic.test:
        Added some check table commands to help pinpoint errors
      mysql-test/t/maria-mvcc.test:
        New tests
      mysql-test/t/maria-purge.test:
        Remove logs to make test results predictable
      mysql-test/t/maria.test:
        New tests for some possible problems
      mysql-test/t/variables-big.test:
        Don't log id as it's not predictable
      mysys/my_handler.c:
        Updated function comment to reflect old code
        Changed nextflag to be uint32 to ensure we can have flags > 16 bit
        Changed checking if we are in insert with NULL keys as next_flag can now include additional bits that have to be ignored.
        Added SEARCH_INSERT flag to be used when inserting new keys in btree. This flag tells us the that the keys includes row position and it's thus safe to remove SEARCH_FIND
        Added comparision of transid. This is only done if the keys actually have a transid, which is indicated by nextflag
      mysys/my_lock.c:
        Fixed wrong test (Found by Guilhem)
      scripts/Makefile.am:
        Ensure that test programs are deleted by make clean
      sql/rpl_rli.cc:
        Moved assignment order to fix compiler warning
      storage/heap/hp_write.c:
        Add SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
      storage/maria/Makefile.am:
        Remove also maria log files when doing make distclean
      storage/maria/ha_maria.cc:
        Use 'file->start_state' as default state for transactional tables without versioning
        At table unlock, set file->state to point to live state. (Needed for information schema to pick up right number of rows)
        In ha_maria::implicit_commit() move all locked (ie open) tables to new transaction. This is needed to ensure ha_maria->info doesn't point to a deleted history event.
        Disable concurrent inserts for insert ... select and table changes with subqueries if statement based replication as this would cause wrong results on slave
      storage/maria/ma_blockrec.c:
        Updated comment
      storage/maria/ma_check.c:
        Compact key pages (removes transid) when doing --zerofill
        Check that 'page_flag' on key pages contains KEYPAGE_FLAG_HAS_TRANSID if there is a single key on the page with a transid
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Use new interface to _ma_rec_pos(), _ma_dpointer(), _ma_ft_del(), ma_update_state_lsn()
        Removed not needed argument from get_record_for_key()
        Fixed that we check doesn't give errors for RTREE; We now treath these like SPATIAL
        Remove some SPATIAL specific code where the virtual functions can handle this in a general manner
        Use info->lastkey_buff instead of info->lastkey
        _ma_dpos() -> _ma_row_pos_from_key()
        _ma_make_key() -> keyinfo->make_key()
        _ma_print_key() -> _ma_print_keydata()
        _ma_move_key() -> ma_copy_copy()
        Add SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
        Ensure that data on page doesn't overwrite page checksum position
        Use DBUG_DUMP_KEY instead of DBUG_DUMP
        Use exact key lengths instead of USE_WHOLE_KEY to ha_key_cmp()
        Fixed check if rowid points outside of BLOCK_RECORD data file
        Use info->lastkey_buff instead of key on stack in some safe places
        Added #fdef EXTERNAL_LOCKING around removed state elements
      storage/maria/ma_close.c:
        Use keyinfo->root_lock instead of share->key_root_lock[keynr]
      storage/maria/ma_create.c:
        Removed assert that is already checked in maria_init()
        Force transactinal tables to be of type BLOCK_RECORD
        Fixed wrong usage of HA_PACK_RECORD (should be HA_OPTION_PACK_RECORD)
        Mark keys that uses HA_KEY_ALG_RTREE with HA_RTREE_INDEX for easier handling of these in ma_check
        Store max_trid in index file as state.create_trid. This is used to pack all transids in the index pages relative to max possible transid for file.
      storage/maria/ma_dbug.c:
        Changed _ma_print_key() to use MARIA_KEY
      storage/maria/ma_delete.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        info->lastkey2-> info->lastkey_buff2
        Added SEARCH_INSERT to signal ha_key_cmp that we we should also compare rowid for keys
        Use new interface for get_key(), _ma_get_last_key() and others
        _ma_dpos() -> ma_row_pos_from_key()
        Simplify setting of prev_key in del()
        Ensure that KEYPAGE_FLAG_HAS_TRANSID is set in page_flag if key page has transid
        Treath key pages that may have a transid as if keys would be of variable length
      storage/maria/ma_delete_all.c:
        Reset history state if maria_delete_all_rows() are called
        Update parameters to _ma_update_state_lsns() call
      storage/maria/ma_extra.c:
        Store and restore info->lastkey
      storage/maria/ma_ft_boolean_search.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_ft_nlq_search.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Use lastkey_buff2 instead of info->lastkey+info->s->base.max_key_length (same thing)
      storage/maria/ma_ft_update.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_ftdefs.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_fulltext.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_init.c:
        Check if blocksize is legal
        (Moved test here from ma_open())
      storage/maria/ma_key.c:
        Added functions for storing/reading of transid 
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Moved _ma_sp_make_key() out of _ma_make_key() as we now use keyinfo->make_key to create keys
        Add transid to keys if table is versioned
        Added _ma_copy_key()
      storage/maria/ma_key_recover.c:
        Add logging of page_flag (holds information if there are keys with transid on page)
        Changed DBUG_PRINT("info" -> DBUG_PRINT("redo" as the redo logging can be quite extensive
        Added lots of DBUG_PRINT()
        Added support for index page operations: KEY_OP_SET_PAGEFLAG and KEY_OP_COMPACT_PAGE
      storage/maria/ma_key_recover.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_locking.c:
        Added new arguments to _ma_update_state_lsns_sub()
      storage/maria/ma_loghandler.c:
        Fixed all logging of LSN to look similar in DBUG log
        Changed if (left != 0) to if (left) as the later is used also later in the code
      storage/maria/ma_loghandler.h:
        Added new index page operations
      storage/maria/ma_open.c:
        Removed allocated "state_dummy" and instead use share->state.common for transactional tables that are not versioned
        This is needed to not get double increments of state.records (one in ma_write.c and on when log is written)
        Changed info->lastkey to MARIA_KEY type
        Removed resetting of MARIA_HA variables that have 0 as default value (as info is zerofilled)
        Enable versioning for transactional tables with index. Tables with an auto-increment key, rtree or fulltext keys are not versioned.
        Check on open that state.create_trid is correct
        Extend share->base.max_key_length in case of transactional table so that it can hold transid
        Removed 4.0 compatible fulltext key mode as this is not relevant for Maria
        Removed old and wrong #ifdef ENABLE_WHEN_WE_HAVE_TRANS_ROW_ID code block
        Initialize all new virtual function pointers
        Removed storing of state->unique, state->process and store state->create_trid instead
      storage/maria/ma_page.c:
        Added comment to describe key page structure
        Added functions to compact key page and log the compact operation
      storage/maria/ma_range.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Use SEARCH_PART_KEY indicator instead of USE_WHOLE_KEY to detect if we are doing a part key search
        Added handling of pages with transid
      storage/maria/ma_recovery.c:
        Don't assert if table we opened are not transactional. This may be a table which has been changed from transactional to not transactinal
        Added new arguments to _ma_update_state_lsns()
      storage/maria/ma_rename.c:
        Added new arguments to _ma_update_state_lsns()
      storage/maria/ma_rkey.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Don't use USE_WHOLE_KEY, use real length of key
        Use share->row_is_visible() to test if row is visible
        Moved search_flag == HA_READ_KEY_EXACT out of 'read-next-row' loop as this only need to be tested once
        Removed test if last_used_keyseg != 0 as this is always true
      storage/maria/ma_rnext.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Simplify code by using local variable keyinfo instead if share->keyinfo[i]
        Use share->row_is_visible() to test if row is visible
      storage/maria/ma_rnext_same.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        lastkey2 -> lastkey_buff2
      storage/maria/ma_rprev.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Simplify code by using local variable keyinfo instead if share->keyinfo[i]
        Use share->row_is_visible() to test if row is visible
      storage/maria/ma_rsame.c:
        Updated comment
        Simplify code by using local variable keyinfo instead if share->keyinfo[i]
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_rsamepos.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_rt_index.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Use better variable names
        Removed not needed casts
        _ma_dpos() -> _ma_row_pos_from_key()
        Use info->last_rtree_keypos to save position to key instead of info->int_keypos
        Simplify err: condition
        Changed return type for maria_rtree_insert() to my_bool as we are only intressed in ok/fail from this function
      storage/maria/ma_rt_index.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_rt_key.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Simplify maria_rtree_add_key by combining idenitcal code and removing added_len
      storage/maria/ma_rt_key.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_rt_mbr.c:
        Changed type of 'nextflag' to uint32
        Added 'to' argument to RT_PAGE_MBR_XXX functions to more clearly see which variables changes value
      storage/maria/ma_rt_mbr.h:
        Changed type of 'nextflag' to uint32
      storage/maria/ma_rt_split.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        key_length -> key_data_length to catch possible errors
      storage/maria/ma_rt_test.c:
        Fixed wrong comment
        Reset recinfo to avoid valgrind varnings
        Fixed wrong argument to create_record() that caused test to fail
      storage/maria/ma_search.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Added support of keys with optional trid
        Test for SEARCH_PART_KEY instead of USE_WHOLE_KEY to detect part key reads
        _ma_dpos() -> _ma_row_pos_from_key()
        If there may be keys with transid on the page, have _ma_bin_search() call _ma_seq_search()
        Add _ma_skip_xxx() functions to quickly step over keys (faster than calling get_key() in most cases as we don't have to copy key data)
        Combine similar code at end of _ma_get_binary_pack_key()
        Removed not used function _ma_move_key()
        In _ma_search_next() don't call _ma_search() if we aren't on a nod page.
        Update info->cur_row.trid with trid for found key
        
        
        
        Removed some not needed casts
        Added _ma_trid_from_key()
        Use MARIA_SHARE instead of MARIA_HA as arguments to _ma_rec_pos(), _ma_dpointer() and _ma_xxx_keypos_to_recpos() to make functions faster and smaller
      storage/maria/ma_sort.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_sp_defs.h:
        _ma_sp_make_key() now fills in and returns (MARIA_KEY *) value
      storage/maria/ma_sp_key.c:
        _ma_sp_make_key() now fills in and returns (MARIA_KEY *) value
        Don't test sizeof(double), test against 8 as we are using float8store()
        Use mi_float8store() instead of doing swap of value (same thing but faster)
      storage/maria/ma_state.c:
        maria_versioning() now only calls _ma_block_get_status() if table supports versioning
        Added _ma_row_visible_xxx() functions for different occasions
        When emptying history, set info->state to point to the first history event.
      storage/maria/ma_state.h:
        Added _ma_row_visible_xxx() prototypes
      storage/maria/ma_static.c:
        Indentation changes
      storage/maria/ma_statrec.c:
        Fixed arguments to _ma_dpointer() and _ma_rec_pos()
      storage/maria/ma_test1.c:
        Call init_thr_lock() if we have versioning
      storage/maria/ma_test2.c:
        Call init_thr_lock() if we have versioning
      storage/maria/ma_unique.c:
        Modified functions to use MARIA_KEY
      storage/maria/ma_update.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
      storage/maria/ma_write.c:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Simplify code by using local variable keyinfo instead if share->keyinfo[i]
        In _ma_enlarge_root(), mark in page_flag if new key has transid
        _ma_dpos() -> _ma_row_pos_from_key()
        Changed return type of _ma_ck_write_tree() to my_bool as we are only testing if result is true or not
        Moved 'reversed' to outside block as area was used later
      storage/maria/maria_chk.c:
        Added error if trying to sort with HA_BINARY_PACK_KEY
        Use new interface to get_key() and _ma_dpointer()
        _ma_dpos() -> _ma_row_pos_from_key()
      storage/maria/maria_def.h:
        Modified functions to use MARIA_KEY instead of key pointer and key length
        Added 'common' to MARIA_SHARE->state for storing state for transactional tables without versioning
        Added create_trid to MARIA_SHARE
        Removed not used state variables 'process' and 'unique'
        Added defines for handling TRID's in index pages
        Changed to use MARIA_SHARE instead of MARIA_HA for some functions
        Added 'have_versioning' flag if table supports versioning
        Moved key_root_lock from MARIA_SHARE to MARIA_KEYDEF
        Changed last_key to be of type MARIA_KEY. Removed lastkey_length
        lastkey -> lastkey_buff, lastkey2 -> lastkey_buff2
        Added _ma_get_used_and_nod_with_flag() for faster access to page data when page_flag is read
        Added DBUG_DUMP_KEY for easier DBUG_DUMP of a key
        Changed 'nextflag' and assocaited variables to uint32
      storage/maria/maria_ftdump.c:
        lastkey -> lastkey_buff
      storage/maria/trnman.c:
        Fixed wrong initialization of min_read_from and max_commit_trid
        Added trnman_get_min_safe_trid()
      storage/maria/unittest/ma_test_all-t:
        Added --start-from
      storage/myisam/mi_check.c:
        Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
      storage/myisam/mi_delete.c:
        Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
      storage/myisam/mi_range.c:
        Updated comment
      storage/myisam/mi_write.c:
        Added SEARCH_INSERT, as ha_key_cmp() needs it when doing key comparision for inserting key on page in rowid order
      storage/myisam/rt_index.c:
        Fixed wrong parameter to rtree_get_req() which could cause crash
      52cb0c24
  9. 29 May, 2008 1 commit
    • unknown's avatar
      WL#3138: Maria - fast "SELECT COUNT(*) FROM t;" and "CHECKSUM TABLE t" · 5099033c
      unknown authored
      Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
      Fixed wrong call to strmake
      Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert
      Allow storing year 2155 in year field
      When running with purify/valgrind avoid copying structures over themself
      Added hook 'trnnam_end_trans_hook' that is called when transaction ends
      Added trn->used_tables that is used to an entry for all tables used by transaction
      Fixed that ndb doesn't crash on duplicate key error when start_bulk_insert/end_bulk_insert are not called
      
      
      include/maria.h:
        Added argument to maria_end_bulk_insert() to know if the table will be deleted after the operation
      include/my_tree.h:
        Added macro 'reset_free_element()' to be able to ignore calls to the external free function.
        Is used to optimize end-bulk-insert in case of failures, in which case we don't want write the remaining keys in the tree
      mysql-test/install_test_db.sh:
        Upgrade to new mysql_install_db options
      mysql-test/r/maria-mvcc.result:
        New tests
      mysql-test/r/maria.result:
        New tests
      mysql-test/suite/ndb/r/ndb_auto_increment.result:
        Fixed error message now when bulk insert is not always called
      mysql-test/suite/ndb/t/ndb_auto_increment.test:
        Fixed error message now when bulk insert is not always called
      mysql-test/t/maria-mvcc.test:
        Added testing of versioning of count(*)
      mysql-test/t/maria-page-checksum.test:
        Added comment
      mysql-test/t/maria.test:
        More tests
      mysys/hash.c:
        Code style change
      sql/field.cc:
        Allow storing year 2155 in year field
      sql/ha_ndbcluster.cc:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_ndbcluster.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_partition.cc:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/ha_partition.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored
      sql/handler.cc:
        Don't call get_dup_key() if there is no table object. This can happen if the handler generates a duplicate key error on commit
      sql/handler.h:
        Added new argument to end_bulk_insert() to signal if the bulk insert should ignored (ie, the table will be deleted)
      sql/item.cc:
        Style fix
        Removed compiler warning
      sql/log_event.cc:
        Added new argument to ha_end_bulk_insert()
      sql/log_event_old.cc:
        Added new argument to ha_end_bulk_insert()
      sql/mysqld.cc:
        Removed compiler warning
      sql/protocol.cc:
        Added DBUG
      sql/sql_class.cc:
        Added DBUG
        Fixed wrong call to strmake
      sql/sql_insert.cc:
        Don't call bulk insert in case of inserting only one row (speed optimization as starting/stopping bulk insert involves a lot of if's)
        Added new argument to ha_end_bulk_insert()
      sql/sql_load.cc:
        Added new argument to ha_end_bulk_insert()
      sql/sql_parse.cc:
        Style fixes
        Avoid goto in common senario
      sql/sql_select.cc:
        When running with purify/valgrind avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
      sql/sql_select.h:
        Avoid copying structures over themself.  This is not a real bug in itself, but it's a waste of cycles and causes valgrind warnings
      sql/sql_table.cc:
        Call HA_EXTRA_PREPARE_FOR_DROP if table created by ALTER TABLE is going to be dropped
        Added new argument to ha_end_bulk_insert()
      storage/archive/ha_archive.cc:
        Added new argument to end_bulk_insert()
      storage/archive/ha_archive.h:
        Added new argument to end_bulk_insert()
      storage/federated/ha_federated.cc:
        Added new argument to end_bulk_insert()
      storage/federated/ha_federated.h:
        Added new argument to end_bulk_insert()
      storage/maria/Makefile.am:
        Added ma_state.c and ma_state.h
      storage/maria/ha_maria.cc:
        Versioning of count(*) and checksum
        - share->state.state is now assumed to be correct, not handler->state
        - Call _ma_setup_live_state() in external lock to get count(*)/checksum versioning. In case of
          not versioned and not concurrent insertable table, file->s->state.state contains the correct state information
        
        Other things:
        - file->s -> share
        - Added DBUG_ASSERT() for unlikely case
        - Optimized end_bulk_insert() to not write anything if table is going to be deleted (as in failed alter table)
        - Indentation changes in external_lock becasue of removed 'goto' caused a big conflict even if very little was changed
      storage/maria/ha_maria.h:
        New argument to end_bulk_insert()
      storage/maria/ma_blockrec.c:
        Update for versioning of count(*) and checksum
        Keep share->state.state.data_file_length up to date (not info->state->data_file_length)
        Moved _ma_block_xxxx_status() and maria_versioning() functions to ma_state.c
      storage/maria/ma_check.c:
        Update and use share->state.state instead of info->state
        info->s to share
        Update info->state at end of repair
        Call _ma_reset_state() to update share->state_history at end of repair
      storage/maria/ma_checkpoint.c:
        Call _ma_remove_not_visible_states() on checkpoint to clean up not visible state history from tables
      storage/maria/ma_close.c:
        Remember state history for running transaction even if table is closed
      storage/maria/ma_commit.c:
        Ensure we always call trnman_commit_trn() even if other calls fails. If we don't do that, the translog and state structures will not be freed
      storage/maria/ma_delete.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
      storage/maria/ma_delete_all.c:
        Versioning of count(*) and checksum:
        - Ensure that share->state.state is updated, as here is where we store the primary information
      storage/maria/ma_dynrec.c:
        Use lock_key_trees instead of concurrent_insert to check if trees should be locked.
        This allows us to lock trees both for concurrent_insert and for index versioning.
      storage/maria/ma_extra.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - share->concurrent_insert -> share->non_transactional_concurrent_insert
        - Don't update share->state.state from info->state if transactional table
        
        Optimization:
        - Don't flush io_cache or bitmap if we are using FLUSH_IGNORE_CHANGED
      storage/maria/ma_info.c:
        Get most state information from current state
      storage/maria/ma_init.c:
        Add hash table and free function to store states for closed tables
        Install hook for transaction commit/rollback to update history state
      storage/maria/ma_key_recover.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
      storage/maria/ma_locking.c:
        Versioning of count(*) and checksum:
        - Call virtual functions (if exists) to restore/update status
        - Move _ma_xxx_status() functions to ma_state.c
        
        info->s -> share
      storage/maria/ma_open.c:
        Versioning of count(*) and checksum:
        - For not transactional tables, set info->state to point to new allocated state structure.
        - Initialize new info->state_start variable that points to state at start of transaction
        - Copy old history states from hash table (maria_stored_states) first time the table is opened
        - Split flag share->concurrent_insert to non_transactional_concurrent_insert & lock_key_tree
        - For now, only enable versioning of tables without keys (to be fixed in soon!)
        - Added new virtual function to restore status in maria_lock_database)
        
        More DBUG
      storage/maria/ma_page.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - Modify share->state.state.key_file_length under share->intern_lock
      storage/maria/ma_range.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
        
        info->s -> share
      storage/maria/ma_recovery.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        - Update state information on close and when reenabling logging
      storage/maria/ma_rkey.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rnext.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rnext_same.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
        - Only skip rows based on file length if non_transactional_concurrent_insert is set
      storage/maria/ma_rprev.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_rsame.c:
        Versioning of count(*) and checksum:
        - Lock trees based on share->lock_key_trees
      storage/maria/ma_sort.c:
        Use share->state.state instead of info->state
        Fixed indentation
      storage/maria/ma_static.c:
        Added maria_stored_state
      storage/maria/ma_update.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
        - Remove optimization for index file update as it doesn't work for transactional tables
      storage/maria/ma_write.c:
        Versioning of count(*) and checksum:
        - Always update info->state->checksum and info->state->records
      storage/maria/maria_def.h:
        Move MARIA_STATUS_INFO to ma_state.h
        
        Changes to MARIA_SHARE:
        - Added state_history to store count(*)/checksum states
        - Added in_trans as counter if table is used by running transactions
        - Split concurrent_insert into lock_key_trees and on_transactional_concurrent_insert.
        - Added virtual function lock_restore_status
        
        Changes to MARIA_HA:
        - save_state -> state_save
        - Added state_start to store state at start of transaction
      storage/maria/maria_pack.c:
        Versioning of count(*) and checksum:
        - Use share->state.state instead of info->state
        
        Indentation fixes
      storage/maria/trnman.c:
        Added hook 'trnnam_end_trans_hook' that is called when transaction ends
        Added trn->used_tables that is used to an entry for all tables used by transaction
        More DBUG
        Changed return type of trnman_end_trn() to my_bool
        Added trnman_get_min_trid() to get minimum trid in use.
        Added trnman_exists_active_transactions() to check if there exist a running transaction started between two commit id
      storage/maria/trnman.h:
        Added 'used_tables'
        Moved all pointers into same groups to get better memory alignment
      storage/maria/trnman_public.h:
        Added prototypes for new functions and variables
        Chagned return type of trnman_end_trn() to my_bool
      storage/myisam/ha_myisam.cc:
        Added argument to end_bulk_insert() if operation should be aborted
      storage/myisam/ha_myisam.h:
        Added argument to end_bulk_insert() if operation should be aborted
      storage/maria/ma_state.c:
        Functions to handle state of count(*) and checksum
      storage/maria/ma_state.h:
        Structures and declarations to handle state of count(*) and checksum
      5099033c
  10. 24 Apr, 2008 1 commit
    • unknown's avatar
      WL#3072 - Maria Recovery · c9a82581
      unknown authored
      Recovery of R-tree and fulltext indices.
      Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using
      repair-with-keycache method".
      Fix for bug (see ma_rt_index.c) where we could have a wrong
      page_link pointer causing wrong memory access during some R-tree
      index insert/delete.
      Making ma_rt_test work again (it had been neglected over time) and
      adding options (record type etc) to prepare it for integration into
      ma_test_all-t (but there is BUG#36321 about "ma_rt_test -M" crash)
      
      
      mysql-test/r/maria.result:
        correct result
      mysql-test/t/maria.test:
        now we get no error
      storage/maria/ma_blockrec.c:
        delete_dir_entry() and delete_head_or_tail() don't use info->keyread_buff.
        ma_get_length() does not change **packet, marking it with 'const' to
        remove some casts in callers of this function. The
        (const uchar**)&header casts will be removed when Monty changes 'header'
        to const uchar*.
        _ma_apply_redo_purge_row_head_or_tail() sets 'buff' from pagecache_read()
        so its initialization was superfluous.
      storage/maria/ma_check.c:
        Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using repair-with-keycache method"
        (see comment in code)
      storage/maria/ma_create.c:
        FULLTEXT and SPATIAL indices have logging now, they are recoverable.
      storage/maria/ma_delete.c:
        Logging done by _ma_ck_delete() is moved to a function
        (_ma_write_undo_key_delete()), for reusal by R-tree logging.
        _ma_log_delete() is made non-static for same
        reason, and some of its parameters are made pointers to const.
        Removed wrong comment ("Note that for delete key" etc, contradicted by
        code and comment "Log also position to row" a few lines above)
      storage/maria/ma_ft_update.c:
        unneeded cast, comment for future
      storage/maria/ma_key_recover.c:
        Comment about possible deadlock.
        Write bad page to DBUG trace if KEY_OP_CHECK founds bad CRC.
        Support operation KEY_OP_MULTI_COPY.
        When we execute, in UNDO phase, UNDO_KEY_DELETE|INSERT, we must call
        the proper key insertion|deletion depending on if this is R-tree
        or B-tree.
        Explanation of of _ma_[un]lock_key_del() work, maybe useful for
        mortals like me.
      storage/maria/ma_key_recover.h:
        change of prototypes
      storage/maria/ma_loghandler.h:
        New operation which can be stored in REDO_INDEX log records: KEY_OP_MULTI_COPY
      storage/maria/ma_page.c:
        Comments
      storage/maria/ma_pagecache.c:
        typo
      storage/maria/ma_rt_index.c:
        Fix for bug: the page_link pointer in maria_rtree_insert_req()
        could be wrong when we set its 'changed' member; for the solution
        see ma_key_recover.h. It is needed only in cases when we manipulate
        several pages.
        Logging of changes done to pages by key insert/delete.
        maria_rtree_delete()'s main work is moved to a new function
        maria_rtree_real_delete(), which is used by maria_rtree_delete()
        and by applying of UNDO_KEY_INSERT.
      storage/maria/ma_rt_index.h:
        new prototypes and macros for ma_rt_index.c
      storage/maria/ma_rt_key.c:
        Logging of maria_rtree_add_key() and maria_rtree_delete_key().
        When inserting, split is necessary if there is not enough room for key:
        take checksum's occupied space in this calculation.
      storage/maria/ma_rt_key.h:
        new prototypes (those functions need to know the page's id
        because they do logging)
      storage/maria/ma_rt_mbr.c:
        Comments about what the functions change.
      storage/maria/ma_rt_split.c:
        maria_rtree_split_page() needs to know the page's id, because
        it does logging.
        Logging of what a split operation does to the split page (see
        comment of _ma_log_rt_split(): moves of keys inside the page,
        sometimes insertion of the new key, and shrinking of the page)
        and to the new page (receives some keys from split page, and
        sometimes the new key).
      storage/maria/ma_rt_test.c:
        ma_rt_test had been forgotten when maria_rkey() was changed some months ago
        (0->HA_WHOLE_KEY change), and when calls to maria_rnd(,,HA_OFFSET_ERROR)
        were rewritten to maria_scan() calls (which implies maria_scan_init()).
        The 'max_i' change is to adapt to the fact that maria_scan() does
        not return deleted records for BLOCK_RECORD but does so for other formats;
        the initial code assumed a certain number of deleted records would be
        returned, we change it to rather count only non-deleted ones.
        We also add more features to this test, like ma_test1 (the plan
        is to run ma_rt_test in ma_test_all-t):
        options to choose records' format, table checksum, transactions,
        checkpoints, end at specific stages, abort without committing,
        and debug trace.
      storage/maria/ma_test1.c:
        MY_INIT() does my_init().
      storage/maria/ma_write.c:
        Logging done by _ma_ck_write_btree_with_log() is moved to a function
        (_ma_write_undo_key_insert()), for reusal by R-tree logging.
        _ma_log_new() and _ma_log_change() are made non-static for same
        reason. Some parameters of logging functions are made pointers to const.
        If EXTRA_DEBUG_KEY_CHANGES, we now log CRC in _ma_log_change() too
        (better checks, bigger record).
      storage/maria/maria_read_log.c:
        Program takes no arguments, bail out if any, instead of silently discarding them
      storage/myisam/rt_test.c:
        rt_test had been forgotten when mi_rkey() was changed some months ago
        (0->HA_WHOLE_KEY change).
        The 'max_i' change is to make it symmetric with ma_rt_test.c
      mysql-test/r/maria-gis-rtree-dynamic.result:
        correct result
      mysql-test/r/maria-gis-rtree-trans.result:
        correct result
      mysql-test/r/maria-recovery-rtree-ft.result:
        almost correct result (hitting BUG# in the end)
      mysql-test/t/maria-gis-rtree-dynamic.test:
        test R-tree & dynamic row format
      mysql-test/t/maria-gis-rtree-trans.test:
        Test R-tree and page row format and transactional
      mysql-test/t/maria-recovery-rtree-ft-master.opt:
        usual options for recovery testing
      mysql-test/t/maria-recovery-rtree-ft.test:
        test of recovery of R-tree and fulltext indices.
      c9a82581
  11. 10 Apr, 2008 1 commit
    • unknown's avatar
      Added versioning of row data · 126c1228
      unknown authored
      Will in future changeset (soon) av versioning of status variables (number of rows) and index
      Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings
      Removed some not needed variables (as noticed by Guilhem)
      
      
      include/maria.h:
        Added prototypes for maria_chk_init_for_check(), maria_versioning() and maria_ignore_trids()
      include/my_base.h:
        Add new error HA_ERR_ROW_NOT_VISIBLE
      include/myisamchk.h:
        Added variables for checking visibility of rows during maria_chk
      include/thr_lock.h:
        Changed argument type from int to my_bool for get_status
        Added variable allow_multiple_concurrent_insert, to signal if table supports multiple concurrent inserts
      mysql-test/r/maria-page-checksum.result:
        Added missing drop table
      mysql-test/t/maria-page-checksum.test:
        Added missing drop table
      mysys/my_handler.c:
        Added new error messages
      mysys/thr_lock.c:
        Added support for multiple concurrent inserts, if table handler supports it
      sql/sql_yacc.yy:
        Added LOCK TABLE table_name WRITE CONCURRENT
        This was added (temporarly?) to be able to check versioning with Maria
      storage/csv/ha_tina.cc:
        Updated parameter for get_status
      storage/maria/ha_maria.cc:
        Added calls to maria_chk_init_status()
        Fixed call to ma_control_file_open()
      storage/maria/ma_blockrec.c:
        Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings
        Changed back some 'header' parameters to const char*
        Removed some casts
        
        Added support for versioning:
        - If info->row_flag & ROW_FLAG_TRANSID is set, store transaction id together with the row
        - When reading rows, check if rows are visible. Give error if not
        - When scanning table, ignore not visible rows
        - Added function parameters to some functions, to be able to call _ma_compact_block_page() with different parameters depending of if the page is a HEAD or TAIL page
        - _ma_compact_block_page() deletes transaction id's that are visible by all running transactions
        - Added functions for thr_lock() to enable multiple concurrent inserts
        - Added helper function 'mysql_versioning()' to enable/disable versioning
        - Added helper function maria_ignore_trids(), used by maria_chk and maria_pack to see all rows.
      storage/maria/ma_blockrec.h:
        Updated parameters for some functions.
        Added new functions to read/store state with thr_lock
      storage/maria/ma_check.c:
        Enable handling of transaction id's in rows
        Give a readable error if a table contains a transation id that makes rows not visible
      storage/maria/ma_control_file.c:
        Added option to not give warning if control file doesn't exists.
      storage/maria/ma_control_file.h:
        Updated parameter lists for ma_control_file_open()
      storage/maria/ma_delete.c:
        Removed not used variable (suggestion by Guilhem)
      storage/maria/ma_locking.c:
        Changed type of argument from int -> my_bool
      storage/maria/ma_open.c:
        Removed not used variables 'key_write_undo_lsn' and 'key_delete_undo_lsn'
        Added new thr_lock interface functions for BLOCK_RECORD to enable multiple concurrent insert
      storage/maria/ma_test1.c:
        Added option --versioning (-C) to check versioning
      storage/maria/ma_test2.c:
        Added option -C to check versioning
      storage/maria/ma_test_recovery:
        Forward argumetns to ma_test_recovery.pl
      storage/maria/ma_write.c:
        Removed not used variable key_write_undo_lsn
      storage/maria/maria_chk.c:
        Always read control file (if exist) at start
        Initialize checking of tables by calling maria_chk_init_for_check()
        In verbose mode and in case of error, print max found transaction id
      storage/maria/maria_def.h:
        Added Trid to MARIA_ROW to be able to check transaction id for found row
        Moved 'base_length' from MARIA_ROW to MARIA_HA to be able to handle different base length (with and without TRANSID) without if's
        Added default row_flag to MARIA_HA for the same reason
        Changed LEX_STRING -> LEX_CUSTRING to avoid casts in ma_blockrec.c
        Removed not needed variables key_write_undo_lsn and key_delete_undo_lsn
        Added prototypes for new functions and fixed those that had changed
      storage/maria/maria_pack.c:
        Ensure we can read all rows from the file, independent of the used transaction id
      storage/maria/maria_read_log.c:
        Updated arguments to ma_control_file_open()
      storage/maria/trnman.c:
        If we have only one transaction, fixed that min_read_from contains current transaction
        Fixed that trnman_can_read_from() returns that row is readable if it was written by current transaction
      storage/maria/unittest/ma_control_file-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_all-t:
        Added test of versioning
        Removed printing of one extra space
      storage/maria/unittest/ma_test_loghandler-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_nologs-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        Updated arguments to ma_control_file_open()
      storage/maria/unittest/ma_test_recovery.expected:
        Updated file with result from new tests
      storage/maria/unittest/ma_test_recovery.pl:
        Added options --abort-on-error and --verbose
        In case of --verbose, print all excuted shell commands
        Added test of versioning
      storage/myisam/mi_locking.c:
        Updated type of parameter
      storage/myisam/myisamdef.h:
        Updated type of parameter
      mysql-test/r/maria-mvcc.result:
        New BitKeeper file ``mysql-test/r/maria-mvcc.result''
      mysql-test/t/maria-mvcc.test:
        New BitKeeper file ``mysql-test/t/maria-mvcc.test''
      126c1228
  12. 04 Apr, 2008 1 commit
    • unknown's avatar
      Store maximum transaction id into control file at clean shutdown. · 722a8ebe
      unknown authored
      This can serve to maria_chk to check that trids found in rows and keys
      are not too big. Also used by Recovery when logs are lost.
      Options --require-control-file, --datadir, --log-dir (yes, the dashes are
      inconsistent but I imitated mysqld --datadir and --maria-log-dir) for
      maria_chk.
      Lock control file _before_ reading its content.
      
      
      storage/maria/ha_maria.cc:
        new prototype
      storage/maria/ma_check.c:
        A function to find the max trid in the system (consults transaction
        manager and control file), to check tables.
      storage/maria/ma_checkpoint.c:
        new prototype
      storage/maria/ma_control_file.c:
        Store max trid into control file, in a backward-compatible way
        (can still read old control files).
        Parameter to ma_control_file_open(), to not create the log if it's
        missing (maria_chk needs that).
        Lock control file _before_ reading its content.
        Fix for a segfault when reading an old control file (bzero() with a
        negative second argument)
      storage/maria/ma_control_file.h:
        changes to the control file module's API
      storage/maria/ma_init.c:
        When Maria shuts down cleanly, store max trid into control file.
      storage/maria/ma_loghandler.c:
        new prototype
      storage/maria/ma_recovery.c:
        During recovery, consult max trid stored in control file, in case it is
        bigger than what we found in log (case of logs manually removed by user).
      storage/maria/ma_test1.c:
        new prototype
      storage/maria/ma_test2.c:
        new prototype
      storage/maria/maria_chk.c:
        New option --require-control-file (abort if control file not found),
        --datadir (path for control file (and for logs if --log-dir not specified)),
        --log-dir (path for logs).
        Try to open control file when maria_chk starts.
      storage/maria/maria_read_log.c:
        new prototype
      storage/maria/trnman.c:
        A new function to know max trid in transaction manager
      storage/maria/trnman_public.h:
        New function
      storage/maria/unittest/ma_control_file-t.c:
        new prototypes. Testing storing and retrieving the max trid to/from
        control file
      storage/maria/unittest/ma_test_loghandler-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_nologs-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        new prototype
      722a8ebe
  13. 03 Apr, 2008 1 commit
    • unknown's avatar
      Injecting more "const" declarations into code which does not change · f094eff1
      unknown authored
      pointed data.
      I ran gcc -Wcast-qual on storage/maria, this identified un-needed casts,
      a couple of functions which said they had a const parameter though
      they changed the pointed content! This is fixed here. Some suspicious
      places receive a comment.
      The original intention of running -Wcast-qual was to find what code
      changes R-tree keys: I added const words, but hidden casts
      like those of int2store (casts target to (uint16*)) removed const
      checking; -Wcast-qual helped find those hidden casts.
      Log handler does not change the content pointed by LEX_STRING::str it
      receives, so we now use a struct which has a const inside, to emphasize
      this and be able to pass "const uchar*" buffers to log handler
      without fear of their content being changed by it.
      One-line fix for a merge glitch (when merging from MyISAM).
      
      
      include/m_string.h:
        As Maria's log handler uses LEX_STRING but never changes the content
        pointed by LEX_STRING::str, and assigns uchar* into this member most
        of the time, we introduce a new struct LEX_CUSTRING
        (C const U unsigned) for the log handler.
      include/my_global.h:
        In macros which read pointed content: use const pointers so that
        gcc -Wcast-qual does not warn about casting a const pointer to non-const.
      include/my_handler.h:
        In macros which read pointed content: use const pointers so that
        gcc -Wcast-qual does not warn about casting a const pointer to non-const.
        ha_find_null() does not change *a.
      include/my_sys.h:
        insert_dynamic() does not change *element.
      include/myisampack.h:
        In macros which read pointed content: use const pointers so that
        gcc -Wcast-qual does not warn about casting a const pointer to non-const.
      mysys/array.c:
        insert_dynamic() does not change *element
      mysys/my_handler.c:
        ha_find_null() does not change *a
      storage/maria/ma_bitmap.c:
        Log handler receives const strings now
      storage/maria/ma_blockrec.c:
        Log handler receives const strings now.
        _ma_apply_undo_row_delete/update() do change *header.
      storage/maria/ma_blockrec.h:
        correct prototype
      storage/maria/ma_check.c:
        Log handler receives const strings now. Un-needed casts
      storage/maria/ma_checkpoint.c:
        Log handler receives const strings now
      storage/maria/ma_checksum.c:
        unneeded cast
      storage/maria/ma_commit.c:
        Log handler receives const strings now
      storage/maria/ma_create.c:
        Log handler receives const strings now
      storage/maria/ma_dbug.c:
        fixing warning of gcc -Wcast-qual
      storage/maria/ma_delete.c:
        Log handler receives const strings now
      storage/maria/ma_delete_all.c:
        Log handler receives const strings now
      storage/maria/ma_delete_table.c:
        Log handler receives const strings now
      storage/maria/ma_dynrec.c:
        fixing some warnings of gcc -Wcast-qual. Unneeded casts removed.
        Comment about function which lies.
      storage/maria/ma_ft_parser.c:
        fix for warnings of gcc -Wcast-qual, removing unneeded casts
      storage/maria/ma_ft_update.c:
        less casts, comment
      storage/maria/ma_key.c:
        less casts, stay const (warnings of gcc -Wcast-qual)
      storage/maria/ma_key_recover.c:
        Log handler receives const strings now
      storage/maria/ma_loghandler.c:
        Log handler receives const strings now
      storage/maria/ma_loghandler.h:
        Log handler receives const strings now
      storage/maria/ma_loghandler_lsn.h:
        In macros which read pointed content: use const pointers so that
        gcc -Wcast-qual does not warn about casting a const pointer to non-const.
      storage/maria/ma_page.c:
        Log handler receives const strings now; more const
      storage/maria/ma_recovery.c:
        Log handler receives const strings now
      storage/maria/ma_rename.c:
        Log handler receives const strings now
      storage/maria/ma_rt_index.c:
        more const, to emphasize that functions don't change pointed content.
        best_key= NULL was forgotten during merge from MyISAM a few days ago,
        was causing a Valgrind warning
      storage/maria/ma_rt_index.h:
        new proto
      storage/maria/ma_rt_key.c:
        more const
      storage/maria/ma_rt_key.h:
        new proto
      storage/maria/ma_rt_mbr.c:
        more const for functions which deserve it
      storage/maria/ma_rt_mbr.h:
        new prototype
      storage/maria/ma_rt_split.c:
        make const what is not changed.
      storage/maria/ma_search.c:
        un-needed casts, more const
      storage/maria/ma_sp_key.c:
        more const
      storage/maria/ma_unique.c:
        un-needed casts.
      storage/maria/ma_write.c:
        Log handler receives const strings now
      storage/maria/maria_def.h:
        some more const
      storage/maria/unittest/ma_test_loghandler-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_nologs-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        Log handler receives const strings now
      storage/maria/unittest/ma_test_loghandler_purge-t.c:
        Log handler receives const strings now
      f094eff1
  14. 01 Apr, 2008 1 commit
    • unknown's avatar
      Merge of changes in MyISAM since December 16 -> April 1 · 3651e328
      unknown authored
      Fixes bugs:
      Bug#28837  MyISAM storage engine error (134) doing delete with self-join
      Bug#31277  myisamchk --unpack corrupts table
      Bug#4692   DISABLE/ENABLE KEYS waste a space
      Bug#31305  myisam tables crash when they are near capacity
      
      
      BitKeeper/etc/ignore:
        added unittest/tmp/*
      mysql-test/r/maria.result:
        Moved missing tests from myisam.test to maria.test
      mysql-test/t/maria.test:
        Moved missing tests from myisam.test to maria.test
      storage/maria/ha_maria.cc:
        Merge of changes in MyISAM since December 16 -> April 1
        Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join)
      storage/maria/ha_maria.h:
        Merge of changes in MyISAM since December 16 -> April 1
      storage/maria/ma_blockrec.c:
        Merge of changes in MyISAM since December 16 -> April 1
        Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join)
        The problem is that we may be using a cached key page with old information. Versioning will fix this
      storage/maria/ma_check.c:
        Merge of changes in MyISAM since December 16 -> April 1
        This fixes a problem with pack_reclength not beeing big enough (Bug #31277 myisamchk --unpack corrupts table)
        BUG#4692 - DISABLE/ENABLE KEYS waste a space
      storage/maria/ma_delete.c:
        Indentation fixes
      storage/maria/ma_dynrec.c:
        Merge of changes in MyISAM since December 16 -> April 1
        Fixes Bug#31305 myisam tables crash when they are near capacity.
        (This uses a simpler fix than in MyISAM by remembering the length of the current row)
      storage/maria/ma_ft_boolean_search.c:
        Merge of all changes from myisam/ft_boolean_search.c (This file had not been kept up to date)
      storage/maria/ma_open.c:
        Merge of changes in MyISAM since December 16 -> April 1
        Calculate default_rec_buff_size more exact to be sure it's always big enough
      storage/maria/ma_packrec.c:
        Merge of changes in MyISAM since December 16 -> April 1
        Update default_rec_buff_size to be big enough to hold one packed row
        Related to Bug#31277 myisamchk --unpack corrupts table
      storage/maria/ma_rnext_same.c:
        Indentation fixes
      storage/maria/ma_rt_index.c:
        Merge of changes in MyISAM since December 16 -> April 1
      storage/maria/ma_rt_mbr.c:
        Merge of changes in MyISAM since December 16 -> April 1
        (Added comment)
      storage/maria/ma_search.c:
        Merge of changes in MyISAM since December 16 -> April 1
        (Added comment)
      storage/maria/ma_sort.c:
        Merge of changes in MyISAM since December 16 -> April 1
      storage/maria/ma_statrec.c:
        Indentation fixes
      storage/maria/ma_test2.c:
        Indentation fixes
      storage/maria/maria_chk.c:
        Indentation fixes
      storage/maria/maria_pack.c:
        Merge of changes in MyISAM since December 16 -> April 1
      3651e328
  15. 08 Mar, 2008 1 commit
    • unknown's avatar
      Fix for #Bug35048 "maria table corruption reported when transactional=0 · 42455c48
      unknown authored
      Problem was that page in bitmap was marked as full even if there was free places in page directory
      
      
      mysql-test/r/maria.result:
        Test case for problem with head/tail page with 255 entries
        (Bug 35048 "maria table corruption reported when transactional=0)
      mysql-test/t/maria.test:
        Test case for problem with head/tail page with 255 entries
        (Bug 35048 "maria table corruption reported when transactional=0)
      storage/maria/ma_blockrec.c:
        Fix to ensure that bitmap is marked 'full' when the head/tail page directory is full
      storage/maria/ma_check.c:
        Better check when directory for head/tail pages are marked full (The page directory can't hold a row tail + blob tails)
      42455c48
  16. 26 Feb, 2008 1 commit
    • unknown's avatar
      WL#3072 Maria Recovery · b01c9528
      unknown authored
      fixes for ma_test_recovery.pl to work in release builds too:
      - bugfix in maria_zerofill_index()
      - applying of LOGREC_INSERT_ROW_BLOBS now zeroes unused end of non-full
      blob page (a mutation of tail page when it takes >75% of maria_block_size)
      like write_full_pages() does.
      
      
      storage/maria/ma_blockrec.c:
        When we write a non-full blob page at run-time, we zero the rest of
        it (see write_full_pages()). We now do the same in
        _ma_apply_redo_insert_row_blobs(): this is consistent and helps
        having log-applying produce the same page as run-time.
      storage/maria/ma_check.c:
        maria_zerofill_index() was wrong: it didn't zero certain bytes
        because it believed that the count of relevant bytes is
        _ma_get_page_used(share, buff) + share->keypage_header,
        whereas it's only the first term.
      storage/maria/ma_pagecache.c:
        typo
      storage/maria/ma_pagecache.h:
        typo
      storage/maria/maria_chk.c:
        enable --zerofill-keep-lsn in all builds
      storage/maria/unittest/ma_test_recovery.pl:
        now even release builds can run ma_test_recovery.pl, because zerofill
        makes tables of this test (made by run-time and by log-applying)
        identical.
      b01c9528
  17. 18 Feb, 2008 1 commit
    • unknown's avatar
      Merge from 5.1-build of the "my_bool for C" changeset. · 0ab7c2f3
      unknown authored
      Removing "#define bool BOOL" as it's dangerous.
      
      
      include/config-win.h:
        This #define was confusing: a) it changes the semantics of bool but
        only on Windows (C++ standard says that casting int to bool to int
        yields 0 or 1, but if using BOOL (which is int) this breaks, see
        old BUG 11567 "Variable 'foreign_key_checks', and other variables,
        differs binlog tests") b) it is not needed in C++ which has a bool type
        c) it is not needed in C where we must use my_bool as bool either does
        not exist or changes size between C and C++.
      storage/maria/ma_check.c:
        my_bool for C
      storage/maria/ma_dynrec.c:
        my_bool for C
      storage/maria/ma_search.c:
        my_bool for C
      storage/maria/ma_write.c:
        my_bool for C
      storage/maria/maria_def.h:
        my_bool for C
      storage/maria/maria_pack.c:
        my_bool for C
      0ab7c2f3
  18. 11 Feb, 2008 1 commit
    • unknown's avatar
      A new option for maria_chk: --zerofill-keep-lsn. This will be used · d2a3bf33
      unknown authored
      by ma_test_recovery.pl when it happens that Recovery does not recreate
      pages exactly as they were at first run: this option will help us
      verify that the differences are in unimportant page pieces (those pieces
      will be zeroed by --zerofill-keep-lsn, but not the important LSNs).
      
      
      include/myisamchk.h:
        new zerofill flag for maria_chk
      storage/maria/ma_check.c:
        If T_ZEROFILL_KEEP_LSN, we don't zero out LSNs of data/index pages.
        Then the table is not movable. We still mark it zerofilled, it helps
        to know what was last done to the table.
      storage/maria/maria_chk.c:
        New option --zerofill-keep-lsn
      d2a3bf33
  19. 07 Feb, 2008 1 commit
    • unknown's avatar
      Mac compiler warnings fixed. · 311d8e89
      unknown authored
      include/maria.h:
        mac compiler warnings fixed.
      storage/maria/ma_bitmap.c:
        mac compiler warnings fixed.
      storage/maria/ma_blockrec.c:
        mac compiler warnings fixed.
      storage/maria/ma_check.c:
        mac compiler warnings fixed.
      storage/maria/ma_control_file.c:
        mac compiler warnings fixed.
      storage/maria/ma_create.c:
        mac compiler warnings fixed.
      storage/maria/ma_delete.c:
        mac compiler warnings fixed.
      storage/maria/ma_ft_boolean_search.c:
        mac compiler warnings fixed.
      storage/maria/ma_page.c:
        mac compiler warnings fixed.
      storage/maria/ma_pagecache.c:
        mac compiler warnings fixed.
      storage/maria/ma_recovery.c:
        mac compiler warning fixed.
      storage/maria/ma_rt_test.c:
        mac compiler warnings fixed.
      storage/maria/ma_search.c:
        mac compiler warning fixed.
      storage/maria/ma_write.c:
        mac compiler warnings fixed.
      storage/maria/unittest/ma_control_file-t.c:
        mac compiler warnings fixed.
      storage/maria/unittest/ma_pagecache_consist.c:
        mac compiler warnings fixed.
      storage/maria/unittest/ma_pagecache_single.c:
        mac compiler warnings fixed.
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        mac compiler warning fixed.
      storage/maria/unittest/test_file.c:
        mac compiler warning fixed.
      311d8e89
  20. 06 Feb, 2008 1 commit
    • unknown's avatar
      Fixes for running maria-recovery*.test and maria-purge.test under · 7300af84
      unknown authored
      Windows.
      
      
      include/my_dbug.h:
        a DBUG expression to force a flush of the trace file then an abort of the process
      mysql-test/include/wait_until_connected_again.inc:
        mysqladmin waits for pid file to be gone only under Unix; so
        maria_empty_logs.inc cannot wait for mysqld to be gone, so
        wait_until_connected_again.inc may send its "show status" to a 
        not-yet-dead server hence the 1053 error ("server shutdown in progress")
      mysys/my_thr_init.c:
        overload abort() under Windows, to not have an annoying CRT popup
        ("ignore/abort/retry" buttons) each time a test intentionally
        crashes mysqld
      sql/handler.cc:
        use new expression
      sql/log.cc:
        use new expression
      sql/mysql_priv.h:
        use new expression
      storage/maria/ha_maria.cc:
        use new expression
      storage/maria/ma_blockrec.c:
        use new expression
      storage/maria/ma_check.c:
        use new expression
      storage/maria/ma_checkpoint.c:
        use new expression
      storage/maria/ma_control_file.c:
        Can't yet lock control file under Windows (test suite problems,
        plus concerns about stray lock preventing a fast restart after crash).
      storage/maria/ma_loghandler.c:
        A file which should be closed, otherwise translog_purge() (the caller)
        cannot delete logs.
      7300af84
  21. 31 Jan, 2008 1 commit
    • unknown's avatar
      Fixed bug in restoring auto-increment value in case of duplicate key with insert or update · ab0fa111
      unknown authored
      Fixed bug when calculating max_key_length that caused some ALTER TABLE to fail if MAX_ROWS was used.
      Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH
      Fixed bug when scanning table with BLOCK format for repair; If table was > bitmap coverage one page block was read twice which caused a lot of duplicate key errors
      Could not repeat Bug#34106 "auto_increment is reset to 1 when table is recovered from crash" after this patch.
      
      NOTE: This is an incompatible change, so one must do maria_chk -r on ones old Maria tables!
      Sorry, but this was needed to fix the bug with max_key_length and to be able to handle bigger key files with smaller key references
      
      
      cmd-line-utils/readline/readline.c:
        Fixed compiler warnings
      mysql-test/r/maria.result:
        Added more test of auto-increment handling
      mysql-test/t/maria.test:
        Added more test of auto-increment handling
      mysys/my_pread.c:
        Fixed wrong test
        Removed not needed tests (error is always 1 if readbytes != Count)
      mysys/my_read.c:
        Fixed wrong test
      storage/maria/ha_maria.cc:
        Disable LOAD INDEX until I got Sanja's extension to pagecache interface
      storage/maria/ma_blockrec.c:
        Ensure that info->last_auto_increment is reset properly
      storage/maria/ma_check.c:
        Fixed wrong printing of row number in case of duplicate key for --safe-repair
        Safety fix in recreate table so that Column numbers are given to maria_create() in original order
        Added missing HA_OPEN_FOR_REPAIR to maria_open()
        Fixed bug when scanning table with BLOCK format for repair; If table was > bitmap coverage one page block was read twice which caused a lot of duplicate key errors
      storage/maria/ma_create.c:
        Use correct value for how much free space there is on a key page
        Remember some missing table option when doing re-create.
        Removed optimization where last packed fields is unpacked; Caused problems for re-create.
      storage/maria/ma_delete.c:
        Ensure that info->last_auto_increment is reset properly
        Fix for update to restore autoincrement value on duplicate key
      storage/maria/ma_key_recover.c:
        Moved handling of restoring value of auto-increment in case of duplicate key from clr to undo
        This ensures the restoring works both for insert and update and also that this is symetrical to how the auto_increment value is stored
      storage/maria/ma_key_recover.h:
        Added new prototype
      storage/maria/ma_loghandler.c:
        Added hook to write_hook_for_undo_key_delete()
      storage/maria/ma_open.c:
        Fixed wrong calculation of max_key_file_length
      storage/maria/ma_page.c:
        Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH
        Increase internal buffer (safety fix)
      storage/maria/ma_search.c:
        Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH
        Note that this is an incompatible change, so one must do maria_chk -r on ones old Maria tables (sorry)
      storage/maria/ma_update.c:
        Ensure that info->last_auto_increment is reset properly
      storage/maria/ma_write.c:
        Ensure that info->last_auto_increment is reset properly
        Fix for update to restore autoincrement value on duplicate key
      storage/maria/maria_chk.c:
        Allow small page_buffer_size
        Fixed printing for --describe to better fit into 80 characters
      storage/maria/maria_def.h:
        Added comments
      ab0fa111
  22. 29 Jan, 2008 1 commit
    • unknown's avatar
      Fix for BUG#34114 "maria_chk reports false error when several tables on · 2fcff898
      unknown authored
      command-line" and BUG#34062 "Maria table corruption on master".
      Use 5 bytes (instead of 4) to store page's number in the checkpoint
      record, to allow bigger table (1PB with maria-block-size=1kB).
      Help pushbuild not run out of memory by moving the portion of
      maria-recovery.test which generates lots of data into a -big.test.
      
      
      mysql-test/r/maria-recovery.result:
        result moved
      mysql-test/t/maria-recovery.test:
        piece which generates much data moved to maria-recovery-big.test
      mysys/my_pread.c:
        To fix BUG#34062, where a 1.1TB file was generated due to a wrong
        pwrite offset, it was useful to not lose precision on 'offset' in
        DBUG_PRINT, so that the crazy value is visible.
      mysys/my_read.c:
        To fix BUG#34062, where a 1.1TB file was generated due to a wrong
        pwrite offset, it was useful to not lose precision on 'offset' in
        DBUG_PRINT, so that the crazy value is visible.
      mysys/my_write.c:
        To fix BUG#34062, where a 1.1TB file was generated due to a wrong
        pwrite offset, it was useful to not lose precision on 'offset' in
        DBUG_PRINT, so that the crazy value is visible.
      storage/maria/ha_maria.cc:
        When starting a bulk insert, we throw away dirty index pages from the
        cache. Unique (non disabled) key insertions thus read out-of-date
        pages from the disk leading to BUG#34062 "Maria table corruption on
        master": a DELETE in procedure viewer_sp() had deleted all rows of
        viewer_tbl2 one by one, putting index page 1 into key_del; that page
        was thrown away at start of INSERT SELECT, then the INSERT SELECT
        needed a page to insert keys, looked at key_del, found 1, read page 1
        from disk, and its out-of-date content was used to set the new value of
        key_del (crazy value of 1TB), then a later insertion needed another
        index page, tried to read page at this crazy offset and failed, leading
        to corruption mark.
        The fix is to destroy out-of-date pages and make the state consistent
        with that, i.e. call maria_delete_all_rows().
      storage/maria/ma_blockrec.c:
        Special hook for UNDO_BULK_INSERT
      storage/maria/ma_blockrec.h:
        special hook for UNDO_BULK_INSERT
      storage/maria/ma_check.c:
        Fix for BUG#34114 "maria_chk reports false error when several tables on
        command-line": if the Nth (on the command line) table was BLOCK_RECORD
        it would start checks by using the param->record_checksum computed by
        checks of table N-1.
      storage/maria/ma_delete_all.c:
        comment
      storage/maria/ma_loghandler.c:
        special hook for UNDO_BULK_INSERT
      storage/maria/ma_page.c:
        comment
      storage/maria/ma_pagecache.c:
        page number is 5 bytes in checkpoint record now (allows bigger tables)
      storage/maria/ma_recovery.c:
        page number is 5 bytes in checkpoint record now
      storage/maria/ma_recovery_util.c:
        page number is 5 bytes now
      storage/maria/ma_write.c:
        typo
      mysql-test/r/maria-recovery-big.result:
        result is correct
      mysql-test/t/maria-recovery-big-master.opt:
        usual options for recovery tests
      mysql-test/t/maria-recovery-big.test:
        Moving out the big blob test to a -big test (it exhausts memory when
        using /dev/shm on certain machines)
      2fcff898
  23. 23 Jan, 2008 1 commit
    • unknown's avatar
      Fixed bug when using maria_chk --safe-recover with packed tables · b40a6348
      unknown authored
      Fixed bug when using maria_chk --safe-recover and getting duplicated keys
      Fixed bug when using maria_pack --join
      
      
      storage/maria/ma_check.c:
        Fixed bug when using --safe-recover with packed tables
        Fixed bug when using --safe-recover and getting duplicated keys
      storage/maria/maria_pack.c:
        Fixed bug when using --join
      storage/maria/unittest/ma_test_all-t:
        Added test to check maria_pack --join
      b40a6348
  24. 20 Jan, 2008 1 commit
    • unknown's avatar
      - fix for segfault in rpl_trigger/rpl_found_rows with default engine=maria · 0825c485
      unknown authored
      (fix is keeping the real TRN through a disable_logging/reenable cycle)
      - fix for pagecache assertion failure in ps/type_ranges with default
      engine=maria (fix is in sql_insert.cc)
      - when reenabling logging we must either flush all dirty pages,
      or at least verify (in debug build) that there are none. For example
      a bulk insert with single UNDO_BULK_INSERT must flush them, no matter
      if it uses repair or not (bugfix)
      - UNDO_BULK_INSERT_WITH_REPAIR is also used with repair, changes name
      
      
      mysql-test/r/maria.result:
        tests for bugs fixed
      mysql-test/t/maria.test:
        tests for bugs fixed
      sql/sql_insert.cc:
        Bugfix: even if select_create::prepare() failed to create the 'table' object
        we still have to re-enable logging.
      storage/maria/ha_maria.cc:
        Bugfix: when a transactional table does a bulk insert without
        repair, it still sometimes skips logging of REDOs thus needs a full
        flush and sync at the end. Not if repair is done, as repair does
        it internally already (see end of maria_repair*()).
      storage/maria/ha_maria.h:
        variable now can have 3 states not 2
      storage/maria/ma_bitmap.c:
        name change
      storage/maria/ma_blockrec.c:
        name change
      storage/maria/ma_blockrec.h:
        name change
      storage/maria/ma_check.c:
        * When maria_repair() re-enables logging it does not need to ask for
        a flush&sync as it did it by itself already a few lines before.
        * the log record of bulk insert can be used even without repair
        * disable logging in maria_zerofill(): without that, it puts LSN pages
        in the cache, so when it flushes them it flushes the log; the change
        makes auto-ha_maria::zerofill-if-moved faster (no log flush).
      storage/maria/ma_key_recover.c:
        name change
      storage/maria/ma_loghandler.c:
        name change
      storage/maria/ma_loghandler.h:
        name change
      storage/maria/ma_pagecache.c:
        A function, to check in debug builds that no dirty pages exist for a file.
      storage/maria/ma_pagecache.h:
        new function (nothing in non-debug)
      storage/maria/ma_recovery.c:
        _ma_tmp_disable_logging() sets info->trn to dummy_transaction_object
        when needed now. The changes done here about info->trn are to allow
        a table to retain its original, real TRN through a disable/reenable
        cycle (see replication scenario in _ma_reenable_logging_for_table()).
        When we reenable, we offer the caller to flush and sync the table;
        if the caller doesn't accept our offer, we verify that it's ok
        (no REDOs => no dirty pages are allowed to exist).
      storage/maria/maria_chk.c:
        comment
      storage/maria/maria_def.h:
        new names
      mysql-test/suite/rpl/r/rpl_stm_maria.result:
        result (it used to crash)
      mysql-test/suite/rpl/t/rpl_stm_maria.test:
        Test of replication-specific Maria bug fixed
      0825c485
  25. 19 Jan, 2008 1 commit
    • unknown's avatar
      - fix for bug when creating bitmaps · cd15ea74
      unknown authored
      - fix for bug seen when running test "type_datetime" with Maria
      (wrong data_file_length in maria_repair())
      - fix for bug seen when running test "repair" with Maria
      (myisam_sort_buffer_size was influencing Maria)
      
      
      sql/handler.cc:
        Sounds illogical to store myisam_sort_buffer_size into a structure
        used by all engines. There are only MyISAM and Maria which used 
        sort_buffer_size: they can get their value from their respective
        system variable (myisam|maria_sort_buffer_size). Using MyISAM's value
        for all engines was wrong (myisam_sort_buffer_size influenced Maria).
      sql/handler.h:
        not needed
      storage/maria/ha_maria.cc:
        check_opt->sort_buffer_size was myisam_sort_buffer_size; Maria
        must use maria_sort_buffer_size instead.
      storage/maria/ma_bitmap.c:
        don't use my_chsize() now that Monty re-explained the problem to me :)
      storage/maria/ma_check.c:
        making maria_repair() work like maria_repair_by_sort(): sort_param.filepos
        must be set at start then possibly corrected by create_new_data_handle();
        in the opposite order, filepos is finally set to 0, and if the table
        has no records, it stays 0 and this causes state.data_file_length
        to be 0 which is incorrect for a BLOCK_RECORD table having always
        at least one bitmap page.
      storage/maria/ma_pagecache.c:
        Comments
      storage/myisam/ha_myisam.cc:
        check_opt->sort_buffer_size is gone
      cd15ea74
  26. 18 Jan, 2008 1 commit
    • unknown's avatar
      compiler warnings · 306e09ba
      unknown authored
      storage/maria/ma_check.c:
        fix for important compiler warning
      storage/maria/ma_recovery.c:
        fix for compiler warning
      306e09ba
  27. 17 Jan, 2008 1 commit
    • unknown's avatar
      WL#3072 - Maria Recovery · 534417c2
      unknown authored
      Bulk insert: don't log REDO/UNDO for rows, log one UNDO which will
      truncate files; this is an optimization and a bugfix (table was left
      half-repaired by crash).
      Repair: mark table crashed-on-repair at start, bump skip_redo_lsn at start,
      this is easier for recovery (tells it to skip old REDOs or even UNDO
      phase) and user (tells it to repair) in case of crash, sync files
      in the end.
      Recovery skips missing or corrupted table and moves to next record
      (in REDO or UNDO phase) to be more robust; warns if happens in UNDO phase.
      Bugfix for UNDO_KEY_DELETE_WITH_ROOT (tested in ma_test_recovery)
      and maria_enable_indexes().
      Create missing bitmaps when needed (there can be more than one to create,
      in rare cases), log a record for this.
      
      
      include/myisamchk.h:
        new flag: bulk insert repair mustn't bump create_rename_lsn
      mysql-test/lib/mtr_report.pl:
        skip normal warning in maria-recovery.test
      mysql-test/r/maria-recovery.result:
        result: crash before bulk insert is committed, causes proper rollback,
        and crash right after OPTIMIZE replaces index file with new index file
        leads to table marked corrupted and recovery not failing.
      mysql-test/t/maria-recovery.test:
        - can't check the table or it would commit the transaction,
        but check is made after recovery.
        - test of crash before bulk-insert-with-repair is committed
        (to see if it is rolled back), and of crash after OPTIMIZE has replaced
        index file but not finished all operations (to see if recovery fails -
        it used to assert when trying to execute an old REDO on the new
        index).
      storage/maria/CMakeLists.txt:
        new file
      storage/maria/Makefile.am:
        new file
      storage/maria/ha_maria.cc:
        - If bulk insert on a transactional table using an index repair:
        table is initially empty, so don't log REDO/UNDO for data rows
        (optimization), just log an UNDO_BULK_INSERT_WITH_REPAIR
        which will, if executed, empty the data and index file. Re-enable
        logging in end_bulk_insert().
        - write log record for repair operation only after it's fully done,
        index sort including (maria_repair*() used to write the log record).
        - Adding back file->trn=NULL which was removed by mistake earlier.
      storage/maria/ha_maria.h:
        new member (see ha_maria.cc)
      storage/maria/ma_bitmap.c:
        Functions to create missing bitmaps:
        - one function which creates missing bitmaps in page cache, except
        the missing one with max offset which it does not put into page cache
        as it will be modified very soon.
        - one function which the one above calls, and creates bitmaps in page
        cache
        - one function to execute REDO_BITMAP_NEW_PAGE which uses the second
        one above.
      storage/maria/ma_blockrec.c:
        - when logging REDO_DELETE_ALL, not only 'records' and 'checksum'
        has to be reset under log's mutex.
        - execution of REDO_INSERT_ROW_BLOBS now checks the dirty pages' list
        - execution of UNDO_BULK_INSERT_WITH_REPAIR
      storage/maria/ma_blockrec.h:
        new functions
      storage/maria/ma_check.c:
        - table-flush-before-repair is moved to a separate function reused
        by maria_sort_index(); syncing is added
        - maria_repair() is allowed to re-enable logging only if it is the one
        which disabled it.
        - "_ma_flush_table_files_after_repair" was a bad name, it's not after
        repair now, and it should not sync as we do more changes to the files
        shortly after (sync is postponed to when writing the log record)
        - REDO_REPAIR record should be written only after all repair
        operations (in particular after sorting index in ha_mara::repair())
        - close to the end of repair by sort, flushing of pages must happen
        also in the non-quick case, to prepare for the sync at end.
        - in parallel repair, some page flushes are not needed as done
        by initialize_variables_for_repair().
      storage/maria/ma_create.c:
        Update skip_redo_lsn, create_rename_lsn optionally.
      storage/maria/ma_delete_all.c:
        Need to sync files at end of maria_delete_all_rows(), if transactional.
      storage/maria/ma_extra.c:
        During repair, we sometimes call _ma_flush_table_files() (via
        _ma_flush_table_files_before_swap()) while there is a WRITE_CACHE.
      storage/maria/ma_key_recover.c:
        - when we see CLR_END for UNDO_BULK_INSERT_WITH_REPAIR, re-enable
        indices.
        - fixing bug: _ma_apply_undo_key_delete() parsed UNDO_KEY_DELETE_WITH_ROOT
        wrongly, leading to recovery failure
      storage/maria/ma_key_recover.h:
        new prototype
      storage/maria/ma_locking.c:
        DBUG_VOID_RETURN missing
      storage/maria/ma_loghandler.c:
        UNDO for bulk insert with repair, and REDO for creating bitmaps.
        LOGREC_FIRST_FREE to not have to change the for() every time we
        add a new record type.
      storage/maria/ma_loghandler.h:
        new UNDO and REDO
      storage/maria/ma_open.c:
        Move share.kfile.file=kfile up a bit, so that _ma_update_state_lsns()
        can get its value, this fixes a bug where LSN_REPAIRED_BY_MARIA_CHK
        was not corrected on disk by maria_open().
        Store skip_redo_lsn in index' header.
        maria_enable_indexes() had a bug for BLOCK_RECORD, where an empty
        file has one page, not 0 bytes.
      storage/maria/ma_recovery.c:
        - Skip a corrupted, missing, or repaired-with-maria_chk, table in
        recovery: don't fail, just go to next REDO or UNDO; but if an UNDO
        is skipped in UNDO phase we issue warnings.
        - Skip REDO|UNDO in REDO phase if <skip_redo_lsn.
        - If UNDO phase fails, delete transactions to not make trnman
        assert.
        - Update skip_redo_lsn when playing REDO_CREATE_TABLE
        - Don't record UNDOs for old transactions which we don't know (long_trid==0)
        - Bugfix for UNDO_KEY_DELETE_WITH_ROOT (see ma_key_recover.c)
        - Execution of UNDO_BULK_INSERT_WITH_REPAIR
        - Don't try to find a page number in REDO_DELETE_ALL
        - Pieces moved to ma_recovery_util.c
      storage/maria/ma_rename.c:
        name change
      storage/maria/ma_static.c:
        I modified layout of the index' header (inserted skip_redo_lsn in its middle)
      storage/maria/ma_test2.c:
        allow breaking the test towards the end, tests execution of
        UNDO_KEY_DELETE_WITH_ROOT
      storage/maria/ma_test_recovery.expected:
        6 as testflag instead of 4
      storage/maria/ma_test_recovery:
        Increase the amount of rollback work to do when testing recovery
        with ma_test2; this reproduces the UNDO_KEY_DELETE_WITH_ROOT bug.
      storage/maria/maria_chk.c:
        skip_redo_lsn should be updated too, for consistency.
        Write a REDO_REPAIR after all operations (including sort-records)
        have been done.
        No reason to flush blocks after maria_chk_data_link() and
        maria_sort_records(), there is maria_close() in the end.
        write_log_record() is a function, to not clutter maria_chk().
      storage/maria/maria_def.h:
        New member skip_redo_lsn in the state, and comments
      storage/maria/maria_pack.c:
        skip_redo_lsn should be updated too, for consistency
      storage/maria/ma_recovery_util.c:
        _ma_redo_not_needed_for_page(), defined in ma_recovery.c, is needed
        by ma_blockrec.c; this causes link issues, resolved by putting
        _ma_redo_not_needed_for_page() into a new file (so that it is not
        in the same file as repair-related objects of ma_recovery.c).
      storage/maria/ma_recovery_util.h:
        new file
      534417c2
  28. 12 Jan, 2008 1 commit
    • unknown's avatar
      Fixes to bugs and compiler warnings detected by pushbuild · 978f3e3c
      unknown authored
      Don't compare uuid's on maria_open() if table is not transactional
      Fixed that my_microtime() works on windows (patch added from 5.1)
      
      
      mysql-test/r/create.result:
        Portability fix
      mysql-test/t/create.test:
        Portability fix
      mysql-test/t/maria.test:
        Remove warnings, to make test portable to windows
      mysys/my_getsystime.c:
        Add missed merge from 5.1
        This fixes that timing works on windows and fixes that that failed becasuse slow_query_log didn't get any queries
      storage/maria/ma_check.c:
        Removed not needed setting of variable
      storage/maria/ma_loghandler.c:
        Fixed compiler warnings
      storage/maria/ma_open.c:
        Don't compare uuid's if table is not transactional
      KNOWN_BUGS.txt:
        New BitKeeper file ``KNOWN_BUGS.txt''
      978f3e3c
  29. 11 Jan, 2008 1 commit
    • unknown's avatar
      WL#3072 Maria Recovery · 17f07388
      unknown authored
      All statements doing an implicit commit now also do one in Maria.
      This is useful because LOCK TABLES; REPAIR; crash; is not rollback-able,
      the implicit commit of REPAIR avoid that Recovery tries to rollback
      and fails.
      Fix for BUG#33827 "COMMIT AND CHAIN causes serious Valgrind error"
      (maybe not the definite one, depends on the assigned dev).
      
      
      mysql-test/t/maria-recovery.test:
        test of REPAIR's implicit commit. I cannot commit the result file
        because maria-recovery fails in vanilla tree (seen in pushbuild) but
        its new section looks like:
        repair table t1;
        Table   Op      Msg_type        Msg_text
        mysqltest.t1    repair  status  OK
        insert into t1 values(2);
        select * from t1;
        a
        1
        2
        3
        SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
        * crashing mysqld intentionally
        set global maria_checkpoint_interval=1;
        ERROR HY000: Lost connection to MySQL server during query
        * recovery happens
        check table t1 extended;
        Table   Op      Msg_type        Msg_text
        mysqltest.t1    check   status  OK
        * testing that checksum after recovery is as expected
        Checksum-check
        failure
        use mysqltest;
        select * from t1;
        a
        1
        3
        Which is as it should be.
      sql/rpl_injector.cc:
        fix for BUG#33827
      sql/sql_parse.cc:
        - All DDLs and mysql_admin_table() (REPAIR etc) use end_actrive_trans()
        to do an implicit commit so we add there an implicit commit of the
        Maria transaction.
        - Fix for BUG#33827
      storage/maria/ha_maria.cc:
        - A method to do implicit commit in Maria
        - After an implicit commit, if it was under LOCK TABLES, the locked
        tables have a stale file->trn: update it.
      storage/maria/ha_maria.h:
        new static method
      storage/maria/ma_check.c:
        bugfix: this disabling of transactionality had the effect that if
        LOCK TABLES; REPAIR; INSERT then the INSERT ran non-transactional
        (so couldn't be undone in case of crash, if, by bad chance, its
        effect on pages went to disk).
      storage/maria/ma_checkpoint.c:
        indentation
      storage/maria/ma_recovery.c:
        dbug statements
      storage/maria/trnman.c:
        When doing an implicit commit we need to know the number of locked
        tables of the committed transaction and copy it to the new transaction
      storage/maria/trnman_public.h:
        prototype change
      17f07388
  30. 10 Jan, 2008 3 commits
    • unknown's avatar
      Added --loose-skip-maria to MYSQLD_BOOTSTRAP_CMD to get bootstrap.test to work · 266fde77
      unknown authored
      Allow one to run bootstrap even if --skip-maria is used (needed for bootstrap.test)
      Fixed lots of compiler warnings
      
      NOTE:
      maria-big and maria-recover tests failes becasue of bugs in transaction log handling.
      Sanja knows about this and is working on it!
      
      
      mysql-test/mysql-test-run.pl:
        Added --loose-skip-maria to MYSQLD_BOOTSTRAP_CMD to get bootstrap.test to work
      mysql-test/r/maria-recovery.result:
        Updated results
      mysql-test/t/bootstrap.test:
        Removed not needed empty line
      mysql-test/t/change_user.test:
        Fixed results for 32 bit systems
      mysql-test/t/maria-big.test:
        Only run this when you use --big
      mysql-test/t/maria-recovery.test:
        Added test case for recovery with big blobs
      mysys/my_uuid.c:
        Fixed compiler warning
      sql/mysqld.cc:
        Allow one to run bootstrap even if --skip-maria is used (needed for bootstrap.test)
      sql/set_var.cc:
        Compare max_join_size with ULONG_MAX instead of HA_POS_ERROR as we set max_join_size to ULONG_MAX by default
      storage/maria/ma_bitmap.c:
        Added __attribute((unused)) to fix compiler warning
      storage/maria/ma_blockrec.c:
        Added casts to remove compiler warnings
        Change variable types to avoid compiler warnings
      storage/maria/ma_check.c:
        Added casts to remove compiler warnings
      storage/maria/ma_checkpoint.c:
        Change variable types to avoid compiler warnings
      storage/maria/ma_create.c:
        Change variable types to avoid compiler warnings
      storage/maria/ma_delete.c:
        Added casts to remove compiler warnings
      storage/maria/ma_key_recover.c:
        Added casts to remove compiler warnings
      storage/maria/ma_loghandler.c:
        Moved initiazation of prev_buffer first as this could otherwise not be set in case of errors
      storage/maria/ma_page.c:
        Added casts to remove compiler warnings
      storage/maria/ma_pagecache.c:
        Added __attribute((unused)) to fix compiler warning
      storage/maria/ma_pagecrc.c:
        Added #ifndef DBUG_OFF to remove compiler warning
      storage/maria/ma_recovery.c:
        Added casts to remove compiler warnings
      storage/maria/ma_write.c:
        Added casts to remove compiler warnings
      storage/maria/maria_chk.c:
        Split long string into two to avoid compiler warnings
      storage/myisam/ft_boolean_search.c:
        Added LINT_INIT() to remove compiler warning
      support-files/compiler_warnings.supp:
        Suppress wrong compiler warning
      unittest/mytap/tap.c:
        Fixed declaration to match prototypes to remove compiler warnings
      266fde77
    • unknown's avatar
      Added --with-maria-tmp-tables (default one) to allow on to configure if Maria... · 5ad477f6
      unknown authored
      Added --with-maria-tmp-tables (default one) to allow on to configure if Maria should be used for internal temporary tables
      Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables
      Fixed bug that caused update of big blobs to crash
      Use pagecache_page_no_t as type for pages (to get rid of compiler warnings)
      Added cast to get rid of compiler warning
      Fixed wrong types of variables and arguments that caused lost information
      Fixed wrong DBUG_ASSERT() that caused REDO of big blobs to fail
      Removed some historical ifdefs that caused problem with windows compilations
      
      
      BUILD/SETUP.sh:
        Added --with-maria-tmp-tables
      include/maria.h:
        Use pagecache_page_no_t as type for pages
        Use my_bool as parameter for 'rep_quick' option
      include/my_base.h:
        Added comment
      mysql-test/r/maria-big.result:
        Added test that uses big blobs
      mysql-test/t/maria-big.test:
        Added test that uses big blobs
      sql/mysqld.cc:
        Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables
      sql/sql_class.h:
        Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined
      sql/sql_select.cc:
        Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined
      storage/maria/ha_maria.cc:
        Fixed compiler warnings reported by MCC
        - Fixed usage of wrong types that caused data loss
        - Changed parameter for rep_quick to my_bool
        - Added safe casts
        
        Fixed indentation
      storage/maria/ma_bitmap.c:
        Use pagecache_page_no_t as type for pages
        Fixed compiler warnings
        Fixed bug that caused update of big blobs to crash
      storage/maria/ma_blockrec.c:
        Use pagecache_page_no_t as type for pages
        Use my_bool as parameter for 'rep_quick' option
        Fixed compiler warnings
        Fixed wrong DBUG_ASSERT()
      storage/maria/ma_blockrec.h:
        Use pagecache_page_no_t as type for pages
      storage/maria/ma_check.c:
        Fixed some wrong parameters where we didn't get all bits for test_flag
        Changed rep_quick to be of type my_bool
        Use pagecache_page_no_t as type for pages
        Added cast's to get rid of compiler warnings
        Changed type of record_pos to get rid of compiler warning
      storage/maria/ma_create.c:
        Added safe cast's to get rid of compiler warnings
      storage/maria/ma_dynrec.c:
        Fixed usage of wrong type
      storage/maria/ma_key.c:
        Fixed compiler warning
      storage/maria/ma_key_recover.c:
        Use pagecache_page_no_t as type for pages
      storage/maria/ma_loghandler_lsn.h:
        Added cast's to get rid of compiler warnings
      storage/maria/ma_page.c:
        Changed variable name from 'page' to 'pos' as it was an offset and not a page address
        Moved page_size inside block to get rid of compiler warning
      storage/maria/ma_pagecache.c:
        Fixed compiler warnings
        Replaced compile time assert with TODO
      storage/maria/ma_pagecache.h:
        Use pagecache_page_no_t as type for pages
      storage/maria/ma_pagecrc.c:
        Allow bitmap pages that is all zero
      storage/maria/ma_preload.c:
        Added cast to get rid of compiler warning
      storage/maria/ma_recovery.c:
        Changed types to get rid of compiler warnings
        Use bool for quick_repair to get rid of compiler warning
        Fixed some variables that was wrongly declared (not enough precission)
        Added cast to get rid of compiler warning
      storage/maria/ma_test2.c:
        Remove historical undefs
      storage/maria/maria_chk.c:
        Changed rep_quick to bool
        Fixed wrong parameter to maria_chk_data_link()
      storage/maria/maria_def.h:
        Use pagecache_page_no_t as type for pages
      storage/maria/maria_pack.c:
        Renamed isam -> maria
      storage/maria/plug.in:
        Added option --with-maria-tmp-tables
      storage/maria/trnman.c:
        Added cast to get rid of compiler warning
      storage/myisam/mi_test2.c:
        Remove historical undefs
      5ad477f6
    • unknown's avatar
      Windows fixes · ce8de7af
      unknown authored
      -new option WITH_MARIA_STORAGE_ENGINE for config.js
      -correct build errors
      -build test executables
      -downport changes for atomic functions from 5.2
      -remove LOCK_uuid_generator from C++ files to avoid linker errors
      -new function my_uuid2str()
      
      
      BitKeeper/deleted/.del-x86-msvc.h:
        Delete: include/atomic/x86-msvc.h
      CMakeLists.txt:
        Windows fixes:
        -New option WITH_MARIA_STORAGE_ENGINE
        -Add unit tests
      include/Makefile.am:
        replace x86-msvc.h with generic-msvc.h
      include/config-win.h:
        my_chmod() support
      include/my_atomic.h:
        Downport my_atomic from 5.2 tree
      include/my_bit.h:
        Correct unresolved symbol errors on Windows
      include/my_pthread.h:
        pthread_mutex_unlock now returns 0 (was void previously)
        defined PTHREAD_STACK_MIN
      include/my_sys.h:
        New function my_uuid2str()
        define MY_UUID_STRING_LENGTH
      include/atomic/nolock.h:
        Downport my_atomic from 5.2 tree
      libmysqld/CMakeLists.txt:
        New option WITH_MARIA_STORAGE_ENGINE
      mysys/CMakeLists.txt:
        Add missing files
      mysys/lf_dynarray.c:
        Fix compiler errors on Windows
      mysys/my_getncpus.c:
        Windows port
      mysys/my_uuid.c:
        Windows fixes: there is no random() on Windows, use ANSI rand()
        New function my_uuid2str()
      mysys/my_winthread.c:
        Downport from 5.2 tree
        -Call my_thread_end() before pthread_exit()
        -Avoid crash if pthread_create is called with NULL attributes
      sql/CMakeLists.txt:
        Link mysqld with Maria storage engine
      sql/item_func.cc:
        Remove LOCK_uuid_generator from C++ to avoid linker errors.
        Use dedicated mutex for short uuids
      sql/item_strfunc.cc:
        Use my_uuid() and my_uuid2str() functions from mysys.
      sql/item_strfunc.h:
        Define MY_UUID_STRING_LENGTH in my_sys.h
      sql/mysql_priv.h:
        LOCK_uuid_generator must be declared as extern "C"
      sql/mysqld.cc:
        Init and destroy LOCK_uuid_short mutex
      storage/maria/CMakeLists.txt:
        -Use the same source files as in Makefile.am
        -Build test binaries
      storage/maria/ha_maria.cc:
        snprintf->my_snprintf
      storage/maria/lockman.c:
        Fix compiler error on Windows
      storage/maria/ma_check.c:
        Fix compiler error on Windows
      storage/maria/ma_loghandler.c:
        Fix compile errors
        my_open()/my_sync() do not work for directories on Windows
      storage/maria/ma_recovery.c:
        Fix compile error on Windows
      storage/maria/ma_test2.c:
        Rename variable to avoid naming conflict with Microsoft C runtime 
        function
      storage/maria/ma_test3.c:
        Fix build errors on Windows
      storage/maria/tablockman.c:
        Fix build errors on Windows
      storage/maria/unittest/Makefile.am:
        Add CMakeLists.txt
      storage/maria/unittest/ma_pagecache_consist.c:
        Fix build errors on Windows
        remove loop from get_len()
      storage/maria/unittest/ma_pagecache_single.c:
        Fix build errors on Windows
      storage/maria/unittest/ma_test_loghandler-t.c:
        Windows fixes
        -Avoid division by 0 in expressions like
        x/(RAND_MAX/y), where y is larger than RAND_MAX(==0x7fff on Windows)
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        Windows fixes
        -Avoid division by 0 in expressions like
        x/(RAND_MAX/y), where y is larger than RAND_MAX(==0x7fff on Windows)
        -remove loop in get_len()
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Windows fixes
        -Avoid division by 0 in expressions like
        x/(RAND_MAX/y), where y is larger than RAND_MAX(==0x7fff on Windows)
        -remove loop in get_len()
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Fix build errors on Windows
      storage/maria/unittest/test_file.c:
        Correct the code to get file size on Windows. 
        stat() information can be outdated and thus cannot be trusted.
        On Vista,stat() returns file size=0 until the file is closed at the
        first time.
      storage/myisam/CMakeLists.txt:
        Fix compiler errors on Windows
        Build test executables
      storage/myisam/mi_test2.c:
        Rename variable to avoid naming conflict with Microsoft C runtime 
        function
      storage/myisam/mi_test3.c:
        Fix build errors on Windows
      strings/CMakeLists.txt:
        Add missing file
      unittest/unit.pl:
        Windows:
        downport unittest changes from 5.2 bk tree
      unittest/mysys/Makefile.am:
        Windows:
        downport unittest changes from 5.2 bk tree
      unittest/mysys/my_atomic-t.c:
        Windows:
        downport unittest changes from 5.2 bk tree
      unittest/mytap/Makefile.am:
        Windows:
        downport unittest changes from 5.2 bk tree
      unittest/mytap/tap.c:
        Windows:
        downport unittest changes from 5.2 bk tree
      win/configure.js:
        Add WITH_MARIA_STORAGE_ENGINE configure option
      unittest/mytap/CMakeLists.txt:
        Add missing file
      unittest/mysys/CMakeLists.txt:
        Add missing file
      storage/maria/unittest/CMakeLists.txt:
        Add missing file
      BitKeeper/etc/ignore:
        Added comments maria-win.patch to the ignore list
      include/atomic/generic-msvc.h:
        Implement atomic operations with MSVC intrinsics
      ce8de7af
  31. 07 Jan, 2008 2 commits
    • unknown's avatar
      3c44bca6
    • unknown's avatar
      Bugs fixed: · b5df1d34
      unknown authored
      - If not in autocommit mode, delete rows one by one so that we can roll back if necessary
      - bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten
      - Fixed bug in bitmap handling when allocation tail pages
      - Ensure we reserve place for directory entry when calculation place for head and tail pages
      - Fixed wrong value in bitmap->size[0]
      - Fixed wrong assert in flush_log_for_bitmap
      - Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset
      - Mark new pages as changed (Required to get repair() to work)
      - Fixed problem with advancing log horizon pointer within one page bounds
      - Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert()
      - Fixed bug in logging of rows with more than one big blob
      - Fixed DBUG_ASSERTS() in pagecache to allow change of WRITE_LOCK to READ_LOCK in unlock() calls
      - Flush pagecache when we change from logging to not logging (if not, pagecache code breaks)
      - Ensure my_errno is set on return from write/delete/update
      - Fixed bug when using FIELD_SKIP_PRESPACE
      
      New features:
      - mysql_fix_privilege_tables now first uses binaries and scripts from source distribution, then in installed distribution
      - Fix that optimize works for Maria tables
      - maria_check --zerofill now also clear freed blob pages
      - maria_check -di now prints more information about record page utilization
      
      Optimizations:
      - Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block)
      - Simplify code to abort when we found optimal bit pattern
      - Skip also full head page bit patterns when searching for tail
      - Increase default repair buffer to 128M for maria_chk and maria_read_log
      - Increase default sort buffer for maria_chk to 64M
      - Increase size of sortbuffer and pagecache for mysqld to 64M
      - VARCHAR/CHAR fields are stored in increasing length order for BLOCK_RECORD tables
      
      Better reporting:
      - Fixed test of error condition for flush (for better error code)
      - More error messages to mysqld if Maria recovery fails
      - Always print warning if rows are deleted in repair
      - Added global function _db_force_flush() that is usable when doing debugging in gdb
      - Added call to my_debug_put_break_here() in case of some errors (for debugging)
      - Remove used testfiles in unittest as these was written in different directories depending on from where the test was started
      
      This should fix the bugs found when importing a big table with many varchars and one/many blobs to Maria
      
      
      dbug/dbug.c:
        Added global function _db_force_flush() that is usable when doing debugging in gdbine
      extra/replace.c:
        Fixed memory leak
      include/my_dbug.h:
        Prototype for _db_force_flush()
      include/my_global.h:
        Added stdarg.h as my_sys.h now depends on it.
      include/my_sys.h:
        Make my_dbug_put_break_here() a NOP if not DBUG build
        Added my_printv_error()
      include/myisamchk.h:
        Added entry 'lost' to be able to count space that is lost forever
      mysql-test/r/maria.result:
        Updated results
      mysql-test/t/maria.test:
        Reset autocommit after test
        New test to check if delete_all_rows is used (verified with --debug)
      mysys/my_error.c:
        Added my_printv_error()
      scripts/mysql_fix_privilege_tables.sh:
        First use binaries and scripts from source distribution, then in installed distribution
        This ensures that a development branch doesn't pick up wrong scripts)
      sql/mysqld.cc:
        Fix that one can break maria recovery with ^C when debugging
      sql/sql_class.cc:
        Removed #ifdef that has no effect
        (The preceeding DBUG_ASSERT() ensures that the following code will not be exectued)
      storage/maria/ha_maria.cc:
        Increase size of sortbuffer and pagecache to 64M
        Fix that optimize works for Maria tables
        Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert()
        If not in autocommit mode, delete rows one by one so that we can roll back if necessary
        Fixed variable comments
      storage/maria/ma_bitmap.c:
        More ASSERTS to detect overwrite of bitmap pages
        bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten
        Ensure we reserve place for directory entry when calculation place for head and tail pages
        bitmap->size[0] should not include space for directory entry
        Simplify code to abort when we found optimal bit pattern
        Skip also full head page bit patterns when searching for tail (should speed up some common cases)
        Fixed bug in allocate_tail() when block->used was not aligned on 6 bytes
        Fixed wrong assert in flush_log_for_bitmap
        Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset
      storage/maria/ma_blockrec.c:
        Ensure my_errno is set on return
        Fixed not optimal setting of row->min_length if we don't have variable length fields
        Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block)
        Added DBUG_ASSERT() if we read or write wrong VARCHAR data
        Added DBUG_ASSERT() to find out if row sizes are calculated wrong
        Fixed bug in logging of rows with more than one big blob
      storage/maria/ma_check.c:
        Disable logging while normal repair is done to avoid logging of index changes
        Fixed bug that caused CHECKSUM part of key page to be used
        Fixed that deleted of wrong records also works for BLOCK_RECORD
        Clear unallocated pages:
        - BLOB pages are not automaticly cleared on delete, so we need to use the bitmap to know if page is used or not
        Better error reporting
        More information about record page utilization
        Change printing of file position to printing of pages to make output more readable
        Always print warning if rows are deleted
      storage/maria/ma_create.c:
        Calculate share.base_max_pack_length more accurately for BLOCK_RECORD pages (for future)
        Fixed that FIELD_SKIP_PRESPACE is recorded as FIELD_NORMAL; Fixed bug where fields could be used in wrong order
        Store FIELD_SKIP_ZERO fields before CHAR and VARCHAR fields (optimization)
        Store other fields in length order (to get better utilization of head block)
      storage/maria/ma_delete.c:
        Ensure my_errno is set on return
      storage/maria/ma_dynrec.c:
        Indentation fix
      storage/maria/ma_locking.c:
        Set changed if open_count is counted down.
        (To avoid getting error "client is using or hasn't closed the table properly" with transactional tables
      storage/maria/ma_loghandler.c:
        Fixed problem with advancing log horizon pointer within one page bounds (Patch from Sanja)
        Added more DBUG
        Indentation fixes
      storage/maria/ma_open.c:
        Removed wrong casts
      storage/maria/ma_page.c:
        Fixed usage of PAGECACHE_LOCK_WRITE_UNLOCK with _ma_new()
        Mark new pages as changed (Required to get repair() to work)
      storage/maria/ma_pagecache.c:
        Fixed test of error condition for flush
        Fixed problem when using PAGECACHE_LOCK_WRITE_TO_READ with unlock()
        Added call to my_debug_put_break_here() in case of errors (for debugging)
      storage/maria/ma_pagecrc.c:
        Ensure we get same crc for 32 and 64 bit systems by forcing argument to maria_page_crc to uint32
      storage/maria/ma_recovery.c:
        Call my_printv_error() from eprint() to get critical errors to mysqld log
        Removed \n from error strings to eprint() to get nicer output in mysqld
        Added simple test in _ma_reenable_logging_for_table() to not do any work if not needed
      storage/maria/ma_update.c:
        Ensure my_errno is set on return
      storage/maria/ma_write.c:
        Ensure my_errno is set on return
      storage/maria/maria_chk.c:
        Use DEBUGGER_OFF if --debug is not use (to get slightly faster execution for debug binaries)
        Added option --skip-safemalloc
        Don't write exponents for rec/key
      storage/maria/maria_def.h:
        Increase default repair buffer to 128M for maria_chk and maria_read_log
        Increase default sort buffer for maria_chk to 64M
      storage/maria/unittest/Makefile.am:
        Don't update files automaticly from bitkeeper
      storage/maria/unittest/ma_pagecache_consist.c:
        Remove testfile at end
      storage/maria/unittest/ma_pagecache_single.c:
        Remove testfile at end
      storage/maria/unittest/ma_test_all-t:
        More tests
        Safer checking if test caused error
      b5df1d34
  32. 02 Jan, 2008 1 commit
    • unknown's avatar
      Disable logging of index pages during repair · f8b3e118
      unknown authored
      Fixed failure in unittest/ma_test_loghandler_pagecache-t
      Initialize pagecache callbacks explictily, not with pagecache_init().
      This is to make things more readable and for the future to make more choices with callbacks
      
      
      storage/maria/ha_maria.cc:
        Disable logging of index pages during repair
      storage/maria/ma_bitmap.c:
        Initialize callbacks explictily, not with pagecache_init(), to make things more readable and for future to have more choices with callbacks
        Use new interface to flush logs from pagecache
      storage/maria/ma_check.c:
        Fixed test for wrong keyblocks
        Use default functions to setup callbacks for pagecache
      storage/maria/ma_loghandler.c:
        Use dummy functions for log flush callback (NULL doesn't work anymore)
      storage/maria/ma_open.c:
        Initialize callbacks explictily, not with pagecache_init(), to make things more readable and for future to have more choices with callbacks
        Prefix external functions with _ma_
      storage/maria/ma_pagecache.c:
        Use new simpler interface to flush logs if needed
      storage/maria/ma_pagecache.h:
        Changed interface to a faster, simpler one to flush logs.
        Now we have a function that takes care of flushing logs, instead of a function to get lsn address
      storage/maria/ma_pagecrc.c:
        Add functions for flushing logs
      storage/maria/ma_recovery.c:
        Rename functions
      storage/maria/maria_chk.c:
        Use default functions to setup callbacks for pagecache
      storage/maria/maria_def.h:
        Prefixd global functions with _ma_
      storage/maria/unittest/ma_pagecache_consist.c:
        Use dummy functions for log flush callback (NULL doesn't work anymore)
      storage/maria/unittest/ma_pagecache_single.c:
        Use dummy functions for log flush callback (NULL doesn't work anymore)
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        Use maria_flush_log_for_page to flush log pages. Fixes failure in unittest
      f8b3e118
  33. 31 Dec, 2007 1 commit
    • unknown's avatar
      Added maria_zerofill() · 6cad0204
      unknown authored
      This is used to bzero all not used parts of the index pages and compact and bzero the not used parts of the data pages of block-record type
      Added --zerofill (-z) option to maria_chk (Mostly code from Jani)
      Added now table states ZEROFILLED and MOVEABLE
      Set state.changed with new states when things changes
      
      
      include/maria.h:
        Added maria_zerofill
      include/myisamchk.h:
        Added option for zerofill
        Extend testflag to be 64 to allow for more flags
      mysql-test/r/create.result:
        Updated results after merge
      mysql-test/r/maria.result:
        Updated results after merge
      mysys/my_getopt.c:
        Removed not used variable
      sql/sql_show.cc:
        Fixed wrong page type
      storage/maria/ma_blockrec.c:
        Renamed compact_page() to ma_compact_block_page() and made it global
        Always zerofill half filled blob pages
        Set share.state.changed on REDO
      storage/maria/ma_blockrec.h:
        Added _ma_compact_block_page()
      storage/maria/ma_check.c:
        Added maria_zerofill()
        This is used to bzero all not used parts of the index pages and compact and bzero the not used parts of the data pages of block-record type
        This gives the following benefits:
        - Table is smaller if compressed
        - All LSN are removed for transactinal tables and this makes them movable between systems
        Dont set table states of we are using --quick
        Changed log entry for repair to use 8 bytes for flag
      storage/maria/ma_delete.c:
        Simplify code
        Update state.changed
      storage/maria/ma_key_recover.c:
        Update state.changed
      storage/maria/ma_locking.c:
        Set uuid for file on first change if it's not set (table was cleared with zerofill)
      storage/maria/ma_loghandler.c:
        Updated log entry for REDO_REPAIR_TABLE
      storage/maria/ma_recovery.c:
        Updated log entry for REDO_REPAIR_TABLE (flag is now 8 bytes)
        Set new bits in state.changed
      storage/maria/ma_test_all.sh:
        Nicer output
      storage/maria/ma_test_recovery.expected:
        Updated results (now states flags are visible)
      storage/maria/ma_update.c:
        Update state.changed
      storage/maria/ma_write.c:
        Simplify code
        Set state.changed
      storage/maria/maria_chk.c:
        Added option --zerofill
        Added printing of states for MOVABLE and ZEROFILLED
        MYD -> MAD
        MYI -> MAI
      storage/maria/maria_def.h:
        Added states STATE_NOT_MOVABLE and STATE_NOT_ZEROFILLED
        Added prototype for new functions
      storage/maria/unittest/ma_test_all-t:
        More tests, including tests for zerofill
        Removed some not needed 'print' statements
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Smaller buffer to not trash devlopment machines totally
      6cad0204
  34. 30 Dec, 2007 2 commits
    • unknown's avatar
      UNDO of rows now puts back all part of the row on their original pages and positions · bfd5c273
      unknown authored
      Added variable _dbug_on_ to speed up execution when DBUG is not going to be used
      Added --debug-on option to mysqld (to be able to turn of DBUG with --debug-on=0)
      Fixed some bugs with 'non_flushable' marking of bitmap pages
      Don't use 'non_flushable' marking of bitmap pages for not transactional tables
      SHOW CREATE TABLE now shows if table was created with page checksums
      Fixed a lot of bugs with BLOB handling in case of update/REDO and UNDO
      More tests (especially for blobs) and DBUG_ASSERTS()
      More readable output from maria_read_log and maria_chk
      Fixed wrong shift that caused Maria to crash on files > 4G
      Mark tables as crashed of REDO fails
      
      
      dbug/dbug.c:
        Changed to use my_bool (allowed me to remove some windows specific code)
        Added variable _dbug_on_ to speed up execution when DBUG is not going to be used
        Removed initialization of variables if not needed
      include/my_dbug.h:
        Use my_bool for some functions that was defined as BOOLEAN in dbug.c code
        Added DBUGGER_ON/DEBUGGER_OFF to speed up execution when DBUG is not used
      include/my_global.h:
        Define my_bool early
        Increase MY_HOW_OFTEN_TO_WRITE as computers are now faster than 10 years ago
      mysql-test/mysql-test-run.pl:
        Added debug-on=0 to speed up tests
      mysql-test/r/maria-recovery.result:
        Added new test by Guilhem to test if UNDO_ROW_DELETE preserves rowid
      mysql-test/r/maria.result:
        Added testing of page checksums
      mysql-test/t/crash_commit_before-master.opt:
        Added --debug-on as test require DBUG to work
      mysql-test/t/maria-recovery-bitmap-master.opt:
        Added --debug-on as test require DBUG to work
      mysql-test/t/maria-recovery-master.opt:
        Added --debug-on as test require DBUG to work
      mysql-test/t/maria-recovery.test:
        Added new test by Guilhem to test if UNDO_ROW_DELETE preserves rowid
      mysql-test/t/maria.test:
        Added testing of page checksums
      sql/mysqld.cc:
        Added --debug-on option (to be able to turn of DBUG with --debug-on=0)
        Indentation fixes
        Removed end spaces
      sql/sql_show.cc:
        Allow update_create_info() to inform MySQL if PACK_KEYS, NO_PACK_KEYS, CHECKSUM, PAGE_CHECKSUM or DELAY_KEY_WRITE is used
      storage/maria/Makefile.am:
        Added ma_test_big.sh
      storage/maria/ha_maria.cc:
        Store in create_info if page checksums are used (For SHOW CREATE TABLE)
      storage/maria/ma_bitmap.c:
        Added _ma_bitmap_wait_or_flush() to cause reader of bitmap pages to wait with reading until bitmap is flushed.
        Use TAIL_PAGE_COUNT_MARKER for tail pages
        Set 'sub_blocks' for and only for the head page or for the first extent of a blob. This is needed for store_extent_info() to be able to set START_EXTENT_BIT's
        Don't allocate more than 0x3ffff pages in one extent (We need bit 0x4000 as a START_EXTENT_BIT)
        Increase the calculated 'head_length' with the number of bytes used for extents.
        Update row->space_on_head_page also in _ma_bitmap_find_new_place()
        Make _ma_bitmap_get_page_bits() global. (Needed for UNDO handling)
        Changed _ma_bitmap_flushable() to take MARIA_HA instead of MARIA_SHARE.
        This was needed to be able to mark the handler if we had a 'non_flushable' call pending or not.
        Don't use 'non_flushable' marking of bitmap pages for not transactional tables.
        Added BLOCKUSED_USE_ORG_BITMAP handling also for tail pages.
        Added more DBUG_ASSERT() to find possible errors in other code
        Some code simplications by adding new local variables
      storage/maria/ma_blockrec.c:
        UNDO of rows now puts back all part of the row on their original pages and positions.
        Changed UNDO of DELETE and UNDO of UPDATE to contain information about the original length of data on head block and also extent information
        This changes a lot of logic as now an insert of a row on a page may happen to any position (and not just to the first or next free)
        Use PAGE_COUNT to mark if an extent is the start of of a blob. (Needed for extent_to_bitmap_blocks())
        Added check_directory() for checking that directroy entries are correct.
        Added checking of row checksums when reading rows (with EXTRA_DEBUG)
        Added make_space_for_directory() and extend_directory() for doing expansion of directory
        Added get_rowpos_in_head_or_tail_page() to be able to store head/tail on original position in UNDO
        Added extent_to_bitmap_blocks() to be able to generate original bitmap blocks from UNDO entry
        Added _ma_update_at_original_place() for UNDO of DELETES
        Added row->min_length to hold minmum required space needed on head page
        Changed find_free_position() to use make_space_for_directory()
        Changed make_empty_page() to allow optional creation of directory entry
        Changed delete_head_or_tail() and _ma_apply_undo_row_isnert() to not copy pagecache block (speed optimization)
        Changed _ma_apply_redo_insert_row_head_or_tail() to be able to insert new row at any position on 'new' page
        Changed _ma_apply_undo_row_delete() and _ma_apply_undo_row_update() to put row in it's original position
        Ensure allocation of tail blocks are of at least MIN_TAIL_SIZE.
        Ensure we store pages in pinned pages even if read failed. (If not we will have pages pinned forever in page cache)
        Write original extent information in UNDO entry, not compacted ones (we need position to tails!)
        When setting BLOCKUSED_USED, don't clear other bits (we have to preserve BLOCKUSED_USE_ORG_BITMAP)
        Fixed som bugs in directory handling
        Fixed bug where we wrote wrong lsn to blob pages
        Added separate blob_buffer for fixing bug when updating row that had char/varchar that spanned several pages and also had blobs
        Ensure we call _ma_bitmap_flushable() also in case of errors
        When doing an update, first delete old entries, then search in bitmap for where to put new information
        Info->s -> share
        Rowid -> rowid
        More DBUG_ASSERT()
      storage/maria/ma_blockrec.h:
        Added START_EXTENT_BIT and TAIL_PAGE_COUNT_MARKER
        Added _ma_bitmap_wait_or_flush() and _ma_bitmap_get_page_bits()
      storage/maria/ma_check.c:
        Don't write extra empty line if there is no deleted blocks
        Ignore START_EXTENT_BIT's in page count
        Call _ma_fast_unlock_key_del() to free key_del link
      storage/maria/ma_close.c:
        Ensure that used_key_del is 0. (If not, someone forgot to call _ma_unlock_key_del())
      storage/maria/ma_create.c:
        Changed constant to macro
      storage/maria/ma_delete.c:
        For deleted keys, log also position to row
      storage/maria/ma_extra.c:
        Release blob buffer at maria_reset() if bigger than MARIA_SMALL_BLOB_BUFFER
      storage/maria/ma_key_recover.c:
        Added bzero() of LSN that confused paged cache in case of uninitialized block
        Mark file crashed if applying of index changes fails
        Added calls to _ma_fast_unlock_key_del() for protection of shared key_del link.
      storage/maria/ma_locking.c:
        Added usage of MARIA_FILE_OPEN_COUNT_OFFSET
        Added _ma_mark_file_crashed()
      storage/maria/ma_loghandler.c:
        Fixed bug where we logged uninitialized memory
      storage/maria/ma_open.c:
        Moved state->changed to be at start of state info on disk to allow one to easly mark files as crashed
      storage/maria/ma_page.c:
        Disable 'dummy' checksumming of pages as this gave false warnings.
        (Need to investigate if this is ever needed)
      storage/maria/ma_pagecache.c:
        Fixed wrong shift that caused Maria to crash on files > 4G
      storage/maria/ma_recovery.c:
        In case of errors, start writing on new line if we where in %## %## printing mode (Made errors more readable)
        Changed global variable name from warnings -> recovery_warnings
        Use MARIA_FILE_CREATE_RENAME_LSN_OFFSET instead of constant
        Removed special handling of row position for deleted keys. Keys now always includes row positions
        _ma_apply_undo_row_delete() now gets page and row position
        Added check that we don't loop forever when handling undo's (in case of bug in undo chain)
        Print name of failed REDO/UNDO
      storage/maria/ma_recovery.h:
        Removed old comment
      storage/maria/ma_static.c:
        Chaned version number of Maria files to not accidently use old ones (becasue of change of ordering of status variables)
      storage/maria/ma_test2.c:
        Added option -u to specify number of rows to update
        Changed old option -u to be -A, as for ma_test1
        Fixed bug in update of rows with blobs (before blobs was always reset to empty on update)
        First created blob is now of max blob length to ensure we have at least one big blob in the table
      storage/maria/ma_test_all.sh:
        More tests
      storage/maria/ma_test_recovery.expected:
        Updated results
      storage/maria/ma_test_recovery:
        Changed tests to use bigger blobs (not just 1K)
        Added new tests that tests recovery of update with blobs
        Removed comparision of .MAD file as it's not guranteed that recovery from scratch gives identical data file as original update
        (compact_page() may be called at different times during normal execution and during REDO)
      storage/maria/ma_update.c:
        Simplify code (changed * to if)
      storage/maria/maria_chk.c:
        Make output more readable
      storage/maria/maria_def.h:
        Changed 'changed' to int to prepare for more bits
        Added 2 more bytes to status information
        Added 'st_mara_row->min_length' for storing min length needed on head page
        Added 'st_mara_handler->blob_buff & blob_buff_size' for storing blobs
        Moved all tunning parameters into one block
        Added MARIA_SMALL_BLOB_BUFFER
        Added _ma_mark_file_crashed()
      storage/myisam/mi_test2.c:
        Fixed bug in update of rows with blobs (before blobs was always reset to empty on update)
      storage/maria/ma_test_big.sh:
        Testing of insert, update, delete, recovery and undo of rows with blobs
        Thanks to the random-ness of ma_test2 this is likely to find most bugs in the row handling
      bfd5c273
    • unknown's avatar
      WL#3072 - Maria Recovery · 18bc7b69
      unknown authored
      * to honour WAL we now force the whole log when flushing a bitmap page.
      * ability to intentionally crash in various places for recovery testing
      * bugfix (dirty pages list found in checkpoint record was ignored)
      * smaller checkpoint record
      * misc small cleanups and comments
      
      
      mysql-test/include/maria_empty_logs.inc:
        maria-purge.test creates ~11 logs, remove them all
      mysql-test/r/maria-recovery-bitmap.result:
        result is good; without the _ma_bitmap_get_log_address() call,
        we got
        check   error   Bitmap at 0 has pages reserved outside of data file length
      mysql-test/r/maria-recovery.result:
        result update
      mysql-test/t/maria-recovery-bitmap.test:
        enable test of "bitmap-flush should flush whole log otherwise
        corrupted data file (bitmap ahead of data pages)".
      mysql-test/t/maria-recovery.test:
        test of checkpoint
      sql/sql_table.cc:
        comment
      storage/maria/ha_maria.cc:
        _ma_reenable_logging_for_table() now includes file->trn=0.
        At the end of repair() we don't need to re-enable logging, it is
        done already by caller (like copy_data_between_tables()); it sounds
        strange that this function could decide to re-enable, it should be
        up to caller who knows what other operations it plans. Removing this
        line led to assertion failure in maria_lock_database(F_UNLCK), fixed
        by removing the assertion: maria_lock_database()
        is here called in a context where F_UNLCK does not make the
        table visible to others so assertion is excessive, and external_lock()
        is already designed to honour the asserted condition.
        Ability to crash at the end of bulk insert when indices
        have been enabled.
      storage/maria/ma_bitmap.c:
        Better use pagecache_file_init() than set pagecache callbacks directly;
        and a new function to set those callbacks for bitmap so that we can
        reuse it.
        _ma_bitmap_get_log_address() is a pagecache get_log_address callback
        which causes the whole log to be flushed when a bitmap page
        is flushed by the page cache. This was required by WAL.
      storage/maria/ma_blockrec.c:
        get_log_address pagecache callback for data (non bitmap) pages:
        just reads the LSN from the page's content, like was hard-coded
        before in ma_pagecache.c.
      storage/maria/ma_blockrec.h:
        functions which need to be exported
      storage/maria/ma_check.c:
        create_new_data_handle() can be static.
        Ability to crash after rebuilding the index in OPTIMIZE,
        in REPAIR. my_lock() implemented already.
      storage/maria/ma_checkpoint.c:
        As MARIA_SHARE* is now accessible to pagecache_collect_changed_blocks_LSN(),
        we don't need to store kfile/dfile descriptors in checkpoint record,
        2-byte-id of the table plus one byte to say if this is data or index
        file is enough. So we go from 4+4 bytes per table down to 2+1.
      storage/maria/ma_commit.c:
        removing duplicate functions (see _ma_tmp_disable_logging_for_table())
      storage/maria/ma_extra.c:
        Monty fixed
      storage/maria/ma_key_recover.c:
        comment
      storage/maria/ma_locking.c:
        Sometimes other code does funny things with maria_lock_database(),
        like ha_maria::repair() calling it at start and end without going
        through ha_maria::external_lock(). So it happens that maria_lock_database()
        is called with now_transactional!=born_transactional.
      storage/maria/ma_loghandler.c:
        update to new prototype
      storage/maria/ma_open.c:
        set_data|index_pagecache_callbacks() need to be exported as
        they are now called when disabling/enabling transactionality.
      storage/maria/ma_pagecache.c:
        Removing PAGE_LSN_OFFSET, as much of the code relies on it being
        0 anyway (let's not give impression we can just change this constant).
        When flushing a page to disk, call the get_log_address callback to
        know up to which LSN the log should be flushed.
        As we now can access MARIA_SHARE* we can know share->id and store
        it into the checkpoint record; we thus go from 4 bytes per dirty page
        to 2+1.
      storage/maria/ma_pagecache.h:
        get_log_address callback
      storage/maria/ma_panic.c:
        No reason to reset pagecache callbacks in HA_PANIC_READ:
        all we do is reopen files if they were closed; callbacks should
        be in place already as 'info' exists; we just want to modify
        the file descriptors, not the full PAGECACHE_FILE structure.
        If we open data file and it was closed, share->bitmap.file needs
        to be set.
        Note that the modified code is disabled anyway.
      storage/maria/ma_recovery.c:
        Checkpoint record does not contain kfile/dfile descriptors anymore
        so code can be simplified. Hash key in all_dirty_pages is 
        not made from file_descriptor & pageno anymore, but
        index_or_data & table-short-id & pageno.
        If a table's create_rename_lsn is higher than record's LSN,
        we skip the table and don't fail if it's corrupted (because the LSNs
        say that we don't have to look at this table).
        If a table is skipped (for example due to create_rename_lsn),
        its UNDOs still cause undo_lsn to advance; this is so that if later
        we notice the transaction has to rollback we fail (as table should
        not be skipped in this case).
        Fixing a bug: the dirty_pages list was never used, because
        the LSN below which it was used was the minimum rec_lsn of dirty pages!
        It is now the min(checkpoint_start_log_horizon, min(trn's rec_lsn)).
        When we disable/reenable transactionality, we modify pagecache
        callbacks (needed for example for get_log_address: changing
        share->page_type is not enough anymore).
      storage/maria/ma_write.c:
        'records' and 'checksum' are protected: they are updated under
        log's mutex in write-hooks when UNDO is written.
      storage/maria/maria_chk.c:
        remove use of duplicate functions.
      storage/maria/maria_def.h:
        set_data|index_pagecache_callbacks() need to be exported;
        _ma_reenable_logging_for_table() changes to a real function.
      storage/maria/unittest/ma_pagecache_consist.c:
        new prototype
      storage/maria/unittest/ma_pagecache_single.c:
        new prototype
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        new prototype
      18bc7b69