After populating the
stock_tmp table, i'm running these SQL queries via legacy
mysqli wrapper code. I don't think this code needs additional locks to prevent people from seeing incorrect data. Is that correct?
DELETE FROM stock WHERE ean NOT IN (SELECT ean FROM stock_tmp);
REPLACE INTO stock SELECT * FROM stock_tmp;