forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit46d6e5f
committed
Display the time when the process started waiting for the lock, in pg_locks, take 2
This commit adds new column "waitstart" into pg_locks view. This columnreports the time when the server process started waiting for the lockif the lock is not held. This information is useful, for example, whenexamining the amount of time to wait on a lock by subtracting"waitstart" in pg_locks from the current time, and identify the lockthat the processes are waiting for very long.This feature uses the current time obtained for the deadlock timeouttimer as "waitstart" (i.e., the time when this process started waitingfor the lock). Since getting the current time newly can cause overhead,we reuse the already-obtained time to avoid that overhead.Note that "waitstart" is updated without holding the lock table'spartition lock, to avoid the overhead by additional lock acquisition.This can cause "waitstart" in pg_locks to become NULL for a very shortperiod of time after the wait started even though "granted" is false.This is OK in practice because we can assume that users are likely tolook at "waitstart" when waiting for the lock for a long time.The first attempt of this patch (commit3b733fc) caused the buildfarmmember "rorqual" (built with --disable-atomics --disable-spinlocks) to reportthe failure of the regression test. It was reverted by commit890d218.The cause of this failure was that the atomic variable for "waitstart"in the dummy process entry created at the end of prepare transaction wasnot initialized. This second attempt fixes that issue.Bump catalog version.Author: Atsushi TorikoshiReviewed-by: Ian Lawrence Barwick, Robert Haas, Justin Pryzby, Fujii MasaoDiscussion:https://postgr.es/m/a96013dc51cdc56b2a2b84fa8a16a993@oss.nttdata.com1 parent9e596b6 commit46d6e5f
File tree
12 files changed
+94
-11
lines changed- contrib/amcheck/expected
- doc/src/sgml
- src
- backend
- access/transam
- storage
- ipc
- lmgr
- utils/adt
- include
- catalog
- storage
- test/regress/expected
12 files changed
+94
-11
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
100 |
| - | |
101 |
| - | |
| 100 | + | |
| 101 | + | |
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10605 | 10605 |
| |
10606 | 10606 |
| |
10607 | 10607 |
| |
| 10608 | + | |
| 10609 | + | |
| 10610 | + | |
| 10611 | + | |
| 10612 | + | |
| 10613 | + | |
| 10614 | + | |
| 10615 | + | |
| 10616 | + | |
| 10617 | + | |
| 10618 | + | |
| 10619 | + | |
| 10620 | + | |
10608 | 10621 |
| |
10609 | 10622 |
| |
10610 | 10623 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
873 | 873 |
| |
874 | 874 |
| |
875 | 875 |
| |
| 876 | + | |
876 | 877 |
| |
877 |
| - | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
878 | 885 |
| |
879 | 886 |
| |
880 | 887 |
| |
|
Lines changed: 23 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
540 | 540 |
| |
541 | 541 |
| |
542 | 542 |
| |
| 543 | + | |
543 | 544 |
| |
544 | 545 |
| |
545 | 546 |
| |
546 | 547 |
| |
| 548 | + | |
547 | 549 |
| |
548 |
| - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
549 | 571 |
| |
550 | 572 |
| |
551 | 573 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3619 | 3619 |
| |
3620 | 3620 |
| |
3621 | 3621 |
| |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
3622 | 3628 |
| |
3623 | 3629 |
| |
3624 | 3630 |
| |
| |||
3646 | 3652 |
| |
3647 | 3653 |
| |
3648 | 3654 |
| |
| 3655 | + | |
3649 | 3656 |
| |
3650 | 3657 |
| |
3651 | 3658 |
| |
| |||
3698 | 3705 |
| |
3699 | 3706 |
| |
3700 | 3707 |
| |
| 3708 | + | |
3701 | 3709 |
| |
3702 | 3710 |
| |
3703 | 3711 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
402 | 402 |
| |
403 | 403 |
| |
404 | 404 |
| |
| 405 | + | |
405 | 406 |
| |
406 | 407 |
| |
407 | 408 |
| |
| |||
580 | 581 |
| |
581 | 582 |
| |
582 | 583 |
| |
| 584 | + | |
583 | 585 |
| |
584 | 586 |
| |
585 | 587 |
| |
| |||
1262 | 1264 |
| |
1263 | 1265 |
| |
1264 | 1266 |
| |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
1265 | 1284 |
| |
1266 | 1285 |
| |
1267 | 1286 |
| |
| |||
1678 | 1697 |
| |
1679 | 1698 |
| |
1680 | 1699 |
| |
| 1700 | + | |
1681 | 1701 |
| |
1682 | 1702 |
| |
1683 | 1703 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
| 66 | + | |
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
| |||
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
| 145 | + | |
| 146 | + | |
145 | 147 |
| |
146 | 148 |
| |
147 | 149 |
| |
| |||
336 | 338 |
| |
337 | 339 |
| |
338 | 340 |
| |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
339 | 345 |
| |
340 | 346 |
| |
341 | 347 |
| |
| |||
406 | 412 |
| |
407 | 413 |
| |
408 | 414 |
| |
| 415 | + | |
409 | 416 |
| |
410 | 417 |
| |
411 | 418 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5994 | 5994 |
| |
5995 | 5995 |
| |
5996 | 5996 |
| |
5997 |
| - | |
5998 |
| - | |
5999 |
| - | |
| 5997 | + | |
| 5998 | + | |
| 5999 | + | |
6000 | 6000 |
| |
6001 | 6001 |
| |
6002 | 6002 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
| 25 | + | |
25 | 26 |
| |
26 | 27 |
| |
27 | 28 |
| |
| |||
446 | 447 |
| |
447 | 448 |
| |
448 | 449 |
| |
| 450 | + | |
| 451 | + | |
449 | 452 |
| |
450 | 453 |
| |
451 | 454 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
181 | 181 |
| |
182 | 182 |
| |
183 | 183 |
| |
| 184 | + | |
| 185 | + | |
184 | 186 |
| |
185 | 187 |
| |
186 | 188 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1394 | 1394 |
| |
1395 | 1395 |
| |
1396 | 1396 |
| |
1397 |
| - | |
1398 |
| - | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1399 | 1400 |
| |
1400 | 1401 |
| |
1401 | 1402 |
| |
|
0 commit comments
Comments
(0)