Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWh9H-0008Vv-SQ for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Oct 2021 15:42:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mWh9F-0005Xk-Ux for pgsql-hackers@arkaria.postgresql.org; Sat, 02 Oct 2021 15:42:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWh9F-0005Xc-IE for pgsql-hackers@lists.postgresql.org; Sat, 02 Oct 2021 15:42:01 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mWh9B-0002m7-UZ for pgsql-hackers@postgresql.org; Sat, 02 Oct 2021 15:42:00 +0000 Received: by mail-io1-xd33.google.com with SMTP id s20so15178573ioa.4 for ; Sat, 02 Oct 2021 08:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nIDM25VveOc3xa5iQDkEL7IKc2mkrrVLqcXxNRR89T4=; b=6QRAaOigafKnahNfe4qRFhdf5w0/D4QjexXJc/Wo1f9mStYwFAnxeCpR/56NyDC3xW 5gZbRDS1vQbqbUu4sHxLq0KLIVpFVyfgreM2HSi2DxB1OSJbzdzzu6c8Ogm2NB+T4blk he4N6E64bJv5Ik8kJN0TKq5n6lLaUhpi8nfZcBIH68vzEgKhPcem4dDMqNUbzVlJdZrZ HpzRmI84SNMDwP8SG7n9zIcepvdfBChNt58beQB+nnep5wl7hoNfd4G/+WMhQgUvvRaj a8kB+5xdgYtDEbdUYm2LM0CefUK8MgHJvkHdR7ZVDdze25FVo3FPYeVWjez3kPlGZ7X3 qfjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nIDM25VveOc3xa5iQDkEL7IKc2mkrrVLqcXxNRR89T4=; b=5qAmUDaehI/xzntweUF7sWj3coHwyddPWJ1ZxbzG5LuzlbNFc6sakMSlxEK8sW91C6 sPmYbUtx7AwsmYgdiHODjTu1nFX9XzjRCYPZOl5YBMyB5ReCFbpJKzRuEeL7Qw28BnUS NyikPg82Zds5ijsPqkrY378+cDLb+V+5r8vXilQgeLtL2lsGJYGlYYw95S3MIBeJdccr GAdiuQv2YB4wBK2n9RJoyK/EMmezQz2/YfFD9abun/nKfOnYaWmU2h4xzRrza7V4BEJ+ a3UbG6NyTJOPyzMzeOqqfKgkinH4of2yqp7mZrrX7H4kseluzKxWUsLwpgJ+Am9gl41a 2iuQ== X-Gm-Message-State: AOAM533LmvXTI89WanXpYGKlaENfmycfBhOBwPT/iV9OdRi1t757rvjC aFFyoVRPQM/vtJwJsYbBx9Hq7Q== X-Google-Smtp-Source: ABdhPJyYQjZDrpz5cO3VhmiDbI3HR/8G5O7mN3zhNuMZ0a4taEZr50h3V5sGq8TwpSoRKIUlOiUVkQ== X-Received: by 2002:a02:ceaf:: with SMTP id z15mr3244988jaq.117.1633189315968; Sat, 02 Oct 2021 08:41:55 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id c14sm5387810ioz.21.2021.10.02.08.41.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Oct 2021 08:41:55 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 95E7C800B42; Sat, 2 Oct 2021 10:41:54 -0500 (CDT) Date: Sat, 2 Oct 2021 10:41:54 -0500 From: Justin Pryzby To: Thomas Munro Cc: Michael Paquier , David Steele , Fujii Masao , Bruce Momjian , Paul Guo , Tom Lane , Michael Brown , pgsql-hackers Subject: Re: should frontend tools use syncfs() ? Message-ID: <20211002154154.GD27491@telsasoft.com> References: <20210930004340.GM831@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 30, 2021 at 05:08:24PM +1300, Thomas Munro wrote: > On Thu, Sep 30, 2021 at 4:49 PM Michael Paquier wrote: > > fsync_pgdata() is going to manipulate many inodes anyway, because > > that's a code path designed to do so. If we know that syncfs() is > > just going to be better, I'd rather just call it by default if > > available and not add new switches to all the frontend tools in need > > of flushing the data folder, switches that are not documented in your > > patch. > > If we want this it should be an option, because it flushes out data > other than the pgdata dir, and it doesn't report errors on old > kernels. I ran into bad performance of initdb --sync-only shortly after adding it to my db migration script, so added initdb --syncfs. I found that with sufficiently recent coreutils, I can do what's wanted by calling /bin/sync -f /datadir Since it's not integrated into initdb, it's necessary to include each tablespace and wal. -- Justin