Commit graph

65455 commits

Author SHA1 Message Date
Konstantin Osipov
69f8e58821 Apply:
3413 Davi Arnaut	2010-06-03
     Don't enable safemalloc for valgrind builds, it's too slow.
to trunk-runtime.
2010-06-07 18:52:44 +04:00
Dmitry Lenev
1398a1a990 Follow-up for bug#52289 "performance regression
for MyISAM in sysbench OLTP_RW test".

Fixes compilation warnings about local variable
shadowing I_P_List_fast_push_back::last member.

Renamed I_P_List_fast_push_back::last member
to m_last. Also to keep member naming consistent
renamed I_P_List::first member to m_first.
2010-06-07 17:40:52 +04:00
Konstantin Osipov
cc90cbbe60 A fix for Bug#52432 "Crash in check_table_is_closed on an
information_schema query.
Porting a fix done for a feature tree by Ingo Struewing.
No test case since the crash only occurs under a stress
load.

storage/myisam/mi_dbug.c:
  Iterate over the list of MyISAM shares and access the MyISAM 
  share internals under a lock.
2010-06-07 16:05:34 +04:00
Dmitry Lenev
9dbd9ce185 Patch that changes approach to how we acquire metadata
locks for DML statements and changes the way MDL locks
are acquired/granted in contended case.

Instead of backing-off when a lock conflict is encountered
and waiting for it to go away before restarting open_tables()
process we now wait for lock to be released without releasing
any previously acquired locks. If conflicting lock goes away
we resume opening tables. If waiting leads to a deadlock we
try to resolve it by backing-off and restarting open_tables()
immediately.

