From b198d0d1c37314920e83d7edce529d2cdb1214b0 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Wed, 3 Apr 2019 13:30:07 -0400 Subject: [PATCH] Lp 1811696: Add --rebuild-rmsr option to pingest.pl 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 Signed-off-by: Galen Charlton --- Open-ILS/src/support-scripts/pingest.pl | 16 ++++++++++++++++ .../Administration/pingest-rebuild-rmsr.adoc | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 docs/RELEASE_NOTES_NEXT/Administration/pingest-rebuild-rmsr.adoc diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl index c39981a9f4..b3a3e4097f 100755 --- a/Open-ILS/src/support-scripts/pingest.pl +++ b/Open-ILS/src/support-scripts/pingest.pl @@ -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 index 0000000000..f8f858fe78 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Administration/pingest-rebuild-rmsr.adoc @@ -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(); +---- -- 2.11.0