Bug #95008 | applying binary log doesn't work with blackhole engine tables | ||
---|---|---|---|
Submitted: | 12 Apr 2019 13:00 | Modified: | 17 Apr 2019 13:55 |
Reporter: | Thomas Benkert | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 5.6.43 - 8.0.15 | OS: | Linux (CentOS 7) |
Assigned to: | CPU Architecture: | x86 |
[12 Apr 2019 13:00]
Thomas Benkert
[12 Apr 2019 14:06]
MySQL Verification Team
Please see: https://dev.mysql.com/doc/refman/8.0/en/replication-features-blackhole.html 17.4.1.2 Replication and BLACKHOLE Tables ´´´´´ " When using row-based logging, updates and deletes to such tables are simply skipped—they are not written to the binary log. A warning is logged whenever this occurs. For this reason we recommend when you replicate to tables using the BLACKHOLE storage engine that you have the binlog_format server variable set to STATEMENT, and not to either ROW or MIXED. "
[12 Apr 2019 14:26]
Thomas Benkert
Sorry, you seem to have misunderstoodd me. I am aware of this behaviour and it has nothing to do with this case. The issue here is that I have a schema with every table using InnodB engine. Binary logs therefore include all DML statements. Now someone wants to have a table from a certain point in time. So I restored a backup of the whole schema and converted all but one table to blackhole engine tables. I did this to speed up the applying of the binary logs, so that I get this one table with data at that certain point in time. What I expect is, that while applying the binary logs, all other tables are essentially ignored. In the above case I would expect the error given when the binary log statement would be something like INSERT INTO tid_m_shop_productgroup SELECT something FROM productSpecsWorkflows WHERE foo = bar; But as you can see from the decoded binlog statement, it simply does an UPDATE statement on productSpecsWorkflows table, which uses the blackhole engine. Therefore I expect that applying the binary log does not raise an error on continue to run. Hopefully this clears things up.
[16 Apr 2019 22:20]
MySQL Verification Team
Hi, > WHERE > @1='210244' > @2='["cutting","stitching"]' > @3=NULL > @4=NULL > @5=1 This type of log is normally created if there is no PK in the table. For the "reproduction" of the issue you are offering the already created binlog, can you reproduce this with a properly designed table? In any way this engine is not designed to be used with replication in any way other then to ignore data.. all best Bogdan
[17 Apr 2019 6:45]
Thomas Benkert
Hello Bogdan, as you can see from the table definition it has a proper primary key which is also used in the statement. CREATE TABLE `productSpecsWorkflows` ( `productSpec` varchar(100) NOT NULL, `workflow` varchar(255) NOT NULL DEFAULT '', `quantityMin` int(11) DEFAULT NULL, `quantityMax` int(11) DEFAULT NULL, `weighting` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`productSpec`), KEY `productSpecQuantities` (`productSpec`) ) ENGINE=BLACKHOLE DEFAULT CHARSET=utf8; In my first tries of applying the binary log I also converted the productSpecsWorkflows table to InnoDB. Then the same error appeared with other tables. All the tables in the schema have a proper primary key, though. > In any way this engine is not designed to be used with replication in any way other then to ignore data.. But isn't that a use case that should definitely be supported? Recovering the table took me several hours, just to apply binary logs of a few hours. This could have been done in a few minutes. And what other use is the blackhole engine then for, other than just playing around with it? Kind regards Thomas
[17 Apr 2019 12:32]
Thomas Benkert
Hello Bogdan, I just remembered, that I changed the primary key when converting to blackhole engine to avoid this bug: https://bugs.mysql.com/bug.php?id=53588 Before converting to blackhole, the primary key is specified as: PRIMARY KEY (`productSpec`,`workflow`) Do you think that solving the other bug would solve this bug, too?
[17 Apr 2019 13:20]
MySQL Verification Team
Hi Thomas, Some data here is missing or I'm getting partially blind :D .. I do see the table structure that's not a problem but I don't see anywhere what is the actual statement that produced the mentioned binlog, the statement you say uses PK. As for the other bug, I don't think solving that one will help with this one. To get bact to statement. What is the exact update executed on master that was logged as this update failing on blackhole all best Bogdan
[17 Apr 2019 13:41]
Thomas Benkert
Oh, sorry, I meant the (decoded) binlog statement. What the original statement was, I unfortunately don't know and don't think I can find out. I (wrongly) said it's using the PK because of the 5 columns in the WHERE clause and the table has just 5 columns.
[17 Apr 2019 13:55]
MySQL Verification Team
Hi, I'm thinking a bit more about this and I'm not 100% sure if blackhole should return error here or not so I'm actually verifying this and will let replication team make a final decision. all best Bogdan mysql 8.0.15: mysql [localhost:8015] {msandbox} (flydbcom) > BINLOG ' '> h6oJXBNlAAAATAAAAEo6IA0AAMjKDAAAAAEACGZseWRiY29tABVwcm9kdWN0U3BlY3NXb3JrZmxv '> d3MABQ8PAwMDBCwB/QIM+ri0pA== '> h6oJXB9lAAAAgAAAAMo6IA0AAMjKDAAAAAEAAgAF///sBgAyMTAyNDQnAFsiY3V0dGluZyIsImNy '> b3NzLWZvbGRpbmciLCJzdGl0Y2hpbmciXQEAAADsBgAyMTAyNDQXAFsiY3V0dGluZyIsInN0aXRj '> aGluZyJdAQAAAIY+ses= '> '/*!*/; ERROR 1032 (HY000): Can't find record in 'productSpecsWorkflows'