Page MenuHomePhabricator

filearchive mysql queries are not replication safe
Closed, ResolvedPublic

Description

Author: afeldman

Description:
130314 18:20:51 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. Statement: INSERT /* LocalFileDeleteBatch::doDBInserts */ INTO filearchive (fa_storage_group,fa_storage_key,fa_deleted_user,fa_deleted_timestamp,fa_deleted_reason,fa_deleted,fa_name,fa_archive_name,fa_size,fa_width,fa_height,fa_metadata,fa_bits,fa_media_type,fa_major_mime,fa_minor_mime,fa_description,fa_user,fa_user_text,fa_timestamp,fa_sha1) SELECT 'deleted',CASE WHEN img_sha1='' THEN '' ELSE CONCAT(img_sha1,'.jpg') END,'6923','20130314180657','([....file metadata....]',0,img_name,NULL,img_size,img_width,img_height,img_metadata,im...


Version: 1.21.x
Severity: normal

Details

Reference
bz46134

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:17 AM
bzimport set Reference to bz46134.
bzimport added a subscriber: Unknown Object (MLST).
Krinkle added a project: Performance-Team.
Krinkle edited subscribers, added: aaron, Krinkle; removed: wikibugs-l-list.

@aaron This would be fixable once we have a primary key on these tables, right? Or would that not suffice?

If so, I propose to close in favour of T28741.

Krinkle claimed this task.

The rdbms layer now does an explicit SELECT first and an insert based on that, which means the insert is now explicit and replication-safe.