In certain cases AFTER UPDATE/DELETE triggers on NDB tables that referenced
subject table didn't see the results of operation which caused invocation
of those triggers. In other words AFTER trigger invoked as result of update
(or deletion) of particular row saw version of this row before update (or
deletion).
The problem occured because NDB handler in those cases postponed actual
update/delete operations to be able to perform them later as one batch.
This fix solves the problem by disabling this optimization for particular
operation if subject table has AFTER trigger for this operation defined.
To achieve this we introduce two new flags for handler::extra() method:
HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH.
These are called if there exists AFTER DELETE/UPDATE triggers during a
statement that potentially can generate calls to delete_row()/update_row().
This includes multi_delete/multi_update statements as well as insert statements
that do delete/update as part of an ON DUPLICATE statement.
include/my_base.h:
Added HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of delete/update is not possible.
mysql-test/r/ndb_trigger.result:
Bug #26242 UPDATE with subquery and triggers failing with cluster tables
---
Added new test cases
mysql-test/t/ndb_trigger.test:
Bug #26242 UPDATE with subquery and triggers failing with cluster tables
---
Added new test cases
sql/ha_ndbcluster.cc:
Bug #26242 UPDATE with subquery and triggers failing with cluster tables: Use HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of delete/update is not possible
sql/ha_ndbcluster.h:
Bug #26242 UPDATE with subquery and triggers failing with cluster tables: Added member variables for handling of HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of delete/update is not possible
sql/mysql_priv.h:
Added new method prepare_triggers_for_insert_stmt to check if batching of delete/update must be disallowed.
sql/sql_delete.cc:
Use HA_EXTRA_DELETE_CANNOT_BATCH to inform handler when batching of delete is not possible
sql/sql_insert.cc:
Added method prepare_triggers_for_insert_stmt to check if batching of delete/update must be dissallowed.
Use HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler
when batching of delete/update is not possible
sql/sql_load.cc:
Call prepare_triggers_for_insert_stmt to check if batching of delete/update must be dissallowed and
mark fields used by triggers for the insert statement.
sql/sql_trigger.h:
Added has_triggers to support what particular triggers exist on a table.
sql/sql_update.cc:
Use HA_EXTRA_UPDATE_CANNOT_BATCH to inform handler when batching of update is not possible
remove timeing dependant part of test
mysql-test/r/ndb_multi.result:
remove timeing dependant part of test
mysql-test/t/ndb_multi.test:
remove timeing dependant part of test
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-ndb
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/table.cc:
Auto merged
Still leakage, make sure all unlinked operations are put back so they will be release
(on failing blob operations, when AO_IgnoreError)
ndb/src/ndbapi/NdbConnection.cpp:
Still leakage, make sure all unlinked operations are put back so they will be release
bugs.
ndb/include/util/UtilBuffer.hpp:
Fix accessing memory after free(), if called with source and destination
pointer the same (which should not really happen...).
Fixes a problem in ndb_restore.
ndb/src/common/util/SimpleProperties.cpp:
Fix typo in check of maxValue.
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-ndb
ndb/src/kernel/blocks/backup/Backup.cpp:
Auto merged
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
Auto merged
mysql-test/r/ndb_multi.result:
update result file for new behaviour of correcting the 241 error on ha_open
mysql-test/t/ndb_multi.test:
no longer errors on ha_open with 241
util thread wasn't behaving correctly after 241 error due to get_table_statistics
not properly returning an error code
sql/ha_ndbcluster.cc:
correctly call ndb_get_table_statistics in get_commitcount (don't report error)
but also return an error code from get_table_statistics so that util thread
gets error code
fixes for ndb_* tests broken by previous fix
be more careful in ndb about setting errors on failure of info call (especially
in open)
sql/ha_ndbcluster.cc:
fix some ndb* tests failing due to fix for 19914
be more careful about setting errors on failure of info call
sql/ha_ndbcluster.h:
fix some ndb* tests failing due to fix for 19914
be more careful about setting errors on failure of info call