Re: BUG #19686: Rolling back SET TABLESPACE - Mailing list pgsql-hackers

From Manu
Subject Re: BUG #19686: Rolling back SET TABLESPACE
Date
Msg-id 179090264869.85105.1086434870759405279@gmail.com
Whole thread
In response to Re: BUG #19686: Rolling back SET TABLESPACE  (Alexandre Felipe <o.alexandre.felipe@gmail.com>)
Responses Re: BUG #19686: Rolling back SET TABLESPACE
List pgsql-hackers
Hi Alexandre,

Thanks -- and for going with this approach.  You raised two things: the
comment still described the pre-patch behavior, and it needed test
cases.  Both are addressed in the attached v2:

  - The comment no longer narrates the pre-patch behavior.  It now says,
    in the present tense, that the heap has just been rewritten and the
    indexes must share that fate, and leaves the detail to
    ATExecSetTableSpaceNewIndexRelfilenumber.

  - There is a regression test now, in the tablespace suite.  It runs
    the rollback-then-reinsert sequence and checks, with seqscans off,
    that the index agrees with the single live heap row -- it returns
    two against the bug, where the aborted transaction's index entry
    survives and aliases the reused TID.  check-world is green with the
    patch.

The approach is the one we settled on: after the heap move, each of the
table's indexes gets a fresh relfilenumber copied within its own
tablespace, so an abort discards the new heap and index files together.
It does not change the indexes' tablespace, matching the documented
behavior that SET TABLESPACE leaves indexes in place.

Regards,
Manu

Attachment

pgsql-hackers by date:

Previous
From: "Alberto Piai"
Date:
Subject: Re: SQL-level pg_datum_image_equal
Next
From: Haibo Yan
Date:
Subject: Extension-defined restore actions depending on dumped objects