mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
f51a03db3d9cf73410924fed32b599da3258e4e3
As mentioned in the comments in TransactionIdDidAbort() and in heapam_visibility.c, the usual procedure for checking whether a transaction aborted is to first call TransactionIdIsInProgress(), and then !TransactionIdDidCommit(). A couple places didn't get the memo, and used TransactionIdDidAbort() incorrectly. In DoesMultiXactIdConflict(), the consequence was that if a conflicting transaction was just aborting, and had already marked the transaction as aborted in pg_xact, but had not yet removed itself from ProcArray, the function would return false meaning that it does not conflict, even though it was still considered as running by TransactionIdIsInProgress(). That could cause trouble later. One known consequence is that if you then went ahead with updating the row again and called MultiXactIdExpand(), MultiXactIdExpand() would see both the old aborting transaction and the new updater as still running, and throw an ERROR: new multixact has more than one updating member. The multixact-aborted-updater.spec included in this commit exercises that scenario. Another place that got this wrong was in heap_update(), where we check if the updating transaction that was part of a multixid committed or aborted. Because it used TransactionIdDidAbort(), if the updating transaction crashed, it was considered as committed and heap_update() incorrectly returned TM_Updated indicating a conflict, even though the row could be updated. This would only happen if the multixid as whole was still considered running, i.e. if the tuple was still locked by other transactions while the updating transaction crashed. That can happen if the locker is a prepared transaction. The included 060_multixact_crashed_updater.pl test tests that scenario. Author: Chee Wooson <wuqi@vastdata.com.cn> Tested-by: Lionel Hamayon <lionel.hamayon@evolution-digitale.fr> Discussion: https://www.postgresql.org/message-id/5778D6297D3CCF21+202609151836512678486@vastdata.com.cn Backpatch-through: 14
PostgreSQL Database Management System ===================================== This directory contains the source code distribution of the PostgreSQL database management system. PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings. PostgreSQL has many language interfaces, many of which are listed here: https://www.postgresql.org/download/ See the file INSTALL for instructions on how to build and install PostgreSQL. That file also lists supported operating systems and hardware platforms and contains information regarding any other software packages that are required to build or run the PostgreSQL system. Copyright and license information can be found in the file COPYRIGHT. A comprehensive documentation set is included in this distribution; it can be read as described in the installation instructions. The latest version of this software may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.
Languages
C
83.9%
PLpgSQL
6.2%
Perl
5.4%
Yacc
1.2%
Meson
0.7%
Other
2.4%