Hello all,
I want my storage engine to take advantage of the
HA_EXTRA_WRITE_CAN_REPLACE flag so that when this flag is set, in
handler::write_row, I silently overwrite the data if a duplicate is
found.
I cannot get this to work with row-based replication. Suppose the
following is executed on the master:
CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, `c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
REPLACE INTO t1(a,b,c) VALUES (1,'1111-11-11', 2);
In the last statement, in my implementation of hander::write_row, I
find the duplicate of '1' internally, overwrite the old row with the
new row, and return success. However, on the replicated server, my
insert statement gets a duplicate key error, because the slave has not
set the HA_EXTRA_WRITE_CAN_REPLACE flag.
My questions:
- How does this flag work with respect to replication? It does not
seem to be getting set, and as a result, the slave fails to execute
the "replace"
- I think NDB takes care of this scenario. How does this work in NDB?
- Does replication of "replace into" work from an NDB master to a
MyISAM slave? I ask because MyISAM ignores the
"HA_EXTRA_WRITE_CAN_REPLACE" flag.
Thanks
-Zardosht