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.92) (envelope-from ) id 1j8eXT-0003V1-3a for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Mar 2020 06:26:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j8eXQ-0006GL-Ju for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Mar 2020 06:26:48 +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 1j8eXQ-0006GD-5y for pgsql-bugs@lists.postgresql.org; Mon, 02 Mar 2020 06:26:48 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j8eXN-0002GL-MZ for pgsql-bugs@lists.postgresql.org; Mon, 02 Mar 2020 06:26:46 +0000 Received: by mail-oi1-x234.google.com with SMTP id g6so7527429oiy.1 for ; Sun, 01 Mar 2020 22:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1U6+rQ4PaowPHYjHqQwudetlh9OIbdz02+If1lgqVlQ=; b=nHesvnjj6iOv0TARe9KH2JzWVcHrGBdtYRLNnGOZ/i2ed6sWmLanugWcxMf70+Y7jF U9I0QlCayS+4WZgd7V6gXhbYEqFyWm31yb5St/ktURa7wnW9v3LY3GATvP5mal4eYA/h oysvSqh8r5OEDofllumvVgRPidIIsZlHxWNONGwBY9cOuMZkbUa1U9lQnMhtwQMoDn09 4l21VVIvsHTAlfwBLdmNO3u18sgv+N2xdTASwWpY7YRHFvRXFMwtfchRMOMUFr90bDhI 53EZRA9S4QCYjZYrK/ryacbKffvdtQnxIIB0+2iSUzkgvAA1Y1060+SBfOkJcW2fZFJo z2Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1U6+rQ4PaowPHYjHqQwudetlh9OIbdz02+If1lgqVlQ=; b=ZtZmm9i1eqm1stWJsIOA/9+OkjjYaXSvoU5Pn6DeJ9yav9mx8DtQF5Nak9opvOxNAb v5OP+GKmneeglemFknKgsBiv9tcBtM5nD9SVTMbyL8P8dFettTDg5VkVua0FzF6YLLac aesiN44mzrXSr3IIypqXmfmQ3+3eNjpedu1nPddSPpDtBQ9PMJ1ETlfTdL1SyxYYV+h8 jm7MvEpGK+Kie9bYifWjM4K3LvgoCxSJWpRzU3epWkp2UD/sb2QzpUEc+bT3Iu2+MoU5 MhhwLYN9kH+H7SC82zDOFeRSvnz+RAyMO6pD7WqlwURIroQL/f0FMO92+Ba0yIF79xGN XdBw== X-Gm-Message-State: APjAAAXln2q69ZLBw8aieTO3Q9EkPv0YscIp6WqLbNxEA3CpbVWYSfJH FOvj0ESfHVVn6oKLZiNmmleNb6NTpXvYY96bWrQ= X-Google-Smtp-Source: APXvYqwD/z0DBHmUFZ8Q5Y0GcrVzPNXSEaPDNqPBvJB8zFh9DSRxrWtUq/LFoF04RWJ8dRuilSU9/hVKlwQN5lH1gBo= X-Received: by 2002:aca:a94a:: with SMTP id s71mr5925091oie.132.1583130404738; Sun, 01 Mar 2020 22:26:44 -0800 (PST) MIME-Version: 1.0 References: <87ftjifoql.fsf@ars-thinkpad> <20191024213157.7pm6niybfxgpvmgg@alap3.anarazel.de> <87eez1fh48.fsf@ars-thinkpad> <8736bs81sx.fsf@ars-thinkpad> <871rrb942q.fsf@ars-thinkpad> <87zhdx76d5.fsf@ars-thinkpad> <8736bjoiax.fsf@ars-thinkpad> In-Reply-To: <8736bjoiax.fsf@ars-thinkpad> From: Amit Kapila Date: Mon, 2 Mar 2020 11:56:33 +0530 Message-ID: Subject: Re: ERROR: subtransaction logged without previous top-level txn record To: Arseny Sher Cc: Andres Freund , "Hsu, John" , "pgsql-bugs@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Feb 9, 2020 at 9:37 PM Arseny Sher wrote: > > > Somehow I hadn't realized this earlier, so my comments/commit messages > in patches above were not accurate here; I've edited them. Also in the > first patch serialized snapshots are not no longer used for new slot > creation at all, as Andres suggested above. > + /* + * Don't use serialized snapshot if we are not sure where all + * currently running xacts will finish (new slot creation). + * (Actually, if we came here through xl_running_xacts, we could perform + * SNAPBUILD_FULL_SNAPSHOT -> SNAPBUILD_CONSISTENT transition properly, + * but added lines of code would hardly worth the benefit.) + */ + if (builder->start_decoding_at == InvalidXLogRecPtr) + return false; Instead of using start_decoding_at to decide whether to restore snapshot or not, won't it be better to have new variable in SnapBuild (say can_use_serialized_snap or something like that) and for this purpose? I think the patch is trying to use a variable that is not meant for the purpose we are using for it, so not sure if it is the right direction for the fix. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com