core icon indicating copy to clipboard operation
core copied to clipboard

MariaDB logs an "Unsafe statement written to the binary log"

Open ervee opened this issue 12 years ago • 23 comments

Hi,

I'm running ownCloud 6.0.1 (stable) without much issues on my Debian Wheezy Server. But sometimes the DB Server (MariaDB Version: 5.5.36+maria-1~wheezy) logs an "Unsafe statement written to the binary log". I could not find other people with this error here or via Google.

I don't notice anything wrong with this, but still wanted to share this with you to examine. Am I doing something whong? Or is there an error in the ownCloud source doing something wrong?

Feb 10 21:24:56 ##### mysqld: 140210 21:24:56 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 10 21:24:56 ##### mysqld: 140210 21:24:56 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 10 21:24:56 ##### mysqld: 140210 21:24:56 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 10 21:24:56 ##### mysqld: 140210 21:24:56 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 15 23:24:14 ##### mysqld: 140215 23:24:14 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 15 23:24:14 ##### mysqld: 140215 23:24:14 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 15 23:24:14 ##### mysqld: 140215 23:24:14 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 15 23:24:14 ##### mysqld: 140215 23:24:14 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 16 18:20:12 ##### mysqld: 140216 18:20:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 16 18:20:12 ##### mysqld: 140216 18:20:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 16 18:20:12 ##### mysqld: 140216 18:20:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 16 18:20:12 ##### mysqld: 140216 18:20:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 16 18:21:12 ##### mysqld: 140216 18:21:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 16 18:21:12 ##### mysqld: 140216 18:21:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 16 18:21:12 ##### mysqld: 140216 18:21:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 16 18:21:12 ##### mysqld: 140216 18:21:12 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 16 18:38:05 ##### mysqld: 140216 18:38:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 16 18:38:05 ##### mysqld: 140216 18:38:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 16 18:38:05 ##### mysqld: 140216 18:38:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 16 18:38:05 ##### mysqld: 140216 18:38:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 16 18:46:11 ##### mysqld: 140216 18:46:11 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 16 18:46:11 ##### mysqld: 140216 18:46:11 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 16 18:46:11 ##### mysqld: 140216 18:46:11 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 16 18:46:11 ##### mysqld: 140216 18:46:11 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 19 13:24:03 ##### mysqld: 140219 13:24:03 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 19 13:24:03 ##### mysqld: 140219 13:24:03 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 19 13:24:03 ##### mysqld: 140219 13:24:03 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 19 13:24:03 ##### mysqld: 140219 13:24:03 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 20 14:51:32 ##### mysqld: 140220 14:51:32 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 20 14:51:32 ##### mysqld: 140220 14:51:32 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 20 14:51:32 ##### mysqld: 140220 14:51:32 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 20 14:51:32 ##### mysqld: 140220 14:51:32 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Feb 20 21:23:05 ##### mysqld: 140220 21:23:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Feb 20 21:23:05 ##### mysqld: 140220 21:23:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Feb 20 21:23:05 ##### mysqld: 140220 21:23:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Feb 20 21:23:05 ##### mysqld: 140220 21:23:05 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Mar  3 07:39:15 ##### mysqld: 140303  7:39:15 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Mar  3 07:39:15 ##### mysqld: 140303  7:39:15 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Mar  3 07:39:15 ##### mysqld: 140303  7:39:15 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Mar  3 07:39:15 ##### mysqld: 140303  7:39:15 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
Mar 12 13:09:39 ##### mysqld: 140312 13:09:39 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0
Mar 12 13:09:39 ##### mysqld: 140312 13:09:39 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Friends' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Friends' HAVING COUNT(*) = 0
Mar 12 13:09:39 ##### mysqld: 140312 13:09:39 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Other' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Other' HAVING COUNT(*) = 0
Mar 12 13:09:39 ##### mysqld: 140312 13:09:39 [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 INTO `oc_vcategory` (`uid`,`type`,`category`) SELECT '#####','contact','Work' FROM `oc_vcategory` WHERE `uid` = '#####' AND `type` = 'contact' AND `category` = 'Work' HAVING COUNT(*) = 0
PS, the first ##### per log rule is the hostname of the DB Server and the 2 other are my username in ownCloud.

As you can see this does not happen huch and so I can't get when exactly this happens.

Yours, Ralf.

ervee avatar Mar 17 '14 16:03 ervee

Seems to be related to the contacts app. CC @tanghus

PVince81 avatar Mar 17 '14 17:03 PVince81

@PVince81 It's related to OCP\Tags in core that contacts uses. I have no idea about what the error message means though. Who are our DB wizzes? @bartv2 @schiesbn ?

tanghus avatar Mar 17 '14 18:03 tanghus

@bantu @icewind1991

PVince81 avatar Mar 17 '14 18:03 PVince81

