Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XHY4U-0006o0-Ky for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 12:54:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XHY4T-0000yP-3U for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 12:54:29 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XHY4Q-0000yG-U8 for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 12:54:27 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XHY4I-0006Pd-T6 for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 12:54:24 +0000 Received: by mail-pa0-f47.google.com with SMTP id kx10so14892820pab.34 for ; Wed, 13 Aug 2014 05:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:references:in-reply-to:subject:date :mime-version:content-type:content-transfer-encoding; bh=cCIwjKRcXXW3TWrWvrqqTpHMxvCIdf3UKsYkCg/1RGE=; b=XwdlSR1YFiOhVuNqTjUSF/AsF2CZDH/0bv4+1IjTp/QU7908ovk/0lKm3hBgtj+i+3 VR+rt2NSOZL1NHzsPMihrWcwg3SK1f7reKzsnS7PcqiCyrHNlGC8SFZ+i05oGqhqchq4 kfYD6xDuH/BI/XHXMH+YU9KXGL6HkXn7/8T1/5GkJm9ypjpaY20dXS3Fg+LT10eUSaHM aBr68gkU5qPDLekzaruPou9YmnxfdXiGCiPwskiTQ9uudTS5YAFNLU67v+YE5TuEu9yJ gPLO2gKbRc2sScNpCLdlkXMgp/Qh9ps2BP9bzQbBcx3hHLyg6OnxavQ7M3syRUvm8Jb6 H0bQ== X-Received: by 10.66.240.197 with SMTP id wc5mr3868199pac.87.1407934457607; Wed, 13 Aug 2014 05:54:17 -0700 (PDT) Received: from maumau (p23196-ipngn100307sizuokaden.shizuoka.ocn.ne.jp. [153.131.144.196]) by mx.google.com with ESMTPSA id t7sm2982397pdj.94.2014.08.13.05.54.14 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Aug 2014 05:54:16 -0700 (PDT) Message-ID: <246F964E3CEB4B8D85FC5876CA37CC36@maumau> From: "MauMau" To: "Pavan Deolasee" , "Andres Freund" Cc: "Tom Lane" , "maxim.boguk" , "Pg Bugs" References: <20140617032438.2585.42918@wrigleys.postgresql.org> <20140618101045.GG3115@awork2.anarazel.de> <20140618110240.GJ3115@awork2.anarazel.de> <11621.1403099146@sss.pgh.pa.us> <20140618141949.GC3968@awork2.anarazel.de> In-Reply-To: Subject: Re: BUG #10675: alter database set tablespace and unlogged table Date: Wed, 13 Aug 2014 21:57:08 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463 X-Pg-Spam-Score: -1.3 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org From: "Pavan Deolasee" >> Anyone else has an opinion on this? >> >> > Since I did not hear anything on this, I created a patch that adds a new > flag to tell checkpointer to flush all pages to the disk. Tom (and even I) > have reservations about the approach, but I would nevertheless leave it to > the committer to decide. IMV we must fix this bug one way or the other. > Otherwise users face risk of failing to do clean shutdown. I'm reviewing this patch. According to the approach of the patch, CREATE DATABASE also needs the new flag to sync the unlogged tables before copying them from source database to the new one. You need to check other places which do checkpointing. I'm with Tom-san: I think it would be better for online checkpoints to sync unlogged tables without a new flag. The reasons are: * There's a greater danger of losing data during operating system restart. For example, IIRC, Windows gives only 20 seconds to terminate all services during OS shutdown. If many dirty buffers for unlogged tables linger in the shared buffers, PostgreSQL service may fail to complete database shutdown. Even if the online checkpoint writes out all dirty buffers, the possibility of there being many dirty buffers at shutdown is not zero, but the probability would be lower. * As you missed the CREATE DATABASE case, we may fail to specify the new flag when necessary in the future code. * Unlogged tables are, as its name suggests, for better performance by not writing WAL. * If the online checkpoint leaves dirty buffers, it would be more probable that the backends have to write them out when evicting the buffers. This may also indicate some influence on how to interpret pg_stat_bgwriter. I'm inclined to just make the online checkpoint write out all dirty buffers. Could you consider this again? Let me mark this as waiting on authoer now. Regards MauMau -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs