Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id DB226133655C for ; Fri, 18 Mar 2011 09:25:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 46931-05 for ; Fri, 18 Mar 2011 12:25:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iy0-f174.google.com (mail-iy0-f174.google.com [209.85.210.174]) by mail.postgresql.org (Postfix) with ESMTP id 43CD5133616B for ; Fri, 18 Mar 2011 09:25:49 -0300 (ADT) Received: by iyb26 with SMTP id 26so3919034iyb.19 for ; Fri, 18 Mar 2011 05:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XIe1GDEMvxGMbDf1qSspLbKYTfKJtMhMzJS1RUVUQbo=; b=V/ze1IyC2bwJwccdhvvyIDJAWi6k14V1TdObcebBCLFZiMxWXnb1l13FVAHAJW+44P DpvZHgfc3ZO3lpT7PBEyP4FBkXSJ8552k61Saq4D1rpPcAKuUVmAsVzri6azTYARIixF BDZUPvAHkEC8rRpvDKvr7sdi5voCa8hstWxhk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CJFk9FuEbwDmuit5tnB/hQyInzzG+ctYHU6FMtpEDtTRVgIBZYdpzL49C5ndjtsoVP SfblSFN66ECt0vRCl1L90hEtQUsntswsHpoYIjYnJ2JyDireEklpdV9mEs7nQjpGP5ke oqRRU8+Muk1xJQBiI/zbXu1LWz9gzmauyDmes= MIME-Version: 1.0 Received: by 10.42.140.9 with SMTP id i9mr1439951icu.227.1300451149371; Fri, 18 Mar 2011 05:25:49 -0700 (PDT) Received: by 10.43.47.129 with HTTP; Fri, 18 Mar 2011 05:25:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 18 Mar 2011 08:25:49 -0400 Message-ID: Subject: Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication. From: Robert Haas To: Fujii Masao Cc: Simon Riggs , PostgreSQL-development Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.72 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, FS_REPLICA=3.599, RCVD_IN_DNSWL_LOW=-0.7, SARE_SPEC_REPLICA=0.72 X-Spam-Level: * X-Archive-Number: 201103/1110 X-Sequence-Number: 184360 On Fri, Mar 18, 2011 at 2:25 AM, Fujii Masao wrote: > In the first place, I think that it's complicated to keep those two param= eters > separately. What about merging them to one parameter? What I'm thinking > is to remove synchronous_replication and to increase the valid values of > synchronous_commit from on/off to async/local/remote/both. Each value > works as follows. > > =A0 =A0async =A0 =3D (synchronous_commit =3D off && synchronous_replicati= on =3D off) > =A0 =A0"async" makes a transaction do local WAL flush and replication > asynchronously. > > =A0 =A0local =A0 =A0 =3D (synchronous_commit =3D on && synchronous_replic= ation =3D off) > =A0 =A0"local" makes a transaction wait for only local WAL flush. > > =A0 =A0remote =3D (synchronous_commit =3D off && synchronous_replication = =3D on) > =A0 =A0"remote" makes a transaction wait for only replication. Local WAL = flush is > =A0 =A0performed by walwriter. This is useless in 9.1 because we always m= ust > =A0 =A0wait for local WAL flush when we wait for replication. But in the = future, > =A0 =A0if we'll be able to send WAL before WAL write (i.e., send WAL from > =A0 =A0wal_buffers), this might become useful. In 9.1, it seems reasonabl= e to > =A0 =A0remove this value. > > =A0 =A0both =A0 =A0 =3D (synchronous_commit =3D on && synchronous_replica= tion =3D on) > =A0 =A0"both" makes a transaction wait for local WAL flush and replicatio= n. > > Thought? Well, if we want to make this all use one parameter, the obvious way to do it that wouldn't break backward compatibility is to remove the synchronous_replication parameter altogether and let synchronous_commit take on the values on/local/off, where on means wait for sync rep if it's enabled (i.e. synchronous_standby_names!=3D''&&max_wal_senders>0) or otherwise just wait for local WAL flush, local means just wait for local WAL flush, and off means commit asynchronously. I'm OK with doing it that way if there's consensus on it, but I'm not eager to break backward compatibility. Simon/Heikki, any opinion on that approach? If we don't have consensus on that then I think we should just do what I proposed above (and Simon agreed to). I am not eager to spend any longer than necessary hammering this out; I want to get to beta. --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company