Recently we realized that our database was not updated consistently. The database update involves node_save() and custom table. We have not being able to figure out the exact cause could be under load. It is apparent that we don't do transactions. After searching, we learned that that there is a need to use InnoDB as MYISAM is the default. We also saw transaction module. However, the transaction module doesn't appear to directly helping Drupal core functions such as node_save(); it manages direct database operations. Ideally we want to something as follows:

txn = new transaction();
txn->begin();
try {
...
do some Drupal functions involving database such as node_save();
do some other custom functions involving database;
...
} catch (Exception e) {
txn->rollback();
...
}

This requires somewhere inside node_save() or Drupal database abstraction to throw an exception when fails.

Any pointer in this concern?

Comments

node_save() makes several

node_save() makes several calls to hook_nodeapi ('presave' and 'update'/'insert')
http://api.drupal.org/api/function/hook_nodeapi/5
perhaps you could use your own implementation of this hook to make the changes?

nobody click here