Lp 1811696: Add --rebuild-rmsr option to pingest.pl
authorJason Stephenson <jstephenson@cwmars.org>
Wed, 3 Apr 2019 17:30:07 +0000 (13:30 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Sep 2019 22:00:33 +0000 (18:00 -0400)
Add the option to rebuild the reporter.materialized_simple_record
table to the pingest.pl support script.

Add release notes.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/support-scripts/pingest.pl
docs/RELEASE_NOTES_NEXT/Administration/pingest-rebuild-rmsr.adoc [new file with mode: 0644]

index c39981a..b3a3e40 100755 (executable)
@@ -34,6 +34,7 @@ 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 $rebuild_rmsr; # Rebuild reporter.materialized_simple_record.
 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
@@ -61,6 +62,7 @@ GetOptions(
     'skip-search'    => \$skip_search,
     'skip-facets'    => \$skip_facets,
     'skip-display'   => \$skip_display,
+    'rebuild-rmsr'   => \$rebuild_rmsr,
     'start-id=i'     => \$start_id,
     'end-id=i'       => \$end_id,
     'pipe'           => \$opt_pipe,
@@ -93,6 +95,8 @@ sub help {
         This option can be used more than once to specify multiple
         attributes to ingest.
         This option is ignored if --skip-attrs is also given.
+    --rebuild-rmsr
+        Rebuild the reporter.materialized_simple_record table.
 
     --start-id
         Start processing at this record ID.
@@ -230,6 +234,9 @@ while ($count < $lists) {
     }
 }
 
+# Rebuild reporter.materialized_simple_record after the ingests.
+rmsr_rebuild() if ($rebuild_rmsr);
+
 # 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.
@@ -324,3 +331,12 @@ END_OF_INGEST
         }
     }
 }
+
+# Rebuild/refresh reporter.materialized_simple_record
+sub rmsr_rebuild {
+    print("Rebuilding reporter.materialized_simple_record\n");
+    my $dbh = DBI->connect("DBI:Pg:database=$db_db;host=$db_host;port=$db_port;application_name=pingest",
+                           $db_user, $db_password);
+    $dbh->selectall_arrayref("SELECT reporter.refresh_materialized_simple_record();");
+    $dbh->disconnect();
+}
diff --git a/docs/RELEASE_NOTES_NEXT/Administration/pingest-rebuild-rmsr.adoc b/docs/RELEASE_NOTES_NEXT/Administration/pingest-rebuild-rmsr.adoc
new file mode 100644 (file)
index 0000000..f8f858f
--- /dev/null
@@ -0,0 +1,16 @@
+--rebuild-rmsr Option Added to pingest.pl
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+An option, `--rebuild-rmsr`, has been added to the pingest.pl support
+script.  This option will rebuild the
+reporter.materialized_simple_record (rmsr) table after the ingests are
+complete.
+
+This option might prove useful if you want to rebuild the table as
+part of a larger reingest.  If all you wish to do is to rebuild the
+rmsr table, then it would be just as simple to connect to the database
+server and run the following SQL:
+
+[source,sql]
+----
+SELECT reporter.refresh_materialized_simple_record();
+----