Tupshin Harper (tupshin) wrote in changelog,
Tupshin Harper
tupshin
changelog

[livejournal] r14782: Beginning of creation of new reader and ...

Committer: tupshin
Beginning of creation of new reader and writer for uniqmap table

U   trunk/cgi-bin/LJ/UniqCookie.pm
U   trunk/cgi-bin/ljdb.pl
Modified: trunk/cgi-bin/LJ/UniqCookie.pm
===================================================================
--- trunk/cgi-bin/LJ/UniqCookie.pm	2009-01-20 14:10:09 UTC (rev 14781)
+++ trunk/cgi-bin/LJ/UniqCookie.pm	2009-01-20 14:11:03 UTC (rev 14782)
@@ -158,8 +158,8 @@
     croak "invalid userid arg: $uid_arg"
         unless $uid;
 
-    my $dbh = LJ::get_db_writer()
-        or die "unable to contact global master for uniq mapping";
+    my $dbh = LJ::get_uniq_db_writer()
+        or die "unable to contact uniq master for uniq mapping";
 
     # allow tests to specify an insertion time callback which specifies 
     # how we calculate insertion times for rows
@@ -271,8 +271,8 @@
         return @$memval;
     }
 
-    my $dbh = LJ::get_db_writer()
-        or die "unable to contact global reader";
+    my $dbh = LJ::get_uniq_db_writer() #FIXME should use reader when appropriate
+        or die "unable to contact uniq writer";
 
     my $limit = $window_size + 1;
     my $sth = $dbh->prepare
@@ -326,8 +326,8 @@
         return @$memval;
     }
 
-    my $dbh = LJ::get_db_reader()
-        or die "unable to contact global reader";
+    my $dbh = LJ::get_uniq_db_reader()
+        or die "unable to contact uniq reader";
 
     my $limit = $window_size + 1;
     my $sth = $dbh->prepare

Modified: trunk/cgi-bin/ljdb.pl
===================================================================
--- trunk/cgi-bin/ljdb.pl	2009-01-20 14:10:09 UTC (rev 14781)
+++ trunk/cgi-bin/ljdb.pl	2009-01-20 14:11:03 UTC (rev 14782)
@@ -300,6 +300,15 @@
     return LJ::get_dbh("master");
 }
 
+sub get_uniq_db_reader {
+    return LJ::get_dbh("uniq_master") if $LJ::_PRAGMA_FORCE_MASTER;
+    return LJ::get_dbh("uniq_slave", "uniq_master");
+}
+
+sub get_uniq_db_writer {
+    return LJ::get_dbh("uniq_master");
+}
+
 # <LJFUNC>
 # name: LJ::get_cluster_reader
 # class: db

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