aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginfast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gin/ginfast.c')
-rw-r--r--src/backend/access/gin/ginfast.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c
index 6b709dbdb3a..56a3ff590a4 100644
--- a/src/backend/access/gin/ginfast.c
+++ b/src/backend/access/gin/ginfast.c
@@ -438,8 +438,12 @@ ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
END_CRIT_SECTION();
+ /*
+ * Since it could contend with concurrent cleanup process we cleanup
+ * pending list not forcibly.
+ */
if (needCleanup)
- ginInsertCleanup(ginstate, false, true, NULL);
+ ginInsertCleanup(ginstate, false, true, false, NULL);
}
/*
@@ -725,7 +729,8 @@ processPendingPage(BuildAccumulator *accum, KeyArray *ka,
*/
void
ginInsertCleanup(GinState *ginstate, bool full_clean,
- bool fill_fsm, IndexBulkDeleteResult *stats)
+ bool fill_fsm, bool forceCleanup,
+ IndexBulkDeleteResult *stats)
{
Relation index = ginstate->index;
Buffer metabuffer,
@@ -742,7 +747,6 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
bool cleanupFinish = false;
bool fsm_vac = false;
Size workMemory;
- bool inVacuum = (stats == NULL);
/*
* We would like to prevent concurrent cleanup process. For that we will
@@ -751,7 +755,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean,
* insertion into pending list
*/
- if (inVacuum)
+ if (forceCleanup)
{
/*
* We are called from [auto]vacuum/analyze or gin_clean_pending_list()
@@ -1014,7 +1018,7 @@ gin_clean_pending_list(PG_FUNCTION_ARGS)
memset(&stats, 0, sizeof(stats));
initGinState(&ginstate, indexRel);
- ginInsertCleanup(&ginstate, true, true, &stats);
+ ginInsertCleanup(&ginstate, true, true, true, &stats);
index_close(indexRel, AccessShareLock);