Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oY0NC-0007EX-RJ for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Sep 2022 07:30:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oY0NB-0007zl-FD for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Sep 2022 07:30:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oY0NB-0007xj-2o for pgsql-hackers@lists.postgresql.org; Tue, 13 Sep 2022 07:30:21 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oY0N1-00015e-4V for pgsql-hackers@lists.postgresql.org; Tue, 13 Sep 2022 07:30:20 +0000 Received: by mail-pj1-x102b.google.com with SMTP id q9-20020a17090a178900b0020265d92ae3so14710791pja.5 for ; Tue, 13 Sep 2022 00:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date; bh=STGu1cE6WRuaMKFJMFHpbJlKp+BabluR0992R6WcFpM=; b=NTS7MPKWl7AusA/hqDlm5qkXEZWDKrIkuu2ShPWEfkyyfuH+/VLLqLpdkqcGaGnuBJ PKi02Yz7vT8la85mseHsVGo7ikyvHIkmAVNo2hIppBRCT0Cn1fEruMjfmFUX4KMqiPzI ypx6C98vxvq/3zd2NmsIR47gicGhyXYMsxinwZO4KANT4UW1HrtK5vY/Gkp+qrClNdMT CZzu6iIHmhv0lCe3ZxpKuxQEIzNsBYNZq+gJNcz5dV//2jtY/93Y/qz/8WEUHCHzt0NZ 0O+PERL6fc3tfY0hosazP7t8gN5ulEkAxYcZaKU834URlKWnpCq4UVEjtDJYoJJVnc0s o7kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date; bh=STGu1cE6WRuaMKFJMFHpbJlKp+BabluR0992R6WcFpM=; b=hTVzdwWQt5eiegNWcjEmM5PnxxQeBAlEEf4vPnRKOsz69V/qBWShmi1xObpSPuGFZO heVwQp0zbaOYgKenCmxpNZQyH3Ege1xbpn27KIu/tyyL80LEiG8jG+Jnxu8tqY6FSp7y dm8tl1sh/t+nRXL/O5yxonY1UFmWrHApUgm9fK6l+eHqLAkc/dtVv7ZVQQVigzvsxBh1 L4hOV9TUJmDsqOyy35hGf0qkK0K8rX0b4oA7oYB8Q16epcrmyR8HXC4ZHL7J+yS4HqVR K2dO+J26bhaW6C93/dr9hPhFfqlcp/phEABnQdlD7utn8im5XoobO9X12ZcNQ2ZjUyLb vkMg== X-Gm-Message-State: ACgBeo3KjQKgNMet7lhCbVfwKn7wNn2h48OAr8IMExJhR/uQ5c2/0ZNK slvhE1pbuS5qb89dALzYXWo= X-Google-Smtp-Source: AA6agR7SY6tLPQAS/7PgEZETGg1IHdzXRBlo2WRUmOTxleMSLQn+owT7TQNVjbZiqZXHzUDCHzoMmQ== X-Received: by 2002:a17:902:aa81:b0:173:3f68:e768 with SMTP id d1-20020a170902aa8100b001733f68e768mr30537371plr.80.1663054210036; Tue, 13 Sep 2022 00:30:10 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id c26-20020a631c5a000000b0042a713dd68csm6934821pgm.53.2022.09.13.00.30.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Sep 2022 00:30:09 -0700 (PDT) Date: Tue, 13 Sep 2022 16:30:06 +0900 (JST) Message-Id: <20220913.163006.1069510603405463109.horikyota.ntt@gmail.com> To: dilipbalaut@gmail.com Cc: andres@anarazel.de, jchampion@timescale.com, y.sokolov@postgrespro.ru, rjuju123@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: Error "initial slot snapshot too large" in create replication slot From: Kyotaro Horiguchi In-Reply-To: <20220913.161059.331955937797746838.horikyota.ntt@gmail.com> References: <20220913.152237.338218493796303493.horikyota.ntt@gmail.com> <20220913.161059.331955937797746838.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Tue, 13 Sep 2022 16:10:59 +0900 (JST), Kyotaro Horiguchi wrote in > At Tue, 13 Sep 2022 12:08:18 +0530, Dilip Kumar wrote in > > On Tue, Sep 13, 2022 at 11:52 AM Kyotaro Horiguchi > > wrote: > > > That function is called after the SnapBuild reaches > > > SNAPBUILD_CONSISTENT state ,or SnapBuildInitialSnapshot() rejects > > > other than that state. That is, IIUC the top-sub relationship of all > > > the currently running transactions is fully known to reorder buffer. > > > We need a comment about that. > > > > I don't think this assumption is true, any xid started after switching > > to the SNAPBUILD_FULL_SNAPSHOT and before switching to the > > SNAPBUILD_CONSISTENT, might still be in progress so we can not > > identify whether they are subxact or not from reorder buffer. > > Yeah, I misunderstood that the relationship is recorded earlier > (how?). Thus it is not reliable in the first place. > > I agree that the best way is oversized xip. > > > By the way, I feel that "is >= than" is redundant or plain wrong.. By the way GetSnapshotData() does this: > snapshot->subxip = (TransactionId *) > malloc(GetMaxSnapshotSubxidCount() * sizeof(TransactionId)); ... > if (!snapshot->takenDuringRecovery) ... > else > { > subcount = KnownAssignedXidsGetAndSetXmin(snapshot->subxip, &xmin, > xmax); It is possible that the subxip is overrun. We need to expand the array somehow. Or assign the array of the size (GetMaxSnapshotXidCount() + GetMaxSnapshotSubxidCount()) for takenDuringRecovery snapshots. (I feel deja vu..) regards. -- Kyotaro Horiguchi NTT Open Source Software Center