Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit eb2ea8d

Browse files
committed
Disable CFS GC during pg_restore
1 parent 598030c commit eb2ea8d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ RestoreArchive(Archive *AHX)
314314
bool parallel_mode;
315315
TocEntry *te;
316316
OutputContext sav;
317+
bool gc_was_enabled = false;
317318

318319
AH->stage = STAGE_INITIALIZING;
319320

@@ -455,6 +456,16 @@ RestoreArchive(Archive *AHX)
455456
ahprintf(AH, "BEGIN;\n\n");
456457
}
457458

459+
/*
460+
* Stop CFS GC
461+
*/
462+
if (AH->connection)
463+
{
464+
PGresult *res = ExecuteSqlQuery((Archive*)AH, "select cfs_enable_gc(false)", PGRES_TUPLES_OK);
465+
gc_was_enabled = *PQgetvalue(res, 0, 0);
466+
PQclear(res);
467+
}
468+
458469
/*
459470
* Establish important parameter values right away.
460471
*/
@@ -693,6 +704,12 @@ RestoreArchive(Archive *AHX)
693704
ahprintf(AH, "COMMIT;\n\n");
694705
}
695706

707+
if (gc_was_enabled)
708+
{
709+
PGresult *res = ExecuteSqlQuery((Archive*)AH, "select cfs_enable_gc(true)", PGRES_TUPLES_OK);
710+
PQclear(res);
711+
}
712+
696713
if (AH->public.verbose)
697714
dumpTimestamp(AH, "Completed on", time(NULL));
698715

0 commit comments

Comments
 (0)