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.89) (envelope-from ) id 1hBSn3-0007iZ-Ty for pgsql-committers@arkaria.postgresql.org; Tue, 02 Apr 2019 23:26:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBSn1-0006de-Ro for pgsql-committers@arkaria.postgresql.org; Tue, 02 Apr 2019 23:25:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBSn1-0006ci-Ej for pgsql-committers@lists.postgresql.org; Tue, 02 Apr 2019 23:25:59 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBSmy-00031P-2Q for pgsql-committers@lists.postgresql.org; Tue, 02 Apr 2019 23:25:58 +0000 Received: by mail-wm1-x341.google.com with SMTP id h18so5838156wml.1 for ; Tue, 02 Apr 2019 16:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DbYNiFGtl+mB+cVZCYux65o22kQ8912gEDWjJJHJskg=; b=rOLiE+mtLNRXWyNdTHRQB506SefacmS4y6+rCv4a4avNoOBQJhghpL6ZUsiqro8E6d DsFg1T+5nhFw3WRMca2fPcq/G8o9Bo7tCvgrXlM5hnxPxwLnBHJWdVDDA3XGNXavSQqM g7aN4RB8rRlKgDEaOZ/EDwmOvXWjLrgRBPCyCJq7i0QjScK52Rjj5fNtJmGGglErxY4k RquDUJcMy4CUZCSUKpzkJPi2dR4U+2DRjtMJr8P0iOJqZifyUkSzpWIRHmdoRSfWE7/m /vf0bTUCzLzel7U+V10qBeSNLy2BLJp6bBwPRWb6lKMR/Z5eW4xd2Z63Du8RnwFBKVB4 QhWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DbYNiFGtl+mB+cVZCYux65o22kQ8912gEDWjJJHJskg=; b=SlOinddCL7xXP1UPvRGDmY7tetUOtbl0/0Azpmt4Ls9pvudLySbPZp74kflGbvN8kH W7wXlHcSUQYVtYTXgIQuE1yHdhMxTADYeCoM8Or8dLbQHjBkL0Ho2PRFhii5B5bYj14N M3jNA5u6WjX3k3O1CCP9y9e2sxErv8+sdFkDrPcrG76WvwjVV1/HXcPxWwINlqPzAAK6 r6Lsi+i+x2DBaCtIG6NrVjMU7fA1n629m/1S+OQlgcAFu/QwBihQpIBTdAqtIoaovJ2R wXZyyX3QYWaxVeO7q7Iqoqw24FA9icej0FpPQWom1oxIonOdFLAukdokHc86M4YZCbpI 1yKA== X-Gm-Message-State: APjAAAV7Ma40+LbtSgsFnVPSCsgc5ZH/wGGrNMaE5mRi0OxB5Fj1xN4c suR9oFFGl5AaxZWjddCOFekvKloZlo8= X-Google-Smtp-Source: APXvYqzGCeE/52iu8VbjByiBxJIoHOziq4UuRbhnHNgbYEyH2VDZeDZ7RvY+c0zI/5Z2gP+STkVCog== X-Received: by 2002:a05:600c:d7:: with SMTP id u23mr5156887wmm.30.1554247555249; Tue, 02 Apr 2019 16:25:55 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id o4sm30327438wmo.20.2019.04.02.16.25.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Apr 2019 16:25:41 -0700 (PDT) Date: Wed, 3 Apr 2019 01:25:40 +0200 From: Tomas Vondra To: Peter Geoghegan Cc: Andres Freund , Tomas Vondra , pgsql-committers Subject: Re: pgsql: Add support for multivariate MCV lists Message-ID: <20190402232540.6teidt2s6dcxj6r5@development> References: <20190327201346.GB21957@development> <20190327203353.GC21957@development> <20190328012752.GD4406@development> <20190328183336.GB16397@development> <20190328193711.GC16397@development> <20190329182013.GB8733@development> <20190329192510.GB1136@development> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2qcha66khhjuf24q" Content-Disposition: inline In-Reply-To: <20190329192510.GB1136@development> User-Agent: NeoMutt/20180716-1433-526d59 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --2qcha66khhjuf24q Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On Fri, Mar 29, 2019 at 08:25:10PM +0100, Tomas Vondra wrote: >On Fri, Mar 29, 2019 at 12:06:26PM -0700, Peter Geoghegan wrote: >>On Fri, Mar 29, 2019 at 11:20 AM Tomas Vondra >> wrote: >>>I've pushed a fix for this. The short version is that the serialized >>>representation was not respecting memory alignment requirements, which was >>>causing issues in machines sensitive to this (ia64, sparc, hppa). It's a >>>blind attempt, as I currently don't have access to any such machine. >> >>Looks like gharial still has problems: >> >>https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=gharial&dt=2019-03-29%2018%3A30%3A47 >> > >Yeah, I saw that :-( > >Unfortunately fixing this without access to any ia64/sparc/hppa machine >will be hard. The only thing I can do is wait for gaur/snapper to report >the failure with a backtrace. > OK, so the second memory-alignment fix I pushed on Saturday seems to have worked. There's one aspect of it that I don't like though - the MCV is first serialized into a buffer, which is then copied into the varlena buffer. Deserialization works in reverse, i.e. it copies the data from the varlena, then accessed the copy. For the emergency fix that seemed acceptable, as it somewhat reduced the amount of modified code, but I don't want to leave it like that because of efficiency and memory consumption. So barring objections I'll push the attached patch, which ensures proper memory alignment within the raw varlena buffer. Thus the copies are not needed. (The second part of the patch merely adds some alignment-enforcing asserts - I don't plan to commit that, but if someone plans decides to test this, it might be useful.) regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --2qcha66khhjuf24q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-improve-mcv-serialization.patch"