Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r19065: More debug info for memcache issue

Committer: gariev
More debug info for memcache issue
U   trunk/cgi-bin/LJ/MemCache.pm
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/MemCache.pm
===================================================================
--- trunk/cgi-bin/LJ/MemCache.pm	2011-05-17 05:37:09 UTC (rev 19064)
+++ trunk/cgi-bin/LJ/MemCache.pm	2011-05-17 05:54:58 UTC (rev 19065)
@@ -626,7 +626,7 @@
 ### OBJECT SERIALIZATION METHODS ###
 
 sub array_to_hash {
-    my ( $format, $array ) = @_;
+    my ( $format, $array, $key ) = @_;
 
     my $format_info = $LJ::MEMCACHE_ARRAYFMT{$format};
     return unless $format_info;
@@ -637,28 +637,28 @@
 
     unless ($array) {
         Carp::cluck "trying to unserialize $format from memcache, "
-                  . Data::Dumper::Dumper($array) . " is not a true value; "
+                  . Data::Dumper::Dumper([$key, $array]) . " is not a true value; "
                   . "stacktrace follows";
         return;
     }
 
     unless ( ref $array eq 'ARRAY' ) {
         Carp::cluck "trying to unserialize $format from memcache, "
-                  . Data::Dumper::Dumper($array) . " is not an array value; "
+                  . Data::Dumper::Dumper([$key, $array]) . " is not an array value; "
                   . "stacktrace follows";
         return;
     }
 
     unless ( @$array ) {
         Carp::cluck "trying to unserialize $format from memcache, "
-                  . Data::Dumper::Dumper($array) . " is an empty arrayref; "
+                  . Data::Dumper::Dumper([$key, $array]) . " is an empty arrayref; "
                   . "stacktrace follows";
         return;
     }
 
     unless ( $array->[0] =~ /^\d+$/ ) {
         Carp::cluck "trying to unserialize $format from memcache, "
-                  . Data::Dumper::Dumper($array) . " has a non-numeric "
+                  . Data::Dumper::Dumper([$key, $array]) . " has a non-numeric "
                   . "'$array->[0]' as its version string; "
                   . "stacktrace follows";
         return;

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-05-17 05:37:09 UTC (rev 19064)
+++ trunk/cgi-bin/LJ/User.pm	2011-05-17 05:54:58 UTC (rev 19065)
@@ -6722,8 +6722,9 @@
 {
     my @keys = @_;
     my @ret;
-    foreach my $ar (values %{LJ::MemCache::get_multi(@keys) || {}}) {
-        my $row = LJ::MemCache::array_to_hash("user", $ar)
+    my $users = LJ::MemCache::get_multi(@keys) || {};
+    while (my ($key, $ar) = each %$users) {
+        my $row = LJ::MemCache::array_to_hash("user", $ar, $key)
             or next;
         my $u = LJ::User->new_from_row($row);
         push @ret, $u;

Tags: gariev, livejournal, 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