dml_write_exception thrown when upgrading to 2.0.1

dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -
Number of replies: 17

I am currently running 1.9.2 and have satisfied all requirements to upgrade to 201. I am getting dml_write_exception thrown errors with the following debug (some of it) info:

4 => '1',
5 => '',
6 => '0',
7 => '1',
8 => '1.0000000',
9 => '0.1000000',
10 => 'multichoice',
11 => '1',
12 => 'moodle.lctn.org+060811131733+aWrMe5',
13 => '1',
14 => '0',
15 => '0',
16 => '0',
17 => NULL,
18 => NULL,
19 => '25',
)]
* line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 984 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1016 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
* line 5134 of /lib/db/upgrade.php: call to mysqli_native_moodle_database->update_record()
* line 1382 of /lib/upgradelib.php: call to xmldb_main_upgrade()
* line 141 of /admin/cli/upgrade.php: call to upgrade_core()

!!! Error writing to database !!!
!! Data too long for column 'questiontext' at row 1
UPDATE mdl_question SET category = ?,parent = ?,name = ?,questiontext = ?,questiontextformat = ?,generalfeedback = ?,oldquestiontextformat = ?,generalfeedbackformat = ?,defaultgrade = ?,penalty = ?,qtype = ?,length = ?,stamp = ?,version = ?,hidden = ?,timecreated = ?,timemodified = ?,createdby = ?,modifiedby = ? WHERE id=?
[array (
0 => '4',
1 => '0',

 

Average of ratings: -
In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -

I was mistaken. I am working with 2.0.3+ (Build: 20110525) (2011033003.03)

In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What is the data type of the mdl_question.questiontext column in your database? It should be TEXT which should cope with very long strings.

In reply to Tim Hunt

Re: dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -

I found the problem. There were 4-6 enteries that seemed to be corrupt. I removed them via phpmyadmin and the upgrade continued. I am now stuck at the following error:

Incorrect pool file content da39a3ee5e6b4b0d3255bfef95601890afd80709.

In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In reply to Tim Hunt

Re: dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -

Database checks out fine. Still getting the following error:

Incorrect pool file content da39a3ee5e6b4b0d3255bfef95601890afd80709.

 

Any ideas?

In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -

Here is the complete list of errors via the command line:

 

php upgrade.php
== Upgrading Moodle database from version 2.0.3+ (Build: 20110525) (2011033003.03) to 2.0.3+ (Build: 20110525) (2011033003.03) ==

Your Moodle files have been changed, and you are about to automatically
upgrade your server to this version:

2.0.3+ (BUILD: 20110525) (2011033003.03)

Once you do this you can not go back again.

Please note that this process can take a long time.

Are you sure you want to upgrade this server to this version?
type y (means yes) or n (means no)
: y
-->mod_forum
Default exception handler: Incorrect pool file content da39a3ee5e6b4b0d3255bfef95601890afd80709. Debug:
* line 1062 of /lib/filestorage/file_storage.php: file_pool_content_exception thrown
* line 810 of /lib/filestorage/file_storage.php: call to file_storage->add_file_to_pool()
* line 138 of /mod/forum/db/upgrade.php: call to file_storage->create_file_from_pathname()
* line 526 of /lib/upgradelib.php: call to xmldb_forum_upgrade()
* line 265 of /lib/upgradelib.php: call to upgrade_plugins_modules()
* line 1425 of /lib/upgradelib.php: call to upgrade_plugins()
* line 146 of /admin/cli/upgrade.php: call to upgrade_noncore()

!!! Incorrect pool file content da39a3ee5e6b4b0d3255bfef95601890afd80709. !!!
!! Stack trace: * line 1062 of /lib/filestorage/file_storage.php: file_pool_content_exception thrown
* line 810 of /lib/filestorage/file_storage.php: call to file_storage->add_file_to_pool()
* line 138 of /mod/forum/db/upgrade.php: call to file_storage->create_file_from_pathname()
* line 526 of /lib/upgradelib.php: call to xmldb_forum_upgrade()
* line 265 of /lib/upgradelib.php: call to upgrade_plugins_modules()
* line 1425 of /lib/upgradelib.php: call to upgrade_plugins()
* line 146 of /admin/cli/upgrade.php: call to upgrade_noncore()

In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Raymond Norton -

Grabbing for straws now. Downgraded to old 1.9 version, then upgraded to 1.9.12+. I also recopied moodle data over. Now with the upgrade to 2.0.3 I get the following error, but not sure what to do about it:

Are you sure you want to upgrade this server to this version?
type y (means yes) or n (means no)
: y
-->mod_forum
Default exception handler: Can not read file, either file does not exist or there are permission problems Debug:
* line 1075 of /lib/filestorage/file_storage.php: file_exception thrown
* line 810 of /lib/filestorage/file_storage.php: call to file_storage->add_file_to_pool()

 

I changed all perms (on test box) to 777 just to rule out a permission problem somewhere.

In reply to Raymond Norton

Upgrade is removing folders and files

by Raymond Norton -

Figuring a few things out here, but not the solution. The upgrade creates a "filedir " folder in moodledata and a "pool" file that is supposed to contain a catalog of all user files and uploads on the moodle server. It errors out "Incorrect pool file content da39a3ee5e6b4b0d3255bfef95601890afd80709", with many more lines of errors, but all of them are related to the fact that the pool file does not match the actual file structure of moodledata.

 

The problem is occuring because the upgrade is deleteting folders for some reason, and then later complaining the folders and files do not exist. I have verified this indeed does occur.

For example, I will get an error saying: !! File not readable, skipping: /data/moodledata/44/moddata/forum/261/3257/Luke_s_Plant_Height_Chart.xls !

I then dump the database back to moodle (mysql -p < dump-fixed.sql) and run the upgrade again. Before the upgrade /data/moodledata/44/moddata/forum contains folders: 144  261  263  302  304  306  308  310  312  314  316  395
260  262  301  303  305  307  309  311  313  315  394

 

After the failed upgrade I am left with: 313  314  315  316, and of course, folder 261 is missing.

 

What can I do to fix this problem?

 

In reply to Raymond Norton

Re: Upgrade is removing folders and files

by Raymond Norton -

Does no reply indicate the solution to this problem is in the documentation and I should have not asked the question, or it is a bug with no current solution?

In reply to Raymond Norton

Re: dml_write_exception thrown when upgrading to 2.0.1

by Andrew Huffman -

!!! Error writing to database !!!
!! Data too long for column 'questiontext' at row 1


I was also getting the above error message when upgrading to 2.1.  However, I did not delete the offending rows from the database.  Instead I changed the data type for 'questiontext' from TEXT to MEDIUMTEXT by issuing the following command in mySQL:

  ALTER TABLE mdl_question MODIFY questiontext MEDIUMTEXT;

I'm not sure if there are any ramifications to changing the data type of this column, but as soon as I made the change I was able to rerun the upgrade successfully without any errors.

Hope this helps.

-Andrew

In reply to Andrew Huffman

Re: dml_write_exception thrown when upgrading to 2.0.1

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That sounds like a good change. What column type was it before?

In reply to Tim Hunt

Re: dml_write_exception thrown when upgrading to 2.0.1

by Andrew Huffman -

The questiontext column was set to TEXT by default which has a maximum size of 65,535 Characters.  MEDIUMTEXT is significantly larger with a maximum size of 16,777,215 Characters. 

In reply to Andrew Huffman

Re: dml_write_exception thrown when upgrading to 2.0.1

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You have a question whose question text does not fit into 65KB? Wow! Are you sure?

In reply to Tim Hunt

Re: dml_write_exception thrown when upgrading to 2.0.1

by Andrew Huffman -

That is what the error implies.  I looked at the question in the database and it appears to have a bunch of binary data (looks like garbage).  Based on the phrasing of the question which asked the student to review a diagram, I believe this binary data is a picture that was attached to the question.  The picture must have been larger than 64K.  That is my best guess at this point.

In reply to Andrew Huffman

Re: dml_write_exception thrown when upgrading to 2.0.1

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Images should be stored separately, not in the question text. I wonder if this questoin was created using copy-and-paste from MS Word?

In reply to Tim Hunt

Re: dml_write_exception thrown when upgrading to 2.0.1

by Michael Williams -

Running ALTER TABLE mdl_question MODIFY questiontext MEDIUMTEXT; got me past that point as well.  My upgrade is now successful.  WOOT!

In reply to Michael Williams

Re: dml_write_exception thrown when upgrading to 2.0.1

by Valerie Pontius -

Thank you so much that got me through my upgrade from 1.19 latest to 2.2 latest!! I have been stuck at that error for so long and was about ready to give up and manually import 300 courses into a clean server.

Now that I have it running, I'll ask the teachers to check their essay questions and responses for pictures or large amounts of text formatting, then change the field back to text like it should be.