1. 29 Aug, 2007 1 commit
    • unknown's avatar
      Added maria_commit() and maria_begin() to be used with external tests · f7b766c0
      unknown authored
      Now ma_test1 -M -T and ma_test2 -M -T produces readable, applyable logs
      
      Note: The .MAD file is not binary identical after applying redo compare to a an original file.
      (This is becasue we don't have full information which function called PURGE_REDO_BLOCKS).
      To verify if a file was correctly applied, we now instead compare row checksums
      
      
      BitKeeper/etc/ignore:
        added storage/maria/tmp/*
      include/maria.h:
        Added maria_commit() and maria_begin() to be used with external tests
      storage/maria/ha_maria.cc:
        Ensure maria_def. is read in C mode
      storage/maria/ma_blockrec.c:
        Fixed redo handling.
        _ma_apply_redo_purge_blocks() updated to handle any number of purged blocks
        Removed code to make data file idenitcal after redo (can't easily be done). See changeset comments
        
        Now ma_test1 -M -T and ma_test2 -M -T produces readable, applyable logs
      storage/maria/ma_commit.c:
        More DBUG statements
        Moved variable declaration to start of function (portability fix)
        Added helper functions 'maria_commit()' and 'maria_begin()'
      storage/maria/ma_loghandler.c:
        Fixed wrong REDO_PURGE_BLOCKS initialization
      storage/maria/ma_recovery.c:
        Added UNDO_ROW_UPDATE
        Removed wrong setting of lsn (there was no lsn at the used position)
        Fixed REDO_PURGE_BLOCKS to handle any number of blocks
      storage/maria/ma_test1.c:
        Added transaction support (via maria_begin() & maria_commit()) to get a log that can be applied with maria_read_log
      storage/maria/ma_test2.c:
        Added transaction support (via maria_begin() & maria_commit()) to get a log that can be applied with maria_read_log
      storage/maria/ma_test_recovery:
        Create temporary files in maria/tmp
        Verify files with checksums instead of byte comparisons
      storage/maria/maria_chk.c:
        When using with -dss we only get  filename, records and checksum.
        This is useful to do a quick comparision if a files is identical to another one.
      storage/maria/maria_def.h:
        Added ma_commit()
      storage/maria/maria_read_log.c:
        Added --help
      f7b766c0
  2. 22 Aug, 2007 1 commit
    • unknown's avatar
      Fixed compiler warnings · d430e5bf
      unknown authored
      Fixed wrong hash function prototype (causes failure on 64 bit systems)
      
      
      mysql-test/r/rpl_events.result:
        Removed wrong merge (result file is now identical as in 5.1 tree)
      mysys/lf_hash.c:
        Fixed compiler warning
      mysys/my_safehash.c:
        Fixed wrong hash function prototype (causes failure on 64 bit systems)
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        Fixed compiler warning
      d430e5bf
  3. 21 Aug, 2007 2 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-maria · a1f80c1e
      unknown authored
      into  mysql.com:/home/my/mysql-maria
      
      
      a1f80c1e
    • unknown's avatar
      Fixes for bugs found by maria.test and event*tests: · a8d94b4a
      unknown authored
      Fixed bug when doing rnd_read followed by update.
      Don't duplicate error messages in log
      Initialize transaction object properly. Fixed failure in event*tests when running with maria
      
      
      mysql-test/mysql-test-run.pl:
        Removed warning when running with --external
      mysql-test/r/maria.result:
        Added back disabled test
        Verified that the result changes are correct
      mysql-test/t/maria.test:
        Added back disabled test
      sql/handler.cc:
        More debugging.
        Simple style change
      sql/sql_class.cc:
        Initialize transaction object properly. Fixed failure in event*tests when running with maria
      storage/maria/ha_maria.cc:
        More dbug info
      storage/maria/ma_blockrec.c:
        Removed not needed line
      storage/maria/ma_rrnd.c:
        Removed not used code
        Ensure that cur_row.lastpos is always set when reading record with rnd. (Fixes failure in maria.test)
      storage/maria/maria_def.h:
        Don't call maria_print_error() except with EXTRA_DEBUG
        (Removes duplicate error messages when somethings goes wrong)
      a8d94b4a
  4. 19 Aug, 2007 1 commit
    • unknown's avatar
      Storing/getting maximum LSN of the record which parts written · d0398f72
      unknown authored
      in the file to the file header.
      
      
      storage/maria/ma_loghandler.h:
        Getting maximum LSN of the record which parts written
        in the file to the file header.
      storage/maria/unittest/Makefile.am:
        Test suite for getting max LSN added.
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        Spelling fixed.
        Cleanup fixed.
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        Cleanup fixed.
      storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
        New BitKeeper file ``storage/maria/unittest/ma_test_loghandler_max_lsn-t.c''
      d0398f72
  5. 13 Aug, 2007 3 commits
    • unknown's avatar
      First LSN calls added for transaction log. · 4cf6756e
      unknown authored
      
      storage/maria/ma_checkpoint.c:
        Definitions of LSN should be collected in
        the one file (ma_loghandler_lsn.h)
      storage/maria/ma_loghandler.c:
        New calls to get first theoretical and first real LSN.
      storage/maria/ma_loghandler.h:
        New calls to get first theoretical and first real LSN.
      storage/maria/ma_loghandler_lsn.h:
        Defined yet another impossible LSN to indicate error.
      storage/maria/ma_recovery.c:
        The first LSN call changed.
      storage/maria/maria_read_log.c:
        The first LSN call changed.
      storage/maria/unittest/Makefile.am:
        New unittest added.
      storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
        New BitKeeper file ``storage/maria/unittest/ma_test_loghandler_first_lsn-t.c''
      4cf6756e
    • unknown's avatar
      Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-noflush · fddf5050
      unknown authored
      into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria
      
      
      storage/maria/ma_pagecache.c:
        Auto merged
      storage/maria/unittest/ma_test_loghandler-t.c:
        Auto merged
      storage/maria/ma_loghandler.c:
        merge
      storage/maria/ma_pagecache.h:
        merge
      fddf5050
    • unknown's avatar
      Ability to read unflushed data added (only problem with CRC left and have to be fixed). · 7c32eac4
      unknown authored
      Already written pages injection to the cache fixed.
      
      
      storage/maria/ma_loghandler.c:
        Ability to read unflushed data added.
      storage/maria/ma_page.c:
        Parameters added
      storage/maria/ma_pagecache.c:
        Already written pages injection to the cache fixed.
        Validator for case of page content injection added.
      storage/maria/ma_pagecache.h:
        Validator for case of page content injection added.
      storage/maria/unittest/Makefile.am:
        Test of reading unflushed data
      storage/maria/unittest/ma_test_loghandler-t.c:
        Define fixed.
        Restart of the log removed.
      storage/maria/unittest/ma_test_loghandler_noflush-t.c:
        New BitKeeper file ``storage/maria/unittest/ma_test_loghandler_noflush-t.c''
      7c32eac4
  6. 10 Aug, 2007 1 commit
  7. 09 Aug, 2007 2 commits
    • unknown's avatar
      * tests which use MERGE or INSERT DELAYED should run only · 0d301ee8
      unknown authored
      with engines which support that
      * temporarily adding option --global-subst to mysqltest so that
      the full testsuite can be run using Maria tables without failing
      on trivial differences (like diff in the engine clause of
      SHOW CREATE TABLE)
      * using recognizable tags for todos of the Maria team
      
      
      client/mysqltest.c:
        temporarily adding option --global-subst: its argument is X,Y.
        It replaces all occurrences of X by Y into mysqltest's result
        before the comparison with the expected result is done.
        This serves for when a test is run with --default-storage-engine=X
        where X is not MyISAM: tests using SHOW CREATE TABLE will always fail
        because SHOW CREATE TABLE prints X instead of MyISAM. With
        --global-subst=X,MyISAM , such trivial differences are eliminated and
        test may be reported as passing.
        For example, --global-subst=MARIA,MyISAM
        This is not good enough for merging into main trees! just for running
        many tests and finding bugs now!
      mysql-test/mysql-test-run.pl:
        new option --mysqltest to pass options to mysqltest (like we have
        --mysqld). Used for example like this:
        ./mtr --mysqltest=--global-subst=MARIA,MyISAM
      mysql-test/r/merge.result:
        update
      mysql-test/t/delayed.test:
        run test only with engines which support INSERT DELAYED
      mysql-test/t/merge.test:
        run test only with MyISAM tables, as they are required by MERGE
      sql/sql_delete.cc:
        recognizable tag
      sql/table.cc:
        recognizable tag
      storage/maria/ha_maria.cc:
        recognizable tag
      storage/maria/ma_check.c:
        recognizable tag
      storage/maria/ma_create.c:
        recognizable tag
      0d301ee8
    • unknown's avatar
      * "transactionality" needs to be preserved by TRUNCATE TABLE: · 95e2558f
      unknown authored
      a table with TRANSACTIONAL=x needs to still have it after TRUNCATE.
      No testcase, but without this fix, the frm and the Maria table
      got "out of sync" in this case:
      create table t1 (a int) row_format=page transactional=0;
      truncate table t1;
      After TRUNCATE, the Maria table (not the frm) was transactional
      (thus logging records, which is wrong).
      * fix for non-closed file at end of "maria_chk -r"
      
      
      sql/table.cc:
        "transactionality" needs to be preserved when truncating.
        It's behind a if() to not cancel the hack added to mysql_truncate()
        today for temporary Maria tables.
      storage/maria/ha_maria.cc:
        question for Monty (he also has a big mail from me on the same subject)
      storage/maria/ma_check.c:
        question for Monty (likely bugs)
      storage/maria/ma_create.c:
        debugging info
      storage/maria/ma_open.c:
        fix for datafile left open at end of "maria_chk -r":
        ma_open_datafile() happens after _ma_bitmap_init(), it sets dfile.file
        so needs to set share->bitmap.file.file too (they are copies of
        each other). Otherwise it breaks how closing of files works in
        BLOCK_RECORD (which is that info.dfile.file is not closed
        but share->bitmap.file.file is closed): not setting share->bitmap.file.file
        can lead to forgetting to close a file or closing a wrong file.
      95e2558f
  8. 08 Aug, 2007 5 commits
    • unknown's avatar
      as I disabled creation of the first empty bitmap at creation time, · 83ea6e4f
      unknown authored
      I disable it too for repair time.
      
      
      83ea6e4f
    • unknown's avatar
      Fix for · ddac4525
      unknown authored
      ./mtr --mysqld=--default-storage-engine=maria --mem ps:
      I got "can't sync on file UNOPENED" among the messages of REPAIR TABLE;
      due to a missing setting of bitmap.file.file to -1.
      Maria had two names "Maria" and "MARIA", using one now: "MARIA".
      
      
      storage/maria/ha_maria.cc:
        plug.in uses "MARIA". Some code apparently picks the name from
        plug.in (SHOW CREATE TABLE, run ps.test on Maria tables), other from
        mysql_declare_plugin (SHOW CREATE TABLE on partitioned tables, run
        partition.test with Maria tables), better make names identical.
      storage/maria/ma_check.c:
        running ps.test on Maria tables I got "can't sync on file UNOPENED"
        among the messages of REPAIR TABLE. That was due to maria_repair()
        closing the data file, setting info->dfile.file to -1 to prevent
        a wrong double close, but forgetting to also set
        info->s->bitmap.file.file to -1; it left it unchanged and so,
        when close_thread_tables() closed the old version of the repaired
        table, _ma_once_end_block_record() tried to fsync the closed
        descriptor, resulting in a message.
        Basically, when setting info->dfile.file to something it's always
        safe and recommended to set bitmap.file.file to the same value
        as it's just a copy of the same descriptor see _ma_bitmap_init().
        Using change_data_file_descriptor() for that.
        Changing that function to use MY_WME as it looks safe.
      storage/maria/ma_close.c:
        no need to make the index file durable if table is not transactional
      ddac4525
    • unknown's avatar
      Tests which use INSERT DELAYED or MERGE tables should explicitely · c7f9cf12
      unknown authored
      specify that they want a MyISAM table, otherwise they fail
      when run with --default-storage-engine=maria.
      
      
      mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
        uses INSERT DELAYED so has to specify MyISAM
      mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
        uses INSERT DELAYED so has to specify MyISAM
      mysql-test/r/query_cache.result:
        result update
      mysql-test/r/rpl_insert.result:
        result update
      mysql-test/r/rpl_stm_flsh_tbls.result:
        result update
      mysql-test/r/rpl_stm_insert_delayed.result:
        result update
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        result update
      mysql-test/r/subselect.result:
        result update
      mysql-test/t/query_cache.test:
        uses MERGE so has to specify MyISAM
      mysql-test/t/query_cache_merge.test:
        uses MERGE so has to specify MyISAM
      mysql-test/t/rpl_insert.test:
        uses INSERT DELAYED so has to specify MyISAM
      mysql-test/t/rpl_stm_flsh_tbls.test:
        specifying the engine lengthens the query in binlog so shifts
        positions
      mysql-test/t/rpl_switch_stm_row_mixed.test:
        uses INSERT DELAYED so has to specify MyISAM
      mysql-test/t/subselect.test:
        uses INSERT DELAYED so has to specify MyISAM
      c7f9cf12
    • unknown's avatar
      Hackish fix for at-shutdown assertions in · 711a8201
      unknown authored
      ./mtr --mysqld=--default-storage-engine=maria --mem --skip-ndb temp_table truncate --force
      The root cause of the problem has been reported as BUG#30309
      "mysql_truncate() does not inform engine that the recreated table is temporary"
      The temporary fix used here is that when mysql_truncate() identifies
      a temp table of engine "Maria" it declares it non-transactional,
      thus the table is re-created by ha_maria::create() as non-transactional.
      
      
      sql/mysqld.cc:
        porting fix of BUG#29133 (mysqld takes too much time to shutdown
        without this fix, I can't wait for the next merge)
      sql/sql_delete.cc:
        a hack to work around BUG#30309 "mysql_truncate() does not inform
        engine that the recreated table is temporary"
      711a8201
    • unknown's avatar
      propagation to maria_repair_by_sort() and maria_repair_parallel() · 62b30a19
      unknown authored
      of bugfix made to maria_repair() yesterday.
      Fail "bk delta" (and thus "bk citool") if an added or modified line
      of a C/C++ file has white space at end of line
      
      
      BitKeeper/triggers/pre-delta:
        detection gave false alarm on added newline
      storage/maria/ma_check.c:
        propagation to maria_repair_by_sort() and maria_repair_parallel()
        of bugfix made to maria_repair() yesterday. No effect now as
        those two repair variants are never used with BLOCK_RECORD.
      62b30a19
  9. 07 Aug, 2007 2 commits
    • unknown's avatar
      Fix for errors during: · 1ad3a05d
      unknown authored
      "./mtr --mysqld=--default-storage-engine=maria mysqldump".
      First problem was use of INSERT DELAYED and MERGE tables without
      specifying that the tables to create should always be MyISAM.
      After fixing this, no rows were returned by the final SELECT of the
      "BUG 19025" portion of the test. Simplified problem was:
      LOCK TABLES `t1` WRITE;
      /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
      INSERT INTO `t1` VALUES ('bla',1000),('bla',1001),('bla',1002);
      /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
      UNLOCK TABLES;
      select * from t1;
      The SELECT would find no rows. Reason: ENABLE KEYS does a maria_repair();
      but data pages are still in the page cache and not on disk (because
      they were not flushed because maria_lock_database(F_UNLCK) was
      not called at the end of INSERT because under LOCK TABLES).
      At start of maria_repair(), sort_info.filelength is set to the
      physical size of the data file (=> too small because pages are in
      cache and not on disk).
      Then in sort_get_next_record(), when seeing end-of-file, this is done:
      sort_param->max_pos= sort_info->filelength;
      Further in maria_repair(), this is done:
      info->state->data_file_length= sort_param.max_pos;
      and so data_file_length is smaller (0) than reality (16384).
      This makes SELECT think EOF is where it is not, and thus find
      no rows.
      This is fixed by flushing all data pages at the start of maria_repair()
      (no performance problem is introduced as in common cases where
      ALTER TABLE is not under LOCK TABLES, the previous statement did
      this flush anyway).
      Another reason to do this flush is that, if not doing it, old cached
      pages might go down onto the repaired data file at a later point
      and thus corrupt it (assume a REPAIR non-QUICK).
      A similar bug is fixed:
      LOCK TABLES WRITE; INSERT; CHECK TABLE;
      reports "Size of datafile is: 0         Should be: 16384"
      again because the physical size was read without a preliminary
      page cache flush.
      
      
      mysql-test/r/maria.result:
        result update
      mysql-test/r/mysqldump.result:
        result update
      mysql-test/t/maria.test:
        adding test for fixed bug in LOCK TABLES + CHECK TABLE + block format.
        Disabling portion which hits "incorrect key file" but still
        letting it make the test fail (Monty to fix).
      mysql-test/t/mysqldump.test:
        in places where test expects engine to support INSERT DELAYED and
        be includable in a MERGE table, i.e. be MyISAM, we explicitely
        ask for MyISAM.
      storage/maria/ma_check.c:
        Before reading the data file's physical size with my_seek(MY_SEEK_END)
        during maria_chk_size() and maria_repair(), we must flush this
        data file, otherwise physical size is misleading and leads to
        - CHECK TABLE finding the table corrupted ("size of datafile should be"
        error)
        - ALTER TABLE ENABLE KEYS losing rows (maria_repair()
        setting data_file_length to a too small value => later SELECT does
        not find rows though they are in the data file).
        This fixes the "mysqldump.test" failure.
        sort_info.filelength contains the physical size, re-using it.
      1ad3a05d
    • unknown's avatar
      Fix for three bugs: · 72c3c369
      unknown authored
      number 1: "./mtr --mysqld=--default-storage-engine=maria backup"
      restored no rows (forgot to flush data pages before my_copy(),
      and also the maria_repair() used by ha_maria::restore() needed
      a correct data_file_length to not miss rows). [note that BACKUP
      TABLE will be removed anyway in 5.2]
      number 2: "./mtr --mysqld=--default-storage-engine=maria bootstrap"
      caused segfault (uninitialized variable)
      number 3: "./mtr --mysqld=--default-storage-engine=maria check"
      showed warning in CHECK TABLE (maria_create() created a non-empty
      data file with data_file_length==0).
      
      
      storage/maria/ha_maria.cc:
        in ha_maria::backup, need to flush the data file before copying it,
        otherwise data misses from the copy (bug 1)
      storage/maria/ma_bitmap.c:
        when allocating data at the end of the bitmap, best_data is at "end",
        should not be left to 0 (bug 2)
      storage/maria/ma_check.c:
        _ma_scan_block_record() is used in QUICK repair. It relies on
        data_file_length. RESTORE TABLE mixes the MAI of an empty table
        (so, data_file_length==0) with an non-empty MAD, and does a 
        QUICK repair; that got fooled (thought it had hit EOF immediately,
        so found no records) (bug 1)
      storage/maria/ma_create.c:
        At the end of maria_create() we have, in the index file,
        data_file_length==0, while the data file has a bitmap page (8192).
        This inconsistency makes CHECK TABLE rightly complain.
        Fixed by not creating a first bitmap page during maria_create()
        (also saves disk space) (bug 3) Question for Monty.
      storage/maria/ma_extra.c:
        A function to flush the data and index files before one can
        use OS syscalls (reads, writes) on those files. For example,
        ha_maria::backup() does a my_copy() of the data file and so
        all cached pieces of this file must be sent to the OS (bug 1)
        This function will have to be used elsewhere in Maria, several places
        have not been updated when we added pagecache-ing of the data file
        (they still only flush the index file), they are probable bugs.
      storage/maria/maria_def.h:
        new function. Needs to be visible from ha_maria::backup.
      72c3c369
  10. 06 Aug, 2007 2 commits
    • unknown's avatar
      Make test does not fail if run with · 1b47e3da
      unknown authored
      --mysqld=--default-storage-engine=X where X does not support
      INSERT DELAYED (like Maria)
      
      
      mysql-test/r/alter_table.result:
        result update
      mysql-test/t/alter_table.test:
        so that test does not fail if run with
        --mysqld=--default-storage-engine=X where X does not support
        INSERT DELAYED (like Maria)
      1b47e3da
    • unknown's avatar
      fixes of bad merge (probably). Less duplication in ma_test_recovery. · ec547ae8
      unknown authored
      
      storage/maria/ma_range.c:
        old code, which is wrong now (key_len is now a local variable,
        not initialized). Fixes some problems in running ma_test2.
      storage/maria/ma_test2.c:
        keypart_map should be used instead of length (fix of bad merge
        probably)
      storage/maria/ma_test_recovery:
        less duplication in this script (one loop instead).
      ec547ae8
  11. 03 Aug, 2007 1 commit
    • unknown's avatar
      Log handler's unit test were broken by me on June 22, fixing this: · 3d0f42a9
      unknown authored
      don't auto-log LOGREC_LONG_TRANSACTION_ID in log handler's unit tests,
      as they read their log and expect to find only the records they asked
      for, and so not LOGREC_LONG_TRANSACTION_ID. All log handler's unit
      tests pass. A way to run them faster: when their LONG_BUFFER_SIZE is
      too big (1GB) I divide it by ten and then I can run them on /dev/shm
      - they are then "instant".
      By the way, pushbuild was not displaying anymore "unit: failed" in
      the list of all pushes, which participates to the reasons why I didn't
      notice the breakage earlier. The other reason being that I was too lazy
      to run log handler unit tests on my machine as they took long (hadn't
      yet thought about the /dev/shm idea) and so I relied on pushbuild;
      Danny has now quickly fixed pushbuild - thanks :)
      
      
      storage/maria/unittest/ma_test_loghandler-t.c:
        don't auto-log LOGREC_LONG_TRANSACTION_ID in log handler's unit tests,
        as they read their log and expect to find only the records they asked
        for
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        don't auto-log LOGREC_LONG_TRANSACTION_ID in log handler's unit tests,
        as they read their log and expect to find only the records they asked
        for
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        don't auto-log LOGREC_LONG_TRANSACTION_ID in log handler's unit tests,
        as they read their log and expect to find only the records they asked
        for
      storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
        don't auto-log LOGREC_LONG_TRANSACTION_ID in log handler's unit tests,
        as they read their log and expect to find only the records they asked
        for
      3d0f42a9
  12. 02 Aug, 2007 1 commit
    • unknown's avatar
      WL#3072 Maria checkpoint · 91f03a4d
      unknown authored
      Preparation: for the two-checkpoint rule we will flush all pages
      which have block->rec_lsn <= last_checkpoint_lsn. Pages with
      rec_lsn not yet set (i.e. ==0) were dirtied very recently and so should
      not be flushed (otherwise it's not efficient: we should try to let
      a page be modified several times in memory before we flush it to disk).
      To make this easy, "block->rec_lsn not yet set" is now expressed
      with block->rec_lsn==LSN_MAX, not block->rec_lsn==0 anymore.
      It is easier this way because LSN_MAX>last_checkpoint_lsn whereas
      0<=last_checkpoint_lsn.
      
      
      storage/maria/ma_blockrec.c:
        typo
      storage/maria/ma_loghandler.c:
        typo
      storage/maria/ma_loghandler_lsn.h:
        LSN_MAX
      storage/maria/ma_pagecache.c:
        "block->rec_lsn not yet set" is now expressed by block->rec_lsn==LSN_MAX,
        not block_rec_lsn==0.
      91f03a4d
  13. 01 Aug, 2007 1 commit
    • unknown's avatar
      WL#3072 Maria recovery: · 372b4ed4
      unknown authored
      preparation to enable recoverability of the table's state, more exactly
      info->state->checksum. This will require that info->state->checksum
      be updated in a inwrite_hook when writing an UNDO record, thus
      info->cur_row.checksum needs to be accessible to inwrite_hook, so we
      make translog_write_record() accept a MARIA_HA* (info) instead of
      MARIA_SHARE* (info->s); with this, we will be able to access
      info->cur_row.checksum. Old code which needed the MARIA_SHARE
      can derive it from MARIA_HA. Fix for typos and compiler warnings.
      
      
      storage/maria/ma_blockrec.c:
        fix for new loghandler API. Removing strange lines (how could gcc
        accept that?)
      storage/maria/ma_check.c:
        fix for new loghandler API
      storage/maria/ma_delete_all.c:
        fix for new loghandler API
      storage/maria/ma_loghandler.c:
        functions now take a MARIA_HA in argument, this is more powerful
        than a MARIA_SHARE (MARIA_SHARE can be derived from MARIA_HA, not
        the other way around). MARIA_HA will be needed to allow recoverability
        of the table's state.
        Fixing wrong DBUG_PRINT ('i' is not the id).
        When writing the LOGREC_FILE_ID, we don't have a MARIA_HA around,
        so we cannot ask translog_write_record() to store the id for us;
        we thus store the file's id by ourselves. Alternative would have been
        to pass MARIA_HA to translog_assign_id_to_share() but I didn't like it.
      storage/maria/ma_loghandler.h:
        new loghandler API
      storage/maria/tablockman.c:
        fix for compiler warning (intptr is int on my machine)
      372b4ed4
  14. 31 Jul, 2007 2 commits
  15. 30 Jul, 2007 2 commits
    • unknown's avatar
      Applying Sanja's patch which makes the log handler not issue · 2cccfcd8
      unknown authored
      errors when reading a log record which has a 0-length header
      (like LOGREC_REDO_DROP_TABLE).
      
      
      storage/maria/ma_loghandler.c:
        Functions reading record's header now don't use 0 to indicate error,
        as some valid records have a 0-length header (like REDO_DROP_TABLE).
        Instead, negative values are used for EOF and error.
      storage/maria/ma_loghandler.h:
        functions to read record's header now return an int
        (either the length of this header (>=0) or some negative values
        for EOF or error).
      storage/maria/ma_recovery.c:
        update to the new log handler's behaviour. Note the @todo.
      storage/maria/maria_read_log.c:
        inform when program failed
      storage/maria/unittest/ma_test_loghandler-t.c:
        update to new log handler's API
      storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
        update to new log handler's API
      storage/maria/unittest/ma_test_loghandler_multithread-t.c:
        update to new log handler's API
      2cccfcd8
    • unknown's avatar
      Maria: it is allowed to change unknown type to any legal type of page · 9554b40d
      unknown authored
      in the pagecache: fixing wrong assertion and a test case.
      maria.test and ps_maria.test still fail.
      
      
      mysql-test/r/maria.result:
        result update
      mysql-test/t/maria.test:
        added test for incorrect assert on page's type
      storage/maria/ma_pagecache.c:
        It is allowed to change unknown type to any legal type of page in the
        pagecache.
      9554b40d
  16. 27 Jul, 2007 2 commits
    • unknown's avatar
      porting Serg's fix for BUG#30094 to Maria. Now ma_test_all passes. · 9b1e83db
      unknown authored
      maria.test and ps_maria.test still fail.
      
      
      mysys/mf_keycache.c:
        split string annoys some compilers
      storage/maria/ha_maria.cc:
        fix for compiler warnings
      storage/maria/ma_test1.c:
        porting Serg's fix for BUG#30094 to Maria
      storage/maria/ma_test2.c:
        porting Serg's fix for BUG#30094 to Maria
      storage/maria/ma_test3.c:
        porting Serg's fix for BUG#30094 to Maria
      storage/maria/ma_test_recovery:
        don't print ma_test1's messages if no problem
      9b1e83db
    • unknown's avatar
      merging MyISAM changes into Maria (not done in 5.1->maria merge of · a3d2ae46
      unknown authored
      Jul 7th). "maria.test" and "ps_maria.test" still fail;
      "ma_test_all" starts failing (MyISAM has the same issue see BUG#30094).
      
      
      include/maria.h:
        merging MyISAM changes into Maria
      mysys/mf_keycache.c:
        mi_test_all showed "floating point exception", this was already
        fixed in the latest 5.1, importing fix.
      sql/item_xmlfunc.cc:
        compiler warning (already fixed in latest 5.1)
      storage/maria/ha_maria.cc:
        merging MyISAM changes into Maria. See #ifdef ASK_MONTY.
      storage/maria/ha_maria.h:
        merging MyISAM changes into Maria
      storage/maria/ma_cache.c:
        merging MyISAM changes into Maria
      storage/maria/ma_check.c:
        merging MyISAM changes into Maria
      storage/maria/ma_create.c:
        merging MyISAM changes into Maria
      storage/maria/ma_dynrec.c:
        merging MyISAM changes into Maria
      storage/maria/ma_extra.c:
        merging MyISAM changes into Maria
      storage/maria/ma_ft_boolean_search.c:
        merging MyISAM changes into Maria
      storage/maria/ma_ft_nlq_search.c:
        merging MyISAM changes into Maria
      storage/maria/ma_info.c:
        merging MyISAM changes into Maria
      storage/maria/ma_key.c:
        merging MyISAM changes into Maria
      storage/maria/ma_loghandler.c:
        compiler warning (part->length is size_t)
      storage/maria/ma_open.c:
        merging MyISAM changes into Maria
      storage/maria/ma_preload.c:
        merging MyISAM changes into Maria
      storage/maria/ma_range.c:
        merging MyISAM changes into Maria
      storage/maria/ma_rkey.c:
        merging MyISAM changes into Maria
      storage/maria/ma_rt_index.c:
        merging MyISAM changes into Maria
      storage/maria/ma_rt_key.c:
        merging MyISAM changes into Maria
      storage/maria/ma_rt_split.c:
        merging MyISAM changes into Maria
      storage/maria/ma_search.c:
        merging MyISAM changes into Maria
      storage/maria/ma_sort.c:
        merging MyISAM changes into Maria
      storage/maria/maria_def.h:
        merging MyISAM changes into Maria
      a3d2ae46
  17. 26 Jul, 2007 3 commits
    • unknown's avatar
      post-merge fixes, and fixes for some of the 16 compiler warnings · 662002fc
      unknown authored
      found in pushbuild on sapsrv1. Some not fixed as not repeatable
      on my machine (32/64 bit issue?).
      Fixes for some test failures:
      - "maria-connect" now passes;
      - "maria": after fixing the obvious reasons for failures, the test
      went further and hit a more complex issues: difference in the output
      of EXPLAIN output; not fixed;
      - "ps_maria" still crashes in assertion
      mysqld: ha_maria.cc:1627: virtual int ha_maria::index_read(uchar*, const uchar*, uint, ha_rkey_function): Ass
      ertion `inited == INDEX' failed, as already observable in pushbuild.
      All this might just be due to an incomplete merge of MyISAM changes
      into Maria when 5.1 was last merged to mysql-maria.
      
      
      include/my_global.h:
        temporary fix until next merge of 5.1; without this it does not build
      mysql-test/r/maria-connect.result:
        position changed
      mysql-test/t/maria-connect.test:
        If one wants to use the binlog it has to ask for it.
        1582 is not used for dup entry error anymore (it was in older 5.1).
        Size of first event in binlog was increased by 4 (when the new type
        of event "gap" was added).
      mysql-test/t/maria.test:
        1582 not used anymore in this case
      storage/maria/ha_maria.cc:
        engine now has to say what binlogging it supports
      storage/maria/ma_blockrec.c:
        fix for compiler warnings ("comparison is always true" or "always
        false")
      storage/maria/ma_loghandler.c:
        fix for compiler warnings (comparing char* to uchar*)
      storage/maria/ma_packrec.c:
        fix for compiler warning (fix simply merged from MyISAM)
      storage/maria/ma_pagecache.c:
        info_check_pin() was not used so gave a compiler warning.
      storage/maria/ma_pagecache.h:
        fixing typo from the last 5.1->maria merge.
      storage/maria/ma_recovery.c:
        my_free() has a void* argument, so why cast. byte->uchar.
      storage/maria/ma_search.c:
        fix for compiler warning (fix simply merged from MyISAM)
      storage/maria/maria_read_log.c:
        gptr->uchar*
      storage/maria/trnman.c:
        probable fix for warning found in pushbuild (but not on my machine):
        storage/maria/trnman.c: 142
         passing argument 6 of \u2018lf_hash_init\u2019 from incompatible pointer type
        on sapsrv1.
      662002fc
    • unknown's avatar
      merge · 79f7cb4e
      unknown authored
      
      sql/handler.cc:
        Auto merged
      storage/maria/ha_maria.cc:
        Auto merged
      storage/maria/ma_blockrec.c:
        Auto merged
      storage/maria/ma_close.c:
        Auto merged
      storage/maria/ma_create.c:
        Auto merged
      storage/maria/ma_loghandler.c:
        Auto merged
      storage/maria/ma_loghandler.h:
        Auto merged
      storage/maria/ma_test2.c:
        Auto merged
      storage/maria/maria_read_log.c:
        will merge by hand
      79f7cb4e
    • unknown's avatar
      WL#3072 - Maria recovery · 6bbca54d
      unknown authored
      Unit test for recovery: runs ma_test1 and ma_test2 (both only with
      INSERTs and DELETEs; UPDATEs disabled as not handled by recovery)
      then moves the tables elswhere; recreates tables from the log, and
      compares and fails if there is a difference. Passes now.
      Most of maria_read_log.c moved to ma_recovery.c, as it will be re-used
      for recovery-from-ha_maria.
      Bugfixes of applying of REDO_INSERT, REDO_PURGE_ROW.
      Applying of REDO_PURGE_BLOCKS, REDO_DELETE_ALL, REDO_DROP_TABLE,
      UNDO_ROW_INSERT (in REDO phase only, i.e. just doing records++),
      UNDO_ROW_DELETE, UNDO_ROW_PURGE.
      Code cleanups.
      Monty: please look for "QQ". Sanja: please look for "Sanja".
      Future tasks: recovery of the bitmap (easy), recovery of the state
      (make it idempotent), more REDOs (Monty to work on
      REDO_UPDATE?), UNDO phase...
      Pushing this cset as it looks safe, contains test and bugfixes which
      will help Monty implement applying of REDO_UPDATE.
      
      
      sql/handler.cc:
        typo
      storage/maria/Makefile.am:
        Adding ma_test_recovery (which ma_test_all invokes, and which can
        also be run alone). Most of maria_read_log.c moved to ma_recovery.c
      storage/maria/ha_maria.cc:
        comments
      storage/maria/ma_bitmap.c:
        fixing comments. 2 -> sizeof(maria_bitmap_marker).
        Bitmap-related part of _ma_initialize_datafile() moves in bitmap module.
        Now putting the "bm" signature when creating the first bitmap page
        (it used to happen only at next open, but that
        caused an annoying difference when testing Recovery if the original
        run didn't open the table, and it looks more
        logical like this: it goes to disk only with its signature correct);
        see the "QQ" comment towards the _ma_initialize_data_file() call
        in ma_create.c for more).
        When reading a bitmap page, verify its signature (happens when normally
        using the table or when CHECKing it; not when REPAIRing it).
      storage/maria/ma_blockrec.c:
        * no need to sync the data file if table is not transactional
        * Comments, code cleanup (log-related data moved to log-related code
        block, int5store->page_store).
        * Store the table's short id into LOGREC_UNDO_ROW_PURGE, like we
        do for other records (though this record will soon be replaced
        with a CLR).
        * If "page" is 1 it means the page which extends from byte
        page*block_size+1 to (page+1)*block_size (byte number 1 being
        the first byte of the file). The last byte of the file is
        data_file_length (same convention).
        A new page needs to be created if the last byte of the page is
        beyond the last byte of the file, i.e.
         (page+1)*block_size+1 > data_file_length, so we correct the test
        (bug found when testing log applying for ma_test1 -M -T --skip-update).
        * update the page's LSN when removing a row from it during
        execution of a REDO_PURGE_ROW record (bug found when testing log
        applying for ma_test1 -M -T --skip-update).
        * applying of REDO_PURGE_BLOCKs (limited to a one-page range for now).
      storage/maria/ma_blockrec.h:
        new functions. maria_bitmap_marker does not need to be exported.
      storage/maria/ma_close.c:
        we can always flush the table's state when closing the last instance
        of the table. And it is needed for maria_read_log (as it does
        not use maria_lock_database()).
      storage/maria/ma_control_file.c:
        when in Recovery, some assertions should not be used.
      storage/maria/ma_control_file.h:
        double-inclusion safe
      storage/maria/ma_create.c:
        during recovery, don't log records. Comments.
        Moving the creation of the first bitmap page to ma_bitmap.c
      storage/maria/ma_delete_table.c:
        during recovery, don't log records. Log the end-zero of the dropped
        table's name, so that recovery can use the string in place without
        extending it to fit an end zero.
      storage/maria/ma_loghandler.c:
        * inwrite_rec_hook also needs access to the MARIA_SHARE, like
        prewrite_rec_hook. This will be needed to update
        share->records_diff (in the upcoming patch "recovery of the state").
        * LOG_DESC::record_ends_group changed to an enum.
        * LOG_DESC for LOGREC_REDO_PURGE_BLOCKS and LOGREC_UNDO_ROW_PURGE
        corrected
        * Sanja please see the @todo LOG BUG
        * avoiding DBUG_RETURN(func()) as it gives confusing debug traces.
      storage/maria/ma_loghandler.h:
        - log write hooks called while the log's lock is held (inwrite_rec_hook)
        now need the MARIA_SHARE, like prewrite_rec_hook already had
        - instead of a bool saying if this record's type ends groups or not,
        we refine: it may not end a group, it may end a group, or it may
        be a group in itself. Imagine that we had a physical write failure
        to a table before we log the UNDO, we still end up in
        external_lock(F_UNLCK) and then we log a COMMIT: we don't want
        to consider this COMMIT as ending the group of REDOs (don't want
        to execute those REDOs during Recovery), that's why we say "COMMIT
        is a group in itself, it aborts any previous group". This also
        gives one more sanity check in maria_read_log.
      storage/maria/ma_recovery.c:
        New Recovery code, replacing the old pseudocode.
        Most of maria_read_log moved here.
        Call-able from ha_maria, but not enabled yet.
        Compared to the previous version of maria_read_log, some bugs have
        been fixed, debugging output can go to stdout or a disk file (for now
        it's useful for me, later it can be changed), execution of
        REDO_DROP_TABLE, REDO_DELETE_ALL, REDO_PURGE_BLOCKS has been added. Duplicate code
        has been factored into functions. We abort an unfinished group
        of records if we see a record which is a group in itself (like COMMIT).
        No need for maria_panic() after a bug (which caused tables to not
        be closed) was fixed; if there is yet another bug I prefer to see it.
        When opening a table for Recovery, set data_file_length
        and key_file_length to their real physical value (these are the
        easiest state members to restore :). Warn us if the last page
        was truncated (but Recovery handles it).
        MARIA_SHARE::state::state::records is now partly recovered (not
        idempotent, but works if recreating tables from scracth).
        When applying a REDO to a page, stamp it with the UNDO's LSN
        (current_group_end_lsn), not with the REDO's LSN; it makes
        the table more identical to the original table (easier to compare
        the two tables in the end).
        Big thing missing: some types of REDOs are not handled,
        and the UNDO phase does not exist (missing functions to execute UNDOs
        to actually rollback). So for now tests are only inserting/deleting
        a few 100 rows, closing the table and seeing if the log is applied ok;
        it works. UPDATE not handled.
      storage/maria/ma_recovery.h:
        new functions: ma_recover() for recovery from inside ha_maria;
        _ma_apply_log() for maria_read_log (ma_recover() calls _ma_apply_log()).
        Btw, we need to not use the word "recover" for REPAIR/maria_chk anymore.
      storage/maria/ma_rename.c:
        don't write log records during recovery
      storage/maria/ma_test2.c:
        - fail if maria_info() or other subtests find some wrong information
        - new option -g to skip updates.
        - init the translog before creating the table, so that log applying
        can work.
        - in "#if 0" you'll see some fixed bugs (will be removed).
      storage/maria/ma_test_all.sh:
        cleanup files. Test log applying.
      storage/maria/maria_read_log.c:
        most of the logic moves to ma_recovery.c to be shared between
        maria_read_log and recovery-from-inside-mysqld.
        See ma_recovery.c for additional changes made to the moved code.
      storage/maria/ma_test_recovery:
        unit test for Recovery. Tests insert and delete,
        REDO_UPDATE not yet coded.
        Script is called from ma_test_all. Can run standalone.
      6bbca54d
  18. 07 Jul, 2007 8 commits
    • unknown's avatar
      Merged from main 5.1 · 85510db9
      unknown authored
      85510db9
    • unknown's avatar
      Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1 · 81e32ad0
      unknown authored
      into  labbari.dsl.inet.fi:/home/my/bk/mysql-maria.prod
      
      
      configure.in:
        Auto merged
      include/my_base.h:
        Auto merged
      mysql-test/lib/mtr_report.pl:
        Auto merged
      mysql-test/t/disabled.def:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/share/errmsg.txt:
        Auto merged
      storage/csv/ha_tina.cc:
        Auto merged
      storage/myisam/ft_parser.c:
        Auto merged
      81e32ad0
    • unknown's avatar
      Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-5.1-engines · 8c35eec8
      unknown authored
      into  anubis.xiphis.org:/usr/home/antony/work/mysql-5.1-engines.merge
      
      
      8c35eec8
    • unknown's avatar
      fe00f78d
    • unknown's avatar
      Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1 · ebd53ca2
      unknown authored
      into  labbari.dsl.inet.fi:/home/my/bk/mysql-maria.prod
      
      
      BitKeeper/etc/ignore:
        auto-union
      client/mysqldump.c:
        Auto merged
      include/my_base.h:
        Auto merged
      include/my_sys.h:
        Auto merged
      mysql-test/lib/mtr_cases.pl:
        Auto merged
      mysql-test/lib/mtr_report.pl:
        Auto merged
      mysql-test/r/ps_2myisam.result:
        Auto merged
      mysql-test/r/ps_3innodb.result:
        Auto merged
      mysql-test/r/ps_4heap.result:
        Auto merged
      mysql-test/r/ps_5merge.result:
        Auto merged
      mysql-test/r/ps_7ndb.result:
        Auto merged
      mysql-test/r/view.result:
        Auto merged
      mysql-test/t/disabled.def:
        Auto merged
      mysql-test/t/view.test:
        Auto merged
      sql/Makefile.am:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/handler.cc:
        Auto merged
      sql/handler.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_class.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/sql_show.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      sql/share/errmsg.txt:
        Auto merged
      sql/table.cc:
        Auto merged
      sql/table.h:
        Auto merged
      storage/myisam/mi_key.c:
        Auto merged
      storage/myisam/mi_open.c:
        Merged with main 5.1.
      ebd53ca2
    • unknown's avatar
      Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-maria · 1ea806b1
      unknown authored
      into  labbari.dsl.inet.fi:/home/my/bk/mysql-maria.prod
      
      
      mysys/thr_lock.c:
        Auto merged
      storage/csv/ha_tina.cc:
        Auto merged
      storage/csv/ha_tina.h:
        Auto merged
      storage/maria/ma_blockrec.c:
        Auto merged
      storage/maria/ma_check.c:
        Auto merged
      storage/maria/ma_loghandler.c:
        Auto merged
      storage/maria/trnman.c:
        Auto merged
      storage/myisam/mi_locking.c:
        Auto merged
      sql/lock.cc:
        SCCS merged
      1ea806b1
    • unknown's avatar
      Merge ymer.(none):/usr/local/mysql/mysql-5.0-engines · efbcbad4
      unknown authored
      into  ymer.(none):/usr/local/mysql/mysql-5.1-engines
      
      
      sql/stacktrace.c:
        Auto merged
      BUILD/compile-pentium-gcov:
        Manual merge.
      efbcbad4
    • unknown's avatar
      Bug #29543 GCov information not written in case of crash. · 87e1a302
      unknown authored
      For GCov builds, if the server crashes, the normal exit handler for writing
      coverage information is not executed due to the abnormal termination.
      
      Fix this by explicitly calling the __gcov_flush function in our crash handler.
      
      
      87e1a302