0001-Log-a-warning-about-io_direct-at-startup-time.patch

text/x-patch

Filename: 0001-Log-a-warning-about-io_direct-at-startup-time.patch
Type: text/x-patch
Part: 0
Message: Re: Direct I/O

Patch

Format: format-patch
Series: patch 0001
Subject: Log a warning about io_direct at startup time.
File+
src/backend/postmaster/postmaster.c 6 0
From a9005129c939a8298c6668645588b2a8ef5064b6 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Mon, 1 May 2023 09:46:35 +1200
Subject: [PATCH] Log a warning about io_direct at startup time.

We've documented io_direct as an experimental developer-only feature,
but that documentation might be hard to find.  Let's also display a
warning about that in the server log.

Later proposals will provide the infrastructure to use it efficiently,
but by releasing this switch earlier we can learn about direct I/O
quirks in systems in the wild.

Discussion: https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 4c49393fc5..8f5c03fa46 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1432,6 +1432,12 @@ PostmasterMain(int argc, char *argv[])
 				 errhint("Set the LC_ALL environment variable to a valid locale.")));
 #endif
 
+	/* Temporary warning about experimental status of direct I/O support. */
+	if (io_direct_flags != 0)
+		ereport(WARNING,
+				(errmsg("io_direct is an experimental setting for developer testing only"),
+				 errhint("File I/O may be inefficient or not work on some file systems.")));
+
 	/*
 	 * Remember postmaster startup time
 	 */
-- 
2.40.1