Bug 403824: Replace table locks in most Bugzilla files with transactions - Patch by Emmanuel Seyman <eseyman@linagora.com> r/a=mkanat

git-svn-id: svn://10.0.0.236/trunk@239400 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
lpsolit%gmail.com
2007-11-14 22:56:32 +00:00
parent 702b8f6c80
commit 3e660f3c01
5 changed files with 18 additions and 35 deletions

View File

@@ -255,7 +255,7 @@ sub SaveEmail {
###########################################################################
# Role-based preferences
###########################################################################
$dbh->bz_lock_tables("email_setting WRITE");
$dbh->bz_start_transaction();
# Delete all the user's current preferences
$dbh->do("DELETE FROM email_setting WHERE user_id = ?", undef, $user->id);
@@ -302,7 +302,7 @@ sub SaveEmail {
}
}
$dbh->bz_unlock_tables();
$dbh->bz_commit_transaction();
###########################################################################
# User watching
@@ -311,11 +311,7 @@ sub SaveEmail {
&& (defined $cgi->param('new_watchedusers')
|| defined $cgi->param('remove_watched_users')))
{
# Just in case. Note that this much locking is actually overkill:
# we don't really care if anyone reads the watch table. So
# some small amount of contention could be gotten rid of by
# using user-defined locks rather than table locking.
$dbh->bz_lock_tables('watch WRITE', 'profiles READ');
$dbh->bz_start_transaction();
# Use this to protect error messages on duplicate submissions
my $old_watch_ids =
@@ -356,7 +352,7 @@ sub SaveEmail {
}
}
$dbh->bz_unlock_tables();
$dbh->bz_commit_transaction();
}
}