Provide much better wait information in pg_stat_activity.
When a process is waiting for a heavyweight lock, we will now indicate the type of heavyweight lock for which it is waiting. Also, you can now see when a process is waiting for a lightweight lock - in which case we will indicate the individual lock name or the tranche, as appropriate - or for a buffer pin.
Amit Kapila, Ildus Kurbangaliev, reviewed by me. Lots of helpful discussion and suggestions by many others, including Alexander Korotkov, Vladimir Borodin, and many others.
Branch ------ master
I am trying to test this feature, and there I see not actual data. Maybe this behave is not related to this patch:
create table foo(a int);
insert into foo values(10);
session one:
begin; select * from foo for update;
session two:
begin; select * from foo for update;
session two is waiting
session one:
select * from pg_stat_activity -- I don't see correct information about session two
session two:
rollback; begin; select * from foo where a = 10 for update;
session two is waiting again
session one:
select * from pg_stat_activity; -- The content is not changed
So content of pg_stat_activity is not correct in holder lock session. Independent third session see valid content of pg_stat_activity.
Hypothesis: the pg_stat_activity is not refreshed under opened transaction?