Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fCRw0-0007ol-DD for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Apr 2018 15:38:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fCRvz-0002pn-9F for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Apr 2018 15:38:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fCRvy-0002pd-UG for pgsql-hackers@lists.postgresql.org; Sat, 28 Apr 2018 15:38:47 +0000 Received: from mout.gmx.net ([212.227.15.15]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fCRvv-0003aZ-Cw for pgsql-hackers@postgresql.org; Sat, 28 Apr 2018 15:38:45 +0000 Received: from nighthawk.chemicalconnection.dyndns.org ([88.217.96.158]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MV5tl-1erulH1yZR-00YRbb; Sat, 28 Apr 2018 17:38:30 +0200 Received: from mbanck by nighthawk.chemicalconnection.dyndns.org with local (Exim 4.84_2) (envelope-from ) id 1fCRt6-0007wf-GD; Sat, 28 Apr 2018 17:35:48 +0200 Date: Sat, 28 Apr 2018 17:35:48 +0200 From: Michael Banck To: Stephen Frost Cc: Craig Ringer , Andres Freund , PostgreSQL Hackers Subject: Re: Postgres, fsync, and OSs (specifically linux) Message-ID: <20180428153548.GA24854@nighthawk.caipicrew.dd-dns.de> References: <20180427222842.in2e4mibx45zdth5@alap3.anarazel.de> <20180428152120.GS27724@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180428152120.GS27724@tamriel.snowman.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: X-Provags-ID: V03:K1:Kmj9mY9IBdqnJURLQM+NLK8jPuZBWM33akZFX1Rp4iw59kRPPDC 4jnKcNVug4RggdLX3QeFCuO6bTKjofAwyn1JjhPZsHAcdQcMxWHETtZr2P8SqqJd6MHrRHo MvMur/PjcFZ6TkPZ+Vncwps3BPfJ/DUUPLPXTIVTOPOzme4gZDJlvTgAAu+UZ5r7NWp/i67 w7FKg5SAzAkh1I1JlhaJg== X-UI-Out-Filterresults: notjunk:1;V01:K0:6VaJ7sVXNbI=:4N+cs1t5uL60R7EXrH6taX hHC3YGHvhkUg9wwl9+ObKvoLFrlWXp+T4h2CneyzQwT55NC9mYRQ3DRUUs0hFBJj/WbHRcMSN 6LzzqAEiY//dtG/WqyxFJBzm2V1+IE0qiE/zUmRZ3tZzVVhEbI7qwrwVJQe6NeeSs9AEaDt/3 8CUMJw2NOu7fdEHsGCqsS6oqamBn9wyuPlhAQe2rsQSl2wRVauDQ+2Dx3MTuHbLPHqPOcG4es Vn0v6i5MDgyEr3kQb1lFM5lE9WOv5S9aI+OcK9W5Prj29TK/4f5oIgfVb1M3qoc9K/emXj+Yd YRJ560CEEWA2v/QFPmrEFbbS1ZizvEMBz5IdXWCewfpUSrypHz3EUh2JNoEdiJxuVmrPkUi+C 4EQRSFnVaYq/cTlV88xW3GGx0GMqLJ2ENiMRCJ9kFONfugjPOWoWQ5ItB0p2/Pf9+ER+UcpFs /I31Z1UeVG9W2Xeufz7IEzItNL7+fOqVBrGeffnFngNvCutgRjF28dUPbsAaOSRNSMxmHYVww ZPTx5ghGwh2itEtyzldU3AKqfWZ5J9LoGg9ccnGkWnrlnJFSPoTV65KVfCCj2qhsIFg9xuTS+ qxZyFbPFlJkz+FGivbDSKIMHD4G30YPo70Cq8e4ErmXqxnSu0g6LghODps9MeHjdTYlvc4e4i +5F5xsgZwTS5CSd5gjnHHm/suq9BJbTJaTUJbHemIdI26cFnNvJzdWgBqpnmnaSD8mBqweCIf dlmejzuZUwaop4PvyCwd6gcexrdeIxbWGxUBatSDoDo2xKalLNhnm2wR25o= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On Sat, Apr 28, 2018 at 11:21:20AM -0400, Stephen Frost wrote: > * Craig Ringer (craig@2ndquadrant.com) wrote: > > On 28 April 2018 at 06:28, Andres Freund wrote: > > > - Add a pre-checkpoint hook that checks for filesystem errors *after* > > > fsyncing all the files, but *before* logging the checkpoint completion > > > record. Operating systems, filesystems, etc. all log the error format > > > differently, but for larger installations it'd not be too hard to > > > write code that checks their specific configuration. > > > > I looked into using trace event file descriptors for this, btw, but > > we'd need CAP_SYS_ADMIN to create one that captured events for other > > processes. Plus filtering the events to find only events for the files > > / file systems of interest would be far from trivial. And I don't know > > what guarantees we have about when events are delivered. > > > > I'd love to be able to use inotify for this, but again, that'd only be > > a new-kernels thing since it'd need an inotify extension to report I/O > > errors. > > > > Presumably mostly this check would land up looking at dmesg. > > > > I'm not convinced it'd get widely deployed and widely used, or that > > it'd be used correctly when people tried to use it. Look at the > > hideous mess that most backup/standby creation scripts, > > archive_command scripts, etc are. > > Agree with more-or-less everything you've said here, but a big +1 on > this. If we do end up going down this route we have *got* to provide > scripts which we know work and have been tested and are well maintained > on the popular OS's for the popular filesystems and make it clear that > we've tested those and not others. We definitely shouldn't put > something in our docs that is effectively an example of the interface > but not an actual command that anyone should be using. This dmesg-checking has been mentioned several times now, but IME enterprise distributions (or server ops teams?) seem to tighten access to dmesg and /var/log to non-root users, including postgres. Well, or just vanilla Debian stable apparently: postgres@fock:~$ dmesg dmesg: read kernel buffer failed: Operation not permitted Is it really a useful expectation that the postgres user will be able to trawl system logs for I/O errors? Or are we expecting the sysadmins (in case they are distinct from the DBAs) to setup sudo and/or relax permissions for this everywhere? We should document this requirement properly at least then. The netlink thing from Google that Tet Ts'O mentioned would probably work around that, but if that is opened up it would not be deployed anytime soon either. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.banck@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer