Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ehNgj-0000qd-TB for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Feb 2018 22:50:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehNgi-0007Yg-9K for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Feb 2018 22:50:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ehNgh-0007YW-Rv for pgsql-hackers@lists.postgresql.org; Thu, 01 Feb 2018 22:50:36 +0000 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ehNgd-0003xP-ML for pgsql-hackers@postgresql.org; Thu, 01 Feb 2018 22:50:34 +0000 Received: by mail-wr0-x232.google.com with SMTP id f6so19086662wra.6 for ; Thu, 01 Feb 2018 14:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/HK/GzcpHsHmBbKpGStTeu5FSNC1Ayip5F/B2wBR6rY=; b=or90Rh8kA1oaOGxSeczz5tCSEBzQNea02/OxGROneS28MRsBJNaUUkPlh55MwtdNkn fLfHj8RhkRaghUopZWXpjpykRMCTZ+7PHrgKixVpUZ4/SI8I56Ik58lB0bXBxnZvW0+8 +n4ECZv2sVo9Co4fQizbobDBjfZpTsF/wjUneUSghXClBlyQplD5Af2GgMiVcFEDRJd6 2u97HqCK7GugdZQGRahNDax85A9dauBiHuVBxxplpLOlIvCVQTF8kMPUztoTPo2iwCgK XrSu8BxwAlo+xZZuyD9t0cYd2XDpAH0h12iNMs/2lYNqtr4EOlz3EB8LtsaNAWyRj9Xt F4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/HK/GzcpHsHmBbKpGStTeu5FSNC1Ayip5F/B2wBR6rY=; b=aTO76ORAeYTo4Qy+bRM1HQrQmb4IVtiWRmNFaR8BSnbIXz2M0EEDS2E9xyW4NGHGz0 NkSQd7tg0bCi/RhaQ3juXnR7903nX3U/GToH4Aq/xa+u0EDzxtf/+WvMK8QEDfTgjF8D PzBUp4qUvhEBGUGN7T2S2iWRdsXBcgWDAJ+ZemhCABwGXXoToYIzS7G5CRXkL2Gk/+/R /UMnDa8L4e3ccLszkuSCGiv7k3/8UV7mw4d9miZmUHs8+kpz5xBnrgUToUCZ1iy5GrFc 9FIXS0qwUajeWawPBPybeC0w0l01rZB3vWjxy3G1TpcQaZNLuVOEa/ew1kU9M8ylIQ/X t6RA== X-Gm-Message-State: AKwxytc55OadCDG0fJ9W0VF3YrKpgvBYmZZEhBMpa44Fy7K9EJrUQPgJ oLzFIlWH3YiLW7m2YXJGX040Yx/HoYwHlSEO85GvzWHayovKh1etNS9pPTzaEtPW0xRFBrnYeUj 8q3wDI7BSnlKCnvAjMB4AkYaBTUSQ+adlASqrpAPnaRm2FTgY/X+TKQWHzqbNi/U0TlSNDl+p4y DHZjsYMNeF/ac= X-Google-Smtp-Source: AH8x226llD1QB2v8sLjQpllRu2ZMNSMyVJQFy97iLBUVHHpTV4qtWm7sEVNEvt3AiuA5fMA7wMgyVQ== X-Received: by 10.223.160.250 with SMTP id n55mr15826554wrn.82.1517525427973; Thu, 01 Feb 2018 14:50:27 -0800 (PST) Received: from [10.137.2.17] (cable-78.29.240.33.coditel.net. [78.29.240.33]) by smtp.gmail.com with ESMTPSA id z22sm731642wrc.3.2018.02.01.14.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 14:50:27 -0800 (PST) Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions To: Masahiko Sawada Cc: PostgreSQL Hackers References: <688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com> <47223121-222d-8e04-4928-a28ecdc5327d@2ndquadrant.com> From: Tomas Vondra Message-ID: Date: Thu, 1 Feb 2018 23:50:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01/31/2018 07:53 AM, Masahiko Sawada wrote: > On Sat, Jan 20, 2018 at 7:08 AM, Tomas Vondra > wrote: >> On 01/19/2018 03:34 PM, Tomas Vondra wrote: >>> Attached is v5, fixing a silly bug in part 0006, causing segfault when >>> creating a subscription. >>> >> >> Meh, there was a bug in the sgml docs ( vs. ), >> causing another failure. Hopefully v6 will pass the CI build, it does >> pass a build with the same parameters on my system. > > Thank you for working on this. This patch would be helpful for > synchronous replication. > > I haven't looked at the code deeply yet, but I've reviewed the v6 > patch set especially on subscriber side. All of the patches can be > applied to current HEAD cleanly. Here is review comment. > > ---- > CREATE SUBSCRIPTION commands accept work_mem < 64 but it leads ERROR > on publisher side when starting replication. Probably we should check > the value on the subscriber side as well. > > ---- > When streaming = on, if we drop subscription in the middle of > receiving stream changes, DROP SUBSCRIPTION could leak tmp files > (.chages file and .subxacts file). Also it also happens when a > transaction on upstream aborted without abort record. > > ---- > Since we can change both streaming option and work_mem option by ALTER > SUBSCRIPTION, documentation of ALTER SUBSCRIPTION needs to be updated. > > ---- > If we create a subscription without any options, both > pg_subscription.substream and pg_subscription.subworkmem are set to > null. However, since GetSubscription are't aware of NULL we start the > replication with invalid options like follows. > LOG: received replication command: START_REPLICATION SLOT "hoge_sub" > LOGICAL 0/0 (proto_version '2', work_mem '893219954', streaming 'on', > publication_names '"hoge_pub"') > > I think we can set substream to false and subworkmem to -1 instead of > null, and then makes libpqrcv_startstreaming not set streaming option > if stream is -1. > > ---- > Some WARNING messages appeared. Maybe these are for debug purpose? > > WARNING: updating stream stats 0x1c12ef8 4 3 65604 > WARNING: UpdateSpillStats: updating stats 0x1c12ef8 0 0 0 39 41 2632080 > > Regards, > Thanks for the review! I'll address the issues in the next version of the patch. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services