Re: Control your disk usage in PG: Introduction to Disk Quota Extension - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Control your disk usage in PG: Introduction to Disk Quota Extension
Date
Msg-id CA+hUKGKCNSCj0XW3pUF8Yd75GhXmD0=UNcZw07Ntsht+XE0_-g@mail.gmail.com
Whole thread Raw
In response to Re: Control your disk usage in PG: Introduction to Disk Quota Extension  (Hubert Zhang <hzhang@pivotal.io>)
Responses Re: Control your disk usage in PG: Introduction to Disk Quota Extension  (Hubert Zhang <hzhang@pivotal.io>)
List pgsql-hackers
On Mon, Feb 18, 2019 at 7:39 PM Hubert Zhang <hzhang@pivotal.io> 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



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY
Next
From: Tom Mercha
Date:
Subject: Re: Extending PostgreSQL with a Domain-Specific Language (DSL) -Development