kumquat-buildroot/package/timescaledb/0015-Adjust-copy-to-PG13-HEAP_INSERT_SKIP_WAL-change.patch

52 lines
1.5 KiB
Diff
Raw Normal View History

From 399acf6de6d02b3362faa13379b6bd948b91e20c Mon Sep 17 00:00:00 2001
From: Sven Klemm <sven@timescale.com>
Date: Fri, 2 Oct 2020 00:58:57 +0200
Subject: [PATCH] Adjust copy to PG13 HEAP_INSERT_SKIP_WAL change
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Fetch from: https://github.com/timescale/timescaledb/pull/2498/commits/446f977be8ead518579b3c5b2458429f27518b48.patch
---
src/copy.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/copy.c b/src/copy.c
index e38ae15e..1187a696 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -27,6 +27,7 @@
#include <parser/parse_collate.h>
#include <parser/parse_relation.h>
#include <storage/bufmgr.h>
+#include <storage/smgr.h>
#include <utils/builtins.h>
#include <utils/guc.h>
#include <utils/lsyscache.h>
@@ -215,8 +216,10 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call
ccstate->rel->rd_newRelfilenodeSubid != InvalidSubTransactionId)
{
ti_options |= HEAP_INSERT_SKIP_FSM;
+#if PG13_LT
if (!XLogIsNeeded())
ti_options |= HEAP_INSERT_SKIP_WAL;
+#endif
}
/*
@@ -449,8 +452,13 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, void (*call
* If we skipped writing WAL, then we need to sync the heap (but not
* indexes since those use WAL anyway)
*/
+#if PG13_LT
if (ti_options & HEAP_INSERT_SKIP_WAL)
heap_sync(ccstate->rel);
+#else
+ if (!RelationNeedsWAL(ccstate->rel))
+ smgrimmedsync(ccstate->rel->rd_smgr, MAIN_FORKNUM);
+#endif
return processed;
}
--
2.29.2