Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9Dq1-0003e3-JG for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Oct 2017 17:27:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9Dq0-0000y8-1M for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Oct 2017 17:27:00 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9DoR-0006Bw-ON for pgsql-hackers@postgresql.org; Mon, 30 Oct 2017 17:25:23 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9DoO-0005ma-6O for pgsql-hackers@postgresql.org; Mon, 30 Oct 2017 17:25:23 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 17DDF21C0670 for ; Mon, 30 Oct 2017 20:25:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru (unknown [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id DA06721C0624 for ; Mon, 30 Oct 2017 20:25:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1509384318; bh=nZ/FICvLklQ4ByIdac2I97qLKF+y+zHNMxoIq9HL/ek=; h=Date:From:To:Subject:In-Reply-To:References; b=nVXGoQc25X0o5MZH7lYsyl0aiPu+7YxU6vFrERZcUkuNqRTHP1anWi6EJgxVvXhOW 5l7Gn3p2tmx6CNxWEiUweA99tx73lFbBraE9F3v8Vx4q76FUieif+z8/rFntmpZv4m V8jpksBjdEaSO1h4c9Lz4rOochrI4kqix80RDQWk= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 30 Oct 2017 20:25:18 +0300 From: Ivan Kartyshov To: pgsql-hackers@postgresql.org Subject: Re: make async slave to wait for lsn to be replayed In-Reply-To: References: <0240c26c-9f84-30ea-fca9-93ab2df5f305@postgrespro.ru> Message-ID: X-Sender: i.kartyshov@postgrespro.ru User-Agent: Roundcube Webmail/1.2.4 List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Ants Aasma писал 2017-10-26 17:29: > On Mon, Oct 23, 2017 at 12:29 PM, Ivan Kartyshov > wrote: >> Ants Aasma писал 2017-09-26 13:00: >>> >>> Exposing this interface as WAITLSN will encode that visibility order >>> matches LSN order. This removes any chance of fixing for example >>> visibility order of async/vs/sync transactions. Just renaming it so >>> the token is an opaque commit visibility token that just happens to >>> be >>> a LSN would still allow for progress in transaction management. For >>> example, making PostgreSQL distributed will likely want timestamp >>> and/or vector clock based visibility rules. >> >> >> I'm sorry I did not understand exactly what you meant. >> Please explain this in more detail. > > Currently transactions on the master become visible when xid is > removed from proc array. This depends on the order of acquiring > ProcArrayLock, which can happen in a different order from inserting > the commit record to wal. Whereas on the standby the transactions will > become visible in the same order that commit records appear in wal. > The difference can be quite large when transactions are using > different values for synchronous_commit. Fixing this is not easy, but > we may want to do it someday. IIRC CSN threads contained more > discussion on this topic. If we do fix it, it seems likely that what > we need to wait on is not LSN, but some other kind of value. If the UI > were something like "WAITVISIBILITY token", then we can later change > the token to something other than LSN. > > Regards, > Ants Aasma It sounds reasonable. I can offer the following version. WAIT LSN lsn_number; WAIT LSN lsn_number TIMEOUT delay; WAIT LSN lsn_number INFINITE; WAIT LSN lsn_number NOWAIT; WAIT [token] wait_value [option]; token - [LSN, TIME | TIMESTAMP | CSN | XID] option - [TIMEOUT | INFINITE | NOWAIT] Ready to listen to your suggestions. -- Ivan Kartyshov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers