[open-ils-commits] [GIT] Evergreen ILS branch master updated. 6afaf84691f593c8a48e528c4f54ef7f991a8a22

Evergreen Git git at git.evergreen-ils.org
Thu Aug 23 12:30:04 EDT 2018


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  6afaf84691f593c8a48e528c4f54ef7f991a8a22 (commit)
       via  4118424b8d80dfb34f3e32c12e1f538a20f8aa92 (commit)
       via  41e6fe45422e24c1b2af4f638d7113c109d7aff2 (commit)
       via  ddfa6af287dc9c7fc69f558ab8e7b99ab9df4f15 (commit)
       via  55093af49ba1d0bd5f63a1206972703ae31d273c (commit)
       via  7e007cc03694799d2b5a49f6c6791df706b51d4d (commit)
       via  d81eb554d9cc40b2b4339fe0ae68847587c8a12f (commit)
       via  3fc6f07190a31ff9c2c52caac10374fc5fe9b9bb (commit)
       via  fa3af4113a3f8cff1bc2fb43dfc62af2977db78f (commit)
       via  bee32963d1be36b22ea1984a90262149f6330faf (commit)
       via  fe5ba7746f7ec5a1d33195160c00654a7bd869dc (commit)
       via  1f2f392b42c5e1e10488d2034a0686c7e8768ad4 (commit)
       via  2da2f10b1e9f744cd57da8ced8fdb8779f1b5511 (commit)
       via  d762c9eb243eeb66f827873e602919598a1cf88d (commit)
       via  844a1fbea2b94dc34802099c5b13376f0fbfab1d (commit)
       via  28d87c24928344307fc68338aa01ca2c1d97173a (commit)
       via  1ceab5e76d05e507da85302be22137f13d4a8635 (commit)
      from  bd8912ee2d1016619ee208d513815072071fc6be (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 6afaf84691f593c8a48e528c4f54ef7f991a8a22
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Aug 23 12:26:11 2018 -0400

    LP 1768715: pingest.pl merge conflict typo fix: skip_dispaly
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 2ddaac5..d351cfa 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -239,7 +239,7 @@ sub browse_ingest {
     } elsif ($pid == 0) {
         my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
                                $db_user, $db_password);
-        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id := ?, skip_facet := TRUE, skip_browse := FALSE, skip_search := TRUE, skip_dispaly := TRUE)');
+        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id := ?, skip_facet := TRUE, skip_browse := FALSE, skip_search := TRUE, skip_display := TRUE)');
         foreach (@list) {
             if ($sth->execute($_)) {
                 my $crap = $sth->fetchall_arrayref();

commit 4118424b8d80dfb34f3e32c12e1f538a20f8aa92
Author: Jason Stephenson <jason at sigio.com>
Date:   Sat Jun 2 20:33:23 2018 -0400

    LP 1768715: pingest.pl Release Notes and Installation
    
    Add pingest.pl to Open-ILS/src/Makefile.am so it will be installed by
    default.
    
    Add release notes for pingest.pl.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/Makefile.am b/Open-ILS/src/Makefile.am
index 21508e8..444846b 100644
--- a/Open-ILS/src/Makefile.am
+++ b/Open-ILS/src/Makefile.am
@@ -129,7 +129,8 @@ gen_scripts = \
 	$(supportscr)/authority_authority_linker.pl \
 	$(supportscr)/eg_db_config \
 	$(supportscr)/marc_export \
-	$(supportscr)/offline-blocked-list.pl
+	$(supportscr)/offline-blocked-list.pl \
+	$(supportscr)/pingest.pl
 
 gen_docs = \
 	$(examples)/apache/eg.conf \
diff --git a/docs/RELEASE_NOTES_NEXT/Cataloging/pingest.adoc b/docs/RELEASE_NOTES_NEXT/Cataloging/pingest.adoc
new file mode 100644
index 0000000..5f381b9
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Cataloging/pingest.adoc
@@ -0,0 +1,70 @@
+Parallel Ingest with pingest.pl
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+A program named pingest.pl is now installed to allow faster record
+ingest.  It performs ingest in parallel so that multiple batches can
+be done simultaneously.  It operates by splitting the records to be
+ingested up into batches and running all of the ingest methods on each
+batch.  You may pass in options to control how many batches are run at
+the same time, how many records there are per batch, and which ingest
+operations to skip.
+
+NOTE: The browse ingest is presently done in a single process over all
+of the input records as it cannot run in parallel with itself.  It
+does, however, run in parallel with the other ingests.
+
+Command Line Options
+++++++++++++++++++++
+pingest.pl accepts the following command line options:
+
+--host::
+    The server where PostgreSQL runs (either host name or IP address).
+    The default is read from the PGHOST environment variable or
+    "localhost."
+
+--port::
+    The port that PostgreSQL listens to on host.  The default is read
+    from the PGPORT environment variable or 5432.
+
+--db::
+    The database to connect to on the host.  The default is read from
+    the PGDATABASE environment variable or "evergreen."
+
+--user::
+    The username for database connections.  The default is read from
+    the PGUSER environment variable or "evergreen."
+
+--password::
+    The password for database connections.  The default is read from
+    the PGPASSWORD environment variable or "evergreen."
+
+--batch-size::
+    Number of records to process per batch.  The default is 10,000.
+
+--max-child::
+    Max number of worker processes (i.e. the number of batches to
+    process simultaneously).  The default is 8.
+
+--skip-browse::
+--skip-attrs::
+--skip-search::
+--skip-facets::
+--skip-display::
+    Skip the selected reingest component.
+
+--start-id::
+    Start processing at this record ID.
+
+--end-id::
+    Stop processing when this record ID is reached.
+
+--pipe::
+    Read record IDs to reingest from standard input.  This option
+    conflicts with --start-id and/or --end-id.
+
+--max-duration::
+    Stop processing after this many total seconds have passed.  The
+    default is to run until all records have been processed.
+
+--help::
+    Show the help text.
+

commit 41e6fe45422e24c1b2af4f638d7113c109d7aff2
Author: Jason Stephenson <jason at sigio.com>
Date:   Sat Jun 2 19:18:40 2018 -0400

    LP 1768715: Fix pingest.pl bug discovered by Dan Scott of Laurentian U.
    
    Reingest was not happening if all ingests were skipped, except for the
    display field reingest.  This came down to a matter of two conditional
    statements not including checks for the $skip_display variable being
    true.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index fac993c..2ddaac5 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -202,7 +202,7 @@ while ($count < $lists) {
     if (scalar(@lol) && scalar(@running) < $max_child && !$duration_expired) {
         # Reuse $records for the lulz.
         $records = shift(@lol);
-        if ($skip_search && $skip_facets && $skip_attrs) {
+        if ($skip_search && $skip_facets && $skip_attrs && $skip_display) {
             $count++;
         } else {
             reingest($records);
@@ -271,7 +271,7 @@ sub reingest {
                                $db_user, $db_password);
         reingest_attributes($dbh, $list) unless ($skip_attrs);
         reingest_field_entries($dbh, $list)
-            unless ($skip_facets && $skip_search);
+            unless ($skip_facets && $skip_search && $skip_display);
         $dbh->disconnect();
         exit(0);
     }

commit ddfa6af287dc9c7fc69f558ab8e7b99ab9df4f15
Author: Jeff Godin <jgodin at tadl.org>
Date:   Fri Nov 24 10:23:56 2017 -0500

    LP 1768715: Use older named notation in pingest.pl
    
    Use older style param := 'value' named notation for PostgreSQL
    function calls in pingest.pl to support PostgreSQL versions < 9.5.
    
    NOTE: This commit was modified to fit with the flow of the surrounding
    commits from the master branch of the source repository.
    
    Signed-off-by: Jeff Godin <jgodin at tadl.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index df96434..fac993c 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -239,7 +239,7 @@ sub browse_ingest {
     } elsif ($pid == 0) {
         my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
                                $db_user, $db_password);
-        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => TRUE, skip_browse => FALSE, skip_search => TRUE, skip_display => TRUE)');
+        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id := ?, skip_facet := TRUE, skip_browse := FALSE, skip_search := TRUE, skip_dispaly := TRUE)');
         foreach (@list) {
             if ($sth->execute($_)) {
                 my $crap = $sth->fetchall_arrayref();
@@ -281,7 +281,7 @@ sub reingest {
 sub reingest_field_entries {
     my $dbh = shift;
     my $list = shift;
-    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, skip_browse => TRUE, skip_search => ?, skip_display => ?)');
+    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id := ?, skip_facet := ?, skip_browse := TRUE, skip_search := ?, skip_display := ?)');
     # Because reingest uses "skip" options we invert the logic of do variables.
     $sth->bind_param(2, ($skip_facets) ? 1 : 0);
     $sth->bind_param(3, ($skip_search) ? 1 : 0);
@@ -301,7 +301,7 @@ sub reingest_attributes {
     my $dbh = shift;
     my $list = shift;
     my $sth = $dbh->prepare(<<END_OF_INGEST
-SELECT metabib.reingest_record_attributes(rid => id, prmarc => marc)
+SELECT metabib.reingest_record_attributes(rid := id, prmarc := marc)
 FROM biblio.record_entry
 WHERE id = ?
 END_OF_INGEST

commit 55093af49ba1d0bd5f63a1206972703ae31d273c
Author: Jason Stephenson <jason at sigio.com>
Date:   Tue Nov 21 21:23:03 2017 -0500

    LP 1768715: Whitespace cleanup in Blake's commit.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 86cd0d2..df96434 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -33,7 +33,7 @@ my $skip_browse;  # Skip the browse reingest.
 my $skip_attrs;   # Skip the record attributes reingest.
 my $skip_search;  # Skip the search reingest.
 my $skip_facets;  # Skip the facets reingest.
-my $skip_display;  # Skip the display reingest.
+my $skip_display; # Skip the display reingest.
 my $start_id;     # start processing at this bib ID.
 my $end_id;       # stop processing when this bib ID is reached.
 my $max_duration; # max processing duration in seconds

commit 7e007cc03694799d2b5a49f6c6791df706b51d4d
Author: Blake GH <blake at mobiusconsortium.org>
Date:   Tue Nov 21 10:41:48 2017 -0600

    LP 1768715: Missing semi colon
    
    Add missing semi-colon in pingest.pl.
    
    Signed-off-by: Blake GH <blake at mobiusconsortium.org>
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 4a194c8..86cd0d2 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -33,7 +33,7 @@ my $skip_browse;  # Skip the browse reingest.
 my $skip_attrs;   # Skip the record attributes reingest.
 my $skip_search;  # Skip the search reingest.
 my $skip_facets;  # Skip the facets reingest.
-my $skip_display  # Skip the display reingest.
+my $skip_display;  # Skip the display reingest.
 my $start_id;     # start processing at this bib ID.
 my $end_id;       # stop processing when this bib ID is reached.
 my $max_duration; # max processing duration in seconds

commit d81eb554d9cc40b2b4339fe0ae68847587c8a12f
Author: Jason Stephenson <jason at sigio.com>
Date:   Wed Oct 4 16:43:37 2017 -0400

    LP 1768715: Handle the skip_display option of metabib.reingest_metabib_field_entries.
    
    pingest.pl gets a --skip-display option of its own that disables the
    display ingest.  The display ingest is also skipped in the browse
    ingest.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index ea692a5..4a194c8 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -33,6 +33,7 @@ my $skip_browse;  # Skip the browse reingest.
 my $skip_attrs;   # Skip the record attributes reingest.
 my $skip_search;  # Skip the search reingest.
 my $skip_facets;  # Skip the facets reingest.
+my $skip_display  # Skip the display reingest.
 my $start_id;     # start processing at this bib ID.
 my $end_id;       # stop processing when this bib ID is reached.
 my $max_duration; # max processing duration in seconds
@@ -58,6 +59,7 @@ GetOptions(
     'skip-attrs'     => \$skip_attrs,
     'skip-search'    => \$skip_search,
     'skip-facets'    => \$skip_facets,
+    'skip-display'   => \$skip_display,
     'start-id=i'     => \$start_id,
     'end-id=i'       => \$end_id,
     'pipe'           => \$opt_pipe,
@@ -81,6 +83,7 @@ sub help {
     --skip-attrs
     --skip-search
     --skip-facets
+    --skip-display
         Skip the selected reingest component
 
     --start-id
@@ -236,7 +239,7 @@ sub browse_ingest {
     } elsif ($pid == 0) {
         my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
                                $db_user, $db_password);
-        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => TRUE, skip_browse => FALSE, skip_search => TRUE)');
+        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => TRUE, skip_browse => FALSE, skip_search => TRUE, skip_display => TRUE)');
         foreach (@list) {
             if ($sth->execute($_)) {
                 my $crap = $sth->fetchall_arrayref();
@@ -278,10 +281,11 @@ sub reingest {
 sub reingest_field_entries {
     my $dbh = shift;
     my $list = shift;
-    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, skip_browse => TRUE, skip_search => ?)');
+    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, skip_browse => TRUE, skip_search => ?, skip_display => ?)');
     # Because reingest uses "skip" options we invert the logic of do variables.
     $sth->bind_param(2, ($skip_facets) ? 1 : 0);
     $sth->bind_param(3, ($skip_search) ? 1 : 0);
+    $sth->bind_param(4, ($skip_display) ? 1: 0);
     foreach (@$list) {
         $sth->bind_param(1, $_);
         if ($sth->execute()) {

commit 3fc6f07190a31ff9c2c52caac10374fc5fe9b9bb
Author: Jason Stephenson <jason at sigio.com>
Date:   Wed Oct 4 13:25:19 2017 -0400

    LP 1768715: Add skip_browse where it was missed in pingest.pl.
    
    I missed the named parameter for skip_browse in reingest_field_entries
    in pingest.pl in the earlier commit.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index eb5434e..ea692a5 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -278,7 +278,7 @@ sub reingest {
 sub reingest_field_entries {
     my $dbh = shift;
     my $list = shift;
-    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, TRUE, skip_search => ?)');
+    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, skip_browse => TRUE, skip_search => ?)');
     # Because reingest uses "skip" options we invert the logic of do variables.
     $sth->bind_param(2, ($skip_facets) ? 1 : 0);
     $sth->bind_param(3, ($skip_search) ? 1 : 0);

commit fa3af4113a3f8cff1bc2fb43dfc62af2977db78f
Author: Jason Stephenson <jason at sigio.com>
Date:   Wed Oct 4 12:55:05 2017 -0400

    LP 1768715: Use named arguments in function calls in pingest.pl.
    
    This makes it work, more or less, with Evergreen 3.0 and the changes
    to metabib.reingest_field_entries.  Note that the new skip_display
    parameter is not set, so you might get collisions between the browse
    ingest and one of the other ingest processes if they both work on the
    same record at once.
    
    I will make a branch for use with Evergreen 3.0 until I upgrade to
    Evergreen 3.0 and merge that branch into master.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 3d0a7ce..eb5434e 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -236,7 +236,7 @@ sub browse_ingest {
     } elsif ($pid == 0) {
         my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
                                $db_user, $db_password);
-        my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, TRUE, FALSE, TRUE)");
+        my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => TRUE, skip_browse => FALSE, skip_search => TRUE)');
         foreach (@list) {
             if ($sth->execute($_)) {
                 my $crap = $sth->fetchall_arrayref();
@@ -278,7 +278,7 @@ sub reingest {
 sub reingest_field_entries {
     my $dbh = shift;
     my $list = shift;
-    my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, ?, TRUE, ?)");
+    my $sth = $dbh->prepare('SELECT metabib.reingest_metabib_field_entries(bib_id => ?, skip_facet => ?, TRUE, skip_search => ?)');
     # Because reingest uses "skip" options we invert the logic of do variables.
     $sth->bind_param(2, ($skip_facets) ? 1 : 0);
     $sth->bind_param(3, ($skip_search) ? 1 : 0);
@@ -297,7 +297,7 @@ sub reingest_attributes {
     my $dbh = shift;
     my $list = shift;
     my $sth = $dbh->prepare(<<END_OF_INGEST
-SELECT metabib.reingest_record_attributes(id, NULL::TEXT[], marc)
+SELECT metabib.reingest_record_attributes(rid => id, prmarc => marc)
 FROM biblio.record_entry
 WHERE id = ?
 END_OF_INGEST

commit bee32963d1be36b22ea1984a90262149f6330faf
Author: Jason Stephenson <jason at sigio.com>
Date:   Wed Oct 4 11:18:35 2017 -0400

    LP 1768715: Add database connection parameters to pingest.pl command line.
    
    This will serve as the model for future Perl scripts that need to
    connect to the PostgreSQL database with DBI.  I may go back and alter
    the existing scripts to use this method.
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 2e610f9..3d0a7ce 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -39,7 +39,19 @@ my $max_duration; # max processing duration in seconds
 my $help;         # show help text
 my $opt_pipe;     # Read record ids from STDIN.
 
+# Database connection options with defaults:
+my $db_user = $ENV{PGUSER} || 'evergreen';
+my $db_host = $ENV{PGHOST} || 'localhost';
+my $db_db = $ENV{PGDATABASE} || 'evergreen';
+my $db_password = $ENV{PGPASSWORD} || 'evergreen';
+my $db_port = $ENV{PGPORT} || 5432;
+
 GetOptions(
+    'user=s'         => \$db_user,
+    'host=s'         => \$db_host,
+    'db=s'           => \$db_db,
+    'password=s'     => \$db_password,
+    'port=i'         => \$db_port,
     'batch-size=i'   => \$batch_size,
     'max-child=i'    => \$max_child,
     'skip-browse'    => \$skip_browse,
@@ -151,7 +163,8 @@ if ($opt_pipe) {
         }
     }
 } else {
-    my $dbh = DBI->connect('DBI:Pg:');
+    my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
+                           $db_user, $db_password);
     @input = @{$dbh->selectcol_arrayref($q)};
     $dbh->disconnect();
 }
@@ -221,7 +234,8 @@ sub browse_ingest {
         # previously counted.
         $lists++;
     } elsif ($pid == 0) {
-        my $dbh = DBI->connect('DBI:Pg:');
+        my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
+                               $db_user, $db_password);
         my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, TRUE, FALSE, TRUE)");
         foreach (@list) {
             if ($sth->execute($_)) {
@@ -250,7 +264,8 @@ sub reingest {
     } elsif ($pid > 0) {
         push(@running, $pid);
     } elsif ($pid == 0) {
-        my $dbh = DBI->connect('DBI:Pg:');
+        my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
+                               $db_user, $db_password);
         reingest_attributes($dbh, $list) unless ($skip_attrs);
         reingest_field_entries($dbh, $list)
             unless ($skip_facets && $skip_search);

commit fe5ba7746f7ec5a1d33195160c00654a7bd869dc
Author: Jason Stephenson <jstephenson at mvlcstaff.org>
Date:   Mon Apr 11 12:25:57 2016 -0400

    LP 1768715: Make the pingest.pl --pipe option be greedy.
    
    The --pipe option is used with pingest.pl now assumes that that any
    string of digits in the input is a record id.  Instead of using just
    the first string of digits on a line, as it did before, it now uses
    each string of digits on a line.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlcstaff.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 8389c53..2e610f9 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -145,9 +145,9 @@ sub duration_expired {
 my @input;
 if ($opt_pipe) {
     while (<STDIN>) {
-        # Want only numbers, one per line.
-        if ($_ =~ /([0-9]+)/) {
-            push(@input, $1);
+        # Assume any string of digits is an id.
+        if (my @subs = /([0-9]+)/g) {
+            push(@input, @subs);
         }
     }
 } else {

commit 1f2f392b42c5e1e10488d2034a0686c7e8768ad4
Author: Jason Stephenson <jstephenson at mvlcstaff.org>
Date:   Mon Apr 11 10:39:02 2016 -0400

    LP 1768715: Simplify Open-ILS/src/support-scripts/pingest.pl with selectcol_arrayref.
    
    By switching to DBI->selectcol_arrayref in pingest.pl, we can avoid
    having to check for references in the main loop.  This eliminates an
    extra variable and an extra line of code that are no longer needed.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlcstaff.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 9c92528..8389c53 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -152,12 +152,11 @@ if ($opt_pipe) {
     }
 } else {
     my $dbh = DBI->connect('DBI:Pg:');
-    @input = @{$dbh->selectall_arrayref($q)};
+    @input = @{$dbh->selectcol_arrayref($q)};
     $dbh->disconnect();
 }
 
-foreach my $r (@input) {
-    my $record = (ref($r)) ? $r->[0] : $r;
+foreach my $record (@input) {
     push(@blist, $record); # separate list of browse-only ingest
     push(@$records, $record);
     if (++$count == $batch_size) {

commit 2da2f10b1e9f744cd57da8ced8fdb8779f1b5511
Author: Jason Stephenson <jstephenson at mvlcstaff.org>
Date:   Fri Apr 1 10:02:45 2016 -0400

    LP 1768715: Only connect to the database when needed in pingest.pl.
    
    We chagne where we connect and disconnect the database in the parent
    process in pingest.pl.  There's no point connecting at all if the
    --pipe option is used.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlcstaff.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 73efaab..9c92528 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -140,7 +140,6 @@ sub duration_expired {
 #
 # 2) edit the DBI->connect() calls in this program so that it can
 # connect to your database.
-my $dbh = DBI->connect('DBI:Pg:');
 
 # Get the input records from either standard input or the database.
 my @input;
@@ -152,7 +151,9 @@ if ($opt_pipe) {
         }
     }
 } else {
+    my $dbh = DBI->connect('DBI:Pg:');
     @input = @{$dbh->selectall_arrayref($q)};
+    $dbh->disconnect();
 }
 
 foreach my $r (@input) {
@@ -167,7 +168,6 @@ foreach my $r (@input) {
 }
 $lol[$lists++] = $records if ($count); # Last batch is likely to be
                                        # small.
-$dbh->disconnect();
 
 # We're going to reuse $count to keep track of the total number of
 # batches processed.

commit d762c9eb243eeb66f827873e602919598a1cf88d
Author: Jason Stephenson <jstephenson at mvlcstaff.org>
Date:   Fri Apr 1 10:00:20 2016 -0400

    LP 1768715: Fix bug in pingest.pl after --pipe option was added.
    
    Apparently, the results of DBI->selectall_arrayref need to be cast to
    an array and not just returned as a list.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlcstaff.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 898dc13..73efaab 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -152,7 +152,7 @@ if ($opt_pipe) {
         }
     }
 } else {
-    @input = ($dbh->selectall_arrayref($q));
+    @input = @{$dbh->selectall_arrayref($q)};
 }
 
 foreach my $r (@input) {

commit 844a1fbea2b94dc34802099c5b13376f0fbfab1d
Author: Jason Stephenson <jstephenson at mvlcstaff.org>
Date:   Thu Mar 31 11:39:49 2016 -0400

    LP 1768715: Add --pipe option to pingest.pl
    
    With this option, pingest.pl reads a list of record IDs from standard
    input, instead of running a query.  This is useful if you have a
    custom query to output only certain records to reingest and you can
    pipe the output into pingest.pl.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlcstaff.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index ed9f45e..898dc13 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -37,6 +37,7 @@ my $start_id;     # start processing at this bib ID.
 my $end_id;       # stop processing when this bib ID is reached.
 my $max_duration; # max processing duration in seconds
 my $help;         # show help text
+my $opt_pipe;     # Read record ids from STDIN.
 
 GetOptions(
     'batch-size=i'   => \$batch_size,
@@ -47,6 +48,7 @@ GetOptions(
     'skip-facets'    => \$skip_facets,
     'start-id=i'     => \$start_id,
     'end-id=i'       => \$end_id,
+    'pipe'           => \$opt_pipe,
     'max-duration=i' => \$max_duration,
     'help'           => \$help
 );
@@ -75,6 +77,10 @@ sub help {
     --end-id
         Stop processing when this record ID is reached
 
+    --pipe
+        Read record IDs to reingest from standard input.
+        This option conflicts with --start-id and/or --end-id.
+
     --max-duration
         Stop processing after this many total seconds have passed.
 
@@ -87,6 +93,12 @@ HELP
 
 help() if $help;
 
+# Check for mutually exclusive options:
+if ($opt_pipe && ($start_id || $end_id)) {
+    warn('Mutually exclusive options');
+    help();
+}
+
 my $where = "WHERE deleted = 'f'";
 if ($start_id && $end_id) {
     $where .= " AND id BETWEEN $start_id AND $end_id";
@@ -130,9 +142,21 @@ sub duration_expired {
 # connect to your database.
 my $dbh = DBI->connect('DBI:Pg:');
 
-my $results = $dbh->selectall_arrayref($q);
-foreach my $r (@$results) {
-    my $record = $r->[0];
+# Get the input records from either standard input or the database.
+my @input;
+if ($opt_pipe) {
+    while (<STDIN>) {
+        # Want only numbers, one per line.
+        if ($_ =~ /([0-9]+)/) {
+            push(@input, $1);
+        }
+    }
+} else {
+    @input = ($dbh->selectall_arrayref($q));
+}
+
+foreach my $r (@input) {
+    my $record = (ref($r)) ? $r->[0] : $r;
     push(@blist, $record); # separate list of browse-only ingest
     push(@$records, $record);
     if (++$count == $batch_size) {

commit 28d87c24928344307fc68338aa01ca2c1d97173a
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Feb 16 12:59:55 2016 -0500

    LP 1768715: pingest supports max/min ID, duration, more ops
    
    From the new help text:
    
        --batch-size
            Number of records to process per batch
    
        --max-child
            Max number of worker processes
    
        --skip-browse
        --skip-attrs
        --skip-search
        --skip-facets
            Skip the selected reingest component
    
        --start-id
            Start processing at this record ID.
    
        --end-id
            Stop processing when this record ID is reached
    
        --max-duration
            Stop processing after this many total seconds have passed.
    
        --help
            Show this help text.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
index 28cb031..ed9f45e 100755
--- a/Open-ILS/src/support-scripts/pingest.pl
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -18,49 +18,89 @@
 use strict;
 use warnings;
 use DBI;
+use Getopt::Long;
+
+# Globals for the command line options: --
 
 # You will want to adjust the next two based on your database size,
 # i.e. number of bib records as well as the number of cores on your
 # database server.  Using roughly number of cores/2 doesn't seem to
 # have much impact in off peak times.
-use constant {
-    BATCHSIZE => 10000,
-    MAXCHILD => 8
-};
-
-# Globals for the command line options:
-my $do_browse = 1; # Do the browse reingest.
-my $do_attrs = 1; # Do the record attributes reingest.
-my $do_search = 1; # Do the search reingest.
-my $do_facets = 1; # Do the facets reingest.
-
-# Command line options to skip different reingests. In this case, we
-# use the '-' to indicate a minus or a no, so to
-# skip browse reingest: -browse or -b
-# skip attribute reingest: -attributes or -a
-# skip search reingest: -search or -s
-# skip facet reingest: -facets or -f
-foreach (@ARGV) {
-    if (/^-b(?:rowse)?$/) {
-        $do_browse = 0;
-    } elsif (/^-a(?:ttr(?:ibute)?s?)?$/) {
-        $do_attrs = 0;
-    } elsif (/^-s(?:earch)?$/) {
-        $do_search = 0;
-    } elsif (/^-f(?:acets?)?$/) {
-        $do_facets = 0;
-    } else {
-        # TODO: Add usage() function to report allowed options.
-        die ("Unrecognized option: $_");
-    }
+my $batch_size = 10000; # records processed per batch
+my $max_child  = 8;     # max number of parallel worker processes
+
+my $skip_browse;  # Skip the browse reingest.
+my $skip_attrs;   # Skip the record attributes reingest.
+my $skip_search;  # Skip the search reingest.
+my $skip_facets;  # Skip the facets reingest.
+my $start_id;     # start processing at this bib ID.
+my $end_id;       # stop processing when this bib ID is reached.
+my $max_duration; # max processing duration in seconds
+my $help;         # show help text
+
+GetOptions(
+    'batch-size=i'   => \$batch_size,
+    'max-child=i'    => \$max_child,
+    'skip-browse'    => \$skip_browse,
+    'skip-attrs'     => \$skip_attrs,
+    'skip-search'    => \$skip_search,
+    'skip-facets'    => \$skip_facets,
+    'start-id=i'     => \$start_id,
+    'end-id=i'       => \$end_id,
+    'max-duration=i' => \$max_duration,
+    'help'           => \$help
+);
+
+sub help {
+    print <<HELP;
+
+    $0 --batch-size $batch_size --max-child $max_child \
+        --start-id 1 --end-id 500000 --duration 14400
+
+    --batch-size
+        Number of records to process per batch
+
+    --max-child
+        Max number of worker processes
+
+    --skip-browse
+    --skip-attrs
+    --skip-search
+    --skip-facets
+        Skip the selected reingest component
+
+    --start-id
+        Start processing at this record ID.
+
+    --end-id
+        Stop processing when this record ID is reached
+
+    --max-duration
+        Stop processing after this many total seconds have passed.
+
+    --help
+        Show this help text.
+
+HELP
+    exit;
+}
+
+help() if $help;
+
+my $where = "WHERE deleted = 'f'";
+if ($start_id && $end_id) {
+    $where .= " AND id BETWEEN $start_id AND $end_id";
+} elsif ($start_id) {
+    $where .= " AND id >= $start_id";
+} elsif ($end_id) {
+    $where .= " AND id <= $end_id";
 }
 
 # "Gimme the keys!  I'll drive!"
 my $q = <<END_OF_Q;
 SELECT id
 FROM biblio.record_entry
-WHERE deleted = 'f'
-AND id > 0
+$where
 ORDER BY id ASC
 END_OF_Q
 
@@ -72,6 +112,13 @@ my @lol = ();
 # To do the browse-only ingest:
 my @blist = ();
 
+my $start_epoch = time;
+
+sub duration_expired {
+    return 1 if $max_duration && (time - $start_epoch) >= $max_duration;
+    return 0;
+}
+
 # All of the DBI->connect() calls in this file assume that you have
 # configured the PGHOST, PGPORT, PGDATABASE, PGUSER, and PGPASSWORD
 # variables in your execution environment.  If you have not, you have
@@ -88,7 +135,7 @@ foreach my $r (@$results) {
     my $record = $r->[0];
     push(@blist, $record); # separate list of browse-only ingest
     push(@$records, $record);
-    if (++$count == BATCHSIZE) {
+    if (++$count == $batch_size) {
         $lol[$lists++] = $records;
         $count = 0;
         $records = [];
@@ -106,17 +153,20 @@ $count = 0;
 my @running = ();
 
 # We start the browse-only ingest before starting the other ingests.
-browse_ingest(@blist) if ($do_browse);
+browse_ingest(@blist) unless ($skip_browse);
 
-# We loop until we have processed all of the batches stored in @lol:
+# We loop until we have processed all of the batches stored in @lol
+# or the maximum processing duration has been reached.
 while ($count < $lists) {
-    if (scalar(@lol) && scalar(@running) < MAXCHILD) {
+    my $duration_expired = duration_expired();
+
+    if (scalar(@lol) && scalar(@running) < $max_child && !$duration_expired) {
         # Reuse $records for the lulz.
         $records = shift(@lol);
-        if ($do_search || $do_facets || $do_attrs) {
-            reingest($records);
-        } else {
+        if ($skip_search && $skip_facets && $skip_attrs) {
             $count++;
+        } else {
+            reingest($records);
         }
     } else {
         my $pid = wait();
@@ -126,6 +176,11 @@ while ($count < $lists) {
             print "$count of $lists processed\n";
         }
     }
+
+    if ($duration_expired && scalar(@running) == 0) {
+        warn "Exiting on max_duration ($max_duration)\n";
+        exit(0);
+    }
 }
 
 # This subroutine forks a process to do the browse-only ingest on the
@@ -151,6 +206,11 @@ sub browse_ingest {
             } else {
                 warn ("Browse ingest failed for record $_");
             }
+            if (duration_expired()) {
+                warn "browse_ingest() stopping on record $_ ".
+                    "after max duration reached\n";
+                last;
+            }
         }
         $dbh->disconnect();
         exit(0);
@@ -168,8 +228,9 @@ sub reingest {
         push(@running, $pid);
     } elsif ($pid == 0) {
         my $dbh = DBI->connect('DBI:Pg:');
-        reingest_attributes($dbh, $list) if ($do_attrs);
-        reingest_field_entries($dbh, $list) if ($do_facets || $do_search);
+        reingest_attributes($dbh, $list) unless ($skip_attrs);
+        reingest_field_entries($dbh, $list)
+            unless ($skip_facets && $skip_search);
         $dbh->disconnect();
         exit(0);
     }
@@ -181,8 +242,8 @@ sub reingest_field_entries {
     my $list = shift;
     my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, ?, TRUE, ?)");
     # Because reingest uses "skip" options we invert the logic of do variables.
-    $sth->bind_param(2, ($do_facets) ? 0 : 1);
-    $sth->bind_param(3, ($do_search) ? 0 : 1);
+    $sth->bind_param(2, ($skip_facets) ? 1 : 0);
+    $sth->bind_param(3, ($skip_search) ? 1 : 0);
     foreach (@$list) {
         $sth->bind_param(1, $_);
         if ($sth->execute()) {

commit 1ceab5e76d05e507da85302be22137f13d4a8635
Author: Jason Stephenson <jstephenson at mvlc.org>
Date:   Mon Oct 26 10:32:19 2015 -0400

    LP 1768715: Add pingest.pl to Evergreen.
    
    Add Open-ILS/src/support-script/pingest.pl to do ingests in parallel.
    See release notes for details.
    
    NOTE: This and subsequent commits were added from a branch that
    preserves the history of the repository from which pingest.pl was
    copied.  The dates on these commits represent when the code was added
    or modified in the source repository.  They do not reflect when the
    code was added to Evergreen.
    
    Also, pingest.pl predates this commit.  The date on this commit was
    when the source repository was split into separate directories for SQL
    and Perl scripts.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl
new file mode 100755
index 0000000..28cb031
--- /dev/null
+++ b/Open-ILS/src/support-scripts/pingest.pl
@@ -0,0 +1,214 @@
+#!/usr/bin/perl
+# ---------------------------------------------------------------
+# Copyright © 2013,2014 Merrimack Valley Library Consortium
+# Jason Stephenson <jstephenson at mvlc.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# ---------------------------------------------------------------
+# TODO: Document with POD.
+# This guy parallelizes a reingest.
+use strict;
+use warnings;
+use DBI;
+
+# You will want to adjust the next two based on your database size,
+# i.e. number of bib records as well as the number of cores on your
+# database server.  Using roughly number of cores/2 doesn't seem to
+# have much impact in off peak times.
+use constant {
+    BATCHSIZE => 10000,
+    MAXCHILD => 8
+};
+
+# Globals for the command line options:
+my $do_browse = 1; # Do the browse reingest.
+my $do_attrs = 1; # Do the record attributes reingest.
+my $do_search = 1; # Do the search reingest.
+my $do_facets = 1; # Do the facets reingest.
+
+# Command line options to skip different reingests. In this case, we
+# use the '-' to indicate a minus or a no, so to
+# skip browse reingest: -browse or -b
+# skip attribute reingest: -attributes or -a
+# skip search reingest: -search or -s
+# skip facet reingest: -facets or -f
+foreach (@ARGV) {
+    if (/^-b(?:rowse)?$/) {
+        $do_browse = 0;
+    } elsif (/^-a(?:ttr(?:ibute)?s?)?$/) {
+        $do_attrs = 0;
+    } elsif (/^-s(?:earch)?$/) {
+        $do_search = 0;
+    } elsif (/^-f(?:acets?)?$/) {
+        $do_facets = 0;
+    } else {
+        # TODO: Add usage() function to report allowed options.
+        die ("Unrecognized option: $_");
+    }
+}
+
+# "Gimme the keys!  I'll drive!"
+my $q = <<END_OF_Q;
+SELECT id
+FROM biblio.record_entry
+WHERE deleted = 'f'
+AND id > 0
+ORDER BY id ASC
+END_OF_Q
+
+# Stuffs needed for looping, tracking how many lists of records we
+# have, storing the actual list of records, and the list of the lists
+# of records.
+my ($count, $lists, $records) = (0,0,[]);
+my @lol = ();
+# To do the browse-only ingest:
+my @blist = ();
+
+# All of the DBI->connect() calls in this file assume that you have
+# configured the PGHOST, PGPORT, PGDATABASE, PGUSER, and PGPASSWORD
+# variables in your execution environment.  If you have not, you have
+# two options:
+#
+# 1) configure them
+#
+# 2) edit the DBI->connect() calls in this program so that it can
+# connect to your database.
+my $dbh = DBI->connect('DBI:Pg:');
+
+my $results = $dbh->selectall_arrayref($q);
+foreach my $r (@$results) {
+    my $record = $r->[0];
+    push(@blist, $record); # separate list of browse-only ingest
+    push(@$records, $record);
+    if (++$count == BATCHSIZE) {
+        $lol[$lists++] = $records;
+        $count = 0;
+        $records = [];
+    }
+}
+$lol[$lists++] = $records if ($count); # Last batch is likely to be
+                                       # small.
+$dbh->disconnect();
+
+# We're going to reuse $count to keep track of the total number of
+# batches processed.
+$count = 0;
+
+# @running keeps track of the running child processes.
+my @running = ();
+
+# We start the browse-only ingest before starting the other ingests.
+browse_ingest(@blist) if ($do_browse);
+
+# We loop until we have processed all of the batches stored in @lol:
+while ($count < $lists) {
+    if (scalar(@lol) && scalar(@running) < MAXCHILD) {
+        # Reuse $records for the lulz.
+        $records = shift(@lol);
+        if ($do_search || $do_facets || $do_attrs) {
+            reingest($records);
+        } else {
+            $count++;
+        }
+    } else {
+        my $pid = wait();
+        if (grep {$_ == $pid} @running) {
+            @running = grep {$_ != $pid} @running;
+            $count++;
+            print "$count of $lists processed\n";
+        }
+    }
+}
+
+# This subroutine forks a process to do the browse-only ingest on the
+# @blist above.  It cannot be parallelized, but can run in parrallel
+# to the other ingests.
+sub browse_ingest {
+    my @list = @_;
+    my $pid = fork();
+    if (!defined($pid)) {
+        die "failed to spawn child";
+    } elsif ($pid > 0) {
+        # Add our browser to the list of running children.
+        push(@running, $pid);
+        # Increment the number of lists, because this list was not
+        # previously counted.
+        $lists++;
+    } elsif ($pid == 0) {
+        my $dbh = DBI->connect('DBI:Pg:');
+        my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, TRUE, FALSE, TRUE)");
+        foreach (@list) {
+            if ($sth->execute($_)) {
+                my $crap = $sth->fetchall_arrayref();
+            } else {
+                warn ("Browse ingest failed for record $_");
+            }
+        }
+        $dbh->disconnect();
+        exit(0);
+    }
+}
+
+# Fork a child to do the other reingests:
+
+sub reingest {
+    my $list = shift;
+    my $pid = fork();
+    if (!defined($pid)) {
+        die "Failed to spawn a child";
+    } elsif ($pid > 0) {
+        push(@running, $pid);
+    } elsif ($pid == 0) {
+        my $dbh = DBI->connect('DBI:Pg:');
+        reingest_attributes($dbh, $list) if ($do_attrs);
+        reingest_field_entries($dbh, $list) if ($do_facets || $do_search);
+        $dbh->disconnect();
+        exit(0);
+    }
+}
+
+# Reingest metabib field entries on a list of records.
+sub reingest_field_entries {
+    my $dbh = shift;
+    my $list = shift;
+    my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, ?, TRUE, ?)");
+    # Because reingest uses "skip" options we invert the logic of do variables.
+    $sth->bind_param(2, ($do_facets) ? 0 : 1);
+    $sth->bind_param(3, ($do_search) ? 0 : 1);
+    foreach (@$list) {
+        $sth->bind_param(1, $_);
+        if ($sth->execute()) {
+            my $crap = $sth->fetchall_arrayref();
+        } else {
+            warn ("metabib.reingest_metabib_field_entries failed for record $_");
+        }
+    }
+}
+
+# Reingest record attributes on a list of records.
+sub reingest_attributes {
+    my $dbh = shift;
+    my $list = shift;
+    my $sth = $dbh->prepare(<<END_OF_INGEST
+SELECT metabib.reingest_record_attributes(id, NULL::TEXT[], marc)
+FROM biblio.record_entry
+WHERE id = ?
+END_OF_INGEST
+    );
+    foreach (@$list) {
+        $sth->bind_param(1, $_);
+        if ($sth->execute()) {
+            my $crap = $sth->fetchall_arrayref();
+        } else {
+            warn ("metabib.reingest_record_attributes failed for record $_");
+        }
+    }
+}

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

Summary of changes:
 Open-ILS/src/Makefile.am                        |    3 +-
 Open-ILS/src/support-scripts/pingest.pl         |  317 +++++++++++++++++++++++
 docs/RELEASE_NOTES_NEXT/Cataloging/pingest.adoc |   70 +++++
 3 files changed, 389 insertions(+), 1 deletions(-)
 create mode 100755 Open-ILS/src/support-scripts/pingest.pl
 create mode 100644 docs/RELEASE_NOTES_NEXT/Cataloging/pingest.adoc


hooks/post-receive
-- 
Evergreen ILS




More information about the open-ils-commits mailing list