Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l2Hu2-0001LF-1k for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jan 2021 18:08:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l2Htz-0004mT-Ay for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jan 2021 18:08:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l2Hty-0004mM-Uh for pgsql-hackers@lists.postgresql.org; Wed, 20 Jan 2021 18:08:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l2Htu-0007dt-0p for pgsql-hackers@lists.postgresql.org; Wed, 20 Jan 2021 18:08:17 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 9E23421C2E96; Wed, 20 Jan 2021 21:08:11 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1611166091; bh=YaGrlVxbgAkYJgHqI9OIufH9YOV2W2bltjl7ZpaqkDw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Gb7cmTsRl5hStH4QtGemvRwDS4XiEcEWGdbvlIQ79Uj6LPv+L1QX26bwPQ8cRq7se TTbxpL/qAFXE4BrvVq7Qt1sirjdp2AJY0uEJKiSZdPqIcnIVkaxoIDHZETNUEs7gvh tN1nE53gSPemHZ2hKsEp4Wis/qCBtA1kYsoawGIM= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 20 Jan 2021 21:08:11 +0300 From: Alexey Kondratov To: Alvaro Herrera Cc: Michael Paquier , Justin Pryzby , Peter Eisentraut , Masahiko Sawada , Steve Singer , pgsql-hackers@lists.postgresql.org, Robert Haas , Alexander Korotkov , Masahiko Sawada , Jose Luis Tallon Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly In-Reply-To: <20210120155450.GA9584@alvherre.pgsql> References: <20210120155450.GA9584@alvherre.pgsql> User-Agent: Roundcube Webmail/1.4.0 Message-ID: <7f51f09d2dd1c92981f898e0a7b2f187@postgrespro.ru> X-Sender: a.kondratov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021-01-20 18:54, Alvaro Herrera wrote: > On 2021-Jan-20, Alvaro Herrera wrote: > >> On 2021-Jan-20, Michael Paquier wrote: >> >> > +/* >> > + * This is mostly duplicating ATExecSetTableSpaceNoStorage, >> > + * which should maybe be factored out to a library function. >> > + */ >> > Wouldn't it be better to do first the refactoring of 0002 and then >> > 0001 so as REINDEX can use the new routine, instead of putting that >> > into a comment? >> >> I think merging 0001 and 0002 into a single commit is a reasonable >> approach. > > ... except it doesn't make a lot of sense to have set_rel_tablespace in > either indexcmds.c or index.c. I think tablecmds.c is a better place > for it. (I would have thought catalog/storage.c, but that one's not > the > right abstraction level it seems.) > I did a refactoring of ATExecSetTableSpaceNoStorage() in the 0001. New function SetRelTablesapce() is placed into the tablecmds.c. Following 0002 gets use of it. Is it close to what you and Michael suggested? > > But surely ATExecSetTableSpaceNoStorage should be using this new > routine. (I first thought 0002 was doing that, since that commit is > calling itself a "refactoring", but now that I look closer, it's not.) > Yeah, this 'refactoring' was initially referring to refactoring of what Justin added to one of the previous 0001. And it was meant to be merged with 0001, once agreed, but we got distracted by other stuff. I have not yet addressed Michael's concerns regarding reindex of partitions. I am going to look closer on it tomorrow. Regards -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company