As result both waiting for possibility to acquire and
acquiring of a metadata lock now always happen within the
same MDL API call. This has allowed to make release of a lock
and granting it to the most appropriate pending request an
atomic operation.
Thanks to this it became possible to wake up during release
of lock only those waiters which requests can be satisfied
at the moment as well as wake up only one waiter in case
when granting its request would prevent all other requests
from being satisfied. This solves thundering herd problem
which occured in cases when we were releasing some lock and
woke up many waiters for SNRW or X locks (this was the issue
in bug#52289 "performance regression for MyISAM in sysbench
OLTP_RW test".
This also allowed to implement more fair (FIFO) scheduling
among waiters with the same priority.
It also opens the door for introducing new types of requests
for metadata locks such as low-prio SNRW lock which is
necessary in order to support LOCK TABLES LOW_PRIORITY WRITE.

Notice that after this sometimes can report ER_LOCK_DEADLOCK
error in cases in which it has not happened before.
Particularly we will always report this error if waiting for
conflicting lock has happened in the middle of transaction
and resulted in a deadlock. Before this patch the error was
not reported if deadlock could have been resolved by backing
off all metadata locks acquired by the current statement.

mysql-test/r/mdl_sync.result:
  Added test coverage for some aspects of deadlock handling in
  metadata locking subsystem.
  Adjusted test case after removing back-off in general case
  when conflicting metadata lock is encountered during
  open_tables() (now this happens only if waiting for
  conflicting lock to go away leads to a deadlock).
mysql-test/r/sp_sync.result:
  Adjusted test case after removing back-off in general case
  when conflicting metadata lock is encountered during
  open_tables() (now this happens only if waiting for
  conflicting lock to go away leads to a deadlock).
mysql-test/suite/perfschema/r/dml_setup_instruments.result:
  Adjusted test results after renaming MDL_context::
  m_waiting_for_lock rwlock to m_LOCK_waiting_for.
mysql-test/suite/rpl/r/rpl_sp.result:
  Adjusted test case after implementing new approach to
  acquiring metadata locks in open_tables(). We no longer
  release all MDL locks acquired by statement before waiting
  for conflicting lock to go away. As result DROP FUNCTION
  statement has to wait for DML statement which managed to
  acquire metadata lock on function being dropped and now
  waits for other conflicting metadata lock to go away.
mysql-test/suite/rpl/t/rpl_sp.test:
  Adjusted test case after implementing new approach to
  acquiring metadata locks in open_tables(). We no longer
  release all MDL locks acquired by statement before waiting
  for conflicting lock to go away. As result DROP FUNCTION
  statement has to wait for DML statement which managed to
  acquire metadata lock on function being dropped and now
  waits for other conflicting metadata lock to go away.
mysql-test/t/mdl_sync.test:
  Added test coverage for some aspects of deadlock handling in
  metadata locking subsystem.
  Adjusted test case after removing back-off in general case
  when conflicting metadata lock is encountered during
  open_tables() (now this happens only if waiting for
  conflicting lock to go away leads to a deadlock).
mysql-test/t/sp_sync.test:
  Adjusted test case after removing back-off in general case
  when conflicting metadata lock is encountered during
  open_tables() (now this happens only if waiting for
  conflicting lock to go away leads to a deadlock).
sql/mdl.cc:
  Changed MDL subsystem to support new approach to acquring
  metadata locks in open tables and more fair and efficient
  scheduling of metadata locks. To implement this:
  - Made releasing of the lock and granting it to the most
    appropriate pending request atomic operation. As result it
    became possible to wake up only those waiters requests from
    which can be satisfied at the moment as well as wake-up
    only one waiter in case when granting its request would
    prevent all other requests from being satisfied.
    This solved thundering herd problem which occured in cases
    when we were releasing some lock and woke up many waiters
    for SNRW or X locks (this was the issue in Bug #52289
    "performance regression for MyISAM in sysbench OLTP_RW
    test".
    To emphasize above changes wake_up_waiters() was renamed
    to MDL_context::reschedule_waiters().
  - Changed code to add tickets for new requests to the back of
    waiters queue and to select tickets to be satisfied from
    the head of the queue if possible (this makes scheduling of
    requests with the same priority fair). To be able to do
    this efficiently we now use for waiting and granted queues
    version of I_P_List class which provides fast push_back()
    method.
  - Members and methods of MDL_context related to sending
    and waiting for signal were moved to separate MDL_wait
    class.
  - Since in order to avoid race conditions we must grant the
    lock only to the context which was not chosen as a victim
    of deadlock, killed or aborted due to timeout
    MDL_wait::set_status() (former awake()) was changed not to
    send signal if signal slot is already occupied and to
    indicate this fact through its return value. As another
    consequence MDL_wait::timed_wait() method was changed to
    handle timeout (optionally) and abort due to kill as
    signals which make signal slot occupied.
  - Renamed MDL_context::acquire_lock_impl() to acquire_lock().
    Changed it to be able correctly process requests for shared
    locks when there are open HANDLERs, made this method more
    optimized for acquisition of shared locks. As part of this
    change moved code common between try_acquire_lock() and
    acquire_lock() to new try_acquire_lock_impl() method.
    Also adjusted acquire_lock()'s code to take into account
    the fact that in cases when lock is granted as result of
    MDL_context::reschedule_waiters() call (i.e. when it is
    granted after waiting for lock conflict to go away)
    updating MDL_lock state is responsibility of the thread
    calling reschedule_waiters().
  - Changed MDL_context::find_deadlock() to send VICTIM
    signal even if victim is the context which has initiated
    deadlock detection. This is required in order to avoid
    races in cases when the same context simultaneously is
    chosen as a victim and its request for lock is satisfied.
    As result return value of this method became unnecessary
    and it was changed to return void.
    Adjusted MDL_lock::find_deadlock() method to take into
    account that now there can be a discrepancy between
    MDL_context::m_waiting_for value being set and real state
    of the ticket this member points to.
  - Renamed MDL_context::m_waiting_for_lock to m_LOCK_waiting_for
    and MDL_context::stop_waiting() to done_waiting_for().
  - Finally, removed MDL_context::wait_for_lock() method.
sql/mdl.h:
  Changed MDL subsystem to support new approach to acquring
  metadata locks in open tables and more fair and efficient
  scheduling of metadata locks. To implement this:
  - Members and methods of MDL_context related to sending
    and waiting for signal were moved to separate MDL_wait
    class.
  - Since now in order to avoid race conditions we must grant
    the lock only to the context which was not chosen as a
    victim of deadlock, killed or aborted due to timeout
    MDL_wait::set_status (former awake()) was changed not to
    send signal if signal slot is already occupied and to
    indicate this fact through its return value.
    Also NORMAL_WAKE_UP signal became GRANTED, and timeouts
    and aborts due to kill became full blown signals rather
    than simple return values.
  - MDL_wait::timed_wait() now takes extra parameter that
    indicates whether signal should be set if timeout is
    reached.
  - Enabled fast push_back() operation in MDL_context::m_tickets
    list to make move_ticket_after_trans_sentinel() method more
    efficient.
  - Removed MDL_context::wait_for_lock() method.
  - Renamed MDL_context::m_waiting_for_lock to m_LOCK_waiting_for
    and MDL_context::stop_waiting() to done_waiting_for().
  - MDL_context::acquire_lock_impl() became acquire_lock().
  - Introduced MDL_context::try_acquire_lock_impl() as a
    place for code shared by try_acquire_lock and
    acquire_lock().
  - Due to fact that now VICTIM signal is sent even if victim
    is the context which has initiated deadlock detection
    find_deadlock() no longer needs a return value.
sql/sql_base.cc:
  Implemented new approach to acquiring metadata locks in
  open_tables(). We no longer perform back-off when conflicting
  metadata lock is encountered. Instead we wait for this lock
  to go away while holding all locks which were acquired so
  far. Back-off is only used in situation when further waiting
  will cause a deadlock which could be avoided by performing
  back-off and restarting open_tables() process. Absence of
  waiting between back-off and restart of acquiring metadata
  locks can't lead to livelocks as MDL subsystem was changed
  to make release of lock and granting it to waiting lock
  an atomic action, so back-off will automatically give way
  to other participants of deadlock loop.
  Accordingly:
  - open_table_get_mdl_lock() and open_and_process_routine()
    were changed to wait for conflicting metadata lock to
    go away without back-off. Only if such wait leads to a
    deadlock back-off is requested. As part of this change
    new error handler class was introduced which converts,
    if possible, ER_LOCK_DEADLOCK error to a request for
    back-off and re-start of open_tables() process.
  - Open_table_context::recover_from_failed_open() was changed
    not to wait in case of metadata lock conflict. Instead we
    immediately proceed to re-acquiring locks.
  - Open_table_context::request_backoff_action() now always
    emits error if back-off is requested in the middle of
    transaction as we can't be sure that releasing lock
    which were acquired only by current statement will
    resolve a deadlock. Before this patch such situations were
    successfully detected thanks to the fact that we called
    MDL_context::wait_for_lock() method in
    recover_from_failed_open().
  - In order to avoid deadlocks open_tables() code was adjusted
    to flush open HANDLERs for which there are pending requests
    for X locks before restarting the process of acquiring
    metadata locks.
  - Changed close_tables_for_reopen() not to reset MDL_request
    for tables belonging to the tail of prelocking list. It is
    no longer necessary as these MDL_request objects won't be
    used for any waiting.
  - Adjusted comment in tdc_wait_for_old_version() to avoid
    mentioning removed MDL_context::wait_for_lock() method.
sql/sql_base.h:
  As we no longer wait for conflicting metadata lock away in
  Open_table_context::recover_from_failed_open() method,
  Open_table_context::OT_WAIT_MDL_LOCK action was renamed to
  OT_MDL_CONFLICT.
  Also Open_table_context::m_failed_mdl_request became
  unnecessary and was removed.
sql/sql_plist.h:
  Extended I_P_List template to support efficient push_back()
  operation if it is parameterized with an appropriate policy
  class.
sql/sql_show.cc:
  Adjusted code after removal of MDL_context::wait_for_lock()
  method. Now if one needs to acquire metadata lock with waiting
  one has to use a variant of MDL_context::acquire_lock() method.
2010-06-07 11:06:55 +04:00
Jon Olav Hauglid
142a162c66 manual merge from mysql-trunk-bugfixing
Conflicts:
Text conflict in mysql-test/r/archive.result
Contents conflict in mysql-test/r/innodb_bug38231.result
Text conflict in mysql-test/r/mdl_sync.result
Text conflict in mysql-test/suite/binlog/t/disabled.def
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
Text conflict in mysql-test/t/archive.test
Contents conflict in mysql-test/t/innodb_bug38231.test
Text conflict in mysql-test/t/mdl_sync.test
Text conflict in sql/sp_head.cc
Text conflict in sql/sql_show.cc
Text conflict in sql/table.cc
Text conflict in sql/table.h
2010-06-06 13:19:29 +02:00
Davi Arnaut
60a9d9bbb9 Post-merge fix: header is used by the client API. Obvious in retrospect.
Also, update a few cases missed by the initial patch.

client/mysqltest.cc:
  Remove trailing comma.
include/my_alloc.h:
  Do not use wrapper.
include/mysql.h.pp:
  Update ABI file.
plugin/semisync/semisync_master.h:
  Initialize variable.
sql/debug_sync.cc:
  Use C linkage.
2010-06-05 16:39:03 -03:00
Konstantin Osipov
cbf4019a1b A follow up for the previous patch, titled:
A code review comment for Bug#52289.
Encapsulate the deadlock detection functionality into
a visitor class...

Remove a race introduced by omission: 
initialize iterators under a read lock on the object.

sql/mdl.cc:
  Initialize iterators under a read lock on the object.
2010-06-03 18:32:56 +04:00
Konstantin Osipov
e7854c86a7 A code review comment for Bug#52289.
Encapsulate the deadlock detection functionality into 
a visitor class, and separate it from the wait-for graph
traversal code.

Use "Internal iterator" and "Visitor" patterns to 
achieve the desired separation of responsibilities.

Add comments.

sql/mdl.cc:
  Encapsulate deadlock detection into a class.
sql/mdl.h:
  Adjust for a rename of a class.
2010-06-03 18:08:22 +04:00
Konstantin Osipov
8867c0a52c Add comments to a few MDL deadlock-search related variables
and methods.

sql/mdl.cc:
  Add comments.
sql/mdl.h:
  Add a comment.
2010-06-02 12:06:07 +04:00
Konstantin Osipov
5fa66315e9 A follow up patch for the fix for Bug#51263 "Deadlock between
transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".

Make open flags part of Open_table_context.
This allows to simplify some code and (in future)
enforce the invariant that we don't, say, request a back 
off on the table when there is MYSQL_OPEN_IGNORE_FLUSH 
flag.



sql/sql_base.cc:
  open_table() flags are part of Open_table_context.
  Remove dead code that would check for OPEN_VIEW_NO_PARSE,
  which is not an open table flag.
sql/sql_base.h:
  Move flags to Open_table_context. Reorder Open_table_context
  members to compact the structure footprint.
sql/sql_insert.cc:
  Update with a new calling signature of open_table().
sql/sql_table.cc:
  Update with a new calling signature of open_table().
2010-06-01 14:49:35 +04:00
Konstantin Osipov
a96d23a57a A follow up patch for the fix for Bug#51263 "Deadlock between
transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".

Move declarations of sql_base.cc classes to sql_base.h
(previously declared in sql_class.h).
Became possible after a header file split.





sql/sql_base.cc:
  Make sql_base.h the first include in sql_base.cc.
sql/sql_base.h:
  Add declarations of Prelocking_strategy and Open_table_context.
sql/sql_class.h:
  Remove declarations of Prelocking_strategy and Open_table_context
  (moved).
2010-06-01 14:19:05 +04:00
Konstantin Osipov
b9aa51e209 A follow up patch for the fix for Bug#51263 "Deadlock between
transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".

Remove unused code - TL_WRITE_ALLOW_READ thr_lock.c lock.






include/thr_lock.h:
  Remove TL_WRITE_ALLOW_READ.
mysys/CMakeLists.txt:
  Add thr_lock test to the list of CMake executables to build.
mysys/thr_lock.c:
  Remove TL_WRITE_ALLOW_READ thr_lock.c lock.
  Consequently, simplify lock compatibility rules.
  Remove unused code.
sql/sql_test.cc:
  Remove TL_WRITE_ALLOW_READ lock.
2010-06-01 14:13:56 +04:00
Davi Arnaut
a8c288054e Bug#53445: Build with -Wall and fix warnings that it generates
Fix various mismatches between function's language linkage. Any
particular function that is declared in C++ but should be callable
from C must have C linkage. Note that function types with different
linkages are also distinct. Thus, if a function type is declared in
C code, it will have C linkage (same if declared in a extern "C"
block).

client/mysql.cc:
  Mismatch between prototype and declaration.
client/mysqltest.cc:
  mysqltest used to be C code. Use C linkage where appropriate.
cmd-line-utils/readline/input.c:
  Isolate unreachable code.
include/my_alloc.h:
  Function type must have C linkage.
include/my_base.h:
  Function type must have C linkage.
include/my_global.h:
  Add helper macros to avoid spurious namespace indentation.
include/mysql.h.pp:
  Update ABI file.
mysys/my_gethwaddr.c:
  Remove stray carriage return and fix coding style.
plugin/semisync/semisync_master_plugin.cc:
  Callback function types have C linkage.
plugin/semisync/semisync_slave_plugin.cc:
  Callback function types have C linkage.
sql/derror.cc:
  Expected function type has C linkage.
sql/field.cc:
  Use helper macro and fix indentation.
sql/handler.cc:
  Expected function type has C linkage.
sql/item_sum.cc:
  Correct function linkages. Remove now unnecessary cast.
sql/item_sum.h:
  Add prototypes with the appropriate linkage as otherwise they
  are distinct.
sql/mysqld.cc:
  Wrap functions in C linkage mode.
sql/opt_range.cc:
  C language linkage is ignored for class member functions.
sql/partition_info.cc:
  Add wrapper functions with C linkage for class member functions.
sql/rpl_utility.h:
  Use helper macro and fix indentation.
sql/sql_class.cc:
  Change type of thd argument -- THD is a class.
  Use helper macro and fix indentation.
sql/sql_class.h:
  Change type of thd argument -- THD is a class.
sql/sql_select.cc:
  Expected function type has C linkage.
sql/sql_select.h:
  Move prototype to sql_test.h
sql/sql_show.cc:
  Expected function type has C linkage.
sql/sql_test.cc:
  Fix required function prototype and fix coding style.
sql/sql_test.h:
  Removed unnecessary export and add another.
storage/myisammrg/ha_myisammrg.cc:
  Expected function type has C linkage.
storage/perfschema/pfs.cc:
  PSI headers are declared with C language linkage, which also
  applies to function types.
2010-05-31 12:29:54 -03:00
Horst.Hunger
e5bcb6f36a merge of patch for bug#52913 from 5.1-bugteam to trunk-bugfixing. Changed $basedir to $bindir in mysql-test-run.pl. 2010-06-04 11:31:03 +02:00
Alexey Kopytov
ae5508a67b Automerge. 2010-06-03 21:29:53 +04:00
Horst.Hunger
6eaf7e6c45 Patch for trunk after merge from 5.1-bugteam of bug52913. 2010-06-03 11:27:27 +02:00
Tor Didriksen
7cfc7d7265 Skip perfschema.misc if "var" is a symlink (due to Bug 51447).
mysql-test/include/not_var_link.inc:
  Chop off /$child_num before testing if "var" is a symlink
2010-06-03 09:52:15 +02:00
Alexander Nozdrin
b2b8a220f7 Disable binlog.binlog_spurious_ddl_errors due to Bug 54195. 2010-06-03 11:50:50 +04:00
He Zhenxing
fa71264e0d Auto merge 2010-06-02 21:24:53 +08:00
He Zhenxing
c54259446d Auto merge from 5.1-rep-semisync 2010-06-02 20:57:39 +08:00
Vasil Dimov
ca24c12b5c Merge mysql-trunk-bugfixing from bk-internal into my local tree 2010-06-02 15:43:14 +03:00
Vasil Dimov
ee07d63945 Merge mysql-trunk-innodb -> mysql-trunk-bugfixing 2010-06-02 15:40:49 +03:00
Alexander Barkov
eed26e92a6 Bug#52520 Difference in tinytext utf column metadata
Problems:
      - regression (compating to version 5.1) in metadata for BLOB types
      - inconsistency between length metadata in server and embedded for BLOB types
      - wrong max_length calculation in items derived from BLOB columns
     @ libmysqld/lib_sql.cc
        Calculating length metadata in embedded similary to server version,
        using new function char_to_byte_length_safe().
     @ mysql-test/r/ctype_utf16.result
        Adding tests
     @ mysql-test/r/ctype_utf32.result
        Adding tests
     @ mysql-test/r/ctype_utf8.result
        Adding tests
     @ mysql-test/r/ctype_utf8mb4.result
        Adding tests
     @ mysql-test/t/ctype_utf16.test
        Adding tests
     @ mysql-test/t/ctype_utf32.test
        Adding tests
     @ mysql-test/t/ctype_utf8.test
        Adding tests
     @ mysql-test/t/ctype_utf8mb4.test
        Adding tests
     @ sql/field.cc
        Overriding char_length() for Field_blob:
        unlike in generic Item::char_length() we don't
        divide to mbmaxlen for BLOBs.
     @ sql/field.h
        - Making Field::char_length() virtual
        - Adding prototype for Field_blob::char_length()
     @ sql/item.h
        - Adding new helper function char_to_byte_length_safe()
        - Using new function
     @ sql/protocol.cc
        Using new function char_to_byte_length_safe().

    modified:
      libmysqld/lib_sql.cc
      mysql-test/r/ctype_utf16.result
      mysql-test/r/ctype_utf32.result
      mysql-test/r/ctype_utf8.result
      mysql-test/r/ctype_utf8mb4.result
      mysql-test/t/ctype_utf16.test
      mysql-test/t/ctype_utf32.test
      mysql-test/t/ctype_utf8.test
      mysql-test/t/ctype_utf8mb4.test
      sql/field.cc
      sql/field.h
      sql/item.h
      sql/protocol.cc
2010-06-02 16:23:50 +04:00
Vasil Dimov
4c1fe7ebf4 Fix the failing innodb.innodb test:
innodb.innodb                            [ fail ]
          Test ended at 2010-06-02 15:04:06
  
  CURRENT_TEST: innodb.innodb
  --- /usr/w/mysql-trunk-innodb/mysql-test/suite/innodb/r/innodb.result	2010-05-23 23:10:26.576407000 +0300
  +++ /usr/w/mysql-trunk-innodb/mysql-test/suite/innodb/r/innodb.reject	2010-06-02 15:04:05.000000000 +0300
  @@ -2648,7 +2648,7 @@
   create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
   insert into t1 values (0x41),(0x4120),(0x4100);
   insert into t2 values (0x41),(0x4120),(0x4100);
  -ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY'
  +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
   insert into t2 values (0x41),(0x4120);

The change in the printout was introduced in:

  ------------------------------------------------------------
  revno: 3008.6.2
  revision-id: sergey.glukhov@sun.com-20100527160143-57nas8nplzpj26dz
  parent: sergey.glukhov@sun.com-20100527155443-24vqi9o8rpnkyci7
  committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
  branch nick: mysql-trunk-bugfixing
  timestamp: Thu 2010-05-27 20:01:43 +0400
  message:
    Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
    For BINARY(N) strip trailing zeroes to make the error message nice-looking
  
   @ mysql-test/r/errors.result
      test case
  
   @ mysql-test/r/type_binary.result
      result fix
  
   @ mysql-test/t/errors.test
      test case
  
   @ sql/key.cc
      For BINARY(N) strip trailing zeroes to make the error message nice-looking

and its author (Sergey) did not notice the test failure because that test
has been disabled in his tree.
2010-06-02 15:09:18 +03:00
Marko Mäkelä
eaf7013d6b ut_strerr(): Handle DB_SUCCESS_LOCKED_REC. 2010-06-02 14:52:11 +03:00
Marko Mäkelä
a2b9532188 Merge from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3495
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-02 13:37:14 +0300
message:
  Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record

  In semi-consistent read, only unlock freshly locked non-matching records.

  lock_rec_lock_fast(): Return LOCK_REC_SUCCESS,
  LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE.

  enum db_err: Add DB_SUCCESS_LOCKED_REC for indicating a successful
  operation where a record lock was created.

  lock_sec_rec_read_check_and_lock(),
  lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(),
  lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(),
  row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(),
  row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a
  new record lock was created. Adjust callers.

  row_unlock_for_mysql(): Correct the function documentation.

  row_prebuilt_t::new_rec_locks: Correct the documentation.
2010-06-02 14:37:33 +03:00
Marko Mäkelä
8f5d78c28b Merge from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3493
revision-id: marko.makela@oracle.com-20100602101940-60x32xiivtqj9va1
parent: marko.makela@oracle.com-20100601135802-hgplcpr8089ura8g
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-02 13:19:40 +0300
message:
  fil_print_orphaned_tablespaces(): Unused function, remove.
2010-06-02 14:34:41 +03:00
Jimmy Yang
0f3b6ab18b Port bug fix #53592 from mysql-5.1-innodb to mysql-trunk-innodb. 2010-06-02 04:04:00 -07:00
He Zhenxing
e0042460e7 Post fix for bug#52748 2010-06-02 18:57:52 +08:00
Jonathan Perkin
e01117534c Revert Oracle Enterprise Linux changes. 2010-06-02 11:38:13 +01:00
Magnus Blåudd
1d451c9fda Merge trunk-bug53983 -> trunk-bugfixing 2010-06-02 11:03:26 +02:00
Magnus Blåudd
36f4d92c91 Bug#53983 Placeholder for MASTER_BIND in master.info
- Reserve line 17 in master.info for master_bind which has been
   added in MySQL Cluster 6.3
 - move the line for "list of server id for ignorable servers" to line 18
2010-06-02 10:11:49 +02:00
Jimmy Yang
ee9ce546b9 Fix bug #54159 InnoDB: New warnings on Windows. Provide "signed/unsigned"
parameter to virtual function store() for longlong data type.

rb://371 approved by Sunny.
2010-06-01 22:26:31 -07:00
Alfranio Correia
2fb387b084 BUG#50479 DDL stmt on row-only/stmt-only tables generate spurious binlog_format
errors
            
In the fix of BUG#39934 in 5.1-rep+3, errors are generated when
binlog_format=row and a statement modifies a table restricted to
statement-logging (ER_BINLOG_ROW_MODE_AND_STMT_ENGINE); or if
binlog_format=statement and a statement modifies a table restricted to
row-logging (ER_BINLOG_STMT_MODE_AND_ROW_ENGINE).
            
However, some DDL statements that lock tables (e.g. ALTER TABLE,
CREATE INDEX and CREATE TRIGGER) were causing spurious errors,
although no row might be inserted into the binary log.
            
To fix the problem, we tagged statements that may generate
rows into the binary log and thence the warning messages are
only printed out when the appropriate conditions hold and rows
might be changed.

sql/log_event.cc:
  Reorganized the Query_log_event's constructor based on the
  CF_CAN_GENERATE_ROW_EVENTS flag and as such any statement
  that has the associated flag should go through a cache
  before being written to the binary log.
sql/share/errmsg-utf8.txt:
  Improved the error message ER_BINLOG_UNSAFE_MIXED_STATEMENT according to Paul's
  suggestion.
sql/sql_class.cc:
  Created a hook to be used by innodb that checks if a statement
  may write rows to the binary log. In other words, if it has
  the CF_CAN_GENERATE_ROW_EVENTS flag associated.
sql/sql_class.h:
  Defined the CF_CAN_GENERATE_ROW_EVENTS flag.
sql/sql_parse.cc:
  Updated the sql_command_flags and added a function to check the 
  CF_CAN_GENERATE_ROW_EVENTS.
sql/sql_parse.h:
  Added a function to check the CF_CAN_GENERATE_ROW_EVENTS.
storage/innobase/handler/ha_innodb.cc:
  Added a call to the hook thd_generates_rows().
storage/innobase/handler/ha_innodb.h:
  Defined an external reference to the hook thd_generates_rows().
2010-06-02 00:25:08 +01:00
Alfranio Correia
f11b030e17 auto-merge mysql-trunk-bugfixing (local) --> mysql-trunk-bugfixing 2010-06-01 20:49:58 +01:00
Alfranio Correia
29c7acd6d4 Post-merge fix for BUG#53421. 2010-06-01 20:34:40 +01:00
Alexey Kopytov
3e1a792c9b Bug #45882: dtoa.c might not work with gcc 4.4.0
- Ported relevant changes from the upstream version to not
break strict-aliasing rules and to fix compiler warnings and
and infinite loops caused by that issue.

- Fixed compilation with Honor_FLT_ROUNDS defined.

- Fixed an unused variable warning.
2010-06-01 21:37:45 +04:00
Alfranio Correia
126b583825 auto-merge mysql-trunk-bugfixing (local) --> mysql-trunk-bugfixing.merge 2010-06-01 15:40:54 +01:00
Alfranio Correia
ebde6f6de0 BUG#53421 Part of transaction not written in binlog after deadlock, replication
breaks
      
When a "CREATE TEMPORARY TABLE SELECT * FROM" was executed the OPTION_KEEP_LOG was
not set into the thd->variables.option_bits. For that reason, if the transaction
had updated only transactional engines and was rolled back at the end (.e.g due to
a deadlock) the changes were not written to the binary log, including the creation
of the temporary table.
      
To fix the problem, we have set the OPTION_KEEP_LOG into the
thd->variables.option_bits when a "CREATE TEMPORARY TABLE
SELECT * FROM" is executed.
2010-06-01 15:39:07 +01:00
Marko Mäkelä
7d5e44460c Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3491
  revision-id: marko.makela@oracle.com-20100601134335-ccthwwru23kn09qw
  parent: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 16:43:35 +0300
  message:
    Bug#48197: Concurrent rw_lock_free may cause assertion failure

    rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
    rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.
2010-06-01 17:03:55 +03:00
Alfranio Correia
c54aabc93b auto-merge mysql-trunk-bugfixing (local) --> mysql-trunk-bugfixing.merge 2010-06-01 14:49:31 +01:00
Alexander Nozdrin
ff6cf4bb46 Auto-merge from mysql-trunk-innodb. 2010-06-01 16:40:34 +04:00
Alexander Nozdrin
bf158eed83 Auto-merge from mysql-trunk-bugfixing.
Due to a BZR bug, that merge was done by the following command:
bzr merge -r 'revid:tor.didriksen@sun.com-20100527074248-6qtv0p1ugy6o1hjo..' <mysql-trunk-bugfixing path>
2010-06-01 16:38:01 +04:00
Marko Mäkelä
ab6a5b4724 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3490
  revision-id: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
  parent: marko.makela@oracle.com-20100601120521-q48hk05ne4j1s2o0
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 15:07:51 +0300
  message:
    Minor cleanup.

    lock_rec_unlock(): Cache first_lock and rewrite while() loops as for().

    btr_cur_optimistic_update(): Use common error handling return.

    row_create_prebuilt(): Add Valgrind instrumentation.
2010-06-01 15:09:33 +03:00
Marko Mäkelä
0902cd6bdd Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3488
  revision-id: marko.makela@oracle.com-20100601103738-upm8awahesmeh9dr
  parent: vasil.dimov@oracle.com-20100531163540-9fu3prbn2asqwdi5
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 13:37:38 +0300
  message:
    Bug#53812: assert row/row0umod.c line 660 in txn rollback after crash recovery
    row_undo_mod_upd_exist_sec(): Tolerate a failure to build the index entry
    for a DYNAMIC or COMPRESSED table during crash recovery.
2010-06-01 15:05:01 +03:00
Marko Mäkelä
c0dd84217c Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3478.1.3
  revision-id: marko.makela@oracle.com-20100525123748-pmpehbg29oyhc1ns
  parent: marko.makela@oracle.com-20100524114349-5kaw52sz0yh4szkb
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-25 15:37:48 +0300
  message:
    Suppress bogus Valgrind warnings about buf_buddy_relocate()
    accessing uninitialized memory in Valgrind-instrumented builds.
2010-06-01 14:56:22 +03:00
Marko Mäkelä
dfe03adad1 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3478.1.4
  revision-id: marko.makela@oracle.com-20100525125352-hgafpmqhrrj7pv5i
  parent: marko.makela@oracle.com-20100525123748-pmpehbg29oyhc1ns
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-25 15:53:52 +0300
  message:
    row_search_for_mysql(): Add assertions to track down Bug #53627.
2010-06-01 14:40:15 +03:00
Jonathan Perkin
5cf1d38570 Merge 2010-06-01 10:33:01 +01:00
Jonathan Perkin
99b5ca1f20 Add SELinux checks from distribution-specific spec file, missed in
previous.

Convert some shell bits to standard 2-space indent, 80 columns, etc.
2010-06-01 10:24:38 +01:00
He Zhenxing
bee85d74eb Auto merge from trunk 2010-06-01 17:03:55 +08:00