Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

HA_ERR_FOUND_DUPP_KEY error after pt-OST optimize

$
0
0

I run a simple alter to optimize a table that had a lot of stale data using the pt-online-schema tool (wrapped for readability):

pt-online-schema-change --alter='ENGINE=InnoDB;' --no-drop-old-table
   --no-check-replication-filters --critical-load=Threads_running=500 
   --execute u=admin,p=admin,D=database,t=table > /tmp/pos.log 2>&1 &

which appeared to work as expected, but shortly after I got a replication error:

2016-04-08 19:23:02 104630 [ERROR] Slave SQL: Could not execute Write_rows_v1 event on table database.table; Duplicate entry 'hash_data' for key 'url', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log binary.053998, end_log_pos 225618679, Error_code: 1062

I moved the old table back into place and fixed replication for now, but why would this happen? This is a Unique key with two hashed values that should never duplicate.

How do I prevent dupe/missing keys from getting removed while doing an online schema change? (I currently use row based replication, with no intention of moving as we look to implement GTIDs in the future).


Viewing all articles
Browse latest Browse all 17268

Trending Articles