Re: Reset snapshot export state on the transaction abort
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-10-13T04:47:38Z
Lists: pgsql-hackers
On Mon, Oct 11, 2021 at 08:46:32PM +0530, Dilip Kumar wrote:
> As reported at [1], if the transaction is aborted during export
> snapshot then ExportInProgress and SavedResourceOwnerDuringExport are
> not getting reset and that is throwing an error
> "clearing exported snapshot in wrong transaction state" while
> executing the next command. The attached patch clears this state if
> the transaction is aborted.
Injecting an error is enough to reproduce the failure in a second
command after the first one failed. This could happen on OOM for the
palloc() done at the beginning of SnapBuildInitialSnapshot().
@@ -2698,6 +2698,9 @@ AbortTransaction(void)
/* Reset logical streaming state. */
ResetLogicalStreamingState();
+ /* Reset snapshot export state. */
+ ResetSnapBuildExportSnapshotState();
Shouldn't we care about the case of a sub-transaction abort as well?
See AbortSubTransaction().
--
Michael
Commits
-
Reset properly snapshot export state during transaction abort
- f49bf8263459 9.6.24 landed
- d1a6a08dfafc 10.19 landed
- 506aa1f71a98 11.14 landed
- a207b8521346 12.9 landed
- 8f4fe8d7f8dc 13.5 landed
- 5b353aaff69c 14.1 landed
- 409f9ca44713 15.0 landed