Unix Technical Forum

Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for

This is a discussion on Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for within the pgsql Hackers forums, part of the PostgreSQL category; --> momjian@postgresql.org (Bruce Momjian) writes: > Add GUC temp_tablespaces to provide a default location for temporary > objects. > Jaime ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 08:35 AM
Tom Lane
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for

momjian@postgresql.org (Bruce Momjian) writes:
> Add GUC temp_tablespaces to provide a default location for temporary
> objects.
> Jaime Casanova


I hadn't looked at this patch before, but now that I have, it is
rather broken.

In the first place, it makes no provision for RemovePgTempFiles() to
clean up leftover temp files that are in non-default places.

In the second place, it's a serious violation of what little modularity
and layering we have for fd.c to be calling into commands/tablespace.c.
This is not merely cosmetic but has real consequences: one being that
it's now unsafe to call OpenTemporaryFile outside a transaction.

Please revert until the submitter can come up with a better-designed
patch.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 08:49 AM
Jaime Casanova
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for

On 3/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> In the second place, it's a serious violation of what little modularity
> and layering we have for fd.c to be calling into commands/tablespace.c.
> This is not merely cosmetic but has real consequences: one being that
> it's now unsafe to call OpenTemporaryFile outside a transaction.
>


ok, you are right... what do you suggest?
maybe move the GetTempTablespace function to somewhere in src/backend/utils?

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 08:49 AM
Tom Lane
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for

"Jaime Casanova" <systemguards@gmail.com> writes:
> On 3/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> In the second place, it's a serious violation of what little modularity
>> and layering we have for fd.c to be calling into commands/tablespace.c.
>> This is not merely cosmetic but has real consequences: one being that
>> it's now unsafe to call OpenTemporaryFile outside a transaction.


> ok, you are right... what do you suggest?
> maybe move the GetTempTablespace function to somewhere in src/backend/utils?


You missed the point entirely. Relocating the code to some other file
wouldn't change the objection: the problem is that fd.c mustn't invoke
any transactional facilities such as catalog lookups. It's too low
level for that.

You could perhaps do it the other way around: some transactional
code (eg the assign hook for a GUC variable) tells fd.c to save
some private state controlling future temp file creations.

BTW, if we are now thinking of temp files as being directed to
particular tablespaces, is there any reason still to have per-database
subdirectories for them? It might simplify life if there were just
one default temp directory, $PGDATA/base/pgsql_tmp/, plus one per
configured temp tablespace, $PGDATA/pg_tblspc/NNNN/pgsql_tmp/.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 08:50 AM
Jaime Casanova
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces to provide a default location for

On 3/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Jaime Casanova" <systemguards@gmail.com> writes:
> > On 3/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> In the second place, it's a serious violation of what little modularity
> >> and layering we have for fd.c to be calling into commands/tablespace.c.
> >> This is not merely cosmetic but has real consequences: one being that
> >> it's now unsafe to call OpenTemporaryFile outside a transaction.

>
> > ok, you are right... what do you suggest?
> > maybe move the GetTempTablespace function to somewhere in src/backend/utils?

>
> You missed the point entirely. Relocating the code to some other file
> wouldn't change the objection: the problem is that fd.c mustn't invoke
> any transactional facilities such as catalog lookups. It's too low
> level for that.
>


oh, i see...

> You could perhaps do it the other way around: some transactional
> code (eg the assign hook for a GUC variable) tells fd.c to save
> some private state controlling future temp file creations.
>


the problem with the assign hook function is that it can't read
catalogs too if we are in a non-interactive command...

so, we need a list with the oids of the tablespaces, we can initialize
this list the first time we need a temp file (i haven't seen exactly
where we can do this, yet), and if we set the GUC via a SET command
then we can let the assign hook do the job.

> BTW, if we are now thinking of temp files as being directed to
> particular tablespaces, is there any reason still to have per-database
> subdirectories for them? It might simplify life if there were just
> one default temp directory, $PGDATA/base/pgsql_tmp/, plus one per
> configured temp tablespace, $PGDATA/pg_tblspc/NNNN/pgsql_tmp/.
>


what the NNNN directory shoud be, i understand ypur idea as just
$PGDATA/pg_tblspc/pgsql_tmp/...

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 09:06 AM
Simon Riggs
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces toprovide a default location for

