Thread

Commits

  1. Doc: Clarify locks taken when using ALTER TABLE ATTACH PARTITION

  2. Doc: Improve description around ALTER TABLE ATTACH PARTITION

  1. update ALTER TABLE with ATTACH PARTITION lock mode

    Justin Pryzby <pryzby@telsasoft.com> — 2019-10-28T00:12:07Z

    commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
    updates ddl.sgml but not alter_table.sgml, which only says:
    
    https://www.postgresql.org/docs/12/release-12.html
    |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
    
    Find attached patch, which also improve language in several related places.
    
    "Without such a constraint": SUCH could refer to either of the constraints..
    
    "because it is no longer necessary.": In our use case, we prefer to keep the
    redundant constraint, to avoid having to add it back if we detach/reattach
    again in the future..
    
  2. Re: update ALTER TABLE with ATTACH PARTITION lock mode

    Michael Paquier <michael@paquier.xyz> — 2019-10-28T07:55:46Z

    On Sun, Oct 27, 2019 at 07:12:07PM -0500, Justin Pryzby wrote:
    > commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
    > updates ddl.sgml but not alter_table.sgml, which only says:
    > 
    > https://www.postgresql.org/docs/12/release-12.html
    > |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
    
    +     <para>
    +      Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    +      lock on the partitioned table, in addition to an
    +      <literal>ACCESS EXCLUSIVE</literal> lock on the partition.
    +     </para>
    Updating the docs of ALTER TABLE sounds like a good idea.  This
    sentence looks fine to me.  Perhaps others have suggestions?
    
    > Find attached patch, which also improve language in several related places.
    
    Not sure that these are actually improvements.
    --
    Michael
    
  3. Re: update ALTER TABLE with ATTACH PARTITION lock mode

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2019-10-28T15:06:44Z

    On 2019-Oct-28, Michael Paquier wrote:
    
    > On Sun, Oct 27, 2019 at 07:12:07PM -0500, Justin Pryzby wrote:
    > > commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
    > > updates ddl.sgml but not alter_table.sgml, which only says:
    > > 
    > > https://www.postgresql.org/docs/12/release-12.html
    > > |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
    > 
    > +     <para>
    > +      Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    > +      lock on the partitioned table, in addition to an
    > +      <literal>ACCESS EXCLUSIVE</literal> lock on the partition.
    > +     </para>
    > Updating the docs of ALTER TABLE sounds like a good idea.  This
    > sentence looks fine to me.  Perhaps others have suggestions?
    
    Doesn't the command also acquire a lock on the default partition if
    there is one?  It sounds worth noting.
    
    > > Find attached patch, which also improve language in several related places.
    > 
    > Not sure that these are actually improvements.
    
    I think some of them (most?) are clear improvements.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
    
  4. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Justin Pryzby <pryzby@telsasoft.com> — 2019-10-29T03:56:33Z

    On Mon, Oct 28, 2019 at 12:06:44PM -0300, Alvaro Herrera wrote:
    > On 2019-Oct-28, Michael Paquier wrote:
    > 
    > > On Sun, Oct 27, 2019 at 07:12:07PM -0500, Justin Pryzby wrote:
    > > > commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
    > > > updates ddl.sgml but not alter_table.sgml, which only says:
    > > > 
    > > > https://www.postgresql.org/docs/12/release-12.html
    > > > |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
    > > 
    > > +     <para>
    > > +      Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    > > +      lock on the partitioned table, in addition to an
    > > +      <literal>ACCESS EXCLUSIVE</literal> lock on the partition.
    > > +     </para>
    > > Updating the docs of ALTER TABLE sounds like a good idea.  This
    > > sentence looks fine to me.  Perhaps others have suggestions?
    > 
    > Doesn't the command also acquire a lock on the default partition if
    > there is one?  It sounds worth noting.
    
    I suppose it should something other than partition(ed), since partitions can be
    partitioned, too...
    
          Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
          lock on the parent table, in addition to
          <literal>ACCESS EXCLUSIVE</literal> locks on the child table and the
          <literal>DEFAULT</literal> partition (if any).
    
    Thanks,
    Justin
    
    
    
    
  5. Re: update ALTER TABLE with ATTACH PARTITION lock mode

    Amit Langote <amitlangote09@gmail.com> — 2019-10-31T08:00:11Z

    Hello,
    
    On Tue, Oct 29, 2019 at 12:13 AM Alvaro Herrera
    <alvherre@2ndquadrant.com> wrote:
    > On 2019-Oct-28, Michael Paquier wrote:
    > > On Sun, Oct 27, 2019 at 07:12:07PM -0500, Justin Pryzby wrote:
    > > > commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
    > > > updates ddl.sgml but not alter_table.sgml, which only says:
    > > >
    > > > https://www.postgresql.org/docs/12/release-12.html
    > > > |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
    > >
    > > +     <para>
    > > +      Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    > > +      lock on the partitioned table, in addition to an
    > > +      <literal>ACCESS EXCLUSIVE</literal> lock on the partition.
    > > +     </para>
    > > Updating the docs of ALTER TABLE sounds like a good idea.  This
    > > sentence looks fine to me.  Perhaps others have suggestions?
    >
    > Doesn't the command also acquire a lock on the default partition if
    > there is one?  It sounds worth noting.
    >
    > > > Find attached patch, which also improve language in several related places.
    > >
    > > Not sure that these are actually improvements.
    >
    > I think some of them (most?) are clear improvements.
    
    As someone who has written some of those lines, I agree that Justin's
    tweaks make them more readable, so +1 to apply 0002 patch too.
    
    Thanks,
    Amit
    
    
    
    
  6. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Michael Paquier <michael@paquier.xyz> — 2019-10-31T09:07:34Z

    On Mon, Oct 28, 2019 at 10:56:33PM -0500, Justin Pryzby wrote:
    > I suppose it should something other than partition(ed), since partitions can be
    > partitioned, too...
    > 
    >       Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    >       lock on the parent table, in addition to
    >       <literal>ACCESS EXCLUSIVE</literal> locks on the child table and the
    >       <literal>DEFAULT</literal> partition (if any).
    
    In this context, "on the child table" sounds a bit confusing?  Would
    it make more sense to say the "on the table to be attached" instead?
    --
    Michael
    
  7. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Justin Pryzby <pryzby@telsasoft.com> — 2019-11-01T13:59:48Z

    On Thu, Oct 31, 2019 at 06:07:34PM +0900, Michael Paquier wrote:
    > On Mon, Oct 28, 2019 at 10:56:33PM -0500, Justin Pryzby wrote:
    > > I suppose it should something other than partition(ed), since partitions can be
    > > partitioned, too...
    > > 
    > >       Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
    > >       lock on the parent table, in addition to
    > >       <literal>ACCESS EXCLUSIVE</literal> locks on the child table and the
    > >       <literal>DEFAULT</literal> partition (if any).
    > 
    > In this context, "on the child table" sounds a bit confusing?  Would
    > it make more sense to say the "on the table to be attached" instead?
    
    I guess you mean because it's not a child until after the ALTER.  Yes, that
    makes sense.
    
    Thanks,
    Justin
    
    
    
    
  8. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Michael Paquier <michael@paquier.xyz> — 2019-11-01T14:01:22Z

    On Fri, Nov 01, 2019 at 08:59:48AM -0500, Justin Pryzby wrote:
    > I guess you mean because it's not a child until after the ALTER.  Yes, that
    > makes sense.
    
    Yes, perhaps you have another idea than mine on how to shape this
    sentence?
    --
    Michael
    
  9. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Justin Pryzby <pryzby@telsasoft.com> — 2019-11-01T16:58:43Z

    On Fri, Nov 01, 2019 at 11:01:22PM +0900, Michael Paquier wrote:
    > On Fri, Nov 01, 2019 at 08:59:48AM -0500, Justin Pryzby wrote:
    > > I guess you mean because it's not a child until after the ALTER.  Yes, that
    > > makes sense.
    > 
    > Yes, perhaps you have another idea than mine on how to shape this
    > sentence?
    
    I can't think of anything better.
    
    Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal> lock
    on the parent table, in addition to <literal>ACCESS EXCLUSIVE</literal> locks
    on the table to be attached and the <literal>DEFAULT</literal> partition (if
    any).                                                                                                                                 
    
    Justin
    
    
    
    
  10. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Michael Paquier <michael@paquier.xyz> — 2019-11-02T08:19:11Z

    On Fri, Nov 01, 2019 at 11:58:43AM -0500, Justin Pryzby wrote:
    > Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal> lock
    > on the parent table, in addition to <literal>ACCESS EXCLUSIVE</literal> locks
    > on the table to be attached and the <literal>DEFAULT</literal> partition (if
    > any).                                                                                                                                 
    
    Sounds fine.  So gathering everything I get the attached.  Any
    thoughts from others?
    --
    Michael
    
  11. Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)

    Michael Paquier <michael@paquier.xyz> — 2019-11-05T01:35:47Z

    On Sat, Nov 02, 2019 at 05:19:11PM +0900, Michael Paquier wrote:
    > Sounds fine.  So gathering everything I get the attached.  Any
    > thoughts from others?
    
    Committed after splitting the changes in two as originally proposed.
    --
    Michael