UpdateTasks: Difference between revisions

From Open-Xchange
No edit summary
No edit summary
Line 70: Line 70:
If you have multiple schemas, you can list all of them which contain that lock e.g. using this command:
If you have multiple schemas, you can list all of them which contain that lock e.g. using this command:


   for i in $(echo show databases | mysql-uopenexchange -psecret | grep oxdatabase); do \
   for i in $(echo show databases | mysql -uopenexchange -psecret | grep oxdatabase); do \
       echo "select taskName from ${i}.updateTask where taskName=\"LOCKED\"" | \
       echo "select taskName from ${i}.updateTask where taskName=\"LOCKED\"" | \
       mysql -uopenexchange -psecret | grep LOCKED > /dev/null && echo "database $i has a LOCK"; done
       mysql -uopenexchange -psecret | grep LOCKED > /dev/null && echo "database $i has a LOCK"; done

Revision as of 13:39, 25 September 2013

Update Task management in Open-Xchange

What is an Update Task?

An update task contains one or more operations on the Open-Xchange mysql database. Update tasks take care to apply changes to database tables which are required for new features or bugfixes.

When are Update Tasks applied?

Update tasks are applied when either the first user logs in to the OX UI or when triggered manually. Update tasks will be applied schema based. Per default, Open-Xchange stores 1000 contexts within a single schema.

Tools to maintain Update Tasks

$ /opt/open-xchange/sbin/runupdate -n schema

runs update tasks in specified schema

$ /opt/open-xchange/sbin/listExecutedUpdateTasks -n schema

lists executed update tasks in specified schema

How to see all schemas?

Note: you need to have your account names and passwords at hand.

run

$ /opt/open-xchange/sbin/listdatabase -A oxadminmaster -P secret
id name       hostname  master mid weight maxctx curctx hlimit max inital
 3 oxdatabase localhost true     0    100   1000     12 true   100      0

to check your database schema prefix. In this case it is oxdatabase

run

$ echo show databases | mysql -uopenexchange -psecret | grep oxdata
oxdatabase_5

so we have just one schema named oxdatabase_5.

Now you could check the status of update tasks on that schema:

$ /opt/open-xchange/sbin/listExecutedUpdateTasks -n oxdatabase_5
taskName                                                                                                successful lastModified
com.openexchange.groupware.calendar.update.AlterCreatingDate                                            true       2012-09-19 05:32:05 EDT
com.openexchange.usm.database.ox.update.ChangeCollationUpdateTask                                       true       2012-09-19 05:32:05 EDT
com.openexchange.contact.storage.rdb.sql.CorrectNumberOfImagesTask                                      true       2012-09-19 05:32:05 EDT
com.openexchange.groupware.update.tasks.AttachmentCountUpdateTask                                       true       2012-09-19 05:32:05 EDT
com.openexchange.groupware.update.tasks.CreateTableVersion                                              true       2012-09-19 05:32:05 EDT
com.openexchange.groupware.update.tasks.ContactAddUIDValueTask                                          true       2012-09-19 05:32:05 EDT
com.openexchange.groupware.update.tasks.ClearOrphanedInfostoreDocuments                                 true       2012-09-19 05:32:05 EDT
com.openexchange.groupware.update.tasks.FacebookCrawlerSubscriptionRemoverTask                          true       2012-09-19 05:32:05 EDT
[...]

What if I have Update Tasks that are LOCKED?

If the command listExecutedUpdateTasks lists tasks that have the word LOCKED in the successful row, these tasks could not be completed. This usually happens when Open-Xchange is being stopped while the update tasks are still running.

Do NOT stop Open-Xchange while Update Tasks are running!

If that happened to you, you need to manually remove these locks. In order to do that, you have to remove the rows from the table updateTask in every schema which have taskName set to LOCKED.

> DELETE FROM updateTask WHERE taskName='LOCKED';

If you have multiple schemas, you can list all of them which contain that lock e.g. using this command:

 for i in $(echo show databases | mysql -uopenexchange -psecret | grep oxdatabase); do \
      echo "select taskName from ${i}.updateTask where taskName=\"LOCKED\"" | \
      mysql -uopenexchange -psecret | grep LOCKED > /dev/null && echo "database $i has a LOCK"; done