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 1pJvan-0007V2-Bw for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jan 2023 12:06:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pJvam-0006pi-7i for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jan 2023 12:06:28 +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 1pJval-0006pY-UH for pgsql-hackers@lists.postgresql.org; Mon, 23 Jan 2023 12:06:27 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pJvaj-0001Nd-MT for pgsql-hackers@postgresql.org; Mon, 23 Jan 2023 12:06:26 +0000 Received: by mail-oo1-xc34.google.com with SMTP id r1-20020a4a3701000000b004f2b4f8200eso2067073oor.7 for ; Mon, 23 Jan 2023 04:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lE8ftRrypvWXSMpduxnyiQtwAhPXkUKkClbwbEnhm3I=; b=FAell//711NvMWQNuW+MA3tZhRZIUEL8eakuqrJ9fZrenRHd6XruAhMqGldPzHu4Pf Y+TcAcqCDzHSCMk8UYS75WytIrNoDSQP5/x0q1X3TXFn49PQ4UNatqmVOIsel7n1Y5wa FI+ybtek3EN3ZluDpiC+ZiCOCKNJCUbL431vC37FXiRRzPCNlUyO/tjiuWIUu2S4/Bgg W1+BZ0RGtlRSrriyK5uFVvs/miEd7wxgwbta0cfJIEKbqkc1BXdhj9xWqyYfU+dEhGyt LtXIChXK+7Q/40DRYyfmotXxp2eDvnUg3sUu0kDtFHkEscD1DhwnWhflkpW7sfCDPzuG cQkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lE8ftRrypvWXSMpduxnyiQtwAhPXkUKkClbwbEnhm3I=; b=FvSUrTVnVfVRVYUr13bTfpmNxfoxtA1HZ17NFA9/PYlDpGYWOxOHXxx7eA3eic8JLk QIc9gzpCyPZzTBpNhf0+fab3KXaaqHPpedQJLFrZI/RyO34wcTvfALyNXtuqowGlxVPd fIWRySp1coCnHJp90lT+0jFo6Q7J71Wdy8cey8fdOZptUXyUDZ8/AkSUnwpsCRxZ8vrA KG+Matf6Tzwbvbv4oR7kVOGS6W7KyouNXzhPMIqpHgIPi6u5JWDXcMFVPtsduJ0FkZ4a woACQN80MUDO1eSpOUBgSzwm9+VLYmRzH1V2OrNVuPuEJs8OwpcH+vuF2Xe/oBLhT5uP aM8w== X-Gm-Message-State: AFqh2kqaTs64d+vm6B6linhn5NOjbG9Jen+S3HqSqOfVOrKqlU+0nyaB NNDrLxc4wO5/s1EcHV3v78WXHg3e8w8ECHWNdm8= X-Google-Smtp-Source: AMrXdXuzXfLJ89mYqivUDy7xrJcEAr33/uzcT91kROsWPIIzne7Wz34evsCbmcdDNMmkYWFiLx2FS94DRGun1QUKcEI= X-Received: by 2002:a4a:e78d:0:b0:49b:c0e:3d5f with SMTP id x13-20020a4ae78d000000b0049b0c0e3d5fmr1020029oov.69.1674475584858; Mon, 23 Jan 2023 04:06:24 -0800 (PST) MIME-Version: 1.0 References: <20230112.120338.534662300633460797.horikyota.ntt@gmail.com> In-Reply-To: From: Amit Kapila Date: Mon, 23 Jan 2023 17:36:13 +0530 Message-ID: Subject: Re: Time delayed LR (WAS Re: logical replication restrictions) To: "Takamichi Osumi (Fujitsu)" Cc: Peter Smith , vignesh C , Kyotaro Horiguchi , "Hayato Kuroda (Fujitsu)" , "shveta.malik@gmail.com" , "dilipbalaut@gmail.com" , "euler@eulerto.com" , "m.melihmutlu@gmail.com" , "andres@anarazel.de" , "marcos@f10.com.br" , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Jan 22, 2023 at 6:12 PM Takamichi Osumi (Fujitsu) wrote: > > > Attached the updated patch v19. > Few comments: ============= 1. } + + +/* Only one empty line is sufficient between different functions. 2. + if (IsSet(supported_opts, SUBOPT_MIN_APPLY_DELAY) && + opts->min_apply_delay > 0 && opts->streaming == LOGICALREP_STREAM_PARALLEL) + ereport(ERROR, + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("%s and %s are mutually exclusive options", + "min_apply_delay > 0", "streaming = parallel")); } I think here we should add a comment for the translator as we are doing in some other nearby cases. 3. + /* + * The combination of parallel streaming mode and + * min_apply_delay is not allowed. + */ + if (opts.streaming == LOGICALREP_STREAM_PARALLEL) + if ((IsSet(opts.specified_opts, SUBOPT_MIN_APPLY_DELAY) && opts.min_apply_delay > 0) || + (!IsSet(opts.specified_opts, SUBOPT_MIN_APPLY_DELAY) && sub->minapplydelay > 0)) + ereport(ERROR, + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot enable %s mode for subscription with %s", + "streaming = parallel", "min_apply_delay")); + A. When can second condition ((!IsSet(opts.specified_opts, SUBOPT_MIN_APPLY_DELAY) && sub->minapplydelay > 0)) in above check be true? B. In comments, you can say "See parse_subscription_options." 4. +/* + * When min_apply_delay parameter is set on the subscriber, we wait long enough + * to make sure a transaction is applied at least that interval behind the + * publisher. Shouldn't this part of the comment needs to be updated after the patch has stopped using interval? 5. How does this feature interacts with the SKIP feature? Currently, it doesn't care whether the changes of a particular xact are skipped or not. I think that might be okay because anyway the purpose of this feature is to make subscriber lag from publishers. What do you think? I feel we can add some comments to indicate the same. -- With Regards, Amit Kapila.