Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hoWGL-0005Jz-5u for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jul 2019 17:01:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hoWGJ-0006DZ-SU for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jul 2019 17:01:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hoWGJ-0006DO-JQ for pgsql-hackers@lists.postgresql.org; Fri, 19 Jul 2019 17:01:39 +0000 Received: from mail-qt1-f196.google.com ([209.85.160.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hoWGC-0004ds-Bp for pgsql-hackers@postgresql.org; Fri, 19 Jul 2019 17:01:39 +0000 Received: by mail-qt1-f196.google.com with SMTP id r6so27519156qtt.0 for ; Fri, 19 Jul 2019 10:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=LYCwN8q7fslthOq9ciQ8835QhJHOG4/+YmNKJ6ZRW60=; b=MCFuHZQARwjwDCCb/NUhQ0RwuFRIy6cOdXrBOKSQoaaQjf8ItnTthbAVlRnIzB1rnS WBN+9VQtmOFODk7INMCHkeRozkHwVl9Kg6/pewGd08otPC7kXQqnJIspYitcmIFBkEue +qbCsIY6ZWTZb2AteLyjmxN7rEeON3FJKemDet17/9sK88Qz1hNzjzHDgxe0bBh7XLmB sC8lIcOC18ZRqhVtozhBY3776F+PqWU47Y3M9M4AshIKZqvNiLLDxKdoUb3R/ISaAMgX yzMTmZl9dDtPFmhsll0M575Y5EnevyzReHIPxEePzz8GFGo+HhVrEUiV/vUHmVD8if5l n70Q== X-Gm-Message-State: APjAAAUROfnmi/+1Q57vwP9YTP8H8OnxNUQ2aVidEMUD3Ti5lZY4yaOl ce+dH/RTVshgHTjVVdSLZPbY3QWZJ4KoKg== X-Google-Smtp-Source: APXvYqyQ+gKCcTwMuJPFzhm3R2mcn/1yiNdSMCZDS879JDG2oqLjkD+C/qVV1wTn8bGnKR4KXUgskw== X-Received: by 2002:ac8:768b:: with SMTP id g11mr39078224qtr.182.1563555689988; Fri, 19 Jul 2019 10:01:29 -0700 (PDT) Received: from localhost.localdomain (c-24-61-8-151.hsd1.ma.comcast.net. [24.61.8.151]) by smtp.gmail.com with ESMTPSA id l63sm14039423qkb.124.2019.07.19.10.01.28 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jul 2019 10:01:28 -0700 (PDT) Reply-To: jesper.pedersen@redhat.com Subject: Re: pg_receivewal documentation To: Michael Paquier Cc: Laurenz Albe , Alvaro Herrera , PostgreSQL-development References: <54779de5-f922-c0cf-629d-b582eded7265@redhat.com> <20190716050555.GA1439@paquier.xyz> <65c3ecdf-8995-34cb-83c4-50068877e632@redhat.com> <20190717013835.GA2130@paquier.xyz> <44e51f9f60abb872854879c91da0ed3b67a6ba95.camel@cybertec.at> <20190717080424.GB20614@paquier.xyz> <7eaf748c-3f40-c994-0eb3-7d87709588d0@redhat.com> <184780f1f90a31c4c8b53f0e6328bf5aaae4f786.camel@cybertec.at> <20190719010903.GC1859@paquier.xyz> From: Jesper Pedersen Organization: Red Hat Message-ID: Date: Fri, 19 Jul 2019 13:01:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190719010903.GC1859@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 7/18/19 9:09 PM, Michael Paquier wrote: >> pg_receivewal -D /tmp/wal -S replica1 --synchronous -h localhost -p 5432 -U >> repluser -W >> psql -c 'SELECT * FROM pg_stat_replication;' postgres >> psql -c 'SELECT * FROM pg_replication_slots;' postgres >> psql -c 'CREATE DATABASE test' postgres >> >> In what scenarios do you see 'on' working ? > > Because the code says so, "on" is an alias for "remote_flush" (which > is not user-visible by the way): > src/include/access/xact.h:#define SYNCHRONOUS_COMMIT_ON > SYNCHRONOUS_COMMIT_REMOTE_FLUSH > > And if you do that it works fine (pg_receivewal --synchronous runs in > the background and I created a dummy table): > =# SELECT application_name, sync_state, flush_lsn, replay_lsn FROM > pg_stat_replication; > application_name | sync_state | flush_lsn | replay_lsn > ------------------+------------+-----------+------------ > pg_receivewal | sync | 0/15E1F88 | null > (1 row) > =# set synchronous_commit to on ; > SET > =# insert into aa values (2); > INSERT 0 1 > I forgot to use pg_receivewal -d with application_name instead of -h -p -U. Maybe we should have an explicit option for that, but that is a separate thread. Best regards, Jesper