This patch contains repack_cleanup_callback() which calls to repack_drop() for cleaning temporary objects. repack_cleanup_callback() will be pushed on stack using pgut_atexit_push() at beginning so that it will pop on abort or exit of program.

This patch includes one global counter (temp_obj_num) which counts number of temporary objects created by pg_repack. Correct order of deletion of temporary object as per count avoids unintentional error messages.
This commit is contained in:
kotsachin
2015-04-17 13:07:01 +09:00
parent f4703be524
commit ad109edb5b
4 changed files with 79 additions and 28 deletions

View File

@ -1180,7 +1180,9 @@ call_atexit_callbacks(bool fatal)
pgut_atexit_item *item;
for (item = pgut_atexit_stack; item; item = item->next)
{
item->callback(fatal, item->userdata);
}
}
static void
@ -1195,10 +1197,11 @@ on_cleanup(void)
static void
exit_or_abort(int exitcode)
{
call_atexit_callbacks(true);
if (in_cleanup)
{
/* oops, error in cleanup*/
call_atexit_callbacks(true);
in_cleanup = false;
abort();
}
else