1. 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
  2. 30 Jun, 2008 4 commits
    • Guilhem Bichot's avatar
      cutting test in two because it takes many things · 6559f5c2
      Guilhem Bichot authored
      mysql-test/r/maria-recovery.result:
        cutting test in two
      mysql-test/r/maria-recovery2.result:
        cutting test in two
      mysql-test/t/maria-recovery.test:
        cutting test in two
      mysql-test/t/maria-recovery2-master.opt:
        cutting test in two
      mysql-test/t/maria-recovery2.test:
        cutting test in two
      6559f5c2
    • Guilhem Bichot's avatar
      Fix for BUG#37288 "Maria - zerofill corrupts table". Testcase is running... · 24257638
      Guilhem Bichot authored
      Fix for BUG#37288 "Maria - zerofill corrupts table". Testcase is running ma_test_recovery.pl on Windows.
      
      storage/maria/ma_blockrec.c:
        comment
      storage/maria/ma_check.c:
        When zerofilling the data file, _ma_compact_block_page() may increase free space in a
        page so bitmap page needs to be corrected.
      24257638
    • Guilhem Bichot's avatar
      Fix for BUG#35107 "maria-preload.test is disabled because causes assertion". · fdebe278
      Guilhem Bichot authored
      maria-preload will be re-enabled later because other pieces of it have possibly random output.
      
      storage/maria/ma_check.c:
        Fix for BUG#35107 "maria-preload.test is disabled because causes assertion".
      fdebe278
    • Guilhem Bichot's avatar
      Fix for unit test failures. · 0432bc1e
      Guilhem Bichot authored
      storage/maria/ma_test1.c:
        rec_length was too short by one byte: at line 299 memcpy(record,read_record,rec_length) thus didn't copy the
        last byte, so 'record' was not ok for use by update_record(), contained an incomplete blob address, sometimes
        crashed on Itanium.
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Tests failed once, never before for hundreds of times, we don't know if test is correct, disabling.
      0432bc1e
  3. 28 Jun, 2008 5 commits
    • Michael Widenius's avatar
      Disable versioning (concurrent writes) if more than one unique key · f27efe69
      Michael Widenius authored
      The reason for this is that if we change one unique key and then get a failure on the second, we may not be able to rename the first one back before someone else writes the same key value.  In Maria 2.0, when we keep deleted key values in the tree, this will not be a problem anymore
      Fixed typedisable concurrent insert/select for SQLCOM_LOAD as there are problems with concurrent threads during index recreation
      
      KNOWN_BUGS.txt:
        More comments
      storage/maria/ha_maria.cc:
        Fixed typo (REPLACE -> INSERT)
        Also disable concurrent insert/select for SQLCOM_LOAD as there are problems with concurrent threads during index recreation
      storage/maria/ma_open.c:
        Disable versioning (concurrent writes) if more than one unique key
      f27efe69
    • Michael Widenius's avatar
      Automatic merge · c5805837
      Michael Widenius authored
      Added some minor changes that was done in my tree while waiting for test to run:
      - Remove in Maria T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
      - Disable code that is only relevant for EXTERNAL_LOCKING
      
      include/m_string.h:
        Automatic merge
      storage/maria/ha_maria.cc:
        Remove T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
      storage/maria/ma_check.c:
        Automatic merge
      storage/maria/ma_key.c:
        Automatic merge
      storage/maria/ma_loghandler.c:
        Automatic merge
      storage/maria/ma_open.c:
        Disable code that is only relevant for EXTERNAL_LOCKING
      storage/maria/ma_sp_key.c:
        Automatic merge
      storage/maria/ma_write.c:
        Automatic merge
      storage/maria/trnman.c:
        Automatic merge
      c5805837
    • Michael Widenius's avatar
      Fix for Bug #37007 Maria: different checksum for MyISAM table depending on CHECKSUM=0|1 · d29e7f74
      Michael Widenius authored
      This also adds a check that MyISAM tables with incompatible checksums are detected by CHECK TABLE ... [FOR UPGRADE] and thus also by mysql_upgrade.
      The tables that are incomatible are MyISAM tables with ROW_FORMAT=fixed and has VARCHAR fields and have CHECKSUM enabled.
      Before these tables gave different checksum if you used CHECK TABLE with or without EXTENDED
      
      mysql-test/r/old-mode.result:
        Now we get same results with and without EXTENDED
      mysql-test/r/row-checksum-old.result:
        Initial results
      mysql-test/r/row-checksum.result:
        Initial results
      mysql-test/t/old-mode.test:
        Added test with QUICK to show that the live checksum is not used when running with --old
      mysql-test/t/row-checksum-old-master.opt:
        Start mysqld with --old mode to enable old checksum code
      mysql-test/t/row-checksum-old.test:
        Run row-checksum test under mysqld --old
      mysql-test/t/row-checksum.test:
        Verify that checksum are calculated the same way with and without EXTENDED
        We run this with several storage engines to ensure results are the same over storage engines
      sql/ha_partition.cc:
        Use new HA_HAS_xxx_CHECKSUM flags
      sql/handler.cc:
        Use new HA_HAS_xxx_CHECKSUM flags
      sql/handler.h:
        Split HA_HAS_CHECKSUM into HA_HAS_NEW_CHECKSUM and HA_HAS_OLD_CHECKSUM flags.
        This is a safe API change as only MyISAM and Maria should use these handler flags.
      sql/sql_show.cc:
        Use new HA_HAS_xxx_CHECKSUM flags
      sql/sql_table.cc:
        Use file->checksum() for live checksums if the life checksum method corresponds to the mysqld --old flag
      storage/maria/ha_maria.cc:
        Use new HA_HAS_xxx_CHECKSUM flags
      storage/myisam/ha_myisam.cc:
        Set HA_HAS_OLD_CHECKSUM and/or HA_HAS_NEW_CHECKSUM flags depending on if this is a new myisam or old myisam file
        Add method check_for_upgrade() to detect if the table is of old version with a checksum that is incompatible with CHECK TABLE ... EXTENDED
      storage/myisam/ha_myisam.h:
        Added check_for_upgrade()
      storage/myisam/mi_open.c:
        Removed not neede cast
        Initialize share->has_null_fields and share->has_varchar_fields variables
      storage/myisam/myisamdef.h:
        Added share->has_null_fields and share->has_varchar_fields
      d29e7f74
    • Sergei Golubchik's avatar
    • 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
  4. 26 Jun, 2008 5 commits
    • unknown's avatar
      merge · 38d024b5
      unknown authored
      38d024b5
    • unknown's avatar
      Fixed maria-big test failure. · 7b8d4af1
      unknown authored
      storage/maria/ma_loghandler.c:
        Processed case when current buffer filled but there is no new LSN in the buffer generated (so it is no need to fluesh this buffer) and buffer->last_lsn is LSN_IMPOSSIBLE.
      7b8d4af1
    • 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
      Merge; No notable changes · 1d726038
      Michael Widenius authored
      .bzr-mysql/default.conf:
        Automatic merge
      config/ac-macros/plugins.m4:
        Automatic merge
      configure.in:
        Automatic merge
      include/my_global.h:
        Automatic merge
      mysql-test/include/maria_empty_logs.inc:
        Use Guilmhems version, but don't echo use database
      mysql-test/r/maria-no-logging.result:
        Automatic merge
      mysql-test/r/maria-page-checksum.result:
        Automatic merge
      mysql-test/r/maria-recover.result:
        Automatic merge
      mysql-test/r/maria2.result:
        Automatic merge
      mysql-test/t/maria-no-logging.test:
        Automatic merge
      mysql-test/t/maria-page-checksum.test:
        Automatic merge
      mysql-test/t/maria-purge.test:
        Automatic merge
      mysql-test/t/maria-recover.test:
        Automatic merge
      mysql-test/t/maria2.test:
        Automatic merge
      sql/sql_table.cc:
        Automatic merge
      storage/maria/CMakeLists.txt:
        Automatic merge
      storage/maria/ma_ft_parser.c:
        Automatic merge
      storage/maria/ma_loghandler.c:
        Automatic merge
      storage/maria/ma_recovery.c:
        Automatic merge
      storage/maria/ma_rt_test.c:
        Manual merge
      storage/maria/ma_state.c:
        Automatic merge
      storage/maria/ma_test_force_start.pl:
        Automatic merge
      storage/maria/plug.in:
        Automatic merge
      storage/maria/unittest/CMakeLists.txt:
        Automatic merge
      storage/maria/unittest/Makefile.am:
        Automatic merge
      storage/maria/unittest/ma_test_all-t:
        Automatic merge
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Automatic merge
      storage/maria/unittest/ma_test_recovery.pl:
        Automatic merge
      storage/myisam/rt_test.c:
        Automatic merge
      1d726038
    • 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
  5. 24 Jun, 2008 1 commit
  6. 16 Jun, 2008 1 commit
  7. 13 Jun, 2008 2 commits
    • Guilhem Bichot's avatar
      Port of ma_test_force_start.pl (test program for... · 771a66ea
      Guilhem Bichot authored
      Port of ma_test_force_start.pl (test program for --maria-force-start-after-recovery-failures) to Windows.
      
      storage/maria/ma_test_force_start.pl:
        port to Windows: detection of where 'mysql' command-line client is (debug/release/etc)), .exe suffix,
        --console instead of --mem, --P instead of --socket, taskkill instead of perl's kill.
      771a66ea
    • Guilhem Bichot's avatar
      disabling lockman2-t: takes too much time for a unit test (>=15 min), and what it · 26f685e7
      Guilhem Bichot authored
      tests is not used in Maria, this fixes BUG#34744 "Maria Unit test "lockman2" fails
      on Mac OS X 10.4 PowerPC 64-bit"
      
      storage/maria/unittest/CMakeLists.txt:
        disabling lockman2-t
      storage/maria/unittest/Makefile.am:
        disabling lockman2-t
      26f685e7
  8. 12 Jun, 2008 2 commits
    • unknown's avatar
      More safe flush_horizon variable initialization. · abdda9e2
      unknown authored
      abdda9e2
    • Guilhem Bichot's avatar
      Fix for BUG#35801 "Maria: unreadable log during tests" and · bbef67f5
      Guilhem Bichot authored
      BUG#35823 "Maria: log handler assertion (page[page_offset] & (3 << 6)) == 0x00... fails"
      Both random problems can be explained by the REDO phase starting from a log horizon which is not a LSN,
      which is the bug fixed here.
      
      storage/maria/ma_recovery.c:
        In Recovery, REDO phase needs to start log reading from a LSN, not a log horizon: start_address was only
        guaranteed to be a horizon, not necessarily a LSN.
        On some machine and test, it happened that start_address was only a log horizon, and run_redo_phase()
        tried to read from there, and log handler naturally refused that:
        ma_loghandler.c:6797: translog_read_record_header_from_buffer: Assertion `translog_is_LSN_chunk(page[page_offset])' failed. And in non-debug build, just the "redo phase failed" message in the error log.
        This was random, because depended on amount of checkpoints which is timing-dependent; also depended on Maria tests
        ran or skipped (so, debug or non-debug builds)... Bad code was introduced by me end of December so it's likely
        to explain lots of random log handler errors we observed since.
      bbef67f5
  9. 11 Jun, 2008 1 commit
    • Guilhem Bichot's avatar
      Fix for BUG#37005 "Maria: ALTER TABLE TRANSACTIONAL=0 leaves table transactional inside Maria" · 8ac71501
      Guilhem Bichot authored
      mysql-test/r/maria-page-checksum.result:
        result for new test portion. Without the code fix, you would see a wrong "yes" or "no" in the "Crashsafe" line
        for iterations 2,9,14.
      mysql-test/t/maria-page-checksum.test:
        Adding test for BUG#37005 "Maria: ALTER TABLE TRANSACTIONAL=0 leaves table transactional inside Maria"
      sql/sql_table.cc:
        In ALTER TABLE, we already rebuilt the table entirely if the DEFAULT CHARSET, ROW_FORMAT or PAGE_CHECKSUM
        clauses were used; we have to do the same if the TRANSACTIONAL clause is used, because it affects
        the table inside the engine (for example, Maria makes shorter rows in non-transactional tables).
        Not doing so led to the BUG#37005, where ALTER TABLE TRANSACTIONAL=0 sometimes left the table
        transactional into Maria though not in the frm.
      8ac71501
  10. 10 Jun, 2008 6 commits
    • Guilhem Bichot's avatar
      public commit mails · 8ffd0339
      Guilhem Bichot authored
      8ffd0339
    • Guilhem Bichot's avatar
      automerge · 5465dd08
      Guilhem Bichot authored
      5465dd08
    • unknown's avatar
      Fixed non-debug build. · 7c87c307
      unknown authored
      storage/maria/ma_loghandler.c:
        Now we need buffer number to set dirty buffers mask.
      7c87c307
    • Guilhem Bichot's avatar
      Fix for BUG#36319 "Maria: table is not empty but DELETE and SELECT find no rows": · a0aa81f9
      Guilhem Bichot authored
      _ma_scan_block_record() has "while (likely(bits))" where bits is ulonglong, so was cast to long
      which lost most significant bits (32-bit linux), and test yielded false.
      
      include/my_global.h:
        It's too easy to think that because "if (some_longlong)" works as intended, "if (likely(longlong))" will work too,
        though it does not. Making likely() cast to bool.
      mysql-test/r/maria2.result:
        Result. Before fixing the bug, 810 was 812 and 0 was 812 (DELETE and SELECT found no rows
        though they were there).
      mysql-test/t/maria2.test:
        Testcase for the bug. maria.test is huge now, so starting a second test file instead.
      a0aa81f9
    • Guilhem Bichot's avatar
      Fix for Valgrind errors when running rt_test and ma_rt_test, and segmentation fault · f89c61f5
      Guilhem Bichot authored
      in ma_rt_test -M (BUG#36321); keyinfo/recinfo/keyseg had non-initialized parts.
      maria_scan() was not wrapped in maria_scan_init()/end() so "ma_rt_test -M" found no rows.
      Preparing for inclusion into ma_test_all-t and ma_test_recovery.pl (still prevented by
      BUG#37307 "Maria: R-tree unit test produces corrupted table").
      
      storage/maria/ma_rt_test.c:
        Some members of keyinfo, recinfo, keyseg had non-initialized parts, led to Valgrind errors,
        and also segmentation fault when running with -M (=BLOCK_RECORD) (BUG#36321).
        We now bzero them like they are in mi_test1.
        Other problems:
        - maria_scan() was not wrapped in maria_scan_init()/end() so "ma_rt_test -M" found no rows.
        - --silent had almost no effect, now it really silences normal output.
        - Some errors were going to stdout, they now go to stderr.
        Added option for testing versioning, to fit well into ma_test_all-t.
      storage/maria/unittest/ma_test_all-t:
        preparing for running ma_rt_test when ma_rt_test remaining bugs are fixed
      storage/maria/unittest/ma_test_recovery.pl:
        preparing for running ma_rt_test when ma_rt_test remaining bugs are fixed
      storage/myisam/rt_test.c:
        Some members of keyinfo, recinfo, keyseg were not initialized, led to Valgrind errors.
        We now bzero them like they are in mi_test1.
      f89c61f5
    • unknown's avatar
      merge · 0f660db3
      unknown authored
      0f660db3
  11. 09 Jun, 2008 2 commits
    • unknown's avatar
      WL#4401 "Maria - deserialize translog_flush() calls" · 3967b6cf
      unknown authored
      storage/maria/ma_loghandler.c:
        New flush procedure added.
      storage/maria/unittest/Makefile.am:
        Test of many multi-thread flush added
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        Test of many multi-thread flush added
      3967b6cf
    • Guilhem Bichot's avatar
      Fix for build failures under Windows · 5f26e738
      Guilhem Bichot authored
      storage/maria/CMakeLists.txt:
        add missing file
      storage/maria/ma_state.c:
        two include files are in storage/maria, not in include/, so they need "" not <>, or compiler misses them.
      5f26e738
  12. 06 Jun, 2008 1 commit
    • Guilhem Bichot's avatar
      Verify that if Maria table is absent or initially empty, CREATE SELECT and... · 54b719a2
      Guilhem Bichot authored
      Verify that if Maria table is absent or initially empty, CREATE SELECT and INSERT SELECT with enough
      rows cause no logging
      
      mysql-test/include/maria_empty_logs.inc:
        don't assume that mysqltest is the default db
      mysql-test/r/maria-no-logging.result:
        result. Without the optimization of disabling logging in ha_maria::start_bulk_insert(),
        we see 24k instead of 16k, in the cases where the table is empty.
      mysql-test/r/maria-purge.result:
        side effect of change to maria_empty_logs.inc
      mysql-test/t/maria-purge.test:
        maria-purge.test used to fail when run in a group like this "--big t/*maria*.test" because
        SHOW ENGINE MARIA LOGS was influenced by previous tests; deleting logs to fix that.
      54b719a2
  13. 05 Jun, 2008 1 commit
    • Sergei Golubchik's avatar
      use "default" plugin configuration by default, not "none". · 17a9470e
      Sergei Golubchik authored
      enable maria in the default plugin configuration
      
      config/ac-macros/plugins.m4:
        typo in comment fixed.
        change default plugin configuration to be "default" not "none".
        don't print default plugin configuration in the help text (as it's "default" anyway)
      configure.in:
        use "default" plugin configuration by default, not "none"
      storage/maria/plug.in:
        enable maria in the default plugin configuration
      17a9470e
  14. 04 Jun, 2008 3 commits
    • Michael Widenius's avatar
      Automatic merge · ab75389a
      Michael Widenius authored
      ab75389a
    • Michael Widenius's avatar
      Fixed failing trnman-t unit test · 7d39726b
      Michael Widenius authored
      mysql-test/valgrind.supp:
        Fixed suppression rule
      storage/maria/unittest/trnman-t.c:
        Test failed becasue it accessed reused structures.
        I fixed this by creating a separate array to hold trids for the transactions
      7d39726b
    • Guilhem Bichot's avatar
      Making maria-recover.test work the same with debug and non-debug builds: one... · 39049add
      Guilhem Bichot authored
      Making maria-recover.test work the same with debug and non-debug builds: one error message was specific of
      debug builds and is now removed, left only in non-ha-maria programs.
      
      mysql-test/r/maria-recover.result:
        This warning is not thrown anymore when used in ha_maria
      mysql-test/t/maria-recover.test:
        In this patch, corruption warnings are unified between debug and non-debug builds, so test can run on both
      storage/maria/ha_maria.cc:
        declare that Maria is used from ha_maria
      storage/maria/ma_static.c:
        new variable to tell if Maria is used from ha_maria
      storage/maria/maria_def.h:
        Comment describing what maria_print_error() does. And change of this macro: it now does nothing when Maria
        is used from ha_maria.
      39049add
  15. 03 Jun, 2008 3 commits
    • Guilhem Bichot's avatar
      comments in tests · 97189b02
      Guilhem Bichot authored
      mysql-test/t/maria-recover.test:
        comments
      97189b02
    • Guilhem Bichot's avatar
      Fix for BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS" · cd8f6a1e
      Guilhem Bichot authored
      mysql-test/r/maria.result:
        result; before the bugfix it would be "TRANSACTIONAL=1 transactional=1"
      mysql-test/t/maria.test:
        test for BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS"
      sql-bench/example:
        doblewrite->doublewrite
      sql/mysqld.cc:
        fix of a wrong 5.1->maria merge of the past
      sql/sql_insert.cc:
        removing my old idea of disabling transactionality in CREATE SELECT:
        1) it caused bugs because re-enabling (ha_enable_transaction()) causes implicit commit, so in complex cases
        like "CREATE SELECT some_func())", where some_func() would want to insert two rows in another table, and fail on the second row, the implicit commit would commit the inserted row, while it should roll back.
        2) it's not needed anymore, because CREATE SELECT uses bulk insert, and Maria has transactionality disabled by
        bulk insert.
      sql/sql_show.cc:
        This was duplicate code, causing BUG#36104 "INFORMATION_SCHEMA.TABLES shows TRANSACTIONAL=1 twice in CREATE_OPTIONS"
      cd8f6a1e
    • Guilhem Bichot's avatar
      Limit maria-recover.test to debug builds and non-ps-protocol for now. Reason... · 280c989c
      Guilhem Bichot authored
      Limit maria-recover.test to debug builds and non-ps-protocol for now. Reason is that non-debug Maria outputs
      less corruption warnings (to be discussed), and mysqltest eats warnings when in ps-protocol (to be discussed).
      This is temporary until a better fix is decided.
      
      mysql-test/t/maria-recover.test:
        limit test to debug builds and non-ps-protocol for now
      280c989c
  16. 02 Jun, 2008 2 commits
    • Guilhem Bichot's avatar
      send commit mails · f829f23e
      Guilhem Bichot authored
      f829f23e
    • Guilhem Bichot's avatar
      WL#4374 "Maria - force start if Recovery fails multiple times" · a5bcb63f
      Guilhem Bichot authored
      http://forge.mysql.com/worklog/task.php?id=4374
      new option --maria-force-start-after-recovery-failures=N; number of consecutive recovery failures (failures
      of log reading or recovery processing, anything in [translog_init(),maria_recovery_from_log()])
      is stored in the control file; if at a Maria start they are more than N, logs are removed. This is for automated
      systems which have to run whatever happens. As tables risk staying corrupted, --maria-recover should also
      be used on them: this revision makes maria-recover work (it was disabled).
      Fixed bug in translog_is_log_files(). translog_init() now prints message to error log if failed.
      Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there.
      
      KNOWN_BUGS.txt:
        As option --maria-force-start-after-recovery-failures is added, it corresponds to the wish "we should fix that if this happens etc".
        LOAD INDEX is not ignored since a few weeks. Listed concurrency bugs have been fixed some time ago.
        Recovery of fulltext and GIS indexes works since a few weeks.
      mysql-test/include/maria_make_snapshot.inc:
        configurable prefix in table's name (so far 't' or 't_corrupted')
      mysql-test/include/maria_make_snapshot_for_comparison.inc:
        configurable prefix in table's name (so far 't' or 't_corrupted')
      mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
        configurable prefix in table's name (so far 't' or 't_corrupted')
      mysql-test/include/maria_verify_recovery.inc:
        configurable prefix in table's name (so far 't' or 't_corrupted')
      mysql-test/lib/mtr_report.pl:
        new test maria-recover.test generates expected corruption warnings in the error log. maria-recovery.test's corrupted table is renamed to t_corrupted1 instead of t1.
      mysql-test/r/maria-preload.result:
        result update. maria_pagecache_read* values are similar to the previous version of this file, though a bit bigger
        because using the information_schema and the join leads to some internal maria temp table being used, and thus some
        blocks of it being read.
      mysql-test/r/maria-purge.result:
        engine's name in SHOW ENGINE MARIA LOGS changed.
      mysql-test/r/maria-recover.result:
        result for new test. We see corruption messages at first SELECT and then none at second SELECT, expected.
      mysql-test/r/maria-recovery.result:
        result update
      mysql-test/r/maria.result:
        new variables show up
      mysql-test/t/disabled.def:
        BUG#34911 is not fixed but the test had been made independent of the bug (workaround). A new bug (crash) has popped recently, so it has to stay
        disabled (BUG#35107).
      mysql-test/t/maria-preload.test:
        Work around BUG#34911 "FLUSH STATUS doesn't flush what it should":
        compute differences in status variables before and after relevant queries
      mysql-test/t/maria-recover-master.opt:
        test --maria-recover
      mysql-test/t/maria-recover.test:
        Test of the --maria-recover option (build a corrupted table and see if it is auto-repaired)
      mysql-test/t/maria-recovery-big.test:
        update for new API of include/maria*.inc
      mysql-test/t/maria-recovery-bitmap.test:
        update for new API of include/maria*.inc
      mysql-test/t/maria-recovery.test:
        update for new API of include/maria*.inc. Corrupted table t1 renamed to t_corrupted1, so that mtr_report.pl
        does not blindly remove all corruption messages for t1 which is
        a common name.
      storage/maria/ha_maria.cc:
        Enabling maria-recover.
        Adding option and global variable --maria_force_start_after_recovery_failures: ha_maria_init()
        calls mark_recovery_start() and mark_recovery_success() to keep track of failed consecutive recoveries
        and remove logs if needed.
        Removed \0 in the output of SHOW ENGINE MARIA LOGS; removed hard-coded engine name there.
      storage/maria/ma_checkpoint.c:
        new prototype
      storage/maria/ma_control_file.c:
        Storing in one byte in the control file, the number of consecutive recovery failures.
      storage/maria/ma_control_file.h:
        new prototype
      storage/maria/ma_init.c:
        new prototype
      storage/maria/ma_locking.c:
        Need to update open_count on disk at first write and close for transactional tables, like we already did for
        non-transactional tables, otherwise we cannot notice that the table is dubious.
      storage/maria/ma_loghandler.c:
        translog_is_log_files() is made more generic to serve either to search or to delete logs (the latter is
        for --maria-force-start-after-recovery-failures). It also had a bug (always returned FALSE).
      storage/maria/ma_loghandler.h:
        export function because ha_maria::mark_recovery_start() needs it
      storage/maria/ma_recovery.c:
        changing name of maria_recover() to distinguish from the maria-recover option.
      storage/maria/ma_recovery.h:
        changing name of maria_recover() to distinguish from the maria-recover option.
      storage/maria/ma_test_force_start.pl:
        Test of --maria-force-start-after-recovery-failures (and also, to be realistic, of --maria-recover).
        This is standalone because mysql-test-run does not support testing that multiple mysqld restarts expectedly failed.
        I'll have to run it on my machine and also on a Windows machine.
      storage/maria/unittest/ma_control_file-t.c:
        adding recovery_failures to the test
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        fix for compiler warning (unused variable in non-debug build)
      a5bcb63f