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 1kXukl-0008Lk-5J for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 23:21:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXuki-0002DE-Ur for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2020 23:21:12 +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 1kXuki-0002D6-NC for pgsql-hackers@lists.postgresql.org; Wed, 28 Oct 2020 23:21:12 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kXukd-0000SQ-DJ for pgsql-hackers@postgresql.org; Wed, 28 Oct 2020 23:21:11 +0000 Received: by mail-ej1-x633.google.com with SMTP id 7so1346162ejm.0 for ; Wed, 28 Oct 2020 16:21:07 -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; bh=eYDsDqgDQ5dcZHdcOTD2Yy5Ug7CJ0Y9sWAqHxW9G+zo=; b=NaTMeHLu7lBWZ9hYv/YgFi/hc2WRk0+ed/FeZGeaF/E7eVl9cZGAn6HikgnWQra4o6 Zu+NFNZJ3vgrweAJBR5DZz7rdYuK2t7J5nEFVY8uKfZn7H3PF7BH4HgHK6HNofE6FY9G Fe9tKu4zABXdArM4LLKiod1mvX1qMtBR/mcjV/spGWmQVBnOXUbXr33Y4ssrSr7jNzW1 Nmkd30ThSRMjJ+U5170GnTE4V76FwrZkVjP6Z83QlDh0eqYHQ4GxMoCH/WuUbQ/b6F8l hCyJNKx8ntG+S14z3CRmJaw0r5H2MNoy053ICM4T9a7ljzqfK5l5eVoKRgtlVR3IReJL eDXg== 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; bh=eYDsDqgDQ5dcZHdcOTD2Yy5Ug7CJ0Y9sWAqHxW9G+zo=; b=mApRWetMxJiaGo6fEgxMipOqt7UGlkgnEWDlWgzs2Y4p1YA+7y5zrK+7j2QtKMKwiF 4Pj4vpv8rAlG+gQhnj0J+gn19PtRknxJnVr3uD2E5KFNkA1xlHsuYgHc02ZhAcoqZT5s x8fJ2uolx2O7dR07GqpkiVGdV3HUhXDpeoEe4iASZ4+PnNFpC3woCZKhTPNz15tFlYNx u05UAOaICIfvE8GZSc1n7Wx9gW8DHOFcH5t2B8MGN0cdp9p8smdZFk9CkH5DjnZj7GgU Vsk5IhIVBeCpGSk018y8WWFktZK6SJSmQVmuyRf9o+V1n3SU9wJdyTlIH2hArRolnag/ 8ERA== X-Gm-Message-State: AOAM531oF7Vd5QtaqXJIrsvlu3WGqLBx9GCcSFreLZiFzgB/PuIbmwiY s/eA8nVoQPKnYPmlGOo3M5LRyw== X-Google-Smtp-Source: ABdhPJySBjQEGofEKLgLRk6ZPN/ZORD9dLkLZY0GUob8rD9A3UlCDvDY3lGsQZrWAB2zoLoimZCpsA== X-Received: by 2002:a17:906:401b:: with SMTP id v27mr1340644ejj.475.1603927265014; Wed, 28 Oct 2020 16:21:05 -0700 (PDT) Received: from localhost (ip-86-49-245-76.net.upcbroadband.cz. [86.49.245.76]) by smtp.gmail.com with ESMTPSA id y2sm462030ejf.85.2020.10.28.16.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 16:21:04 -0700 (PDT) Date: Thu, 29 Oct 2020 00:21:01 +0100 From: Tomas Vondra To: Alexander Korotkov Cc: Andrey Borodin , Anastasia Lubennikova , Daniel Gustafsson , Kyotaro Horiguchi , pgsql-hackers Subject: Re: MultiXact\SLRU buffers configuration Message-ID: <20201028232101.4awgmc2cu2cemu7p@development> References: <2ECE132B-C042-4489-930E-DBC5D0DAB84A@yandex-team.ru> <2087E87D-44CA-4443-8E6A-5087F07443F4@yandex-team.ru> <8A94938B-054C-4439-9866-2C220B4D0DD7@yandex-team.ru> <20201028013651.de5cj2xadgmba5nf@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Oct 28, 2020 at 10:36:39PM +0300, Alexander Korotkov wrote: >Hi, Tomas! > >Thank you for your review. > >On Wed, Oct 28, 2020 at 4:36 AM Tomas Vondra > wrote: >> I did a quick review on this patch series. A couple comments: >> >> >> 0001 >> ---- >> >> This looks quite suspicious to me - SimpleLruReadPage_ReadOnly is >> changed to return information about what lock was used, merely to allow >> the callers to do an Assert() that the value is not LW_NONE. > >Yes, but this is not merely to allow callers to do an Assert(). >Sometimes in multixacts it could save us some relocks. So, we can >skip relocking lock to exclusive mode if it's in exclusive already. >Adding Assert() to every caller is probably overkill. > Hmm, OK. That can only happen in GetMultiXactIdMembers, which is the only place where we do retry, right? Do we actually know this makes any measurable difference? It seems we're mostly imagining that it might help, but we don't have any actual proof of that (e.g. a workload which we might benchmark). Or am I missing something? For me, the extra conditions make it way harder to reason about the behavior of the code, and I can't convince myself it's worth it. >> IMO we could achieve exactly the same thing by passing a simple flag >> that would say 'make sure we got a lock' or something like that. In >> fact, aren't all callers doing the assert? That'd mean we can just do >> the check always, without the flag. (I see GetMultiXactIdMembers does >> two calls and only checks the second result, but I wonder if that's >> intended or omission.) > >Having just the flag is exactly what the original version by Andrey >did. But if we have to read two multixact offsets pages or multiple >members page in one GetMultiXactIdMembers()), then it does relocks >from exclusive mode to exclusive mode. I decide that once we decide >to optimize this locks, this situation is nice to evade. > >> In any case, it'd make the lwlock.c changes unnecessary, I think. > >I agree that it would be better to not touch lwlock.c. But I didn't >find a way to evade relocking exclusive mode to exclusive mode without >touching lwlock.c or making code cumbersome in other places. > Hmm. OK. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services