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 1krd5Y-0004oa-K2 for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Dec 2020 08:32:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krd5X-00015O-9k for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Dec 2020 08:32:11 +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 1krd5W-00015F-Tq for pgsql-hackers@lists.postgresql.org; Tue, 22 Dec 2020 08:32:11 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1krd5T-0007ay-Iu for pgsql-hackers@lists.postgresql.org; Tue, 22 Dec 2020 08:32:09 +0000 Received: by mail-io1-xd36.google.com with SMTP id q137so11262358iod.9 for ; Tue, 22 Dec 2020 00:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=U7hhQ8zH1gXsJj+oqO7LPwaKvlvVWxrqf8A6jld+YNM=; b=F4MB3OjYxDvKLbNvZxn4gWLw+WurhYloP+zCTsikI+ufFDzRYIDy5DnrLgwDsXP36H XbYkEqiaEz0kYh/0wfEiG6es1jhouLgHY0LV7k+ax7aP0WJ57eNlojlmx5oyYCjUm0Wl OrRpgeSTZ1tUGHspO8nb/X7z/9T8XbyPGWCnKYF3YVI77q6RlZVjbuNnkFAZNl19i8pC lKlM3Tc2QtW7/WkX1ei7mwnyPXIvF4ap0ILfdMmp6p6lo7ZF0xt+71NlLLOCavVMhyZI 4UX1xDL/vMS5A4Nzuc6d0SmUeVBraizcO/VBUabUDAwk/ON0owSKSOIzsak6lp4TMhbA WUWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=U7hhQ8zH1gXsJj+oqO7LPwaKvlvVWxrqf8A6jld+YNM=; b=nfvQwzogdy/44pXBYy1TW2Am/wdDjWuHxCWR9+h4fz0/7sfenwiTkyIgAM9df/zoAh K6qp86V+L5nlDw/Y0gkWVOwu5G9iiHZ+funRr9HZYf1IbuubeqsFK/XFadj0j8a8JLNJ mA2T+kDgwKIKW+4thCsNS21wrGPpMxnT21N9pYNEXv/YNFIH7bLYUt+K1QviGZZ6v35w BkKebtxRrojAscDgTHrGv1Ww4EQBNcEjeNwDJSpqhFfM8CxNOD5RnyqozZKtmCJOseeZ 3vhhyTNAbZM1VEyUN1PNGXLXimAIIEJDQ23WOwzOzaNWVZGP9U3yGcHo3+eDg/BXULA5 VCWg== X-Gm-Message-State: AOAM531wYzJJ4YHee1FbCvntZ6wlPhVQ5c+ARxivUQgIJ3zgHRaPXVZm 3w/Baztk8EuqXdG/u6zuHPcm+g== X-Google-Smtp-Source: ABdhPJxLPpW0hQklEnFjFUVs9PlblwGeKzd4CHvKtZipvodOCfjEafscyu6UWr/0j0cIs0oJ7xE0zQ== X-Received: by 2002:a02:ac03:: with SMTP id a3mr18051732jao.71.1608625926996; Tue, 22 Dec 2020 00:32:06 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id e1sm23191768iod.17.2020.12.22.00.32.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2020 00:32:06 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 275BD800C55; Tue, 22 Dec 2020 02:32:05 -0600 (CST) Date: Tue, 22 Dec 2020 02:32:05 -0600 From: Justin Pryzby To: Michael Paquier Cc: Alvaro Herrera , Peter Eisentraut , Alexey Kondratov , 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 Message-ID: <20201222083204.GL30237@telsasoft.com> References: <7ec67c56-2377-cd05-51a0-691104404abe@enterprisedb.com> <20201216004517.GA18498@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Dec 22, 2020 at 03:47:57PM +0900, Michael Paquier wrote: > On Wed, Dec 16, 2020 at 10:01:11AM +0900, Michael Paquier wrote: > > On Tue, Dec 15, 2020 at 09:45:17PM -0300, Alvaro Herrera wrote: > > > I don't like this idea too much, because adding an option causes an ABI > > > break. I don't think we commonly add options in backbranches, but it > > > has happened. The bitmask is much easier to work with in that regard. > > > > ABI flexibility is a good point here. I did not consider this point > > of view. Thanks! > > FWIW, I have taken a shot at this part of the patch, and finished with > the attached. This uses bits32 for the bitmask options and an hex > style for the bitmask params, while bundling all the flags into > dedicated structures for all the options that can be extended for the > tablespace case (or some filtering for REINDEX). Seems fine, but why do you do memcpy() instead of a structure assignment ? > @@ -3965,8 +3965,11 @@ reindex_relation(Oid relid, int flags, int options) > * Note that this should fail if the toast relation is missing, so > * reset REINDEXOPT_MISSING_OK. > */ > - result |= reindex_relation(toast_relid, flags, > - options & ~(REINDEXOPT_MISSING_OK)); > + ReindexOptions newoptions; > + > + memcpy(&newoptions, options, sizeof(ReindexOptions)); > + newoptions.flags &= ~(REINDEXOPT_MISSING_OK); > + result |= reindex_relation(toast_relid, flags, &newoptions); Could be newoptions = *options; Also, this one is going to be subsumed by ExecReindex(), so the palloc will go away (otherwise I would ask to pass it in from the caller): > +ReindexOptions * > ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt) > { > ListCell *lc; > - int options = 0; > + ReindexOptions *options; > bool concurrently = false; > bool verbose = false; > > + options = (ReindexOptions *) palloc0(sizeof(ReindexOptions)); > + -- Justin