alaa_wmde added a comment.
It can be lag issue between replica and master. I'm also suspecting another issue that we faced once. Reading a record from replica once didn't match the existing record due to the silent truncation mariadb was doing, resulting in trying to reinsert the same record again into master. At the time, I though that this could theoretically happen if reading doesn't match again what already exist, perhaps for encoding-related issue or smth of that sort. In T226639#5286934 <https://phabricator.wikimedia.org/T226639#5286934>, @Addshore wrote: > So, it looks like this is probably a race condition within ReplicaMasterAwareRecordIdsAcquirer. > > It looks like generally the slave will be read ( i didnt look into isIgnoringReplica much but it looks like it is only used in restoreCleanedUpIds). > If the records are not in the slave insertNonExistingRecordsIntoMaster will be called which does a plane insert not accounting or the possible race condition. > And INSERT IGNORE here would probably solve this particular issue. We avoided INSERT IGNORE here as it does increment the auto_increment field even if it doesn't ignore (so if it inserts 4, ignoring 2 as they exist, next auto increment will be increased by 4 and not 2). That is also not very favorable side-effect for scalability. What ReplicaMasterAwareRecordIdAcquirer does is that in this case, it then reads from master, and potentially tries to insert again if it still didn't get all the records it is searching for. A solution that saves us from log spam and keeps this scalable solution is probably to catch and not log those Duplicate entiry errors to the log somehow. Is that possible? TASK DETAIL https://phabricator.wikimedia.org/T226639 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: alaa_wmde Cc: Addshore, darthmon_wmde, WMDE-leszek, Lydia_Pintscher, Lucas_Werkmeister_WMDE, alaa_wmde, Aklapper, Ladsgroup, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Jonas, Wikidata-bugs, aude, Jdforrester-WMF, Mbch331, Jay8g, Krenair
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
