summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-11-19 03:23:54 +0100
committerlpsolit%gmail.com <>2007-11-19 03:23:54 +0100
commit68312cf980e2b7d7f55d48fd9102d8480404a1a6 (patch)
treece89937c30cc30ff45ecab8c488d59323e481b06 /sanitycheck.cgi
parent9d6205cdb651fe3769ac58f03068dedb68e7689a (diff)
downloadbugzilla-68312cf980e2b7d7f55d48fd9102d8480404a1a6.tar.gz
bugzilla-68312cf980e2b7d7f55d48fd9102d8480404a1a6.tar.xz
Bug 403834: Replace table locks with database transactions in tokens, votes, and sanitycheck - Patch by Emmanuel Seyman <eseyman@linagora.com> r/a=mkanat
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi22
1 files changed, 8 insertions, 14 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index b1a48b16a..57dca0c31 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -106,7 +106,7 @@ unless ($user->in_group('editcomponents')) {
if ($cgi->param('rebuildvotecache')) {
Status('vote_cache_rebuild_start');
- $dbh->bz_lock_tables('bugs WRITE', 'votes READ');
+ $dbh->bz_start_transaction();
$dbh->do(q{UPDATE bugs SET votes = 0});
my $sth_update = $dbh->prepare(q{UPDATE bugs
SET votes = ?
@@ -117,7 +117,7 @@ if ($cgi->param('rebuildvotecache')) {
while (my ($id, $v) = $sth->fetchrow_array) {
$sth_update->execute($v, $id);
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
Status('vote_cache_rebuild_end');
}
@@ -262,11 +262,7 @@ if ($cgi->param('rescanallBugMail')) {
if ($cgi->param('remove_invalid_bug_references')) {
Status('bug_reference_deletion_start');
- $dbh->bz_lock_tables('attachments WRITE', 'bug_group_map WRITE',
- 'bugs_activity WRITE', 'cc WRITE',
- 'dependencies WRITE', 'duplicates WRITE',
- 'flags WRITE', 'keywords WRITE',
- 'longdescs WRITE', 'votes WRITE', 'bugs READ');
+ $dbh->bz_start_transaction();
foreach my $pair ('attachments/', 'bug_group_map/', 'bugs_activity/', 'cc/',
'dependencies/blocked', 'dependencies/dependson',
@@ -286,7 +282,7 @@ if ($cgi->param('remove_invalid_bug_references')) {
}
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
Status('bug_reference_deletion_end');
}
@@ -297,7 +293,7 @@ if ($cgi->param('remove_invalid_bug_references')) {
if ($cgi->param('remove_invalid_attach_references')) {
Status('attachment_reference_deletion_start');
- $dbh->bz_lock_tables('attachments WRITE', 'attach_data WRITE');
+ $dbh->bz_start_transaction();
my $attach_ids =
$dbh->selectcol_arrayref('SELECT attach_data.id
@@ -311,7 +307,7 @@ if ($cgi->param('remove_invalid_attach_references')) {
join(',', @$attach_ids) . ')');
}
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
Status('attachment_reference_deletion_end');
}
@@ -698,7 +694,7 @@ sub _check_keywords {
Status('keyword_cache_start');
if ($cgi->param('rebuildkeywordcache')) {
- $dbh->bz_lock_tables('bugs write', 'keywords read', 'keyworddefs read');
+ $dbh->bz_start_transaction();
}
my $query = q{SELECT keywords.bug_id, keyworddefs.name
@@ -765,7 +761,7 @@ sub _check_keywords {
}
if ($cgi->param('rebuildkeywordcache')) {
- $dbh->bz_unlock_tables();
+ $dbh->bz_commit_transaction();
}
}
@@ -804,10 +800,8 @@ if (scalar(@invalid_flags)) {
if ($cgi->param('remove_invalid_flags')) {
Status('flag_deletion_start');
my @flag_ids = map {$_->[0]} @invalid_flags;
- $dbh->bz_lock_tables('flags WRITE');
# Silently delete these flags, with no notification to requesters/setters.
$dbh->do('DELETE FROM flags WHERE id IN (' . join(',', @flag_ids) .')');
- $dbh->bz_unlock_tables();
Status('flag_deletion_end');
}
else {