0002-Break-fsyncs-for-testing-not-for-commit.patch
application/octet-stream
Filename: 0002-Break-fsyncs-for-testing-not-for-commit.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch 0002
Subject: Break fsyncs for testing, not for commit.
| File | + | − |
|---|---|---|
| src/backend/storage/smgr/md.c | 12 | 0 |
From 223ca88239f6950ccd27e6f75983ecd42edb7762 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Fri, 6 Apr 2018 12:01:37 +1200
Subject: [PATCH 2/2] Break fsyncs for testing, not for commit.
---
src/backend/storage/smgr/md.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 27c55de16a..930b3111c3 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -39,6 +39,18 @@
#include "utils/memutils.h"
#include "pg_trace.h"
+#include <unistd.h>
+
+static int broken_fsync(int fd, int x)
+{
+ if (access("/tmp/broken_fsync", F_OK) != -1)
+ {
+ errno = EIO;
+ return -1;
+ }
+ return FileSync(fd, x);
+}
+#define FileSync(a, b) broken_fsync(a, b)
/* intervals for calling AbsorbFsyncRequests in mdsync and mdpostckpt */
#define FSYNCS_PER_ABSORB 10
--
2.16.2