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 1pD1rJ-0006fB-CX for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 11:23:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pD1rH-0007y5-Kv for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 11:22:59 +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 1pD1rH-0007xw-9Y for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 11:22:59 +0000 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pD1rD-0006y6-4c for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 11:22:58 +0000 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-476e643d1d5so356285387b3.1 for ; Wed, 04 Jan 2023 03:22:54 -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=Qce2mII3EZEYxkeMJAtWNdfpQgVNHFNvOw+T50A/9og=; b=Cjlrs4SkRJRMi46k6m1EFntkXWO3hcmytx3jMyGBwl3S1OFGTQJg2A2eGBm+wZOpZz bDCjEgKR4t/ZS5rNDSmNXRnJwHU/XC+XFq0ik2XYTC0EON9b7eWwVCjMuQeUuDxDsYNk souMBNixqAZEsxQ/sSKuyCaw0CYFs/SWLJsu6LkKLbKpBSTyyUwu9w2Q82PmDNv/sM3s Pg+G2SUIdJBvQzgnQMLZyDRsxfeySfsDerIyTpfwjF8cj4mq5JeEFdprqw4asKiciDIv rc7/YirEhfXs2W2LspUloAPLJCxN0pbQqmwlzw0hYyEwYoRyfEVgCA/qAOUOwxaflBSM C09w== 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=Qce2mII3EZEYxkeMJAtWNdfpQgVNHFNvOw+T50A/9og=; b=cQWbc8nc/s+TqikhZO7CEi53w3EMkmWwK7uEzPmfMY5bPt8GS2RsSwWQczOYrF/TP6 IhtNvTVf83kWvG29u6+AWzMxrHWXNqsNiIlxMvozG50iib614eXAZMujh5FDqxzIyUzO ClRR35HBwbcWDw/EbdYbeYkloec01FymdKj9rv0LZvnPdU0oiTmSseAiRWFB0xXBWljm guk0BJDGMvjPnWnTp4Aw4eq02hH67JvmMuVIUMUGzq1Y4uPSGboBKIs97YAojGK/6eCk b6WtBMMUkr0Dw0zXPVZGnBlSa18qovBl4hGvmnvMaOiOxrAWJc54yld6TQQMYlLz2Zfm w0Og== X-Gm-Message-State: AFqh2kpDQtzuOwxxwJweX5cEHUB+/w1UqFZ2ZV6+bYfkUXk+Pb23puzZ jJ+lhCfj5O1tDDTWCQoMk0ZVUuBujPpP0Av6us0= X-Google-Smtp-Source: AMrXdXtQdgHiV/yZYt01EbYnsEeXFucFlufbd65cEbdUljgfJLzTXJrz4WmIR5oIsWmylgY9DqfQ6EAJd1wDz5O5d8w= X-Received: by 2002:a81:a109:0:b0:4a4:557:14bd with SMTP id y9-20020a81a109000000b004a4055714bdmr1462098ywg.323.1672831374169; Wed, 04 Jan 2023 03:22:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Wed, 4 Jan 2023 16:52:37 +0530 Message-ID: Subject: Re: Perform streaming logical transactions by background workers and parallel apply To: "houzj.fnst@fujitsu.com" Cc: Masahiko Sawada , "wangw.fnst@fujitsu.com" , Amit Kapila , Peter Smith , "shiy.fnst@fujitsu.com" , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 4, 2023 at 4:25 PM houzj.fnst@fujitsu.com wrote: > > Attach the new patch set. > Apart from addressing Sawada-San's comments, I also did some other minor > changes in the patch: I have done a high-level review of 0001, and later I will do a detailed review of this while reading through the patch I think some of the comments need some changes.. 1. + The deadlock can happen in + * the following ways: + * + * 4) Lock types + * + * Both the stream lock and the transaction lock mentioned above are + * session-level locks because both locks could be acquired outside the + * transaction, and the stream lock in the leader needs to persist across + * transaction boundaries i.e. until the end of the streaming transaction. I think the Lock types should not be listed with the number 4). Because point number 1,2 and 3 are explaining the way how deadlocks can happen but 4) doesn't fall under that category. 2. + * Since the database structure (schema of subscription tables, constraints, + * etc.) of the publisher and subscriber could be different, applying + * transactions in parallel mode on the subscriber side can cause some + * deadlocks that do not occur on the publisher side. I think this paragraph needs to be rephrased a bit. It is saying that some deadlock can occur on subscribers which did not occur on the publisher. I think what it should be conveying is that the deadlock can occur due to concurrently applying the conflicting/dependent transactions which are not conflicting/dependent on the publisher due to . Because if we create the same schema on the publisher it might not have ended up in a deadlock instead it would have been executed in sequence (due to lock waiting). So the main point we are conveying is that the transaction which was independent of each other on the publisher could be dependent on the subscriber and they can end up in deadlock due to parallel apply. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com