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 1hg9Up-0007B4-GO for pgsql-general@arkaria.postgresql.org; Wed, 26 Jun 2019 15:06:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hg9Uo-0003yc-CK for pgsql-general@arkaria.postgresql.org; Wed, 26 Jun 2019 15:06:02 +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 1hg9Uo-0003yV-2y for pgsql-general@lists.postgresql.org; Wed, 26 Jun 2019 15:06:02 +0000 Received: from mail-qt1-f193.google.com ([209.85.160.193]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hg9Ul-0000Oq-1k for pgsql-general@lists.postgresql.org; Wed, 26 Jun 2019 15:06:01 +0000 Received: by mail-qt1-f193.google.com with SMTP id w40so2758535qtk.0 for ; Wed, 26 Jun 2019 08:05:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:reply-to:from:subject:organization:message-id :date:user-agent:mime-version:content-language :content-transfer-encoding; bh=vYz/S8FVWoflcYGu2oZO6ZDzqZ42owgzMYdRUhkdgiM=; b=ojVtLI6Gdweje3GVswj7IxcHtq1wesTTo4Y69/DwUCuDGfaZ5jtBAqEaVGsH9FdZeD 2H1uTUvAY+BOMZPCli5bK1IZfisi1WTXCPNRy9VGW4pMODvWmoGHwE3qcD2J5naV+BKv qZRrmxMqbGWZeZFSfkSOHdh4KLz8NvLyIZWlwJW0cZupvi7Qi6dG/rCPAM6ntH5kKmVZ NwNU4Y0TxcalF6Bw7Dt7+SEMb3CIyO4ZzzpfKpUZIR6L82luN2VkbaqV/z0g6dEcZLhO /0RGkCZ7LAlDodMk1N5f1vOUcenJqNnrdlR4gKaaoWDHscZYZ4AB6Y2/oj6DlkDjWWEh ELVw== X-Gm-Message-State: APjAAAW+3q2j1a5evKnypCUmFXLMOfQ+8y+nlNejDx2pD1mzHOeeeCOu 6XqhAGxIrojqnXv+VUsVkL6/aHrkAt4= X-Google-Smtp-Source: APXvYqwVTivE4EC6d+bYAE5jNAeKAVNq3+EWmVHS591mk2ZSjBOMFace/SzBTzTZnCKS/AGVA5g9zg== X-Received: by 2002:ac8:38a4:: with SMTP id f33mr4252547qtc.163.1561561556215; Wed, 26 Jun 2019 08:05:56 -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 o17sm7855822qkm.6.2019.06.26.08.05.55 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 08:05:55 -0700 (PDT) To: pgsql-general@lists.postgresql.org Reply-To: jesper.pedersen@redhat.com From: Jesper Pedersen Subject: pg_receivelwal vs synchronous Organization: Red Hat Message-ID: <94c4d130-8efa-35c4-ba86-789f2cd9acfa@redhat.com> Date: Wed, 26 Jun 2019 11:05:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; 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, PostgreSQL 11.4 Given, postgresql.conf: ---------------- wal_level = replica synchronous_commit = remote_apply synchronous_standby_names = '*' CREATE ROLE repluser WITH LOGIN REPLICATION PASSWORD 'mypwd'; SELECT pg_create_physical_replication_slot('replica1'); Execute pg_receivewal -D /tmp/wal/ -S replica1 --synchronous -p 5432 -h localhost -U repluser -W --dbname="application_name=replica1" gives LOG: standby "replica1" is now a synchronous standby with priority 1 Then psql -c 'CREATE DATABASE test' postgres which hangs (committed locally). postgres=# SELECT * FROM pg_replication_slots ; slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn -----------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+--------------------- replica1 | | physical | | | f | t | 12502 | | | 0/1655508 | (1 row) postgres=# SELECT * FROM pg_stat_replication; pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | backend_xmin | state | sen t_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state -------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+--------------+-----------+---- -------+-----------+-----------+------------+-----------------+-----------------+-----------------+---------------+------------ 12502 | 16384 | repluser | replica1 | ::1 | | 45816 | 2019-06-26 11:00:45.098276-04 | | streaming | 0/1 655508 | 0/1655508 | 0/1655508 | | 00:00:00.000267 | 00:00:00.000267 | 00:02:14.938836 | 1 | sync (1 row) So, replica1 is active and in sync mode, but replay_lsn is never updated, and replay_lag keeps increasing. What am I missing here ? Thanks in advance ! Best regards, Jesper