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 1oSpzs-0006wb-3Z for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2022 01:24:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oSpzq-0004zo-7W for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2022 01:24:54 +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 1oSpzp-0004ze-Ue for pgsql-hackers@lists.postgresql.org; Tue, 30 Aug 2022 01:24:53 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oSpzn-0004hY-Fe for pgsql-hackers@lists.postgresql.org; Tue, 30 Aug 2022 01:24:52 +0000 Received: by mail-ej1-x630.google.com with SMTP id nc14so14260534ejc.4 for ; Mon, 29 Aug 2022 18:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=J2gbbHU5PBvg7Wme+GDvDkvC2Hk+W3dbHJaiwFxZjyY=; b=PcIaIQF8yfAirkj4mPLowttqIs63YtoATWPepbn4571IeoBrNhG6p2LZfpXhEsH496 EfpzIuwXq4hrelhOzoHjpDTW8sATrK0Ol1VOjK1hWbmeZRGHWIvFsyqvQEjkuTUt2/JC CPCWLOztC9HPxLNto5fXEg09h1M/n3H7LoA+SJlNPArKaUb79MEzgS00LpyUbfkUSxuE 0SLBWQsrpzOFoDc8Ri6twN5qYjaoRxbCsgM5zzUxKf22g3jg76GgNN296TB+jWbGpMPc z6IElZ/UgLkJRDEZq1/S+KqmAtVYsidvn1oMBbJ2rOXiWlanCZmGV00VhDvkRYCeMVZP MrXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=J2gbbHU5PBvg7Wme+GDvDkvC2Hk+W3dbHJaiwFxZjyY=; b=JF0GqzUTLzCL7Cnt8/NJ2i7oTZF95pPqlty4rOXYwz5p5C8SK96XmqfId8MS6LKPSS CHCONceAt2GirzP9S8j+jENu6RdZ/iIqtADOhj48m5zQEpxQHwqceURNMuR5sJWsGqmm Dwv5fnXQld65iSLFfPXIx2iPPNsxSIRLw0PZEiq2WgeNsa+XoYbJKYZmDppfqFZCckiU fokVPhqJWY1ZML4rHbzZfA7s/odvV9JcJNMz5Ecr/KOghd2/fs8A9FdQP2ekjqy+beJj 7Drafb4eTFv2JqZpAGJxOoMvnPWpwqUWHXydWUTXnTiTpfsBwRgVnNarasS5s5kFha8n isew== X-Gm-Message-State: ACgBeo3n/Bq2xdtLnfxyjRaaeVhFaJ/3rie2QikDJT3kpX4xqBhaPt6E r+aCNWTJvJdhZ74aupu2kDFL53ovCy6EBwX5RERDkby2CuPLwOr6fSgyB+hm4pbht1QHnqtsNlQ zV7pn/SWJWw9k9fIpMCX7O2CP8AvVJg2Yy26DtvMczEQpPk7MO8X4ok85QFzNGKXNXr10KBL8bv AXDYG1kFWyRwgtJyIWYTx4W3ejaTIJU+JqaXkVd+Hscp1aMUSHuYvU X-Google-Smtp-Source: AA6agR7+EO615kp9jSvlAnqRv7ebhGzBRATMHsu8yTF5q8dkal514DxDFpUhXwocRO9OVwxE953FXw== X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr16137808ejc.66.1661822690020; Mon, 29 Aug 2022 18:24:50 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-229-52.bb.vodafone.cz. [86.49.229.52]) by smtp.gmail.com with ESMTPSA id b5-20020a17090630c500b0073dde7c1767sm5132689ejb.175.2022.08.29.18.24.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Aug 2022 18:24:49 -0700 (PDT) Message-ID: Date: Tue, 30 Aug 2022 03:24:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: Reducing the chunk header sizes on all memory context types Content-Language: en-US To: David Rowley Cc: Tom Lane , Amit Kapila , Andres Freund , Robert Haas , Yura Sokolov , PostgreSQL Developers References: <20220809184410.g6yzu6pvttuphag5@awork3.anarazel.de> <3137572.1661780863@sss.pgh.pa.us> <3205803.1661786437@sss.pgh.pa.us> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/30/22 02:45, David Rowley wrote: > On Tue, 30 Aug 2022 at 03:39, Tomas Vondra > wrote: >> The attached patch seems to fix the issue for me - at least it seems >> like that. This probably will need to get backpatched, I guess. Maybe we >> should add an assert to MemoryChunkGetPointer to check alignment? > > Hi Tomas, > > I just wanted to check with you if you ran the full make check-world > with this patch? > > I don't yet have a working ARM 32-bit environment to test, but on > trying it with x86 32-bit and adjusting MAXIMUM_ALIGNOF to 8, I'm > getting failures in test_decoding. Namely: > > test twophase ... FAILED 51 ms > test twophase_stream ... FAILED 25 ms > > INSERT INTO test_prepared2 VALUES (5); > SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, > NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); > +WARNING: problem in slab Change: detected write past chunk end in > block 0x58b8ecf0, chunk 0x58b8ed08 > +WARNING: problem in slab Change: detected write past chunk end in > block 0x58b8ecf0, chunk 0x58b8ed58 > +WARNING: problem in slab Change: detected write past chunk end in > block 0x58b8ecf0, chunk 0x58b8eda8 > +WARNING: problem in slab Change: detected write past chunk end in > block 0x58b8ecf0, chunk 0x58b8edf8 > +WARNING: problem in slab Change: detected write past chunk end in > block 0x58b8ecf0, chunk 0x58b8ee48 > > I think the existing sentinel check looks wrong: > > if (!sentinel_ok(chunk, slab->chunkSize)) > > shouldn't that be passing the pointer rather than the chunk? > I agree the check in SlabCheck() looks wrong, as it's ignoring the chunk header (unlike the other contexts). But yeah, I ran "make check-world" and it passed just fine, so my only explanation is that the check never actually executes because there's no space for the sentinel thanks to alignment, and the tweak you did breaks that. Strange ... regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company