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 1j0pTE-0002TT-W2 for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2020 16:30:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j0pSE-0004Eb-I6 for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Feb 2020 16:29:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j0pSD-0004EU-S3 for pgsql-hackers@lists.postgresql.org; Sun, 09 Feb 2020 16:29:06 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1j0pSA-0000Wz-DO for pgsql-hackers@postgresql.org; Sun, 09 Feb 2020 16:29:04 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4EA0821C4BE9; Sun, 9 Feb 2020 19:29:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from ars-thinkpad (nat03-43-2.netorn.net [188.35.130.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1762221C4BDA; Sun, 9 Feb 2020 19:29:00 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1581265740; bh=tUl34B8m9lRoUnZdb6t0YjLFv9laY67MXnxpXVcHsys=; h=From:To:Subject:Date; b=h+afDV4A8eYB8rTXare7yvpIwjxu9FKiqY2MbpAQhJl/L4HS8N83bztCeti6yHFqW r6HuI+Sqqu9Mr23gZjUhBeDABnh6oy6h/iMGXRBz95olU7tghAJZpo6K3X8GnhvFWN AVyV69HV58MTViK1RkxnNRr4E8K1adgOhlxJuh00= User-agent: mu4e 1.1.0; emacs 26.0.50 From: Arseny Sher To: PostgreSQL Hackers , Masahiko Sawada , Alvaro Herrera Subject: logical copy_replication_slot issues Date: Sun, 09 Feb 2020 19:28:59 +0300 Message-ID: <871rr3ohbo.fsf@ars-thinkpad> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, While jumping around partically decoded xacts questions [1], I've read through the copy replication slots code (9f06d79ef) and found a couple of issues. 1) It seems quite reckless to me to dive into DecodingContextFindStartpoint without actual WAL reservation (donors slot restart_lsn is used, but it is not acquired). Why risking erroring out with WAL removal error if the function advances new slot position to updated donors one in the end anyway? 2) In the end, restart_lsn of new slot is set to updated donors one. However, confirmed_flush field is not updated. This is just wrong -- we could start decoding too early and stream partially decoded transaction. I'd probably avoid doing DecodingContextFindStartpoint at all. Its only purpose is to assemble consistent snapshot (and establish corresponding pair), but donor slot must have already done that and we could use it as well. Was this considered? [1] https://www.postgresql.org/message-id/flat/AB5978B2-1772-4FEE-A245-74C91704ECB0%40amazon.com -- Arseny Sher Postgres Professional: http://www.postgrespro.com The Russian Postgres Company