mariadb/trx/trx0sys.c
marko e578585049 branches/innodb+: Merge revisions 6130:6364 from branches/zip:
------------------------------------------------------------------------
  r6130 | marko | 2009-11-02 11:42:56 +0200 (Mon, 02 Nov 2009) | 9 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/btr/btr0sea.c
     M /branches/zip/buf/buf0buf.c
     M /branches/zip/dict/dict0dict.c
     M /branches/zip/fil/fil0fil.c
     M /branches/zip/ibuf/ibuf0ibuf.c
     M /branches/zip/include/btr0sea.h
     M /branches/zip/include/dict0dict.h
     M /branches/zip/include/fil0fil.h
     M /branches/zip/include/ibuf0ibuf.h
     M /branches/zip/include/lock0lock.h
     M /branches/zip/include/log0log.h
     M /branches/zip/include/log0recv.h
     M /branches/zip/include/mem0mem.h
     M /branches/zip/include/mem0pool.h
     M /branches/zip/include/os0file.h
     M /branches/zip/include/pars0pars.h
     M /branches/zip/include/srv0srv.h
     M /branches/zip/include/thr0loc.h
     M /branches/zip/include/trx0i_s.h
     M /branches/zip/include/trx0purge.h
     M /branches/zip/include/trx0rseg.h
     M /branches/zip/include/trx0sys.h
     M /branches/zip/include/trx0undo.h
     M /branches/zip/include/usr0sess.h
     M /branches/zip/lock/lock0lock.c
     M /branches/zip/log/log0log.c
     M /branches/zip/log/log0recv.c
     M /branches/zip/mem/mem0dbg.c
     M /branches/zip/mem/mem0pool.c
     M /branches/zip/os/os0file.c
     M /branches/zip/os/os0sync.c
     M /branches/zip/os/os0thread.c
     M /branches/zip/pars/lexyy.c
     M /branches/zip/pars/pars0lex.l
     M /branches/zip/que/que0que.c
     M /branches/zip/srv/srv0srv.c
     M /branches/zip/srv/srv0start.c
     M /branches/zip/sync/sync0arr.c
     M /branches/zip/sync/sync0sync.c
     M /branches/zip/thr/thr0loc.c
     M /branches/zip/trx/trx0i_s.c
     M /branches/zip/trx/trx0purge.c
     M /branches/zip/trx/trx0rseg.c
     M /branches/zip/trx/trx0sys.c
     M /branches/zip/trx/trx0undo.c
     M /branches/zip/usr/usr0sess.c
     M /branches/zip/ut/ut0mem.c

  branches/zip: Free all resources at shutdown. Set pointers to NULL, so
  that Valgrind will not complain about freed data structures that are
  reachable via pointers.  This addresses Bug #45992 and Bug #46656.

  This patch is mostly based on changes copied from branches/embedded-1.0,
  mainly c5432, c3439, c3134, c2994, c2978, but also some other code was
  copied.  Some added cleanup code is specific to MySQL/InnoDB.

  rb://199 approved by Sunny Bains
  ------------------------------------------------------------------------
  r6134 | marko | 2009-11-04 09:57:29 +0200 (Wed, 04 Nov 2009) | 5 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: innobase_convert_identifier(): Convert table names with
  explain_filename() to address Bug #32430: 'show innodb status'
  causes errors Invalid (old?) table or database name in logs.

  rb://134 approved by Sunny Bains
  ------------------------------------------------------------------------
  r6137 | marko | 2009-11-04 15:24:28 +0200 (Wed, 04 Nov 2009) | 1 line
  Changed paths:
     M /branches/zip/dict/dict0dict.c

  branches/zip: dict_index_too_big_for_undo(): Correct a typo.
  ------------------------------------------------------------------------
  r6153 | vasil | 2009-11-10 15:33:22 +0200 (Tue, 10 Nov 2009) | 145 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: Merge r6125:6152 from branches/5.1:

  (everything except the last white-space change was skipped as it is already
  in branches/zip)
    ------------------------------------------------------------------------
    r6127 | vasil | 2009-10-30 11:18:25 +0200 (Fri, 30 Oct 2009) | 18 lines
    Changed paths:
       M /branches/5.1/Makefile.am
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1:

    Backport c6121 from branches/zip:
      ------------------------------------------------------------------------
      r6121 | sunny | 2009-10-30 01:42:11 +0200 (Fri, 30 Oct 2009) | 7 lines
      Changed paths:
         M /branches/zip/mysql-test/innodb-autoinc.result

      branches/zip: This test has been problematic for sometime now. The underlying
      bug is that the data dictionaries get out of sync. In the AUTOINC code we
      try and apply salve to the symptoms. In the past MySQL made some unrelated
      change and the dictionaries stopped getting out of sync and this test started
      to fail. Now, it seems they have reverted that changed and the test is
      passing again. I suspect this is not he last time that this test will change.
      ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    r6129 | vasil | 2009-10-30 17:14:22 +0200 (Fri, 30 Oct 2009) | 4 lines
    Changed paths:
       M /branches/5.1/Makefile.am

    branches/5.1:

    Revert a change to Makefile.am that sneaked unnoticed in c6127.
    ------------------------------------------------------------------------
    r6136 | marko | 2009-11-04 12:28:10 +0200 (Wed, 04 Nov 2009) | 15 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/include/ha_prototypes.h
       M /branches/5.1/ut/ut0ut.c

    branches/5.1: Port r6134 from branches/zip:

      ------------------------------------------------------------------------
      r6134 | marko | 2009-11-04 07:57:29 +0000 (Wed, 04 Nov 2009) | 5 lines

      branches/zip: innobase_convert_identifier(): Convert table names with
      explain_filename() to address Bug #32430: 'show innodb status'
      causes errors Invalid (old?) table or database name in logs.

      rb://134 approved by Sunny Bains
      ------------------------------------------------------------------------

    innobase_print_identifier(): Replace with innobase_convert_name().

    innobase_convert_identifier(): New function, called by innobase_convert_name().
    ------------------------------------------------------------------------
    r6149 | vasil | 2009-11-09 11:15:01 +0200 (Mon, 09 Nov 2009) | 5 lines
    Changed paths:
       M /branches/5.1/CMakeLists.txt

    branches/5.1:

    Followup to r5700: Adjust the changes so they are the same as in the BZR
    repository.
    ------------------------------------------------------------------------
    r6150 | vasil | 2009-11-09 11:43:31 +0200 (Mon, 09 Nov 2009) | 58 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1:

    Merge a part of r2911.5.5 from MySQL:
    (the other part of this was merged in c5700)

      ------------------------------------------------------------
      revno: 2911.5.5
      committer: Vladislav Vaintroub <vvaintroub@mysql.com>
      branch nick: 5.1-innodb_plugin
      timestamp: Wed 2009-06-10 10:59:49 +0200
      message:
        Backport WL#3653 to 5.1 to enable bundled innodb plugin.
        Remove custom DLL loader code from innodb plugin code, use
        symbols exported from mysqld.
      removed:
        storage/innodb_plugin/handler/handler0vars.h
        storage/innodb_plugin/handler/win_delay_loader.cc
      added:
        storage/mysql_storage_engine.cmake
        win/create_def_file.js
      modified:
        CMakeLists.txt
        include/m_ctype.h
        include/my_global.h
        include/my_sys.h
        include/mysql/plugin.h
        libmysqld/CMakeLists.txt
        mysql-test/mysql-test-run.pl
        mysql-test/t/plugin.test
        mysql-test/t/plugin_load-master.opt
        mysys/charset.c
        sql/CMakeLists.txt
        sql/handler.h
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/sql_class.cc
        sql/sql_class.h
        sql/sql_list.h
        sql/sql_profile.h
        storage/Makefile.am
        storage/archive/CMakeLists.txt
        storage/blackhole/CMakeLists.txt
        storage/csv/CMakeLists.txt
        storage/example/CMakeLists.txt
        storage/federated/CMakeLists.txt
        storage/heap/CMakeLists.txt
        storage/innobase/CMakeLists.txt
        storage/innobase/handler/ha_innodb.cc
        storage/innodb_plugin/CMakeLists.txt
        storage/innodb_plugin/handler/ha_innodb.cc
        storage/innodb_plugin/handler/handler0alter.cc
        storage/innodb_plugin/handler/i_s.cc
        storage/innodb_plugin/plug.in
        storage/myisam/CMakeLists.txt
        storage/myisammrg/CMakeLists.txt
        win/Makefile.am
        win/configure.js
    ------------------------------------------------------------------------
    r6152 | vasil | 2009-11-10 15:30:20 +0200 (Tue, 10 Nov 2009) | 4 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1:

    White space fixup.
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6157 | jyang | 2009-11-11 14:27:09 +0200 (Wed, 11 Nov 2009) | 10 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     A /branches/zip/mysql-test/innodb_bug47167.result
     A /branches/zip/mysql-test/innodb_bug47167.test
     M /branches/zip/mysql-test/innodb_file_format.result

  branches/zip: Fix an issue that a local variable defined
  in innodb_file_format_check_validate() is being referenced
  across function in innodb_file_format_check_update().
  In addition, fix "set global innodb_file_format_check =
  DEFAULT" call.
  Bug #47167: "set global innodb_file_format_check" cannot
  set value by User-Defined Variable."
  rb://169 approved by Sunny Bains and Marko.
  ------------------------------------------------------------------------
  r6159 | vasil | 2009-11-11 15:13:01 +0200 (Wed, 11 Nov 2009) | 37 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/handler/ha_innodb.h

  branches/zip:

  Merge a change from MySQL:
  (this has been reviewed by Calvin and Marko, and Calvin says Luis has
  incorporated Marko's suggestions)

    ------------------------------------------------------------
    revno: 3092.5.1
    committer: Luis Soares <luis.soares@sun.com>
    branch nick: mysql-5.1-bugteam
    timestamp: Thu 2009-09-24 15:52:52 +0100
    message:
      BUG#42829: binlogging enabled for all schemas regardless of
      binlog-db-db / binlog-ignore-db

      InnoDB will return an error if statement based replication is used
      along with transaction isolation level READ-COMMITTED (or weaker),
      even if the statement in question is filtered out according to the
      binlog-do-db rules set. In this case, an error should not be printed.

      This patch addresses this issue by extending the existing check in
      external_lock to take into account the filter rules before deciding to
      print an error. Furthermore, it also changes decide_logging_format to
      take into consideration whether the statement is filtered out from
      binlog before decision is made.
    added:
      mysql-test/suite/binlog/r/binlog_stm_do_db.result
      mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
      mysql-test/suite/binlog/t/binlog_stm_do_db.test
    modified:
      sql/sql_base.cc
      sql/sql_class.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innodb_plugin/handler/ha_innodb.cc
      storage/innodb_plugin/handler/ha_innodb.h
  ------------------------------------------------------------------------
  r6160 | vasil | 2009-11-11 15:33:49 +0200 (Wed, 11 Nov 2009) | 72 lines
  Changed paths:
     M /branches/zip/include/os0file.h
     M /branches/zip/os/os0file.c

  branches/zip: Merge r6152:6159 from branches/5.1:

  (r6158 was skipped as an equivallent change has already been merged from MySQL)
    ------------------------------------------------------------------------
    r6154 | calvin | 2009-11-11 02:51:17 +0200 (Wed, 11 Nov 2009) | 17 lines
    Changed paths:
       M /branches/5.1/include/os0file.h
       M /branches/5.1/os/os0file.c

    branches/5.1: fix bug#3139: Mysql crashes: 'windows error 995'
    after several selects on a large DB

    During stress environment, Windows AIO may fail with error code
    ERROR_OPERATION_ABORTED. InnoDB does not handle the error, rather
    crashes. The cause of the error is unknown, but likely due to
    faulty hardware or driver.

    This patch introduces a new error code OS_FILE_OPERATION_ABORTED,
    which maps to Windows ERROR_OPERATION_ABORTED (995). When the error
    is detected during AIO, the InnoDB will issue a synchronous retry
    (read/write).

    This patch has been extensively tested by MySQL support.

    Approved by: Marko
    rb://196
    ------------------------------------------------------------------------
    r6158 | vasil | 2009-11-11 14:52:14 +0200 (Wed, 11 Nov 2009) | 37 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/handler/ha_innodb.h

    branches/5.1:

    Merge a change from MySQL:
    (this has been reviewed by Calvin and Marko, and Calvin says Luis has
    incorporated Marko's suggestions)

      ------------------------------------------------------------
      revno: 3092.5.1
      committer: Luis Soares <luis.soares@sun.com>
      branch nick: mysql-5.1-bugteam
      timestamp: Thu 2009-09-24 15:52:52 +0100
      message:
        BUG#42829: binlogging enabled for all schemas regardless of
        binlog-db-db / binlog-ignore-db

        InnoDB will return an error if statement based replication is used
        along with transaction isolation level READ-COMMITTED (or weaker),
        even if the statement in question is filtered out according to the
        binlog-do-db rules set. In this case, an error should not be printed.

        This patch addresses this issue by extending the existing check in
        external_lock to take into account the filter rules before deciding to
        print an error. Furthermore, it also changes decide_logging_format to
        take into consideration whether the statement is filtered out from
        binlog before decision is made.
      added:
        mysql-test/suite/binlog/r/binlog_stm_do_db.result
        mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
        mysql-test/suite/binlog/t/binlog_stm_do_db.test
      modified:
        sql/sql_base.cc
        sql/sql_class.cc
        storage/innobase/handler/ha_innodb.cc
        storage/innobase/handler/ha_innodb.h
        storage/innodb_plugin/handler/ha_innodb.cc
        storage/innodb_plugin/handler/ha_innodb.h

    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6161 | vasil | 2009-11-11 15:36:16 +0200 (Wed, 11 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Add changelog entry for r6160.
  ------------------------------------------------------------------------
  r6162 | vasil | 2009-11-11 16:00:12 +0200 (Wed, 11 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Add ChangeLog for r6157.
  ------------------------------------------------------------------------
  r6163 | calvin | 2009-11-11 17:53:20 +0200 (Wed, 11 Nov 2009) | 8 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/handler/ha_innodb.h

  branches/zip: Exclude thd_binlog_filter_ok() when building
  with older version of MySQL.

  thd_binlog_filter_ok() is introduced in MySQL 5.1.41. But the
  plugin can be built with MySQL prior to 5.1.41.

  Approved by Heikki (on IM).
  ------------------------------------------------------------------------
  r6169 | calvin | 2009-11-12 14:40:43 +0200 (Thu, 12 Nov 2009) | 6 lines
  Changed paths:
     A /branches/zip/mysql-test/innodb_bug46676.result
     A /branches/zip/mysql-test/innodb_bug46676.test

  branches/zip: add test case for bug#46676

  This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
  But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
  Add test case to catch future regression.
  ------------------------------------------------------------------------
  r6170 | marko | 2009-11-12 15:49:08 +0200 (Thu, 12 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/include/db0err.h
     M /branches/zip/row/row0merge.c
     M /branches/zip/row/row0mysql.c

  branches/zip: Allow CREATE INDEX to be interrupted.  (Issue #354)

  rb://183 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r6175 | vasil | 2009-11-16 20:07:39 +0200 (Mon, 16 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Wrap line at 78th char in the ChangeLog
  ------------------------------------------------------------------------
  r6177 | calvin | 2009-11-16 20:20:38 +0200 (Mon, 16 Nov 2009) | 2 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip: add an entry to ChangeLog for r6065
  ------------------------------------------------------------------------
  r6179 | marko | 2009-11-17 10:19:34 +0200 (Tue, 17 Nov 2009) | 2 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: ha_innobase::change_active_index(): When the history is
  missing, report it to the client, not to the error log.
  ------------------------------------------------------------------------
  r6181 | vasil | 2009-11-17 12:21:41 +0200 (Tue, 17 Nov 2009) | 33 lines
  Changed paths:
     M /branches/zip/mysql-test/innodb-index.test

  branches/zip:

  At the end of innodb-index.test: restore the environment as it was before
  the test was started to silence this warning:

    MTR's internal check of the test case 'main.innodb-index' failed.
    This means that the test case does not preserve the state that existed
    before the test case was executed.  Most likely the test case did not
    do a proper clean-up.
    This is the diff of the states of the servers before and after the
    test case was executed:
    mysqltest: Logging to '/tmp/autotest.sh-20091117_033000-zip.btyZwu/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.log'.
    mysqltest: Results saved in '/tmp/autotest.sh-20091117_033000-zip.btyZwu/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.result'.
    mysqltest: Connecting to server localhost:13000 (socket /tmp/autotest.sh-20091117_033000-zip.btyZwu/mysql-5.1/mysql-test/var/tmp/mysqld.1.sock) as 'root', connection 'default', attempt 0 ...
    mysqltest: ... Connected.
    mysqltest: Start processing test commands from './include/check-testcase.test' ...
    mysqltest: ... Done processing test commands.
    --- /tmp/autotest.sh-20091117_033000-zip.btyZwu/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.result	2009-11-17 13:10:40.000000000 +0300
    +++ /tmp/autotest.sh-20091117_033000-zip.btyZwu/mysql-5.1/mysql-test/var/tmp/check-mysqld_1.reject	2009-11-17 13:10:54.000000000 +0300
    @@ -84,7 +84,7 @@
     INNODB_DOUBLEWRITE	ON
     INNODB_FAST_SHUTDOWN	1
     INNODB_FILE_FORMAT	Antelope
    -INNODB_FILE_FORMAT_CHECK	Antelope
    +INNODB_FILE_FORMAT_CHECK	Barracuda
     INNODB_FILE_PER_TABLE	OFF
     INNODB_FLUSH_LOG_AT_TRX_COMMIT	1
     INNODB_FLUSH_METHOD	

    mysqltest: Result content mismatch

    not ok
  ------------------------------------------------------------------------
  r6182 | marko | 2009-11-17 13:49:15 +0200 (Tue, 17 Nov 2009) | 1 line
  Changed paths:
     M /branches/zip/mysql-test/innodb-consistent-master.opt
     M /branches/zip/mysql-test/innodb-consistent.result
     M /branches/zip/mysql-test/innodb-consistent.test
     M /branches/zip/mysql-test/innodb-use-sys-malloc-master.opt
     M /branches/zip/mysql-test/innodb-use-sys-malloc.result
     M /branches/zip/mysql-test/innodb-use-sys-malloc.test
     M /branches/zip/mysql-test/innodb_bug21704.result
     M /branches/zip/mysql-test/innodb_bug21704.test
     M /branches/zip/mysql-test/innodb_bug40360.test
     M /branches/zip/mysql-test/innodb_bug40565.result
     M /branches/zip/mysql-test/innodb_bug40565.test
     M /branches/zip/mysql-test/innodb_bug41904.result
     M /branches/zip/mysql-test/innodb_bug41904.test
     M /branches/zip/mysql-test/innodb_bug42101-nonzero-master.opt
     M /branches/zip/mysql-test/innodb_bug42101-nonzero.result
     M /branches/zip/mysql-test/innodb_bug42101-nonzero.test
     M /branches/zip/mysql-test/innodb_bug42101.result
     M /branches/zip/mysql-test/innodb_bug42101.test
     M /branches/zip/mysql-test/innodb_bug44032.result
     M /branches/zip/mysql-test/innodb_bug44032.test
     M /branches/zip/mysql-test/innodb_bug44369.result
     M /branches/zip/mysql-test/innodb_bug44369.test
     M /branches/zip/mysql-test/innodb_bug44571.result
     M /branches/zip/mysql-test/innodb_bug44571.test
     M /branches/zip/mysql-test/innodb_bug45357.test
     M /branches/zip/mysql-test/innodb_bug46000.result
     M /branches/zip/mysql-test/innodb_bug46000.test
     M /branches/zip/mysql-test/innodb_bug46676.result
     M /branches/zip/mysql-test/innodb_bug46676.test
     M /branches/zip/mysql-test/innodb_bug47167.result
     M /branches/zip/mysql-test/innodb_bug47167.test
     M /branches/zip/mysql-test/innodb_bug47777.result
     M /branches/zip/mysql-test/innodb_bug47777.test
     M /branches/zip/mysql-test/innodb_file_format.result
     M /branches/zip/mysql-test/innodb_file_format.test

  branches/zip: Set svn:eol-style on mysql-test files.
  ------------------------------------------------------------------------
  r6183 | marko | 2009-11-17 13:51:16 +0200 (Tue, 17 Nov 2009) | 1 line
  Changed paths:
     M /branches/zip/mysql-test/innodb-consistent-master.opt
     M /branches/zip/mysql-test/innodb-master.opt
     M /branches/zip/mysql-test/innodb-semi-consistent-master.opt
     M /branches/zip/mysql-test/innodb-use-sys-malloc-master.opt
     M /branches/zip/mysql-test/innodb_bug42101-nonzero-master.opt

  branches/zip: Prepend loose_ to plugin-only mysql-test options.
  ------------------------------------------------------------------------
  r6184 | marko | 2009-11-17 13:52:01 +0200 (Tue, 17 Nov 2009) | 1 line
  Changed paths:
     M /branches/zip/mysql-test/innodb-index.result
     M /branches/zip/mysql-test/innodb-index.test

  branches/zip: innodb-index.test: Restore innodb_file_format_check.
  ------------------------------------------------------------------------
  r6185 | marko | 2009-11-17 16:44:20 +0200 (Tue, 17 Nov 2009) | 16 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/mysql-test/innodb.result
     M /branches/zip/mysql-test/innodb.test
     M /branches/zip/mysql-test/innodb_bug44369.result
     M /branches/zip/mysql-test/innodb_bug44369.test
     D /branches/zip/mysql-test/patches/innodb-index.diff
     M /branches/zip/row/row0mysql.c

  branches/zip: Report duplicate table names
  to the client connection, not to the error log.  This change will allow
  innodb-index.test to be re-enabled.  It was previously disabled, because
  mysql-test-run does not like output in the error log.

  row_create_table_for_mysql(): Do not output anything to the error log
  when reporting DB_DUPLICATE_KEY.  Let the caller report the error.
  Add a TODO comment that the dict_table_t object is apparently not freed
  when an error occurs.

  create_table_def(): Convert InnoDB table names to the character set
  of the client connection for reporting.  Use my_error(ER_WRONG_COLUMN_NAME)
  for reporting reserved column names.  Report my_error(ER_TABLE_EXISTS_ERROR)
  when row_create_table_for_mysql() returns DB_DUPLICATE_KEY.

  rb://206
  ------------------------------------------------------------------------
  r6186 | vasil | 2009-11-17 16:48:14 +0200 (Tue, 17 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Add ChangeLog entry for r6185.
  ------------------------------------------------------------------------
  r6189 | marko | 2009-11-18 11:36:18 +0200 (Wed, 18 Nov 2009) | 5 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/handler/handler0alter.cc

  branches/zip: ha_innobase::add_index(): When creating the primary key
  and the table is being locked by another transaction,
  do not attempt to drop the table. (Bug #48782)

  Approved by Sunny Bains over IM
  ------------------------------------------------------------------------
  r6194 | vasil | 2009-11-19 09:24:45 +0200 (Thu, 19 Nov 2009) | 5 lines
  Changed paths:
     M /branches/zip/include/univ.i

  branches/zip:

  Increment version number from 1.0.5 to 1.0.6 since 1.0.5 was just released
  by MySQL and we will soon release 1.0.6.
  ------------------------------------------------------------------------
  r6197 | calvin | 2009-11-19 09:32:55 +0200 (Thu, 19 Nov 2009) | 6 lines
  Changed paths:
     M /branches/zip/CMakeLists.txt

  branches/zip: merge the fix of bug#48317 (CMake file)

  Due to MySQL changes to the CMake, it is no longer able
  to build InnoDB plugin as a static library on Windows.
  The fix is proposed by Vlad of MySQL.
  ------------------------------------------------------------------------
  r6198 | vasil | 2009-11-19 09:44:31 +0200 (Thu, 19 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Add ChangeLog entry for r6197.
  ------------------------------------------------------------------------
  r6199 | vasil | 2009-11-19 12:10:12 +0200 (Thu, 19 Nov 2009) | 31 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/btr/btr0btr.c
     M /branches/zip/data/data0type.c

  branches/zip: Merge r6159:6198 from branches/5.1:

    ------------------------------------------------------------------------
    r6187 | jyang | 2009-11-18 05:27:30 +0200 (Wed, 18 Nov 2009) | 9 lines
    Changed paths:
       M /branches/5.1/btr/btr0btr.c

    branches/5.1: Fix bug #48469 "when innodb tablespace is
    configured too small, crash and corruption!". Function
    btr_create() did not check the return status of fseg_create(),
    and continue the index creation even there is no sufficient
    space.

    rb://205 Approved by Marko
    ------------------------------------------------------------------------
    r6188 | jyang | 2009-11-18 07:14:23 +0200 (Wed, 18 Nov 2009) | 8 lines
    Changed paths:
       M /branches/5.1/data/data0type.c

    branches/5.1: Fix bug #48526 "Data type for float and
    double is incorrectly reported in InnoDB table monitor".
    Certain datatypes are not printed correctly in
    dtype_print().

    rb://204 Approved by Marko.
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6201 | marko | 2009-11-19 14:09:11 +0200 (Thu, 19 Nov 2009) | 2 lines
  Changed paths:
     M /branches/zip/handler/handler0alter.cc

  branches/zip: ha_innobase::add_index(): Clarify the comment
  on orphaned tables when creating a primary key.
  ------------------------------------------------------------------------
  r6202 | jyang | 2009-11-19 15:01:00 +0200 (Thu, 19 Nov 2009) | 8 lines
  Changed paths:
     M /branches/zip/btr/btr0btr.c

  branches/zip: Function fseg_free() is no longer defined
  in branches/zip. To port fix for bug #48469 to zip,
  we can use btr_free_root() which frees the page,
  and also does not require mini-transaction.

  Approved by Marko.
  ------------------------------------------------------------------------
  r6207 | vasil | 2009-11-20 10:19:14 +0200 (Fri, 20 Nov 2009) | 54 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: Merge r6198:6206 from branches/5.1:

  (r6203 was skipped as it is already in branches/zip)

    ------------------------------------------------------------------------
    r6200 | vasil | 2009-11-19 12:14:23 +0200 (Thu, 19 Nov 2009) | 4 lines
    Changed paths:
       M /branches/5.1/btr/btr0btr.c

    branches/5.1:

    White space fixup - indent under the opening (
    ------------------------------------------------------------------------
    r6203 | jyang | 2009-11-19 15:12:22 +0200 (Thu, 19 Nov 2009) | 8 lines
    Changed paths:
       M /branches/5.1/btr/btr0btr.c

    branches/5.1: Use btr_free_root() instead of fseg_free() for
    the fix of bug #48469, because fseg_free() is not defined
    in the zip branch. And we could save one mini-trasaction started
    by fseg_free().

    Approved by Marko.
    ------------------------------------------------------------------------
    r6205 | jyang | 2009-11-20 07:55:48 +0200 (Fri, 20 Nov 2009) | 11 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1: Add a special case to handle the Duplicated Key error
    and return DB_ERROR instead. This is to avoid a possible SIGSEGV
    by mysql error handling re-entering the storage layer for dup key
    info without proper table handle.
    This is to prevent a server crash when error situation in bug
    #45961 "DDL on partitioned innodb tables leaves data dictionary
    in an inconsistent state" happens.

    rb://157 approved by Sunny Bains.
    ------------------------------------------------------------------------
    r6206 | jyang | 2009-11-20 09:38:43 +0200 (Fri, 20 Nov 2009) | 5 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1: Fix a minor code formating issue for
    the parenthesis iplacement of the if condition in
    rename_table().
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6208 | vasil | 2009-11-20 10:49:24 +0200 (Fri, 20 Nov 2009) | 4 lines
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip:

  Add ChangeLog entry for c6207.
  ------------------------------------------------------------------------
  r6210 | vasil | 2009-11-20 23:39:48 +0200 (Fri, 20 Nov 2009) | 3 lines
  Changed paths:
     M /branches/zip/trx/trx0i_s.c

  branches/zip:

  Whitespace fixup.
  ------------------------------------------------------------------------
  r6248 | marko | 2009-11-30 12:19:50 +0200 (Mon, 30 Nov 2009) | 1 line
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip: ChangeLog: Document r4922 that was forgotten.
  ------------------------------------------------------------------------
  r6252 | marko | 2009-11-30 12:50:11 +0200 (Mon, 30 Nov 2009) | 23 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/dict/dict0boot.c
     M /branches/zip/dict/dict0crea.c
     M /branches/zip/dict/dict0load.c
     M /branches/zip/dict/dict0mem.c
     M /branches/zip/fil/fil0fil.c
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/include/dict0mem.h
     M /branches/zip/row/row0mysql.c

  branches/zip: Suppress errors about non-found temporary tables.
  Write the is_temp flag to SYS_TABLES.MIX_LEN.

  dict_table_t:🎏 Add a flag for is_temporary, DICT_TF2_TEMPORARY.
  Unlike other flags, this will not be written to the tablespace flags
  or SYS_TABLES.TYPE, but only to SYS_TABLES.MIX_LEN.

  dict_build_table_def_step(): Only pass DICT_TF_BITS to tablespaces.

  dict_check_tablespaces_and_store_max_id(), dict_load_table():
  Suppress errors about temporary tables not being found.

  dict_create_sys_tables_tuple(): Write the DICT_TF2_TEMPORARY flag
  to SYS_TABLES.MIX_LEN.

  fil_space_create(), fil_create_new_single_table_tablespace(): Add assertions
  about space->flags.

  row_drop_table_for_mysql(): Do not complain about non-found temporary tables.

  rb://160 approved by Heikki Tuuri.  This addresses the second part of
  Bug #41609 Crash recovery does not work for InnoDB temporary tables.
  ------------------------------------------------------------------------
  r6263 | vasil | 2009-12-01 14:49:05 +0200 (Tue, 01 Dec 2009) | 4 lines
  Changed paths:
     M /branches/zip/include/univ.i

  branches/zip: Increment version number from 1.0.6 to 1.0.7

  1.0.6 has been released
  ------------------------------------------------------------------------
  r6264 | vasil | 2009-12-01 16:19:44 +0200 (Tue, 01 Dec 2009) | 1 line
  Changed paths:
     M /branches/zip/ChangeLog

  branches/zip: Add ChangeLog entry for the release of 1.0.6.
  ------------------------------------------------------------------------
  r6269 | marko | 2009-12-02 11:35:22 +0200 (Wed, 02 Dec 2009) | 2 lines
  Changed paths:
     M /branches/zip/srv/srv0start.c

  branches/zip: innobase_start_or_create_for_mysql(): UNIV_IBUF_DEBUG
  should not break crash recovery, but UNIV_IBUF_COUNT_DEBUG will.
  ------------------------------------------------------------------------
  r6270 | marko | 2009-12-02 11:36:47 +0200 (Wed, 02 Dec 2009) | 1 line
  Changed paths:
     M /branches/zip/srv/srv0start.c

  branches/zip: innobase_start_or_create_for_mysql(): Log the zlib version.
  ------------------------------------------------------------------------
  r6271 | marko | 2009-12-02 11:43:49 +0200 (Wed, 02 Dec 2009) | 2 lines
  Changed paths:
     M /branches/zip/ChangeLog
     M /branches/zip/Makefile.am
     M /branches/zip/include/univ.i
     M /branches/zip/plug.in

  branches/zip: ChangeLog: Document that since r6270, the zlib version number
  will be displayed at start-up.
  ------------------------------------------------------------------------
  r6272 | marko | 2009-12-02 11:46:05 +0200 (Wed, 02 Dec 2009) | 1 line
  Changed paths:
     M /branches/zip/Makefile.am
     M /branches/zip/include/univ.i
     M /branches/zip/plug.in

  branches/zip: Revert changes that were accidentally committed in r6271.
  ------------------------------------------------------------------------
  r6274 | marko | 2009-12-03 14:47:12 +0200 (Thu, 03 Dec 2009) | 6 lines
  Changed paths:
     M /branches/zip/dict/dict0dict.c

  branches/zip: dict_table_check_for_dup_indexes(): Assert that the
  data dictionary mutex is being held while table->indexes is accessed.
  This is already the case.

  Currently, only dict_table_get_next_index() and dict_table_get_first_index()
  are being invoked without holding dict_sys->mutex.
  ------------------------------------------------------------------------
  r6275 | pekka | 2009-12-03 18:32:47 +0200 (Thu, 03 Dec 2009) | 10 lines
  Changed paths:
     M /branches/zip/include/log0recv.h
     M /branches/zip/include/trx0sys.h
     M /branches/zip/log/log0recv.c
     M /branches/zip/trx/trx0sys.c

  branches/zip: Minor changes which allow build with UNIV_HOTBACKUP
  defined to succeed:

  include/trx0sys.h: Allow Hot Backup build to see some
                     TRX_SYS_DOUBLEWRITE_... macros.
  trx/trx0sys.c:     Exclude trx_sys_close() function from Hot Backup build.
  log/log0recv.[ch]: Exclude recv_sys_var_init() function from Hot Backup build.

  This change should not affect !UNIV_HOTBACKUP build.
  ------------------------------------------------------------------------
  r6277 | marko | 2009-12-08 11:13:36 +0200 (Tue, 08 Dec 2009) | 1 line
  Changed paths:
     M /branches/zip/fsp/fsp0fsp.c

  branches/zip: fsp0fsp.c: Add some missing in/out and const qualifiers.
  ------------------------------------------------------------------------
  r6285 | marko | 2009-12-09 09:24:50 +0200 (Wed, 09 Dec 2009) | 13 lines
  Changed paths:
     M /branches/zip/row/row0sel.c

  branches/zip: row_sel_fetch_columns(): Remove redundant code that was
  accidentally added in r1591, which introduced dfield_t::ext in order
  to make the merge sort of fast index creation support externally
  stored columns,

  Initially, I tried to allocate the bit for dfield_t::ext from
  dfield_t::len by making the length 31 bits and mapping UNIV_SQL_NULL
  to something that would fit in it.  Then I decided that it would be
  too risky.  The redundant check was part of the mapping.  The
  condition may have been dfield_is_null() initially.

  This redundant code was noticed by Sergey Petrunya on the MySQL
  internals list.
  ------------------------------------------------------------------------
  r6288 | marko | 2009-12-09 09:51:00 +0200 (Wed, 09 Dec 2009) | 15 lines
  Changed paths:
     M /branches/zip/row/row0upd.c

  branches/zip: row_upd_copy_columns(): Remove redundant code that was
  accidentally added in r1591, which introduced dfield_t::ext in order
  to make the merge sort of fast index creation support externally
  stored columns.

  Initially, I tried to allocate the bit for dfield_t::ext from
  dfield_t::len by making the length 31 bits and mapping UNIV_SQL_NULL
  to something that would fit in it.  Then I decided that it would be
  too risky.  The redundant check was part of the mapping.  The
  condition may have been dfield_is_null() initially.

  This is similar to the redundant code in row_sel_fetch_columns() that
  was noticed by Sergey Petrunya on the MySQL internals list and removed
  in r6285.  As far as I can tell, there are no redundant UNIV_SQL_NULL
  assignments remaining after this change.
  ------------------------------------------------------------------------
  r6305 | marko | 2009-12-14 13:03:57 +0200 (Mon, 14 Dec 2009) | 2 lines
  Changed paths:
     M /branches/zip/row/row0umod.c

  branches/zip: row_undo_mod_del_unmark_sec_and_undo_update(): Add a missing
  const qualifier.
  ------------------------------------------------------------------------
  r6309 | marko | 2009-12-15 14:05:50 +0200 (Tue, 15 Dec 2009) | 3 lines
  Changed paths:
     M /branches/zip/lock/lock0lock.c

  branches/zip: lock_rec_insert_check_and_lock(): Avoid casting away constness.
  Use page_rec_get_next_const() instead. This silences a gcc 4.2.4 warning.
  Reported by Sunny Bains.
  ------------------------------------------------------------------------
  r6312 | marko | 2009-12-16 10:10:36 +0200 (Wed, 16 Dec 2009) | 6 lines
  Changed paths:
     M /branches/zip/fil/fil0fil.c

  branches/zip: fil_close(): Add #ifndef UNIV_HOTBACKUP around a debug
  assertion on mutex.magic_n.  InnoDB Hot Backup is a single-threaded
  program and does not contain mutexes.  This change allows InnoDB Hot
  Backup to be compiled with UNIV_DEBUG.

  Suggested by Michael Izioumtchenko.
  ------------------------------------------------------------------------
  r6321 | marko | 2009-12-16 16:16:33 +0200 (Wed, 16 Dec 2009) | 4 lines
  Changed paths:
     M /branches/zip/row/row0merge.c

  branches/zip: row_merge_drop_temp_indexes(): Revert a hack to
  transaction isolation level that was made unnecessary by r5826 (Issue #337).
  When this function is called, any active data dictionary transaction
  should have been rolled back.
  ------------------------------------------------------------------------
  r6345 | marko | 2009-12-21 10:46:14 +0200 (Mon, 21 Dec 2009) | 7 lines
  Changed paths:
     M /branches/zip/log/log0recv.c

  branches/zip: recv_scan_log_recs(): Non-functional change: Replace a
  debug assertion ut_ad(len > 0) with ut_ad(len >= OS_FILE_LOG_BLOCK_SIZE).

  This change is only for readability, for Issue #428.  Another
  assertion on len being an integer multiple of OS_FILE_LOG_BLOCK_SIZE
  already ensured together with the old ut_ad(len > 0) that actually len
  must be at least OS_FILE_LOG_BLOCK_SIZE.
  ------------------------------------------------------------------------
  r6346 | marko | 2009-12-21 12:03:25 +0200 (Mon, 21 Dec 2009) | 2 lines
  Changed paths:
     M /branches/zip/log/log0recv.c

  branches/zip: recv_recovery_from_checkpoint_finish():
  Revert a change that was accidentally committed in r6345.
  ------------------------------------------------------------------------
  r6348 | marko | 2009-12-22 11:04:34 +0200 (Tue, 22 Dec 2009) | 37 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/include/ha_prototypes.h
     M /branches/zip/include/trx0trx.h
     M /branches/zip/lock/lock0lock.c
     M /branches/zip/trx/trx0i_s.c
     M /branches/zip/trx/trx0trx.c

  branches/zip: Merge a change from MySQL:
  ------------------------------------------------------------
  revno: 3236
  committer: Satya B <satya.bn@sun.com>
  branch nick: mysql-5.1-bugteam
  timestamp: Tue 2009-12-01 17:48:57 +0530
  message:
    merge to mysql-5.1-bugteam
      ------------------------------------------------------------
      revno: 3234.1.1
      committer: Gleb Shchepa <gshchepa@mysql.com>
      branch nick: mysql-5.1-bugteam
      timestamp: Tue 2009-12-01 14:38:40 +0400
      message:
        Bug #38883 (reopened): thd_security_context is not thread safe, crashes?

        manual merge 5.0-->5.1, updating InnoDB plugin.
      ------------------------------------------------------------
      revno: 1810.3968.13
      committer: Gleb Shchepa <gshchepa@mysql.com>
      branch nick: mysql-5.0-bugteam
      timestamp: Tue 2009-12-01 14:24:44 +0400
      message:
        Bug #38883 (reopened): thd_security_context is not thread safe, crashes?

        The bug 38816 changed the lock that protects THD::query from
        LOCK_thread_count to LOCK_thd_data, but didn't update the associated
        InnoDB functions.

        1. The innobase_mysql_prepare_print_arbitrary_thd and the
        innobase_mysql_end_print_arbitrary_thd InnoDB functions have been
        removed, since now we have a per-thread mutex: now we don't need to wrap
        several inter-thread access tries to THD::query with a single global
        LOCK_thread_count lock, so we can simplify the code.

        2. The innobase_mysql_print_thd function has been modified to lock
        LOCK_thd_data in direct way.
  ------------------------------------------------------------------------
  r6351 | marko | 2009-12-22 11:11:18 +0200 (Tue, 22 Dec 2009) | 1 line
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc

  branches/zip: Remove an obsolete declaration of LOCK_thread_count.
  ------------------------------------------------------------------------
  r6352 | marko | 2009-12-22 12:33:01 +0200 (Tue, 22 Dec 2009) | 104 lines
  Changed paths:
     M /branches/zip/handler/ha_innodb.cc
     M /branches/zip/include/lock0lock.h
     M /branches/zip/include/srv0srv.h
     M /branches/zip/lock/lock0lock.c
     M /branches/zip/log/log0log.c
     M /branches/zip/mysql-test/innodb-autoinc.result
     M /branches/zip/mysql-test/innodb-autoinc.test
     M /branches/zip/row/row0sel.c
     M /branches/zip/srv/srv0srv.c
     M /branches/zip/srv/srv0start.c

  branches/zip: Merge revisions 6206:6350 from branches/5.1,
  except r6347, r6349, r6350 which were committed separately
  to both branches, and r6310, which was backported from zip to 5.1.

    ------------------------------------------------------------------------
    r6206 | jyang | 2009-11-20 09:38:43 +0200 (Fri, 20 Nov 2009) | 3 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc

    branches/5.1: Non-functional change, fix formatting.
    ------------------------------------------------------------------------
    r6230 | sunny | 2009-11-24 23:52:43 +0200 (Tue, 24 Nov 2009) | 3 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb-autoinc.result

    branches/5.1: Fix autoinc failing test results.
    (this should be skipped when merging 5.1 into zip)
    ------------------------------------------------------------------------
    r6231 | sunny | 2009-11-25 10:26:27 +0200 (Wed, 25 Nov 2009) | 7 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test
       M /branches/5.1/row/row0sel.c

    branches/5.1: Fix BUG#49032 - auto_increment field does not initialize to last value in InnoDB Storage Engine.

    We use the appropriate function to read the column value for non-integer
    autoinc column types, namely float and double.

    rb://208. Approved by Marko.
    ------------------------------------------------------------------------
    r6232 | sunny | 2009-11-25 10:27:39 +0200 (Wed, 25 Nov 2009) | 2 lines
    Changed paths:
       M /branches/5.1/row/row0sel.c

    branches/5.1: This is an interim fix, fix white space errors.
    ------------------------------------------------------------------------
    r6233 | sunny | 2009-11-25 10:28:35 +0200 (Wed, 25 Nov 2009) | 2 lines
    Changed paths:
       M /branches/5.1/include/mach0data.h
       M /branches/5.1/include/mach0data.ic
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test
       M /branches/5.1/row/row0sel.c

    branches/5.1: This is an interim fix, fix tests and make read float/double arg const.
    ------------------------------------------------------------------------
    r6234 | sunny | 2009-11-25 10:29:03 +0200 (Wed, 25 Nov 2009) | 2 lines
    Changed paths:
       M /branches/5.1/row/row0sel.c

    branches/5.1: This is an interim fix, fix whitepsace issues.
    ------------------------------------------------------------------------
    r6235 | sunny | 2009-11-26 01:14:42 +0200 (Thu, 26 Nov 2009) | 9 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: Fix Bug#47720 - REPLACE INTO Autoincrement column with negative values.

    This bug is similiar to the negative autoinc filter patch from earlier,
    with the additional handling of filtering out the negative column values
    set explicitly by the user.

    rb://184
    Approved by Heikki.
    ------------------------------------------------------------------------
    r6242 | vasil | 2009-11-27 22:07:12 +0200 (Fri, 27 Nov 2009) | 4 lines
    Changed paths:
       M /branches/5.1/export.sh

    branches/5.1:

    Minor changes to support plugin snapshots.
    ------------------------------------------------------------------------
    r6306 | calvin | 2009-12-14 15:12:46 +0200 (Mon, 14 Dec 2009) | 5 lines
    Changed paths:
       M /branches/5.1/mysql-test/innodb-autoinc.result
       M /branches/5.1/mysql-test/innodb-autoinc.test

    branches/5.1: fix bug#49267: innodb-autoinc.test fails on windows
    because of different case mode

    There is no change to the InnoDB code, only to fix test case by
    changing "T1" to "t1".
    ------------------------------------------------------------------------
    r6324 | jyang | 2009-12-17 06:54:24 +0200 (Thu, 17 Dec 2009) | 8 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/include/lock0lock.h
       M /branches/5.1/include/srv0srv.h
       M /branches/5.1/lock/lock0lock.c
       M /branches/5.1/log/log0log.c
       M /branches/5.1/srv/srv0srv.c
       M /branches/5.1/srv/srv0start.c

    branches/5.1: Fix bug #47814 - Diagnostics are frequently not
    printed after a long lock wait in InnoDB. Separate out the
    lock wait timeout check thread from monitor information
    printing thread.

    rb://200 Approved by Marko.
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r6364 | marko | 2009-12-26 21:06:31 +0200 (Sat, 26 Dec 2009) | 4 lines
  Changed paths:
     M /branches/zip/ibuf/ibuf0ibuf.c

  branches/zip: ibuf_bitmap_get_map_page():
  Define a wrapper macro that passes __FILE__, __LINE__ of the caller
  to buf_page_get_gen().
  This will ease the diagnosis of the likes of Issue #135.
  ------------------------------------------------------------------------
2009-12-26 19:17:43 +00:00

1615 lines
43 KiB
C

/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file trx/trx0sys.c
Transaction system
Created 3/26/1996 Heikki Tuuri
*******************************************************/
#include "trx0sys.h"
#ifdef UNIV_NONINL
#include "trx0sys.ic"
#endif
#ifndef UNIV_HOTBACKUP
#include "fsp0fsp.h"
#include "mtr0log.h"
#include "mtr0log.h"
#include "trx0trx.h"
#include "trx0rseg.h"
#include "trx0undo.h"
#include "srv0srv.h"
#include "trx0purge.h"
#include "log0log.h"
#include "os0file.h"
#include "read0read.h"
/** The file format tag structure with id and name. */
struct file_format_struct {
ulint id; /*!< id of the file format */
const char* name; /*!< text representation of the
file format */
mutex_t mutex; /*!< covers changes to the above
fields */
};
/** The file format tag */
typedef struct file_format_struct file_format_t;
/** The transaction system */
UNIV_INTERN trx_sys_t* trx_sys = NULL;
/** The doublewrite buffer */
UNIV_INTERN trx_doublewrite_t* trx_doublewrite = NULL;
/** The following is set to TRUE when we are upgrading from pre-4.1
format data files to the multiple tablespaces format data files */
UNIV_INTERN ibool trx_doublewrite_must_reset_space_ids = FALSE;
/** Set to TRUE when the doublewrite buffer is being created */
UNIV_INTERN ibool trx_doublewrite_buf_is_being_created = FALSE;
/** The following is TRUE when we are using the database in the
post-4.1 format, i.e., we have successfully upgraded, or have created
a new database installation */
UNIV_INTERN ibool trx_sys_multiple_tablespace_format = FALSE;
/** In a MySQL replication slave, in crash recovery we store the master log
file name and position here. */
/* @{ */
/** Master binlog file name */
UNIV_INTERN char trx_sys_mysql_master_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN];
/** Master binlog file position. We have successfully got the updates
up to this position. -1 means that no crash recovery was needed, or
there was no master log position info inside InnoDB.*/
UNIV_INTERN ib_int64_t trx_sys_mysql_master_log_pos = -1;
/* @} */
/** If this MySQL server uses binary logging, after InnoDB has been inited
and if it has done a crash recovery, we store the binlog file name and position
here. */
/* @{ */
/** Binlog file name */
UNIV_INTERN char trx_sys_mysql_bin_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN];
/** Binlog file position, or -1 if unknown */
UNIV_INTERN ib_int64_t trx_sys_mysql_bin_log_pos = -1;
/* @} */
#endif /* !UNIV_HOTBACKUP */
/** List of animal names representing file format. */
static const char* file_format_name_map[] = {
"Antelope",
"Barracuda",
"Cheetah",
"Dragon",
"Elk",
"Fox",
"Gazelle",
"Hornet",
"Impala",
"Jaguar",
"Kangaroo",
"Leopard",
"Moose",
"Nautilus",
"Ocelot",
"Porpoise",
"Quail",
"Rabbit",
"Shark",
"Tiger",
"Urchin",
"Viper",
"Whale",
"Xenops",
"Yak",
"Zebra"
};
/** The number of elements in the file format name array. */
static const ulint FILE_FORMAT_NAME_N
= sizeof(file_format_name_map) / sizeof(file_format_name_map[0]);
#ifndef UNIV_HOTBACKUP
/** This is used to track the maximum file format id known to InnoDB. It's
updated via SET GLOBAL innodb_file_format_check = 'x' or when we open
or create a table. */
static file_format_t file_format_max;
/****************************************************************//**
Determines if a page number is located inside the doublewrite buffer.
@return TRUE if the location is inside the two blocks of the
doublewrite buffer */
UNIV_INTERN
ibool
trx_doublewrite_page_inside(
/*========================*/
ulint page_no) /*!< in: page number */
{
if (trx_doublewrite == NULL) {
return(FALSE);
}
if (page_no >= trx_doublewrite->block1
&& page_no < trx_doublewrite->block1
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
return(TRUE);
}
if (page_no >= trx_doublewrite->block2
&& page_no < trx_doublewrite->block2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
return(TRUE);
}
return(FALSE);
}
/****************************************************************//**
Creates or initialializes the doublewrite buffer at a database start. */
static
void
trx_doublewrite_init(
/*=================*/
byte* doublewrite) /*!< in: pointer to the doublewrite buf
header on trx sys page */
{
trx_doublewrite = mem_alloc(sizeof(trx_doublewrite_t));
/* Since we now start to use the doublewrite buffer, no need to call
fsync() after every write to a data file */
#ifdef UNIV_DO_FLUSH
os_do_not_call_flush_at_each_write = TRUE;
#endif /* UNIV_DO_FLUSH */
mutex_create(&trx_doublewrite->mutex, SYNC_DOUBLEWRITE);
trx_doublewrite->first_free = 0;
trx_doublewrite->block1 = mach_read_from_4(
doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK1);
trx_doublewrite->block2 = mach_read_from_4(
doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK2);
trx_doublewrite->write_buf_unaligned = ut_malloc(
(1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE);
trx_doublewrite->write_buf = ut_align(
trx_doublewrite->write_buf_unaligned, UNIV_PAGE_SIZE);
trx_doublewrite->buf_block_arr = mem_alloc(
2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * sizeof(void*));
}
/****************************************************************//**
Marks the trx sys header when we have successfully upgraded to the >= 4.1.x
multiple tablespace format. */
UNIV_INTERN
void
trx_sys_mark_upgraded_to_multiple_tablespaces(void)
/*===============================================*/
{
buf_block_t* block;
byte* doublewrite;
mtr_t mtr;
/* We upgraded to 4.1.x and reset the space id fields in the
doublewrite buffer. Let us mark to the trx_sys header that the upgrade
has been done. */
mtr_start(&mtr);
block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
trx_sys_multiple_tablespace_format = TRUE;
}
/****************************************************************//**
Creates the doublewrite buffer to a new InnoDB installation. The header of the
doublewrite buffer is placed on the trx system header page. */
UNIV_INTERN
void
trx_sys_create_doublewrite_buf(void)
/*================================*/
{
buf_block_t* block;
buf_block_t* block2;
buf_block_t* new_block;
byte* doublewrite;
byte* fseg_header;
ulint page_no;
ulint prev_page_no;
ulint i;
mtr_t mtr;
if (trx_doublewrite) {
/* Already inited */
return;
}
start_again:
mtr_start(&mtr);
trx_doublewrite_buf_is_being_created = TRUE;
block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
/* The doublewrite buffer has already been created:
just read in some numbers */
trx_doublewrite_init(doublewrite);
mtr_commit(&mtr);
trx_doublewrite_buf_is_being_created = FALSE;
} else {
fprintf(stderr,
"InnoDB: Doublewrite buffer not found:"
" creating new\n");
if (buf_pool_get_curr_size()
< ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2 + 100)
* UNIV_PAGE_SIZE)) {
fprintf(stderr,
"InnoDB: Cannot create doublewrite buffer:"
" you must\n"
"InnoDB: increase your buffer pool size.\n"
"InnoDB: Cannot continue operation.\n");
exit(1);
}
block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
TRX_SYS_DOUBLEWRITE
+ TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
/* fseg_create acquires a second latch on the page,
therefore we must declare it: */
buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK);
if (block2 == NULL) {
fprintf(stderr,
"InnoDB: Cannot create doublewrite buffer:"
" you must\n"
"InnoDB: increase your tablespace size.\n"
"InnoDB: Cannot continue operation.\n");
/* We exit without committing the mtr to prevent
its modifications to the database getting to disk */
exit(1);
}
fseg_header = buf_block_get_frame(block)
+ TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG;
prev_page_no = 0;
for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ FSP_EXTENT_SIZE / 2; i++) {
page_no = fseg_alloc_free_page(fseg_header,
prev_page_no + 1,
FSP_UP, &mtr);
if (page_no == FIL_NULL) {
fprintf(stderr,
"InnoDB: Cannot create doublewrite"
" buffer: you must\n"
"InnoDB: increase your"
" tablespace size.\n"
"InnoDB: Cannot continue operation.\n"
);
exit(1);
}
/* We read the allocated pages to the buffer pool;
when they are written to disk in a flush, the space
id and page number fields are also written to the
pages. When we at database startup read pages
from the doublewrite buffer, we know that if the
space id and page number in them are the same as
the page position in the tablespace, then the page
has not been written to in doublewrite. */
new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no,
RW_X_LATCH, &mtr);
buf_block_dbg_add_level(new_block,
SYNC_NO_ORDER_CHECK);
if (i == FSP_EXTENT_SIZE / 2) {
ut_a(page_no == FSP_EXTENT_SIZE);
mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_BLOCK1,
page_no, MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_REPEAT
+ TRX_SYS_DOUBLEWRITE_BLOCK1,
page_no, MLOG_4BYTES, &mtr);
} else if (i == FSP_EXTENT_SIZE / 2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
ut_a(page_no == 2 * FSP_EXTENT_SIZE);
mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_BLOCK2,
page_no, MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_REPEAT
+ TRX_SYS_DOUBLEWRITE_BLOCK2,
page_no, MLOG_4BYTES, &mtr);
} else if (i > FSP_EXTENT_SIZE / 2) {
ut_a(page_no == prev_page_no + 1);
}
prev_page_no = page_no;
}
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC,
TRX_SYS_DOUBLEWRITE_MAGIC_N,
MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC
+ TRX_SYS_DOUBLEWRITE_REPEAT,
TRX_SYS_DOUBLEWRITE_MAGIC_N,
MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
+ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
fprintf(stderr, "InnoDB: Doublewrite buffer created\n");
trx_sys_multiple_tablespace_format = TRUE;
goto start_again;
}
}
/****************************************************************//**
At a database startup initializes the doublewrite buffer memory structure if
we already have a doublewrite buffer created in the data files. If we are
upgrading to an InnoDB version which supports multiple tablespaces, then this
function performs the necessary update operations. If we are in a crash
recovery, this function uses a possible doublewrite buffer to restore
half-written pages in the data files. */
UNIV_INTERN
void
trx_sys_doublewrite_init_or_restore_pages(
/*======================================*/
ibool restore_corrupt_pages) /*!< in: TRUE=restore pages */
{
byte* buf;
byte* read_buf;
byte* unaligned_read_buf;
ulint block1;
ulint block2;
ulint source_page_no;
byte* page;
byte* doublewrite;
ulint space_id;
ulint page_no;
ulint i;
/* We do the file i/o past the buffer pool */
unaligned_read_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
read_buf = ut_align(unaligned_read_buf, UNIV_PAGE_SIZE);
/* Read the trx sys header to check if we are using the doublewrite
buffer */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, 0,
UNIV_PAGE_SIZE, read_buf, NULL);
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
/* The doublewrite buffer has been created */
trx_doublewrite_init(doublewrite);
block1 = trx_doublewrite->block1;
block2 = trx_doublewrite->block2;
buf = trx_doublewrite->write_buf;
} else {
goto leave_func;
}
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
!= TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N) {
/* We are upgrading from a version < 4.1.x to a version where
multiple tablespaces are supported. We must reset the space id
field in the pages in the doublewrite buffer because starting
from this version the space id is stored to
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. */
trx_doublewrite_must_reset_space_ids = TRUE;
fprintf(stderr,
"InnoDB: Resetting space id's in the"
" doublewrite buffer\n");
} else {
trx_sys_multiple_tablespace_format = TRUE;
}
/* Read the pages from the doublewrite buffer to memory */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block1, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf, NULL);
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block2, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
NULL);
/* Check if any of these pages is half-written in data files, in the
intended position */
page = buf;
for (i = 0; i < TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 2; i++) {
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
if (trx_doublewrite_must_reset_space_ids) {
space_id = 0;
mach_write_to_4(page
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0);
/* We do not need to calculate new checksums for the
pages because the field .._SPACE_ID does not affect
them. Write the page back to where we read it from. */
if (i < TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
source_page_no = block1 + i;
} else {
source_page_no = block2
+ i - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE;
}
fil_io(OS_FILE_WRITE, TRUE, 0, 0, source_page_no, 0,
UNIV_PAGE_SIZE, page, NULL);
/* printf("Resetting space id in page %lu\n",
source_page_no); */
} else {
space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
}
if (!restore_corrupt_pages) {
/* The database was shut down gracefully: no need to
restore pages */
} else if (!fil_tablespace_exists_in_mem(space_id)) {
/* Maybe we have dropped the single-table tablespace
and this page once belonged to it: do nothing */
} else if (!fil_check_adress_in_tablespace(space_id,
page_no)) {
fprintf(stderr,
"InnoDB: Warning: a page in the"
" doublewrite buffer is not within space\n"
"InnoDB: bounds; space id %lu"
" page number %lu, page %lu in"
" doublewrite buf.\n",
(ulong) space_id, (ulong) page_no, (ulong) i);
} else if (space_id == TRX_SYS_SPACE
&& ((page_no >= block1
&& page_no
< block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|| (page_no >= block2
&& page_no
< (block2
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)))) {
/* It is an unwritten doublewrite buffer page:
do nothing */
} else {
ulint zip_size = fil_space_get_zip_size(space_id);
/* Read in the actual page from the file */
fil_io(OS_FILE_READ, TRUE, space_id, zip_size,
page_no, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE,
read_buf, NULL);
/* Check if the page is corrupt */
if (UNIV_UNLIKELY
(buf_page_is_corrupted(read_buf, zip_size))) {
fprintf(stderr,
"InnoDB: Warning: database page"
" corruption or a failed\n"
"InnoDB: file read of"
" space %lu page %lu.\n"
"InnoDB: Trying to recover it from"
" the doublewrite buffer.\n",
(ulong) space_id, (ulong) page_no);
if (buf_page_is_corrupted(page, zip_size)) {
fprintf(stderr,
"InnoDB: Dump of the page:\n");
buf_page_print(read_buf, zip_size);
fprintf(stderr,
"InnoDB: Dump of"
" corresponding page"
" in doublewrite buffer:\n");
buf_page_print(page, zip_size);
fprintf(stderr,
"InnoDB: Also the page in the"
" doublewrite buffer"
" is corrupt.\n"
"InnoDB: Cannot continue"
" operation.\n"
"InnoDB: You can try to"
" recover the database"
" with the my.cnf\n"
"InnoDB: option:\n"
"InnoDB: set-variable="
"innodb_force_recovery=6\n");
exit(1);
}
/* Write the good page from the
doublewrite buffer to the intended
position */
fil_io(OS_FILE_WRITE, TRUE, space_id,
zip_size, page_no, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE,
page, NULL);
fprintf(stderr,
"InnoDB: Recovered the page from"
" the doublewrite buffer.\n");
}
}
page += UNIV_PAGE_SIZE;
}
fil_flush_file_spaces(FIL_TABLESPACE);
leave_func:
ut_free(unaligned_read_buf);
}
/****************************************************************//**
Checks that trx is in the trx list.
@return TRUE if is in */
UNIV_INTERN
ibool
trx_in_trx_list(
/*============*/
trx_t* in_trx) /*!< in: trx */
{
trx_t* trx;
ut_ad(mutex_own(&(kernel_mutex)));
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
while (trx != NULL) {
if (trx == in_trx) {
return(TRUE);
}
trx = UT_LIST_GET_NEXT(trx_list, trx);
}
return(FALSE);
}
/*****************************************************************//**
Writes the value of max_trx_id to the file based trx system header. */
UNIV_INTERN
void
trx_sys_flush_max_trx_id(void)
/*==========================*/
{
trx_sysf_t* sys_header;
mtr_t mtr;
ut_ad(mutex_own(&kernel_mutex));
mtr_start(&mtr);
sys_header = trx_sysf_get(&mtr);
mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
trx_sys->max_trx_id, &mtr);
mtr_commit(&mtr);
}
/*****************************************************************//**
Updates the offset information about the end of the MySQL binlog entry
which corresponds to the transaction just being committed. In a MySQL
replication slave updates the latest master binlog position up to which
replication has proceeded. */
UNIV_INTERN
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
const char* file_name,/*!< in: MySQL log file name */
ib_int64_t offset, /*!< in: position in that log file */
ulint field, /*!< in: offset of the MySQL log info field in
the trx sys header */
mtr_t* mtr) /*!< in: mtr */
{
trx_sysf_t* sys_header;
if (ut_strlen(file_name) >= TRX_SYS_MYSQL_LOG_NAME_LEN) {
/* We cannot fit the name to the 512 bytes we have reserved */
return;
}
sys_header = trx_sysf_get(mtr);
if (mach_read_from_4(sys_header + field
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
mlog_write_ulint(sys_header + field
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD,
TRX_SYS_MYSQL_LOG_MAGIC_N,
MLOG_4BYTES, mtr);
}
if (0 != strcmp((char*) (sys_header + field + TRX_SYS_MYSQL_LOG_NAME),
file_name)) {
mlog_write_string(sys_header + field
+ TRX_SYS_MYSQL_LOG_NAME,
(byte*) file_name, 1 + ut_strlen(file_name),
mtr);
}
if (mach_read_from_4(sys_header + field
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH) > 0
|| (offset >> 32) > 0) {
mlog_write_ulint(sys_header + field
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH,
(ulint)(offset >> 32),
MLOG_4BYTES, mtr);
}
mlog_write_ulint(sys_header + field
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW,
(ulint)(offset & 0xFFFFFFFFUL),
MLOG_4BYTES, mtr);
}
/*****************************************************************//**
Stores the MySQL binlog offset info in the trx system header if
the magic number shows it valid, and print the info to stderr */
UNIV_INTERN
void
trx_sys_print_mysql_binlog_offset(void)
/*===================================*/
{
trx_sysf_t* sys_header;
mtr_t mtr;
ulint trx_sys_mysql_bin_log_pos_high;
ulint trx_sys_mysql_bin_log_pos_low;
mtr_start(&mtr);
sys_header = trx_sysf_get(&mtr);
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
mtr_commit(&mtr);
return;
}
trx_sys_mysql_bin_log_pos_high = mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
trx_sys_mysql_bin_log_pos_low = mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW);
trx_sys_mysql_bin_log_pos
= (((ib_int64_t)trx_sys_mysql_bin_log_pos_high) << 32)
+ (ib_int64_t)trx_sys_mysql_bin_log_pos_low;
ut_memcpy(trx_sys_mysql_bin_log_name,
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME, TRX_SYS_MYSQL_LOG_NAME_LEN);
fprintf(stderr,
"InnoDB: Last MySQL binlog file position %lu %lu,"
" file name %s\n",
trx_sys_mysql_bin_log_pos_high, trx_sys_mysql_bin_log_pos_low,
trx_sys_mysql_bin_log_name);
mtr_commit(&mtr);
}
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header if
the magic number shows it valid. */
UNIV_INTERN
void
trx_sys_print_mysql_master_log_pos(void)
/*====================================*/
{
trx_sysf_t* sys_header;
mtr_t mtr;
mtr_start(&mtr);
sys_header = trx_sysf_get(&mtr);
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
mtr_commit(&mtr);
return;
}
fprintf(stderr,
"InnoDB: In a MySQL replication slave the last"
" master binlog file\n"
"InnoDB: position %lu %lu, file name %s\n",
(ulong) mach_read_from_4(sys_header
+ TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
(ulong) mach_read_from_4(sys_header
+ TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW),
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME);
/* Copy the master log position info to global variables we can
use in ha_innobase.cc to initialize glob_mi to right values */
ut_memcpy(trx_sys_mysql_master_log_name,
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME,
TRX_SYS_MYSQL_LOG_NAME_LEN);
trx_sys_mysql_master_log_pos
= (((ib_int64_t) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH)) << 32)
+ ((ib_int64_t) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW));
mtr_commit(&mtr);
}
/****************************************************************//**
Looks for a free slot for a rollback segment in the trx system file copy.
@return slot index or ULINT_UNDEFINED if not found */
UNIV_INTERN
ulint
trx_sysf_rseg_find_free(
/*====================*/
mtr_t* mtr) /*!< in: mtr */
{
trx_sysf_t* sys_header;
ulint page_no;
ulint i;
ut_ad(mutex_own(&(kernel_mutex)));
sys_header = trx_sysf_get(mtr);
for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
page_no = trx_sysf_rseg_get_page_no(sys_header, i, mtr);
if (page_no == FIL_NULL) {
return(i);
}
}
return(ULINT_UNDEFINED);
}
/*****************************************************************//**
Creates the file page for the transaction system. This function is called only
at the database creation, before trx_sys_init. */
static
void
trx_sysf_create(
/*============*/
mtr_t* mtr) /*!< in: mtr */
{
trx_sysf_t* sys_header;
ulint slot_no;
buf_block_t* block;
page_t* page;
ulint page_no;
ulint i;
ut_ad(mtr);
/* Note that below we first reserve the file space x-latch, and
then enter the kernel: we must do it in this order to conform
to the latching order rules. */
mtr_x_lock(fil_space_get_latch(TRX_SYS_SPACE, NULL), mtr);
mutex_enter(&kernel_mutex);
/* Create the trx sys file block in a new allocated file segment */
block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
mtr);
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO);
page = buf_block_get_frame(block);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
MLOG_2BYTES, mtr);
/* Reset the doublewrite buffer magic number to zero so that we
know that the doublewrite buffer has not yet been created (this
suppresses a Valgrind warning) */
mlog_write_ulint(page + TRX_SYS_DOUBLEWRITE
+ TRX_SYS_DOUBLEWRITE_MAGIC, 0, MLOG_4BYTES, mtr);
sys_header = trx_sysf_get(mtr);
/* Start counting transaction ids from number 1 up */
mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
ut_dulint_create(0, 1), mtr);
/* Reset the rollback segment slots */
for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
trx_sysf_rseg_set_space(sys_header, i, ULINT_UNDEFINED, mtr);
trx_sysf_rseg_set_page_no(sys_header, i, FIL_NULL, mtr);
}
/* The remaining area (up to the page trailer) is uninitialized.
Silence Valgrind warnings about it. */
UNIV_MEM_VALID(sys_header + (TRX_SYS_RSEGS
+ TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE),
(UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
- (TRX_SYS_RSEGS
+ TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
+ TRX_SYS_RSEG_SPACE))
+ page - sys_header);
/* Create the first rollback segment in the SYSTEM tablespace */
page_no = trx_rseg_header_create(TRX_SYS_SPACE, 0, ULINT_MAX, &slot_no,
mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
ut_a(page_no != FIL_NULL);
mutex_exit(&kernel_mutex);
}
/*****************************************************************//**
Creates and initializes the central memory structures for the transaction
system. This is called when the database is started. */
UNIV_INTERN
void
trx_sys_init_at_db_start(void)
/*==========================*/
{
trx_sysf_t* sys_header;
ib_int64_t rows_to_undo = 0;
const char* unit = "";
trx_t* trx;
mtr_t mtr;
mtr_start(&mtr);
ut_ad(trx_sys == NULL);
mutex_enter(&kernel_mutex);
trx_sys = mem_alloc(sizeof(trx_sys_t));
sys_header = trx_sysf_get(&mtr);
trx_rseg_list_and_array_init(sys_header, &mtr);
trx_sys->latest_rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the 'if' in
trx_sys_get_new_trx_id will evaluate to TRUE when the function
is first time called, and the value for trx id will be written
to the disk-based header! Thus trx id values will not overlap when
the database is repeatedly started! */
trx_sys->max_trx_id = ut_dulint_add(
ut_dulint_align_up(mtr_read_dulint(
sys_header
+ TRX_SYS_TRX_ID_STORE, &mtr),
TRX_SYS_TRX_ID_WRITE_MARGIN),
2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
UT_LIST_INIT(trx_sys->mysql_trx_list);
trx_dummy_sess = sess_open();
trx_lists_init_at_db_start();
if (UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
for (;;) {
if ( trx->conc_state != TRX_PREPARED) {
rows_to_undo += ut_conv_dulint_to_longlong(
trx->undo_no);
}
trx = UT_LIST_GET_NEXT(trx_list, trx);
if (!trx) {
break;
}
}
if (rows_to_undo > 1000000000) {
unit = "M";
rows_to_undo = rows_to_undo / 1000000;
}
fprintf(stderr,
"InnoDB: %lu transaction(s) which must be"
" rolled back or cleaned up\n"
"InnoDB: in total %lu%s row operations to undo\n",
(ulong) UT_LIST_GET_LEN(trx_sys->trx_list),
(ulong) rows_to_undo, unit);
fprintf(stderr, "InnoDB: Trx id counter is " TRX_ID_FMT "\n",
TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
}
UT_LIST_INIT(trx_sys->view_list);
trx_purge_sys_create();
mutex_exit(&kernel_mutex);
mtr_commit(&mtr);
}
/*****************************************************************//**
Creates and initializes the transaction system at the database creation. */
UNIV_INTERN
void
trx_sys_create(void)
/*================*/
{
mtr_t mtr;
mtr_start(&mtr);
trx_sysf_create(&mtr);
mtr_commit(&mtr);
trx_sys_init_at_db_start();
}
/*****************************************************************//**
Update the file format tag.
@return always TRUE */
static
ibool
trx_sys_file_format_max_write(
/*==========================*/
ulint format_id, /*!< in: file format id */
const char** name) /*!< out: max file format name, can
be NULL */
{
mtr_t mtr;
byte* ptr;
buf_block_t* block;
ulint tag_value_low;
mtr_start(&mtr);
block = buf_page_get(
TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
file_format_max.id = format_id;
file_format_max.name = trx_sys_file_format_id_to_name(format_id);
ptr = buf_block_get_frame(block) + TRX_SYS_FILE_FORMAT_TAG;
tag_value_low = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
if (name) {
*name = file_format_max.name;
}
mlog_write_dulint(
ptr,
ut_dulint_create(TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH,
tag_value_low),
&mtr);
mtr_commit(&mtr);
return(TRUE);
}
/*****************************************************************//**
Read the file format tag.
@return the file format or ULINT_UNDEFINED if not set. */
static
ulint
trx_sys_file_format_max_read(void)
/*==============================*/
{
mtr_t mtr;
const byte* ptr;
const buf_block_t* block;
ulint format_id;
dulint file_format_id;
/* Since this is called during the startup phase it's safe to
read the value without a covering mutex. */
mtr_start(&mtr);
block = buf_page_get(
TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
ptr = buf_block_get_frame(block) + TRX_SYS_FILE_FORMAT_TAG;
file_format_id = mach_read_from_8(ptr);
mtr_commit(&mtr);
format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
|| format_id >= FILE_FORMAT_NAME_N) {
/* Either it has never been tagged, or garbage in it. */
return(ULINT_UNDEFINED);
}
return(format_id);
}
/*****************************************************************//**
Get the name representation of the file format from its id.
@return pointer to the name */
UNIV_INTERN
const char*
trx_sys_file_format_id_to_name(
/*===========================*/
const ulint id) /*!< in: id of the file format */
{
ut_a(id < FILE_FORMAT_NAME_N);
return(file_format_name_map[id]);
}
/*****************************************************************//**
Check for the max file format tag stored on disk. Note: If max_format_id
is == DICT_TF_FORMAT_MAX + 1 then we only print a warning.
@return DB_SUCCESS or error code */
UNIV_INTERN
ulint
trx_sys_file_format_max_check(
/*==========================*/
ulint max_format_id) /*!< in: max format id to check */
{
ulint format_id;
/* Check the file format in the tablespace. Do not try to
recover if the file format is not supported by the engine
unless forced by the user. */
format_id = trx_sys_file_format_max_read();
if (format_id == ULINT_UNDEFINED) {
/* Format ID was not set. Set it to minimum possible
value. */
format_id = DICT_TF_FORMAT_51;
}
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: highest supported file format is %s.\n",
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX));
if (format_id > DICT_TF_FORMAT_MAX) {
ut_a(format_id < FILE_FORMAT_NAME_N);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: %s: the system tablespace is in a file "
"format that this version doesn't support - %s\n",
((max_format_id <= DICT_TF_FORMAT_MAX)
? "Error" : "Warning"),
trx_sys_file_format_id_to_name(format_id));
if (max_format_id <= DICT_TF_FORMAT_MAX) {
return(DB_ERROR);
}
}
format_id = (format_id > max_format_id) ? format_id : max_format_id;
/* We don't need a mutex here, as this function should only
be called once at start up. */
file_format_max.id = format_id;
file_format_max.name = trx_sys_file_format_id_to_name(format_id);
return(DB_SUCCESS);
}
/*****************************************************************//**
Set the file format id unconditionally except if it's already the
same value.
@return TRUE if value updated */
UNIV_INTERN
ibool
trx_sys_file_format_max_set(
/*========================*/
ulint format_id, /*!< in: file format id */
const char** name) /*!< out: max file format name or
NULL if not needed. */
{
ibool ret = FALSE;
ut_a(format_id <= DICT_TF_FORMAT_MAX);
mutex_enter(&file_format_max.mutex);
/* Only update if not already same value. */
if (format_id != file_format_max.id) {
ret = trx_sys_file_format_max_write(format_id, name);
}
mutex_exit(&file_format_max.mutex);
return(ret);
}
/********************************************************************//**
Tags the system table space with minimum format id if it has not been
tagged yet.
WARNING: This function is only called during the startup and AFTER the
redo log application during recovery has finished. */
UNIV_INTERN
void
trx_sys_file_format_tag_init(void)
/*==============================*/
{
ulint format_id;
format_id = trx_sys_file_format_max_read();
/* If format_id is not set then set it to the minimum. */
if (format_id == ULINT_UNDEFINED) {
trx_sys_file_format_max_set(DICT_TF_FORMAT_51, NULL);
}
}
/********************************************************************//**
Update the file format tag in the system tablespace only if the given
format id is greater than the known max id.
@return TRUE if format_id was bigger than the known max id */
UNIV_INTERN
ibool
trx_sys_file_format_max_upgrade(
/*============================*/
const char** name, /*!< out: max file format name */
ulint format_id) /*!< in: file format identifier */
{
ibool ret = FALSE;
ut_a(name);
ut_a(file_format_max.name != NULL);
ut_a(format_id <= DICT_TF_FORMAT_MAX);
mutex_enter(&file_format_max.mutex);
if (format_id > file_format_max.id) {
ret = trx_sys_file_format_max_write(format_id, name);
}
mutex_exit(&file_format_max.mutex);
return(ret);
}
/*****************************************************************//**
Get the name representation of the file format from its id.
@return pointer to the max format name */
UNIV_INTERN
const char*
trx_sys_file_format_max_get(void)
/*=============================*/
{
return(file_format_max.name);
}
/*****************************************************************//**
Initializes the tablespace tag system. */
UNIV_INTERN
void
trx_sys_file_format_init(void)
/*==========================*/
{
mutex_create(&file_format_max.mutex, SYNC_FILE_FORMAT_TAG);
/* We don't need a mutex here, as this function should only
be called once at start up. */
file_format_max.id = DICT_TF_FORMAT_51;
file_format_max.name = trx_sys_file_format_id_to_name(
file_format_max.id);
}
/*****************************************************************//**
Closes the tablespace tag system. */
UNIV_INTERN
void
trx_sys_file_format_close(void)
/*===========================*/
{
/* Does nothing at the moment */
}
#else /* !UNIV_HOTBACKUP */
/*****************************************************************//**
Prints to stderr the MySQL binlog info in the system header if the
magic number shows it valid. */
UNIV_INTERN
void
trx_sys_print_mysql_binlog_offset_from_page(
/*========================================*/
const byte* page) /*!< in: buffer containing the trx
system header page, i.e., page number
TRX_SYS_PAGE_NO in the tablespace */
{
const trx_sysf_t* sys_header;
sys_header = page + TRX_SYS;
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
== TRX_SYS_MYSQL_LOG_MAGIC_N) {
fprintf(stderr,
"ibbackup: Last MySQL binlog file position %lu %lu,"
" file name %s\n",
(ulong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
(ulong) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW),
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME);
}
}
/* THESE ARE COPIED FROM NON-HOTBACKUP PART OF THE INNODB SOURCE TREE
(This code duplicaton should be fixed at some point!)
*/
#define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */
/* The offset of the file format tag on the trx system header page */
#define TRX_SYS_FILE_FORMAT_TAG (UNIV_PAGE_SIZE - 16)
/* We use these random constants to reduce the probability of reading
garbage (from previous versions) that maps to an actual format id. We
use these as bit masks at the time of reading and writing from/to disk. */
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW 3645922177UL
#define TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH 2745987765UL
/* END OF COPIED DEFINITIONS */
/*****************************************************************//**
Reads the file format id from the first system table space file.
Even if the call succeeds and returns TRUE, the returned format id
may be ULINT_UNDEFINED signalling that the format id was not present
in the data file.
@return TRUE if call succeeds */
UNIV_INTERN
ibool
trx_sys_read_file_format_id(
/*========================*/
const char *pathname, /*!< in: pathname of the first system
table space file */
ulint *format_id) /*!< out: file format of the system table
space */
{
os_file_t file;
ibool success;
byte buf[UNIV_PAGE_SIZE * 2];
page_t* page = ut_align(buf, UNIV_PAGE_SIZE);
const byte* ptr;
dulint file_format_id;
*format_id = ULINT_UNDEFINED;
file = os_file_create_simple_no_error_handling(
pathname,
OS_FILE_OPEN,
OS_FILE_READ_ONLY,
&success
);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
fprintf(stderr,
" ibbackup: Error: trying to read system tablespace file format,\n"
" ibbackup: but could not open the tablespace file %s!\n",
pathname
);
return(FALSE);
}
/* Read the page on which file format is stored */
success = os_file_read_no_error_handling(
file, page, TRX_SYS_PAGE_NO * UNIV_PAGE_SIZE, 0, UNIV_PAGE_SIZE
);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
fprintf(stderr,
" ibbackup: Error: trying to read system table space file format,\n"
" ibbackup: but failed to read the tablespace file %s!\n",
pathname
);
os_file_close(file);
return(FALSE);
}
os_file_close(file);
/* get the file format from the page */
ptr = page + TRX_SYS_FILE_FORMAT_TAG;
file_format_id = mach_read_from_8(ptr);
*format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
|| *format_id >= FILE_FORMAT_NAME_N) {
/* Either it has never been tagged, or garbage in it. */
*format_id = ULINT_UNDEFINED;
return(TRUE);
}
return(TRUE);
}
/*****************************************************************//**
Reads the file format id from the given per-table data file.
@return TRUE if call succeeds */
UNIV_INTERN
ibool
trx_sys_read_pertable_file_format_id(
/*=================================*/
const char *pathname, /*!< in: pathname of a per-table
datafile */
ulint *format_id) /*!< out: file format of the per-table
data file */
{
os_file_t file;
ibool success;
byte buf[UNIV_PAGE_SIZE * 2];
page_t* page = ut_align(buf, UNIV_PAGE_SIZE);
const byte* ptr;
ib_uint32_t flags;
*format_id = ULINT_UNDEFINED;
file = os_file_create_simple_no_error_handling(
pathname,
OS_FILE_OPEN,
OS_FILE_READ_ONLY,
&success
);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
fprintf(stderr,
" ibbackup: Error: trying to read per-table tablespace format,\n"
" ibbackup: but could not open the tablespace file %s!\n",
pathname
);
return(FALSE);
}
/* Read the first page of the per-table datafile */
success = os_file_read_no_error_handling(
file, page, 0, 0, UNIV_PAGE_SIZE
);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
fprintf(stderr,
" ibbackup: Error: trying to per-table data file format,\n"
" ibbackup: but failed to read the tablespace file %s!\n",
pathname
);
os_file_close(file);
return(FALSE);
}
os_file_close(file);
/* get the file format from the page */
ptr = page + 54;
flags = mach_read_from_4(ptr);
if (flags == 0) {
/* file format is Antelope */
*format_id = 0;
return (TRUE);
} else if (flags & 1) {
/* tablespace flags are ok */
*format_id = (flags / 32) % 128;
return (TRUE);
} else {
/* bad tablespace flags */
return(FALSE);
}
}
/*****************************************************************//**
Get the name representation of the file format from its id.
@return pointer to the name */
UNIV_INTERN
const char*
trx_sys_file_format_id_to_name(
/*===========================*/
const ulint id) /*!< in: id of the file format */
{
if (!(id < FILE_FORMAT_NAME_N)) {
/* unknown id */
return ("Unknown");
}
return(file_format_name_map[id]);
}
#endif /* !UNIV_HOTBACKUP */
#ifndef UNIV_HOTBACKUP
/*********************************************************************
Shutdown/Close the transaction system. */
UNIV_INTERN
void
trx_sys_close(void)
/*===============*/
{
trx_rseg_t* rseg;
read_view_t* view;
ut_ad(trx_sys != NULL);
/* Check that all read views are closed except read view owned
by a purge. */
if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
fprintf(stderr,
"InnoDB: Error: all read views were not closed"
" before shutdown:\n"
"InnoDB: %lu read views open \n",
UT_LIST_GET_LEN(trx_sys->view_list) - 1);
}
sess_close(trx_dummy_sess);
trx_dummy_sess = NULL;
trx_purge_sys_close();
mutex_enter(&kernel_mutex);
/* Free the double write data structures. */
ut_a(trx_doublewrite != NULL);
ut_free(trx_doublewrite->write_buf_unaligned);
trx_doublewrite->write_buf_unaligned = NULL;
mem_free(trx_doublewrite->buf_block_arr);
trx_doublewrite->buf_block_arr = NULL;
mutex_free(&trx_doublewrite->mutex);
mem_free(trx_doublewrite);
trx_doublewrite = NULL;
/* There can't be any active transactions. */
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
while (rseg != NULL) {
trx_rseg_t* prev_rseg = rseg;
rseg = UT_LIST_GET_NEXT(rseg_list, prev_rseg);
UT_LIST_REMOVE(rseg_list, trx_sys->rseg_list, prev_rseg);
trx_rseg_mem_free(prev_rseg);
}
view = UT_LIST_GET_FIRST(trx_sys->view_list);
while (view != NULL) {
read_view_t* prev_view = view;
view = UT_LIST_GET_NEXT(view_list, prev_view);
/* Views are allocated from the trx_sys->global_read_view_heap.
So, we simply remove the element here. */
UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view);
}
ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
mem_free(trx_sys);
trx_sys = NULL;
mutex_exit(&kernel_mutex);
}
#endif /* !UNIV_HOTBACKUP */