Below is the list of changes that have just been committed into a local
6.0 repository of cpowers. When cpowers does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-12-02 22:35:56-06:00, chris@stripped +2 -0
Bug#32150, Replication fails with Falcon when 'Delete from table' is issued
Replication requires a fully populated record in the binlog in order to replicate deletes and some updates.
If the binlog is open, Falcon will return fully populated records to the server on DELETE and UPDATE operations.
storage/falcon/ha_falcon.cpp@stripped, 2007-12-02 22:35:54-06:00, chris@stripped +28 -4
Modified StorageInterface to allow for dynamic updates to the table flags:
- Created default table flags constant, "default_table_flags"
- Added StorageInterface::checkBinLog() for each statement. This method sets the HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
table flag if the binlog is open. The table flag forces Falcon to fully populate records during delete and
update operations, which is necessary for replication.
storage/falcon/ha_falcon.h@stripped, 2007-12-02 22:35:54-06:00, chris@stripped +2 -0
Added default table flags constant, "default_table_flags"
Added StorageInterface::checkBinLog()
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp 2007-12-02 14:27:27 -06:00
+++ b/storage/falcon/ha_falcon.cpp 2007-12-02 22:35:54 -06:00
@@ -84,6 +84,14 @@ int isolation_levels[4] = {TRANSACT
TRANSACTION_READ_COMMITTED,
TRANSACTION_CONSISTENT_READ, // TRANSACTION_WRITE_COMMITTED, // This is repeatable read
TRANSACTION_SERIALIZABLE};
+
+static const ulonglong default_table_flags = ( HA_REC_NOT_IN_SEQ
+ | HA_NULL_IN_KEY
+ | HA_PARTIAL_COLUMN_READ
+ | HA_CAN_GEOMETRY
+ //| HA_AUTO_PART_KEY
+ | HA_BINLOG_ROW_CAPABLE);
+
static struct st_mysql_show_var falconStatus[]=
{
@@ -357,6 +365,8 @@ StorageInterface::StorageInterface(handl
recordLength = table_arg->reclength;
tempTable = false;
}
+
+ tableFlags = default_table_flags;
}
@@ -629,8 +639,7 @@ const char **StorageInterface::bas_ext(v
ulonglong StorageInterface::table_flags(void) const
{
DBUG_ENTER("StorageInterface::table_flags");
- DBUG_RETURN(HA_REC_NOT_IN_SEQ | HA_NULL_IN_KEY | // HA_AUTO_PART_KEY |
- HA_PARTIAL_COLUMN_READ | HA_CAN_GEOMETRY | HA_BINLOG_ROW_CAPABLE);
+ DBUG_RETURN(tableFlags);
}
@@ -1035,6 +1044,7 @@ int StorageInterface::delete_row(const u
DBUG_RETURN(0);
}
+
int StorageInterface::commit(handlerton *hton, THD* thd, bool all)
{
DBUG_ENTER("StorageInterface::commit");
@@ -1720,7 +1730,6 @@ int StorageInterface::start_stmt(THD *th
DBUG_RETURN(0);
}
-
int StorageInterface::external_lock(THD *thd, int lock_type)
{
DBUG_ENTER("StorageInterface::external_lock");
@@ -1783,11 +1792,13 @@ int StorageInterface::external_lock(THD
if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
+ checkBinLog();
+
if (storageConnection->startTransaction(isolation_levels[thd_tx_isolation(thd)]))
{
if (!isTruncate && storageTable)
storageTable->setTruncateLock();
-
+
trans_register_ha(thd, true, falcon_hton);
}
@@ -1796,6 +1807,8 @@ int StorageInterface::external_lock(THD
}
else
{
+ checkBinLog();
+
if (storageConnection->startImplicitTransaction(isolation_levels[thd_tx_isolation(thd)]))
{
if (!isTruncate && storageTable)
@@ -2453,6 +2466,17 @@ void StorageInterface::unlockTable(void)
tableLocked = false;
}
}
+
+void StorageInterface::checkBinLog(void)
+{
+ // If binary logging is enabled, ensure that records are fully populated for replication
+
+ if (mysql_bin_log.is_open())
+ tableFlags |= HA_PRIMARY_KEY_REQUIRED_FOR_DELETE;
+ else
+ tableFlags &= ~HA_PRIMARY_KEY_REQUIRED_FOR_DELETE;
+}
+
//*****************************************************************************
//
diff -Nrup a/storage/falcon/ha_falcon.h b/storage/falcon/ha_falcon.h
--- a/storage/falcon/ha_falcon.h 2007-11-29 16:47:51 -06:00
+++ b/storage/falcon/ha_falcon.h 2007-12-02 22:35:54 -06:00
@@ -112,6 +112,7 @@ public:
void encodeRecord(uchar *buf, bool updateFlag);
void decodeRecord(uchar *buf);
void unlockTable(void);
+ void checkBinLog(void);
static StorageConnection* getStorageConnection(THD* thd);
@@ -174,6 +175,7 @@ public:
key_range startKey;
key_range endKey;
uint64 insertCount;
+ ulonglong tableFlags;
};
class NfsPluginHandler
| Thread |
|---|
| • bk commit into 6.0 tree (chris:1.2724) BUG#32150 | cpowers | 3 Dec |