Hi all, We prepared a patch that includes the hook points. And such hook points are needed for disk quota extension. There are two hooks. One is SmgrStat_hook. It's used to perform ad-hoc logic in storage when doing smgr create/extend/truncate in general. As for disk quota extension, this hook is used to detect active tables(new created tables, tables extending new blocks, or tables being truncated) The other is BufferExtendCheckPerms_hook. It's used to perform ad-hoc logic when buffer extend a new block. Since ReadBufferExtended is a hot function, we call this hook only when blockNum == P_NEW. As for disk quota extension, this hook is used to do query enforcement during the query is loading data.
Any comments are appreciated. Regards, Haozhou On Wed, Nov 14, 2018 at 6:07 PM Hubert Zhang <hzh...@pivotal.io> wrote: > Thanks, Tomas, > > Yes, we want to add the hooks into postgres repo. > But before that, we plan to firstly get some feedbacks from community > about the diskquota extension implementation and usage? > Later, we'll modify our license and submit the hooks into CF. > > Thanks > Hubert > > On Wed, Nov 14, 2018 at 3:54 AM Tomas Vondra <tomas.von...@2ndquadrant.com> > wrote: > >> On Tue, 2018-11-13 at 16:47 +0800, Hubert Zhang wrote: >> > Hi all, >> > >> > We implement disk quota feature on Postgresql as an extension(link: >> > https://github.com/greenplum-db/diskquota), >> > If you are interested, try and use it to limit the amount of disk >> > space that >> > a schema or a role can use in Postgresql. >> > Any feedback or question are appreciated. >> > >> >> It's not clear to me what's the goal of this thread? I understand what >> quotas are about, but are you sharing it because (a) it's a useful >> extension, (b) you propose adding a couple of new hooks (and keep the >> extension separate) or (c) you propose adding both the hooks and the >> extension (into contrib)? >> >> I assume it's either (b) and (c), in which case you should add it to >> 2019-01 CF: https://commitfest.postgresql.org/21/ >> >> In either case, it might be useful to add a LICENSE to the github >> repository, it's not clear what's the situation in this respect. That >> probably matters especially for (b), because for (c) it'd end up with >> PostgreSQL license automatically. >> >> regards >> >> -- >> Tomas Vondra http://www.2ndQuadrant.com >> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >> >> > > -- > Thanks > > Hubert Zhang >
disk_quota_hooks_v1.patch
Description: Binary data