[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3a2e51f8b637cd3b3020767728dd6cf889fb2922

Evergreen Git git at git.evergreen-ils.org
Wed Jun 10 15:36:33 EDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  3a2e51f8b637cd3b3020767728dd6cf889fb2922 (commit)
       via  bc45adbe96a8517914abcb99e90ba5a2bb5590cc (commit)
      from  564f3fdbe4ec932c041e9304bbcd6d0e38b40dfa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3a2e51f8b637cd3b3020767728dd6cf889fb2922
Author: Mike Rylander <mrylander at gmail.com>
Date:   Wed Jun 10 15:29:16 2020 -0400

    LP#1882937: Comment and dead-code cleanup
    
    Adjust comments in Storage::Driver::Pg to remove references to
    Class::DBI::Replication, which we did not end up using.
    
    Also remove a commented-out sub that purported to make use of a function
    that did not exist in the home-grown multi-db implementation.
    
    NOTE: While unused, the multi-db implementation in Storage::Driver::Pg
    intelligently decides when to use a read-only secondary based on the
    existence of a transaction or the "write-iness" state controlled by the
    caller, and does not require separate main (or primary) and secondary
    db lists.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
index f556456dce..9050ca31e6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
@@ -1,12 +1,11 @@
 
-{ # The driver package itself just needs a db_Main method (or db_standbys if
-  #Class::DBI::Replication is in use) for Class::DBI to call.
+{ # The driver package itself just needs a db_Main method.
   #
   # Any other fixups can go in here too... Also, the drivers should subclass the
   # DBI driver that they are wrapping, or provide a 'quote()' method that calls
   # the DBD::xxx::quote() method on FTI's behalf.
   #
-  # The dirver MUST be a subclass of Class::DBI(::Replication) and
+  # The dirver MUST be a subclass of Class::DBI and
   # OpenILS::Application::Storage.
   #-------------------------------------------------------------------------------
     package OpenILS::Application::Storage::Driver::Pg;
@@ -139,18 +138,6 @@
         return $self->db_Main->quote(@_)
     }
 
-#   sub tsearch2_trigger {
-#       my $self = shift;
-#       return unless ($self->value);
-#       $self->index_vector(
-#           $self->db_standbys->selectrow_array(
-#               "SELECT to_tsvector('default',?);",
-#               {},
-#               $self->value
-#           )
-#       );
-#   }
-
     my $_xact_session;
     my $_audit_session;
 

commit bc45adbe96a8517914abcb99e90ba5a2bb5590cc
Author: Sam Link <slink at gchrl.org>
Date:   Wed Jun 10 08:32:26 2020 -0400

    LP1882937 Replace master/slave terminology
    
    In Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
    changed master/slave terminology to more neutral primary/standby.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
index 6105d7ae50..f556456dce 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
@@ -1,5 +1,5 @@
 
-{ # The driver package itself just needs a db_Main method (or db_Slaves if
+{ # The driver package itself just needs a db_Main method (or db_standbys if
   #Class::DBI::Replication is in use) for Class::DBI to call.
   #
   # Any other fixups can go in here too... Also, the drivers should subclass the
@@ -34,12 +34,12 @@
     __PACKAGE__->set_sql( copy_start => 'COPY %s (%s) FROM STDIN;' );
     __PACKAGE__->set_sql( copy_end => '\.' );
 
-    my $master_db;
-    my @slave_dbs;
+    my $primary_db;
+    my @standby_dbs;
     my $_db_params;
 
     sub db_Handles {
-        return ($master_db, @slave_dbs);
+        return ($primary_db, @standby_dbs);
     }
 
     sub child_init {
@@ -64,50 +64,50 @@
                 ChopBlanks => 1,
         );
 
-        my $master = shift @$_db_params;
-        $$master{port} ||= '5432';
-        $$master{host} ||= 'localhost';
-        $$master{db} ||= 'openils';
+        my $primary = shift @$_db_params;
+        $$primary{port} ||= '5432';
+        $$primary{host} ||= 'localhost';
+        $$primary{db} ||= 'openils';
 
-        $log->debug("Attempting to connect to $$master{db} at $$master{host}", INFO);
+        $log->debug("Attempting to connect to $$primary{db} at $$primary{host}", INFO);
 
         try {
-            $master_db = DBI->connect(
+            $primary_db = DBI->connect(
                 "dbi:Pg:".
-                    "host=$$master{host};".
-                    "port=$$master{port};".
-                    "dbname=$$master{db}".
-                    ($$master{application_name} ? ";application_name='$$master{application_name}'": ""),
-                $$master{user},
-                $$master{pw},
+                    "host=$$primary{host};".
+                    "port=$$primary{port};".
+                    "dbname=$$primary{db}".
+                    ($$primary{application_name} ? ";application_name='$$primary{application_name}'": ""),
+                $$primary{user},
+                $$primary{pw},
                 \%attrs)
             || do { sleep(1);
                 DBI->connect(
                     "dbi:Pg:".
-                        "host=$$master{host};".
-                        "port=$$master{port};".
-                        "dbname=$$master{db}".
-                        ($$master{application_name} ? ";application_name='$$master{application_name}'": ""),
-                    $$master{user},
-                    $$master{pw},
+                        "host=$$primary{host};".
+                        "port=$$primary{port};".
+                        "dbname=$$primary{db}".
+                        ($$primary{application_name} ? ";application_name='$$primary{application_name}'": ""),
+                    $$primary{user},
+                    $$primary{pw},
                     \%attrs) }
             || throw OpenSRF::EX::ERROR
-                ("Couldn't connect to $$master{db}".
-                 " on $$master{host}::$$master{port}".
-                 " as $$master{user}!!");
+                ("Couldn't connect to $$primary{db}".
+                 " on $$primary{host}::$$primary{port}".
+                 " as $$primary{user}!!");
         } catch Error with {
             my $e = shift;
             $log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);
             throw $e;
         };
 
-        $log->debug("Connected to MASTER db $$master{db} at $$master{host}", INFO);
+        $log->debug("Connected to primary db $$primary{db} at $$primary{host}", INFO);
         
-        $master_db->do("SET NAMES '$$master{client_encoding}';") if ($$master{client_encoding});
+        $primary_db->do("SET NAMES '$$primary{client_encoding}';") if ($$primary{client_encoding});
 
         for my $db (@$_db_params) {
             try {
-                push @slave_dbs, DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}". ($$db{application_name} ? ";application_name='$$db{application_name}'" : ""),$$db{user},$$db{pw}, \%attrs)
+                push @standby_dbs, DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}". ($$db{application_name} ? ";application_name='$$db{application_name}'" : ""),$$db{user},$$db{pw}, \%attrs)
                     || do { sleep(1); DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}". ($$db{application_name} ? ";application_name='$$db{application_name}'" : ""),$$db{user},$$db{pw}, \%attrs) }
                     || throw OpenSRF::EX::ERROR
                         ("Couldn't connect to $$db{db}".
@@ -119,9 +119,9 @@
                 throw $e;
             };
 
-            $slave_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$master{client_encoding});
+            $standby_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$primary{client_encoding});
 
-            $log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
+            $log->debug("Connected to primary db '$$primary{db} at $$primary{host}", INFO);
         }
 
         $log->debug("All is well on the western front", INTERNAL);
@@ -129,9 +129,9 @@
 
     sub db_Main {
         my $self = shift;
-        return $master_db if ($self->current_xact_session || $OpenILS::Application::Storage::WRITE);
-        return $master_db unless (@slave_dbs);
-        return ($master_db, @slave_dbs)[rand(scalar(@slave_dbs))];
+        return $primary_db if ($self->current_xact_session || $OpenILS::Application::Storage::WRITE);
+        return $primary_db unless (@standby_dbs);
+        return ($primary_db, @standby_dbs)[rand(scalar(@standby_dbs))];
     }
 
     sub quote {
@@ -143,7 +143,7 @@
 #       my $self = shift;
 #       return unless ($self->value);
 #       $self->index_vector(
-#           $self->db_Slaves->selectrow_array(
+#           $self->db_standbys->selectrow_array(
 #               "SELECT to_tsvector('default',?);",
 #               {},
 #               $self->value

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Storage/Driver/Pg.pm   | 81 +++++++++-------------
 1 file changed, 34 insertions(+), 47 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list