Error writing to database (2.2.1+ (Build: 20120119))

Error writing to database (2.2.1+ (Build: 20120119))

by Alberto Nieto -
Number of replies: 4

I did a migration of my moodle site into a new server and now I get a "writing to database" error.


I've already tried this: https://moodle.org/mod/forum/discuss.php?d=196209#p888327 with no results. 


I've enabled the debug mode on the config.php:

$CFG->debug = 38911;


This is the result I get:

Error writing to database

Debug info: 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.
UPDATE mdl_local_ousearch_documents SET timemodified = ? WHERE id=?
[array (
0 => 1429799197,
1 => '3691',
)]
Stack trace:
  • line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 999 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1031 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
  • line 212 of /local/ousearch/searchlib.php: call to mysqli_native_moodle_database->update_record()
  • line 285 of /local/ousearch/ousmodules.php: call to local_ousearch_document->update()
  • line 367 of /course/modedit.php: call to ouscoursemodule::update()
Average of ratings: -
In reply to Alberto Nieto

Re: Error writing to database (2.2.1+ (Build: 20120119))

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Try this on your database:  "SETGLOBALbinlog_format='MIXED'"

In reply to Emma Richardson

Re: Error writing to database (2.2.1+ (Build: 20120119))

by Alberto Nieto -

Thanks a lot, Emma. I did it and the error is gone!


Do you mind explaining a bit what is exactly that instruction?


Thanks in advance.

In reply to Alberto Nieto

Re: Error writing to database (2.2.1+ (Build: 20120119))

by Just H -

Quote:

"There are 3 methods that MySQL can use to write to the binary logs:

STATEMENT

This means that every SQL statement on the master is recorded in the log, and executed on the slave. This can cause problems if the SQL statement contains statements such as "NOW()", "RAND()" and anything non-deterministic. This also requires support from the storage engine in use.

ROW

This means that every row that is changed by a statement is individually recorded in the binary log. This gives larger binary logs (generally) than statement based logging, but is almost always guaranteed to give the exact replication needed.

MIXED

This allows MySQL to choose between binary and row based logging as required.

If you're getting this error, one suggestion is to change the BINLOG_FORMAT variable to MIXED. This allows MySQL to automatically switch between ROW and STATEMENT based logging as required."

"Borrowed" from StackExchange. smile

Average of ratings: Useful (1)