kumquat-buildroot/package/timescaledb/0015-Adjust-copy-to-PG13-HEAP_INSERT_SKIP_WAL-change.patch
Maxim Kochetkov 5cff0c8a2d package/timescaledb: bump to version 2.0.0
Add patches needed for compatibility with Postgresql 13, which are
still under review upstream.

Debug builds (BR2_ENABLE_DEBUG=y) fails because of warnings, so
disable WARNINGS_AS_ERRORS.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-01-21 22:48:16 +01:00

52 lines
1.5 KiB
Diff

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