pgsql: Remove volatiles from {procarray,volatile}.c and fix memory orde

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Remove volatiles from {procarray,volatile}.c and fix memory orde
Дата
Msg-id E1gLdTM-0001rU-Uf@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove volatiles from {procarray,volatile}.c and fix memory ordering issue.

The use of volatiles in procarray.c largely originated from the time
when postgres did not have reliable compiler and memory
barriers. That's not the case anymore, so we can do better.

Several of the functions in procarray.c can be bottlenecks, and
removal of volatile yields mildly better code.

The new state, with explicit memory barriers, is also more
correct. The previous use of volatile did not actually deliver
sufficient guarantees on weakly ordered machines, in particular the
logic in GetNewTransactionId() does not look safe.  It seems unlikely
to be a problem in practice, but worth fixing.

Thomas and I independently wrote a patch for this.

Reported-By: Andres Freund and Thomas Munro
Author: Andres Freund, with cherrypicked changes from a patch by Thomas Munro
Discussion:
    https://postgr.es/m/20181005172955.wyjb4fzcdzqtaxjq@alap3.anarazel.de
    https://postgr.es/m/CAEepm=1nff0x=7i3YQO16jLA2qw-F9O39YmUew4oq-xcBQBs0g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/450c7defa6d5f3c9fdb6efc92cca106c7b582cb3

Modified Files
--------------
src/backend/access/transam/varsup.c |  52 +++++-------
src/backend/storage/ipc/procarray.c | 155 ++++++++++++++++++++----------------
2 files changed, 108 insertions(+), 99 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Remove ineffective check against dropped columns fromslot_getat
Следующее
От: Andrew Dunstan
Дата:
Сообщение: pgsql: Disable MSVC warning caused by recent snprintf.c changes