See http://drupal.org/node/704446

If user_save fails on slave sites after updating account on master, this should trigger an error message. Ideally we'd roll back the change on master too.

CommentFileSizeAuthor
#5 704488-bakery-update-rollback-5.patch2.64 KBcoltrane
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

killes@www.drop.org’s picture

Status: Active » Needs review
Issue tags: +Needs deployment

This was patched in CVS:

http://drupal.org/cvs?commit=324210

juliangb’s picture

Just to clarify this issue, as I was a bit confused on initial reading whether it was fixed:

The commit has added an error message if user_save fails, but the rollback functionality hasn't been done yet.

juliangb’s picture

coltrane’s picture

Title: If slave update fails, send error » Update rollback functionality
Category: bug » feature
Status: Needs review » Active
Issue tags: -Needs deployment

1) The master should know that an update has failed
2) The slave should be able to return to the original, un-updated state

1 is handled in Bakery right now but I'm looking at this feature for being able to rollback any failed updates as part of #556666: Sync hooks: Enable sharing of arbitrary data

Implementation thoughts:

For sake of simplicity, I think the slave should just report TRUE/FALSE as to the success of an update, even if the update was partial. If a slave is unresponsive to an update (such as if the slave site is down) the master should assume FALSE. All false updates are recorded and viewable (is watchdog good enough?).

Rolling back an update should happen on the slave. The slave should record the original state and if an update request from the master fails to succeed the slave returns to the saved original state and responds with FALSE.

coltrane’s picture

Here's a patch for D6 Bakery for rolling back if user_save fails. It stores the previous fields and does a user_save on them should the user_save for the update fail. It also does a watchdog in bakery_user() update to record that the update failed.

greggles’s picture

Status: Active » Needs work

I think the drupal_set_message should be more explicit that the save has been rolled back to previous values as a result of the error from the sub site and suggest that the admin do something to fix the problem with the subsite/communication so they really know that there's a problem.

fuzzy76’s picture

What if the user account is present at 3 slave sites, and only one of them fails to update? If it's the last slave site receiving the update, wouldn't we need a way to undo the first two as well? I am think it would be easier to figure out why an update can fail instead, and figure out a fallback to make the update succeed.