From 8a6b3aaa467ca066c839b337ca524e48715bf101 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Aug 2017 14:03:08 -0400 Subject: [PATCH] JBAS-1554 Circ history checker log cleanup Log each affected user once (instead of once per circ) for ease of manual cleanup. Signed-off-by: Bill Erickson --- KCLS/sql/schema/tools/circ-history-migrate-check.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/KCLS/sql/schema/tools/circ-history-migrate-check.sql b/KCLS/sql/schema/tools/circ-history-migrate-check.sql index dc7877d3b5..c152bacd86 100644 --- a/KCLS/sql/schema/tools/circ-history-migrate-check.sql +++ b/KCLS/sql/schema/tools/circ-history-migrate-check.sql @@ -22,6 +22,7 @@ DECLARE usr_count INTEGER DEFAULT 0; migrated_count INTEGER DEFAULT 0; pending_count INTEGER DEFAULT 0; + has_pending BOOLEAN; BEGIN FOR cur_usr IN WITH history_users AS ( @@ -34,6 +35,7 @@ BEGIN ) SELECT users.id FROM history_users users ORDER BY users.id LOOP usr_count := usr_count + 1; + has_pending := FALSE; FOR cur_circ IN SELECT * FROM action.usr_visible_circs(cur_usr) LOOP PERFORM TRUE FROM action.usr_circ_history WHERE source_circ = cur_circ.id; @@ -41,12 +43,16 @@ BEGIN IF FOUND THEN migrated_count := migrated_count + 1; ELSE - RAISE NOTICE 'User % [offset = %] has pending circs', - cur_usr, (usr_count - 1); + has_pending := TRUE; pending_count := pending_count + 1; END IF; END LOOP; + IF has_pending THEN + RAISE NOTICE 'User % [offset = %] has pending circs', + cur_usr, (usr_count - 1); + END IF; + IF (usr_count % 10000) = 0 THEN RAISE NOTICE 'Processed % patrons', usr_count; RAISE NOTICE 'Pending circs: %', pending_count; -- 2.11.0