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 1hkFwk-0000hh-0D for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jul 2019 22:47:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkFwi-0002oa-Qc for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jul 2019 22:47:48 +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 1hkFwi-0002oT-Hi for pgsql-hackers@lists.postgresql.org; Sun, 07 Jul 2019 22:47:48 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkFwf-0000oK-KW for pgsql-hackers@postgresql.org; Sun, 07 Jul 2019 22:47:48 +0000 Received: by mail-oi1-x22a.google.com with SMTP id a127so11156361oii.2 for ; Sun, 07 Jul 2019 15:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wrbL1vymJHJLSOsl6P3oO2KDFQznL543QsO/m3ZvDgs=; b=cP8dcm768ZF47mHDBnArkBSyxdDIAtUkP2jhCmYMAt5q0kGnsGLlPn/lvYUI0TKs5r pAxlFoV8IsGgKdjT4sm9GsLgd+roa/nlk2g+Lz9w0i6fADhMgOIsu734cojUj0sm2FNV Cu0//wyFZw+C5nnV1HQlWhj25EnV+GuEyDL0Y247drE9wEy5pbytV7lP3hVkGHjt9FPd qcLcIeNt3xn9c7IU7+fODnDqV4/BeS4BDfdYgsCHWj1MVCejjGxbWKe6T879cngO41cj BYlYtUFdEPmxpPkBi+q4buN8mBnozhPe0tfFvuxjgXmlPVYTqpY155vfDUCRAlkQbPw5 9vFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wrbL1vymJHJLSOsl6P3oO2KDFQznL543QsO/m3ZvDgs=; b=J3oXdYpDVCZsfkSoliBRITZ7JD1rA8zshGb1dTX/ouC2Ay7Kx3wSgnluAozj5RU0om /O5c5VZzOlJZ1YIWwRD7YbGoxEsW3aQMAFyh9K2xu2ylmnBZv/ELlZid0ZrDPFL1+jdh VJIQlCF+t2/HZOBCIZ5C+KuIC4WdkeqVQDS71NFcAJ3t9bTa4W44MseVzESakwTZoYPs 9p15bH9X3rkGq/t9FhDalrI5G/WZAGlFBKftGXoEWv5cG/YNqX0E6nNgijMwP58CyU47 SQ8AM4a618IysneXJgavSOvDXnYNrEeczR37bUbxc6z3ReK745HkIgF9PPYBbqcH0Bjt /Jiw== X-Gm-Message-State: APjAAAXDUwQfDPgBKF3l8zt4zqhwonmeXwVRNatDhrimf+RlcCTGw0wK yHDuEgGfcan+U/PDPjn6TmwOuF1h/zEA/oXXtoM= X-Google-Smtp-Source: APXvYqy0wMQ35bBzlEqVlbT2L2wYztO2cJq1HJBHTSdqrgtCW/7Cby1OEvLHCYh95CiNcRdGalwjXhVutOJdtYY4Tb8= X-Received: by 2002:aca:cf51:: with SMTP id f78mr7544535oig.10.1562539662979; Sun, 07 Jul 2019 15:47:42 -0700 (PDT) MIME-Version: 1.0 References: <20181226055647.GK2234@paquier.xyz> <20190216045351.q344ex2utwk7ndtr@alap3.anarazel.de> In-Reply-To: From: Thomas Munro Date: Mon, 8 Jul 2019 10:47:06 +1200 Message-ID: Subject: Re: Control your disk usage in PG: Introduction to Disk Quota Extension To: Hubert Zhang Cc: Andres Freund , Michael Paquier , Robert Haas , "pgsql-hackers@postgresql.org" , Tomas Vondra , Heikki Linnakangas Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Feb 18, 2019 at 7:39 PM Hubert Zhang wrote: > Based on the assumption we use smgr as hook position, hook API option1 or option2 which is better? > Or we could find some balanced API between option1 and option2? > > Again comments on other better hook positions are also appreciated! Hi Hubert, The July Commitfest is now running, and this entry is in "needs review" state. Could you please post a rebased patch? I have questions about how disk quotas should work and I think we'll probably eventually want more hooks than these, but simply adding these hooks so extensions can do whatever they want doesn't seem very risky for core. I think it's highly likely that the hook signatures will have to change in future releases too, but that seems OK for such detailed internal hooks. As for your question, my first reaction was that I preferred your option 1, because SMgrRelation seems quite private and there are no existing examples of that object being exposed to extensions. But on reflection, other callbacks don't take such a mollycoddling approach. So my vote is for option 2 "just pass all the arguments to the callback", which I understand to be the approach of patch you have posted. + if (smgrcreate_hook) + { + (*smgrcreate_hook)(reln, forknum, isRedo); + } Usually we don't use curlies for single line if branches. -- Thomas Munro https://enterprisedb.com