agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Justin Pryzby <[email protected]>
Subject: [PATCH v16 3/3] vacuum error callback for index cleanup
Date: Sat, 1 Feb 2020 22:41:48 -0600
---
src/backend/access/heap/vacuumlazy.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 5d4fb3d..c14a917 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -2427,6 +2427,8 @@ lazy_cleanup_index(Relation indrel,
IndexVacuumInfo ivinfo;
const char *msg;
PGRUsage ru0;
+ vacuum_error_callback_arg errcbarg;
+ ErrorContextCallback errcallback = { error_context_stack, vacuum_error_callback, &errcbarg, };
pg_rusage_init(&ru0);
@@ -2439,8 +2441,18 @@ lazy_cleanup_index(Relation indrel,
ivinfo.num_heap_tuples = reltuples;
ivinfo.strategy = vac_strategy;
+ /* Setup error traceback support for ereport() */
+ errcbarg.relnamespace = get_namespace_name(RelationGetNamespace(indrel));
+ errcbarg.indname = RelationGetRelationName(indrel);
+ errcbarg.relname = get_rel_name(indrel->rd_index->indexrelid);
+ errcbarg.phase = PROGRESS_VACUUM_PHASE_INDEX_CLEANUP;
+ error_context_stack = &errcallback;
+
*stats = index_vacuum_cleanup(&ivinfo, *stats);
+ /* Pop the error context stack */
+ error_context_stack = errcallback.previous;
+
if (!(*stats))
return;
@@ -3469,5 +3481,10 @@ vacuum_error_callback(void *arg)
errcontext(_("while vacuuming index \"%s.%s\" of relation \"%s\""),
cbarg->relnamespace, cbarg->indname, cbarg->relname);
break;
+
+ case PROGRESS_VACUUM_PHASE_INDEX_CLEANUP:
+ errcontext(_("while cleaning up index \"%s.%s\" of relation \"%s\""),
+ cbarg->relnamespace, cbarg->indname, cbarg->relname);
+ break;
}
}
--
2.7.4
--Ubca5Sl/zyRO+Ah+--
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v16 3/3] vacuum error callback for index cleanup
In-Reply-To: <no-message-id-187634@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox