From 195cb619299cfc66c011bf59e2ac56677204168e Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 24 Jan 2019 11:14:33 -0500 Subject: [PATCH] Lp 1811696: Add --update-rmsr option to pingest.pl Add an option to the pingest.pl support script to enable the updating of reporter.materialized_simple_record entries for the ingested records. Add a release note for the new feature. Signed-off-by: Jason Stephenson --- Open-ILS/src/support-scripts/pingest.pl | 24 +++++++++++++++++++++- .../Administration/pingest_update_rmsr.adoc | 19 +++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 docs/RELEASE_NOTES_NEXT/Administration/pingest_update_rmsr.adoc diff --git a/Open-ILS/src/support-scripts/pingest.pl b/Open-ILS/src/support-scripts/pingest.pl index d351cfacb5..9a17f3c718 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 $update_rmsr; # Update reporter.materialized_simple_record table. 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 @@ -60,6 +61,7 @@ GetOptions( 'skip-search' => \$skip_search, 'skip-facets' => \$skip_facets, 'skip-display' => \$skip_display, + 'update-rmsr' => \$update_rmsr, 'start-id=i' => \$start_id, 'end-id=i' => \$end_id, 'pipe' => \$opt_pipe, @@ -86,6 +88,10 @@ sub help { --skip-display Skip the selected reingest component + --update-rmsr + Update reporter.materialized_simple_record entries. + This does NOT happen unless this option is specified. + --start-id Start processing at this record ID. @@ -202,7 +208,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 && $skip_display) { + if ($skip_search && $skip_facets && $skip_attrs && $skip_display && !$update_rmsr) { $count++; } else { reingest($records); @@ -272,6 +278,7 @@ sub reingest { reingest_attributes($dbh, $list) unless ($skip_attrs); reingest_field_entries($dbh, $list) unless ($skip_facets && $skip_search && $skip_display); + rmsr_update($dbh, $list) if ($update_rmsr); $dbh->disconnect(); exit(0); } @@ -315,3 +322,18 @@ END_OF_INGEST } } } + +# Update reporter.materialized_simple_record entries. +sub rmsr_update { + my $dbh = shift; + my $list = shift; + my $sth = $dbh->prepare('SELECT reporter.simple_record_update(?)'); + foreach (@$list) { + $sth->bind_param(1, $_); + if ($sth->execute()) { + my $crap = $sth->fetchall_arrayref(); + } else { + warn ("reporter.simple_record_update failed for record $_"); + } + } +} diff --git a/docs/RELEASE_NOTES_NEXT/Administration/pingest_update_rmsr.adoc b/docs/RELEASE_NOTES_NEXT/Administration/pingest_update_rmsr.adoc new file mode 100644 index 0000000000..5be510f2c3 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Administration/pingest_update_rmsr.adoc @@ -0,0 +1,19 @@ +pingest.pl New --update-rmsr Option +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The pingest.pl support script has a new option, `--update-rmsr`, that +can be used to update entries in the +reporter.materialized_simple_record table for the records being +processed by pingest.pl. Unlike most of the options, this is not a +skip option. It needs to be enabled for this update to take place. + +Furthermore, this option is not meant to be used to rebuild the +reporter.materialized_simple_record table wholesale. If that is your +goal, you are better off connecting to the database directly and +running the following SQL: + +[source,sql] +----- +SELECT reporter.disable_materialized_simple_record_trigger(); +SELECT reporter.enable_materialized_simple_record_trigger(); +---- -- 2.11.0