Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2sEE-0000jO-Qw for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Apr 2017 04:37:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d2sED-0005ZV-Nn for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Apr 2017 04:37:29 +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 1d2sEB-0005ZL-UU for pgsql-hackers@postgresql.org; Tue, 25 Apr 2017 04:37:28 +0000 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d2sE6-00070e-Ei for pgsql-hackers@postgresql.org; Tue, 25 Apr 2017 04:37:26 +0000 Received: by mail-wr0-x233.google.com with SMTP id l50so28068474wrc.3 for ; Mon, 24 Apr 2017 21:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to; bh=R3PoqSOkkUsPOPVAwB5t3+H0Ca3CruklxmCD/wSs98g=; b=WG+J1BpCw2tUJ6KrXHfrkIOiLm1xKS7ygijrUMfC/88lc85ZkF6fo1XtFhEg0hKJfY rmmGfX+tmI9uE4dJjlazjrAfzB3a6PDO7/8yFzpCwsSkWr2VNdD/6iPhVvupNKyG30DN NFSJEPDWX6nWClbNKX/Axmjfv1rpQsAahWub/NLYWxzraU+G2RubB9/MI/KXLLLfwALg 94Tz4yXnw3rJJ7M9yGdTVf9oWL1hMpdN2FtufM2D8zlqnZAv3d4G67PpoIFZtef5ZAue hrvafoY4YjBQ3brPtiknGvs+tN2W2egoAoijBGacsHVLKbZthRfcYyde6dePHxgctXLb 7fEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=R3PoqSOkkUsPOPVAwB5t3+H0Ca3CruklxmCD/wSs98g=; b=PSj8iPvoM7iWbE6a/XGGLBTWUMIz27POjKed3EK4hy4mWAbwNDshnCGJlXIWUzUznf r4/V3y+/9rSKo82zCy2T4LLk1XPVN+XS/vnS8SPmG7nPnqpmepzWih1XL+E7SmvIy4rn x6XMaCcdcJwmUOCExHOB0BdmRl6cCMS35xauJPClTKbP7RfYb1MURcEkhFDchKEdFdMi 5PweLRjoN8PDtE91cqIjAvEKR3GoahFrGgwWeEE8w7irrlv0bgtQH7d9n638f5PGJXmj DgQ7LNxOo5TBpeESuGQl07vE2w3CDTA8MGJMXSfJ9JmoTiKyQbJvnRFhaDRUzPqsgs/j srfg== X-Gm-Message-State: AN3rC/4DXSmI4A6e4dmm/hAujgBUdD6+Pv/EE8gH28ZKqysU0AIpiBOR D1eKBbtm/wRpMOdk X-Received: by 10.223.169.226 with SMTP id b89mr9119542wrd.100.1493095039157; Mon, 24 Apr 2017 21:37:19 -0700 (PDT) Received: from [192.168.0.105] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id n193sm1433946wmg.30.2017.04.24.21.37.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Apr 2017 21:37:17 -0700 (PDT) Subject: Re: walsender & parallelism To: Andres Freund References: <20170421014030.fdzvvvbrz4nckrow@alap3.anarazel.de> <7966f454-7cd7-2b0c-8b70-cdca9d5a8c97@2ndquadrant.com> <20170423235941.qosiuoyqprq4nu7v@alap3.anarazel.de> <20170424000452.3iab4qpc3mtb2v6v@alap3.anarazel.de> <13973428-ca0b-b329-7f32-f15150e10334@2ndquadrant.com> <20170424232559.j5zuna3rpzksj26l@alap3.anarazel.de> Cc: PostgreSQL Hackers , Petr Jelinek , Peter Eisentraut From: Petr Jelinek Message-ID: <81eaca60-3f7b-6a21-5531-fd51ffbf3f63@2ndquadrant.com> Date: Tue, 25 Apr 2017 06:37:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170424232559.j5zuna3rpzksj26l@alap3.anarazel.de> Content-Type: multipart/mixed; boundary="------------D107D9585E4881522F559BAF" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------D107D9585E4881522F559BAF Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 25/04/17 01:25, Andres Freund wrote: > Hi, > > On 2017-04-24 07:31:18 +0200, Petr Jelinek wrote: >> The previous coding tried to run the unknown string throur lexer which >> could fail for some valid SQL statements as the replication command >> parser is too simple to handle all the complexities of SQL language. >> >> Instead just fall back to SQL parser on any unknown command. >> >> Also remove SHOW command handling from walsender as it's handled by the >> simple query code path. > > This break SHOW var; over the plain replication connections though > (which was quite intentionally supported), so I don't think that's ok? > Hmm I guess we don't use this anywhere in tests (which is not surprising as it would have to be used in plain walsender connection). Fixed. > > I don't like much how SHOW and walsender understanding SQL statements > turned out, I think code like > > if (am_walsender) > { > if (!exec_replication_command(query_string)) > exec_simple_query(query_string); > } > else > exec_simple_query(query_string); > > shows some of the issues here. > Not sure how it's related to SHOW, but in any case, it's just result of the parsing fallback. > >> New alternative output for largeobject test has been added as the >> replication connection does not support fastpath function calls. > > I think just supporting fastpath over the replication protocol is less > work than maintaining the alternative file. > > >> --- a/src/Makefile.global.in >> +++ b/src/Makefile.global.in >> @@ -321,6 +321,7 @@ BZIP2 = bzip2 >> # Testing >> >> check: temp-install >> +check-walsender-sql: temp-install > > This doesn't strike me as something that should go into > a/src/Makefile.global.in - I'd rather put it in > b/src/test/regress/GNUmakefile. check is in .global because it's used > in a lot of different makefiles, but that's not true for this target, right? > Shows how well I know our build system :) Anyway, I gave it a try to support as much as possible and the result is attached. First patch adds the new make target that runs regression tests through walsender. I had to change one test to run SHOW TIMEZONE instead of SHOW TIME ZONE, otherwise no tests need to be changed. The second patch unifies the sighup handling across all kinds of processes. This is mostly replacing got_SIGHuP with new variable and removing local SIGHUP handlers in favor of generic one where possible. And the third patch changes walsender. There are 3 things it does a) it overhauls signal handling there, b) it allows both fast path function calls and extended protocol messages (once I did function fast path I didn't really see any difference in terms of extended protocol, please correct me if I am wrong in that) and c) improves the fallback in parser. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------D107D9585E4881522F559BAF Content-Type: binary/octet-stream; name="0001-Add-check-walsender-sql-make-target.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Add-check-walsender-sql-make-target.patch"