From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Steve Singer <steve(at)ssinger(dot)info>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Jose Luis Tallon <jltallon(at)adv-solutions(dot)net> |
Subject: | Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly |
Date: | 2020-03-26 18:01:12 |
Message-ID: | 20200326180112.GH17431@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I included your new solution regarding this part from 0004 into 0001. It
> seems that at least a tip of the problem was in that we tried to change
> tablespace to pg_default being already there.
Right, causing it to try to drop that filenode twice.
> +++ b/doc/src/sgml/ref/cluster.sgml
> + The name of a specific tablespace to store clustered relations.
Could you phrase these like you did in the comments:
" the name of the tablespace where the clustered relation is to be rebuilt."
> +++ b/doc/src/sgml/ref/reindex.sgml
> + The name of a specific tablespace to store rebuilt indexes.
" The name of a tablespace where indexes will be rebuilt"
> +++ b/doc/src/sgml/ref/vacuum.sgml
> + The name of a specific tablespace to write a new copy of the table.
> + This specifies a tablespace, where all rebuilt indexes will be created.
say "specifies the tablespace where", with no comma.
> + else if (!OidIsValid(classtuple->relfilenode))
> + {
> + /*
> + * Skip all mapped relations.
> + * relfilenode == 0 checks after that, similarly to
> + * RelationIsMapped().
I would say "OidIsValid(relfilenode) checks for that, ..."
> @@ -262,7 +280,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
> * and error messages should refer to the operation as VACUUM not CLUSTER.
> */
> void
> -cluster_rel(Oid tableOid, Oid indexOid, int options)
> +cluster_rel(Oid tableOid, Oid indexOid, Oid tablespaceOid, int options)
Add a comment here about the tablespaceOid parameter, like the other functions
where it's added.
The permission checking is kind of duplicitive, so I'd suggest to factor it
out. Ideally we'd only have one place that checks for pg_global/system/mapped.
It needs to check that it's not a system relation, or that system_table_mods
are allowed, and in any case that if it's a mapped rel, that it's not being
moved. I would pass a boolean indicating if the tablespace is being changed.
Another issue is this:
> +VACUUM ( FULL [, ...] ) [ TABLESPACE <replaceable class="parameter">new_tablespace</replaceable> ] [ <replaceable class="parameter">table_and_columns</replaceable> [, ...] ]
As you mentioned in your v1 patch, in the other cases, "tablespace
[tablespace]" is added at the end of the command rather than in the middle. I
wasn't able to make that work, maybe because "tablespace" isn't a fully
reserved word (?). I didn't try with "SET TABLESPACE", although I understand
it'd be better without "SET".
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2020-03-26 18:02:29 | Re: backup manifests |
Previous Message | Pavel Stehule | 2020-03-26 17:56:27 | Re: proposal \gcsv |