It uses OC\DB::insertIfNotExists() which uses the most effective way I could find for conditionally inserting records in MySQL:

INSERT INTO table ('field1', 'field2') 
  SELECT 'one','two' FROM table 
  WHERE 'field1' = 'one' AND 'field2' = 'two' HAVING COUNT(*) = 0;

tanghus avatar Mar 17 '14 18:03 tanghus

Full error message:

Feb 10 21:24:56 ##### mysqld: 140210 21:24:56 [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 INTO `oc_vcategory` 
`uid`,`type`,`category`) SELECT '#####','contact','Family' FROM `oc_vcategory` WHERE `uid` = 
#####' AND `type` = 'contact' AND `category` = 'Family' HAVING COUNT(*) = 0

bantu avatar Mar 17 '14 20:03 bantu

@ervee is this still happening in OC 7.0.3 or 7.0.4 RC 1?

PVince81 avatar Dec 05 '14 14:12 PVince81

I believe I still have these log warnings with 7.0.3 but I need to check for sure. I'll try to get this info for you ASAP. It is hard to reproduce and am reluctant to upgrade the production server to 7.0.4 RC 1 so that would be hard to tell if it is fixed in that version.

ervee avatar Dec 05 '14 15:12 ervee

7.0.3 should be fine, just saw that the original report was for 6.0.1 so I thought maybe it was fixed indirectly.

PVince81 avatar Dec 05 '14 15:12 PVince81

According to APT logs I upgraded OwnCloud from 7.0.2 to 7.0.3 at 2014-11-13 12:13:26. Not even a minute later (I probably connected to OwnCloud triggering the upgrade) these lines were logged:

Nov 13 12:14:12 #MYDBHOST# mysqld: 141113 12:14:12 [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 INTO `oc_oc_storages_d62264c6b03f6` SELECT * FROM `oc_storages`
Nov 13 12:14:13 #MYDBHOST# mysqld: 141113 12:14:13 [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 INTO `oc_oc_mimetypes_6fd777d6edebf` SELECT * FROM `oc_mimetypes`
Nov 13 12:14:19 #MYDBHOST# mysqld: 141113 12:14:19 [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 INTO `oc_oc_filecache_177143d0e16b9` SELECT * FROM `oc_filecache`
Nov 13 12:14:29 #MYDBHOST# mysqld: 141113 12:14:29 [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 INTO `oc_oc_locks_27e6a8d1cb18d` SELECT * FROM `oc_locks`
Nov 13 12:14:31 #MYDBHOST# mysqld: 141113 12:14:31 [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 INTO `oc_oc_properties_cd0dcf099d363` SELECT * FROM `oc_properties`
Nov 13 12:14:32 #MYDBHOST# mysqld: 141113 12:14:32 [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 INTO `oc_oc_share_2ad5277a084f0` SELECT * FROM `oc_share`
Nov 13 12:14:33 #MYDBHOST# mysqld: 141113 12:14:33 [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 INTO `oc_oc_jobs_72e805b12973a` SELECT * FROM `oc_jobs`
Nov 13 12:14:35 #MYDBHOST# mysqld: 141113 12:14:35 [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 INTO `oc_oc_vcategory_74a3be629d096` SELECT * FROM `oc_vcategory`
Nov 13 12:14:36 #MYDBHOST# mysqld: 141113 12:14:36 [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 INTO `oc_oc_privatedata_4e4b2a611d73a` SELECT * FROM `oc_privatedata`
Nov 13 12:14:37 #MYDBHOST# mysqld: 141113 12:14:37 [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 INTO `oc_oc_contacts_addressbooks_f096f50ec8d38` SELECT * FROM `oc_contacts_addressbooks`
Nov 13 12:14:38 #MYDBHOST# mysqld: 141113 12:14:38 [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 INTO `oc_oc_contacts_cards_aee860c40ae85` SELECT * FROM `oc_contacts_cards`
Nov 13 12:14:39 #MYDBHOST# mysqld: 141113 12:14:39 [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 INTO `oc_oc_contacts_cards_properties_e0b6ab27bd4df` SELECT * FROM `oc_contacts_cards_properties`
Nov 13 12:14:41 #MYDBHOST# mysqld: 141113 12:14:41 [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: DELETE FROM `oc_contacts_cards_properties`
Nov 13 12:14:41 #MYDBHOST# mysqld: #011#011#011#011#011#011#011WHERE NOT EXISTS(SELECT NULL
Nov 13 12:14:41 #MYDBHOST# mysqld:                     #011#011FROM `oc_contacts_cards`
Nov 13 12:14:41 #MYDBHOST# mysqld:                    #011#011#011WHERE `oc_contacts_cards`.id = `oc_contacts_cards_properties`.contactid)
Nov 13 12:14:42 #MYDBHOST# mysqld: 141113 12:14:42 [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: UPDATE `oc_filecache`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011SET `mimetype` = (
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011SELECT `id`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011FROM `oc_mimetypes`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011WHERE `mimetype` = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011) WHERE `name` LIKE '%.docx'
Nov 13 12:14:42 #MYDBHOST# mysqld: 141113 12:14:42 [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: UPDATE `oc_filecache`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011SET `mimetype` = (
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011SELECT `id`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011FROM `oc_mimetypes`
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011#011WHERE `mimetype` = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
Nov 13 12:14:42 #MYDBHOST# mysqld: #011#011#011) WHERE `name` LIKE '%.xlsx'
Nov 13 12:14:43 #MYDBHOST# mysqld: 141113 12:14:43 [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: UPDATE `oc_filecache`
Nov 13 12:14:43 #MYDBHOST# mysqld: #011#011#011SET `mimetype` = (
Nov 13 12:14:43 #MYDBHOST# mysqld: #011#011#011#011SELECT `id`
Nov 13 12:14:43 #MYDBHOST# mysqld: #011#011#011#011FROM `oc_mimetypes`
Nov 13 12:14:43 #MYDBHOST# mysqld: #011#011#011#011WHERE `mimetype` = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
Nov 13 12:14:43 #MYDBHOST# mysqld: #011#011#011) WHERE `name` LIKE '%.pptx'