On Sun, 2007-03-18 at 14:05 -0500, Jaime Casanova wrote:
> On 3/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > "Jaime Casanova" <systemguards@gmail.com> writes:
> > > On 3/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > >> In the second place, it's a serious violation of what little modularity
> > >> and layering we have for fd.c to be calling into commands/tablespace.c.
> > >> This is not merely cosmetic but has real consequences: one being that
> > >> it's now unsafe to call OpenTemporaryFile outside a transaction.

> >
> > > ok, you are right... what do you suggest?
> > > maybe move the GetTempTablespace function to somewhere in src/backend/utils?

> >
> > You missed the point entirely. Relocating the code to some other file
> > wouldn't change the objection: the problem is that fd.c mustn't invoke
> > any transactional facilities such as catalog lookups. It's too low
> > level for that.
> >

>
> oh, i see...
>
> > You could perhaps do it the other way around: some transactional
> > code (eg the assign hook for a GUC variable) tells fd.c to save
> > some private state controlling future temp file creations.
> >

>
> the problem with the assign hook function is that it can't read
> catalogs too if we are in a non-interactive command...
>
> so, we need a list with the oids of the tablespaces, we can initialize
> this list the first time we need a temp file (i haven't seen exactly
> where we can do this, yet), and if we set the GUC via a SET command
> then we can let the assign hook do the job.
>
> > BTW, if we are now thinking of temp files as being directed to
> > particular tablespaces, is there any reason still to have per-database
> > subdirectories for them? It might simplify life if there were just
> > one default temp directory, $PGDATA/base/pgsql_tmp/, plus one per
> > configured temp tablespace, $PGDATA/pg_tblspc/NNNN/pgsql_tmp/.
> >

>
> what the NNNN directory shoud be, i understand ypur idea as just
> $PGDATA/pg_tblspc/pgsql_tmp/...


Am I right in thinking we didn't get an updated patch in yet?

Any help needed here?

This seems a very important patch for manageability and it would be a
shame to miss out on it for 8.3 since its been a TODO item for so long.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-12-2008, 09:07 AM
Bruce Momjian
 
Posts: n/a
Default Re: [COMMITTERS] pgsql: Add GUC temp_tablespacestoprovide a default location for


Right, no updated patch submitted.

---------------------------------------------------------------------------

Simon Riggs wrote:
> On Sun, 2007-03-18 at 14:05 -0500, Jaime Casanova wrote:
> > On 3/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > > "Jaime Casanova" <systemguards@gmail.com> writes:
> > > > On 3/5/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > > >> In the second place, it's a serious violation of what little modularity
> > > >> and layering we have for fd.c to be calling into commands/tablespace.c.
> > > >> This is not merely cosmetic but has real consequences: one being that
> > > >> it's now unsafe to call OpenTemporaryFile outside a transaction.
> > >
> > > > ok, you are right... what do you suggest?
> > > > maybe move the GetTempTablespace function to somewhere in src/backend/utils?
> > >
> > > You missed the point entirely. Relocating the code to some other file
> > > wouldn't change the objection: the problem is that fd.c mustn't invoke
> > > any transactional facilities such as catalog lookups. It's too low
> > > level for that.
> > >

> >
> > oh, i see...
> >
> > > You could perhaps do it the other way around: some transactional
> > > code (eg the assign hook for a GUC variable) tells fd.c to save
> > > some private state controlling future temp file creations.
> > >

> >
> > the problem with the assign hook function is that it can't read
> > catalogs too if we are in a non-interactive command...
> >
> > so, we need a list with the oids of the tablespaces, we can initialize
> > this list the first time we need a temp file (i haven't seen exactly
> > where we can do this, yet), and if we set the GUC via a SET command
> > then we can let the assign hook do the job.
> >
> > > BTW, if we are now thinking of temp files as being directed to
> > > particular tablespaces, is there any reason still to have per-database
> > > subdirectories for them? It might simplify life if there were just
> > > one default temp directory, $PGDATA/base/pgsql_tmp/, plus one per
> > > configured temp tablespace, $PGDATA/pg_tblspc/NNNN/pgsql_tmp/.
> > >

> >
> > what the NNNN directory shoud be, i understand ypur idea as just
> > $PGDATA/pg_tblspc/pgsql_tmp/...

>
> Am I right in thinking we didn't get an updated patch in yet?
>
> Any help needed here?
>
> This seems a very important patch for manageability and it would be a
> shame to miss out on it for 8.3 since its been a TODO item for so long.
>
> --
> Simon Riggs
> EnterpriseDB http://www.enterprisedb.com
>


--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com