Re: Tablespace patch review - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Tablespace patch review
Date
Msg-id 200406190147.i5J1lhC05652@candle.pha.pa.us
Whole thread Raw
In response to Re: Tablespace patch review  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Tablespace patch review  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> Somebody's got to fix oid2name and dbsize though.  Bruce, you want
> >> to catch those?
>
> > Uh, how do they have to be fixed?  Isn't the relfilenode unchanged?  Do
> > we just need to add tablespace lookups?
>
> How useful will oid2name be if it doesn't understand about tablespaces?
> I dunno how it ought to be changed, but surely it needs some thought.

Well, I figure we would copy the database capability we have for
tablespaces.

If you call oid2name with no args, you get:

    All databases:
    ---------------------------------
    17219  = test
    1      = template1
    17218  = template0

If we specify just the database name we get:

    (2) aspg oid2name -d template1
    All tables from database "template1":
    ---------------------------------
    17147  = sql_features
    17152  = sql_implementation_info
    17157  = sql_languages
    17162  = sql_packages
    17167  = sql_sizing
    17172  = sql_sizing_profiles

I assume we just need to add a tablespace display when run with no args,
and a -s option to display _with_ -d to display only objects in that
database.  We could go fancy and spin through all the databases and list
the datbase name and objects in that tablespace.

> dbsize doesn't even compile right now, because it's using
> GetDatabasePath which now has another argument.  I did not patch it
> because it needs more thought: should it report the total of all
> tablespaces for the database, or should its API be extended so you
> can ask about individual tablespaces, or what?  In any case it's
> not a one-liner fix...

For dbsize, I assume we have to follow the symlinks.  We would have to
spin through all the tablespaces looking for directories with the
database oid.

Given the number of open items for 7.5, I am thinking of keeping this
for post-feature freeze.  Both are contrib.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Tablespace patch review
Next
From: Tom Lane
Date:
Subject: Re: Tablespace patch review