So, yes, looks like the issue is still present in 7.x.

ervee avatar Dec 06 '14 20:12 ervee

@nickvergessen insertIfNotExist-fun - wana take a look? :speak_no_evil:

DeepDiver1975 avatar Mar 20 '15 17:03 DeepDiver1975

Well the warning is valid, I'm not sure whether there is a way to tell mysql to run this query on the master only. But otherwise I have no idea about this.

nickvergessen avatar Mar 23 '15 13:03 nickvergessen

I think I found a solution and I'm testing it now.

For my installation MariaDB has a default statement-based binary logging format configured. This triggers the unsafe statement logs. Perhaps OwnCloud should not do transactions which are unsafe in this statement-based binary logging format, but I'm neither programmer nor a DBA, so... More info in the topic here: https://mariadb.com/kb/en/mariadb/unsafe-statements-for-replication/

Now, I changed the binlog-format to MIXED like so: sed -i -e "s|binlog-format|#binlog-format|" /etc/mysql/my.cnf sed -i -e "s|log_bin|binlog-format = MIXED\nlog_bin|" /etc/mysql/my.cnf

And I should see results fairly soon because somehow, since OC8, the unsafe statements logging became much worse.

Ralf.

ervee avatar Apr 03 '15 06:04 ervee

Today after trying the latest master i got following statement: [Doctrine\DBAL\Driver\PDOException] SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

[Doctrine\DBAL\Exception\DriverException] An exception occurred while executing 'UPDATE oc_filecache SET mtime = ?, size = ?, etag = ?, storage_mtime=? WHERE fileid = ?' with params [1429275470, -1, "5531034eafb07", 1429275470, 5718]: SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

Setting binlog-format to MIXED resolved it but after rerun occ encryption:migrate i got

[Doctrine\DBAL\Exception\UniqueConstraintViolationException] An exception occurred while executing 'UPDATE oc_appconfig SET appid = ? WHERE appid = ?' with params ["encryption", "files_encryption"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-publicShareKeyId' for key 'PRIMARY'

[Doctrine\DBAL\Driver\PDOException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-publicShareKeyId' for key 'PRIMARY'

This happened on MariaDB 10.0.17 (w/ Ubuntu 14.04)

redhell avatar Apr 17 '15 13:04 redhell

@DeepDiver1975 ^ Since we use READ_COMMITED, we should update out docs with a note about this?

nickvergessen avatar Apr 18 '15 07:04 nickvergessen

@nickvergessen What is the status here?

karlitschek avatar May 04 '15 17:05 karlitschek

Well, after I changed '''binlog-format''' to '''MIXED''' in my MariaDB config I didn't see the "Unsafe statement" logs anymore. Should I close the case or so you guys still want to hunt this issue down?

ervee avatar May 04 '15 18:05 ervee

@karlitschek I think we need to change the documentation here, nothing we can fix on the owncloud server side. I just want @DeepDiver1975 to confirm

nickvergessen avatar May 05 '15 07:05 nickvergessen

@carlaschroder We definitely need to document this.

karlitschek avatar May 05 '15 12:05 karlitschek

@karlitschek @nickvergessen Not sure what I'm documenting-- I'm not comfortable telling users to change their dB settings without a solid reason, and oC admins on shared hosting are at the mercy of their hosts. https://github.com/owncloud/core/issues/16008#issuecomment-98844031 suggests that this could be fixed in ownCloud.

carlaschroder avatar May 05 '15 17:05 carlaschroder

I'll go ahead and write something up until this is resolved.

carlaschroder avatar May 05 '15 17:05 carlaschroder