Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r10435: LJSUP-8704 (make moveucluster more speci...

Committer: ailyin
LJSUP-8704 (make moveucluster more specific handling 'cannot get db handle' errors)
U   trunk/cgi-bin/LJ/Worker/UserManage/ClusterMassMove.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/PostPurge.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/PrePurge.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/PurgeGlobal.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCommentPurge.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCopy.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterDelete.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostCopy.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostDelete.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPreMove.pm
U   trunk/cgi-bin/LJ/Worker/UserManage/UsersAutoPurge.pm
Modified: trunk/cgi-bin/LJ/Worker/UserManage/ClusterMassMove.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/ClusterMassMove.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/ClusterMassMove.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -18,7 +18,10 @@
 
     my $callback = $arg->{'callback'};
 
-    my $dbr = LJ::get_db_reader(); $dbr->{'RaiseError'} = 1;
+    my $dbr = LJ::get_db_reader();
+    die 'cannot get global cluster reader'
+        unless $dbr;
+    $dbr->{'RaiseError'} = 1;
 
     my $cap_bit = LJ::class_bit(LJ::UserManage::READONLY_CAP_CLASS);
     my $sth = $dbr->prepare(qq{

Modified: trunk/cgi-bin/LJ/Worker/UserManage/PostPurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/PostPurge.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/PostPurge.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -20,6 +20,10 @@
     my $u = LJ::want_user($userid) || die "no such user";
 
     my $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
+
     $dbh->do(qq{
         REPLACE INTO expunged_users
         SET userid=?, user=?, expunge_time=?

Modified: trunk/cgi-bin/LJ/Worker/UserManage/PrePurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/PrePurge.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/PrePurge.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -33,6 +33,10 @@
     LJ::update_user($u, { 'caps' => $u->caps | (1 << $capbit) });
 
     my $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
+
     $dbh->do(qq{
         INSERT INTO clustermove
         SET

Modified: trunk/cgi-bin/LJ/Worker/UserManage/PurgeGlobal.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/PurgeGlobal.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/PurgeGlobal.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -47,7 +47,10 @@
     $userid = $arg->{'userid'} || die "no userid";
     $cmid = $arg->{'cmid'} || die "no cluster move id";
 
-    $dbh = LJ::get_db_writer(); $dbh->{'RaiseError'} = 1;
+    $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
 
     $arg->{'tables'} ||= $dbh->selectcol_arrayref('SHOW TABLES');
     @tables = @{$arg->{'tables'}};

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCommentPurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCommentPurge.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCommentPurge.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -52,7 +52,10 @@
 
     $start_time = time unless $passed_arg;
 
-    my $dbh = LJ::get_cluster_master($clust); $dbh->{'RaiseError'} = 1;
+    my $dbh = LJ::get_cluster_master($clust);
+    die "cannot get cluster master for cluster=$clust"
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
 
     __PACKAGE__->debug_msg("delete: from table: talk2\n");
 

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCopy.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCopy.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterCopy.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -56,9 +56,16 @@
     $cmid = $arg->{'cmid'} || die "no cluster move id";
     die "cannot move user to the same cluster" if $sclust == $dclust;
 
-    $sdbh = LJ::get_cluster_master($sclust); $sdbh->{'RaiseError'} = 1;
-    $ddbh = LJ::get_cluster_master($dclust); $ddbh->{'RaiseError'} = 1;
+    $sdbh = LJ::get_cluster_master($sclust);
+    die "cannot get cluster master for source cluster=$sclust"
+        unless $sdbh;
+    $sdbh->{'RaiseError'} = 1;
 
+    $ddbh = LJ::get_cluster_master($dclust);
+    die "cannot get cluster master for destination cluster=$dclust"
+        unless $ddbh;
+    $ddbh->{'RaiseError'} = 1;
+
     $arg->{'tables'} ||= $sdbh->selectcol_arrayref('SHOW TABLES');
     @tables = @{$arg->{'tables'}};
 

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterDelete.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterDelete.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterDelete.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -64,7 +64,10 @@
 
     $cmid = $arg->{'cmid'} || die "no cluster move id";
 
-    $dbh = LJ::get_cluster_master($clust); $dbh->{'RaiseError'} = 1;
+    $dbh = LJ::get_cluster_master($clust);
+    die "cannot get cluster master for cluster=$clust"
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
 
     $arg->{'tables'} ||= $dbh->selectcol_arrayref('SHOW TABLES');
     @tables = @{$arg->{'tables'}};

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostCopy.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostCopy.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostCopy.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -23,6 +23,10 @@
     LJ::update_user($u, { 'clusterid' => $dclust });
 
     my $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
+
     $dbh->do('UPDATE clustermove SET timedone=? WHERE cmid=?', undef,
         time, $cmid);
 

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostDelete.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostDelete.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostDelete.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -31,6 +31,10 @@
     LJ::update_user($u, { 'caps' => $u->caps & ~(1 << $capbit) });
 
     my $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
+
     $dbh->do('UPDATE clustermove SET sdeleted=1 WHERE cmid=?', undef, $cmid);
 
     return $class->finished($job, $callback);

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPostPurge.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -49,7 +49,10 @@
 
     $start_time = time unless $passed_arg;
 
-    my $dbh = LJ::get_cluster_master($clust); $dbh->{'RaiseError'} = 1;
+    my $dbh = LJ::get_cluster_master($clust);
+    die "cannot get cluster master for cluster=$clust"
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
 
     __PACKAGE__->debug_msg("delete: from table: log2\n");
 

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPreMove.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPreMove.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UserClusterPreMove.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -33,6 +33,10 @@
     LJ::update_user($u, { 'caps' => $u->caps | (1 << $capbit) });
 
     my $dbh = LJ::get_db_writer();
+    die 'cannot get global cluster writer'
+        unless $dbh;
+    $dbh->{'RaiseError'} = 1;
+
     $dbh->do(qq{
         INSERT INTO clustermove
         SET

Modified: trunk/cgi-bin/LJ/Worker/UserManage/UsersAutoPurge.pm
===================================================================
--- trunk/cgi-bin/LJ/Worker/UserManage/UsersAutoPurge.pm	2011-04-26 03:15:21 UTC (rev 10434)
+++ trunk/cgi-bin/LJ/Worker/UserManage/UsersAutoPurge.pm	2011-04-26 04:02:03 UTC (rev 10435)
@@ -6,6 +6,8 @@
 
 sub work {
     my $dbr = LJ::get_dbh(qw(slow master));
+    die 'cannot get global cluster slow handle'
+        unless $dbh;
     $dbr->{'RaiseError'} = 1;
 
     my @subqueries;

Tags: andy, ljcom, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments