Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit890d218

Browse files
committed
Revert "Display the time when the process started waiting for the lock, in pg_locks."
This reverts commit3b733fc.Per buildfarm members prion and rorqual.
1 parent3b733fc commit890d218

File tree

11 files changed

+10
-85
lines changed

11 files changed

+10
-85
lines changed

‎contrib/amcheck/expected/check_btree.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ SELECT bt_index_parent_check('bttest_b_idx');
9797
SELECT * FROM pg_locks
9898
WHERE relation = ANY(ARRAY['bttest_a', 'bttest_a_idx', 'bttest_b', 'bttest_b_idx']::regclass[])
9999
AND pid = pg_backend_pid();
100-
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | fastpath| waitstart
101-
----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-----+------+---------+----------+-----------
100+
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | fastpath
101+
----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-----+------+---------+----------
102102
(0 rows)
103103

104104
COMMIT;

‎doc/src/sgml/catalogs.sgml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10604,19 +10604,6 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
1060410604
lock table
1060510605
</para></entry>
1060610606
</row>
10607-
10608-
<row>
10609-
<entry role="catalog_table_entry"><para role="column_definition">
10610-
<structfield>waitstart</structfield> <type>timestamptz</type>
10611-
</para>
10612-
<para>
10613-
Time when the server process started waiting for this lock,
10614-
or null if the lock is held.
10615-
Note that this can be null for a very short period of time after
10616-
the wait started even though <structfield>granted</structfield>
10617-
is <literal>false</literal>.
10618-
</para></entry>
10619-
</row>
1062010607
</tbody>
1062110608
</tgroup>
1062210609
</table>

‎src/backend/storage/ipc/standby.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -540,34 +540,12 @@ void
540540
ResolveRecoveryConflictWithLock(LOCKTAGlocktag,boollogging_conflict)
541541
{
542542
TimestampTzltime;
543-
TimestampTznow;
544543

545544
Assert(InHotStandby);
546545

547546
ltime=GetStandbyLimitTime();
548-
now=GetCurrentTimestamp();
549547

550-
/*
551-
* Update waitStart if first time through after the startup process
552-
* started waiting for the lock. It should not be updated every time
553-
* ResolveRecoveryConflictWithLock() is called during the wait.
554-
*
555-
* Use the current time obtained for comparison with ltime as waitStart
556-
* (i.e., the time when this process started waiting for the lock). Since
557-
* getting the current time newly can cause overhead, we reuse the
558-
* already-obtained time to avoid that overhead.
559-
*
560-
* Note that waitStart is updated without holding the lock table's
561-
* partition lock, to avoid the overhead by additional lock acquisition.
562-
* This can cause "waitstart" in pg_locks to become NULL for a very short
563-
* period of time after the wait started even though "granted" is false.
564-
* This is OK in practice because we can assume that users are likely to
565-
* look at "waitstart" when waiting for the lock for a long time.
566-
*/
567-
if (pg_atomic_read_u64(&MyProc->waitStart)==0)
568-
pg_atomic_write_u64(&MyProc->waitStart,now);
569-
570-
if (now >=ltime&&ltime!=0)
548+
if (GetCurrentTimestamp() >=ltime&&ltime!=0)
571549
{
572550
/*
573551
* We're already behind, so clear a path as quickly as possible.

‎src/backend/storage/lmgr/lock.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,12 +3619,6 @@ GetLockStatusData(void)
36193619
instance->leaderPid=proc->pid;
36203620
instance->fastpath= true;
36213621

3622-
/*
3623-
* Successfully taking fast path lock means there were no
3624-
* conflicting locks.
3625-
*/
3626-
instance->waitStart=0;
3627-
36283622
el++;
36293623
}
36303624

@@ -3652,7 +3646,6 @@ GetLockStatusData(void)
36523646
instance->pid=proc->pid;
36533647
instance->leaderPid=proc->pid;
36543648
instance->fastpath= true;
3655-
instance->waitStart=0;
36563649

36573650
el++;
36583651
}
@@ -3705,7 +3698,6 @@ GetLockStatusData(void)
37053698
instance->pid=proc->pid;
37063699
instance->leaderPid=proclock->groupLeader->pid;
37073700
instance->fastpath= false;
3708-
instance->waitStart= (TimestampTz)pg_atomic_read_u64(&proc->waitStart);
37093701

37103702
el++;
37113703
}

‎src/backend/storage/lmgr/proc.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ InitProcess(void)
402402
MyProc->lwWaitMode=0;
403403
MyProc->waitLock=NULL;
404404
MyProc->waitProcLock=NULL;
405-
pg_atomic_init_u64(&MyProc->waitStart,0);
406405
#ifdefUSE_ASSERT_CHECKING
407406
{
408407
inti;
@@ -1263,23 +1262,6 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
12631262
}
12641263
else
12651264
enable_timeout_after(DEADLOCK_TIMEOUT,DeadlockTimeout);
1266-
1267-
/*
1268-
* Use the current time obtained for the deadlock timeout timer as
1269-
* waitStart (i.e., the time when this process started waiting for the
1270-
* lock). Since getting the current time newly can cause overhead, we
1271-
* reuse the already-obtained time to avoid that overhead.
1272-
*
1273-
* Note that waitStart is updated without holding the lock table's
1274-
* partition lock, to avoid the overhead by additional lock
1275-
* acquisition. This can cause "waitstart" in pg_locks to become NULL
1276-
* for a very short period of time after the wait started even though
1277-
* "granted" is false. This is OK in practice because we can assume
1278-
* that users are likely to look at "waitstart" when waiting for the
1279-
* lock for a long time.
1280-
*/
1281-
pg_atomic_write_u64(&MyProc->waitStart,
1282-
get_timeout_start_time(DEADLOCK_TIMEOUT));
12831265
}
12841266
elseif (log_recovery_conflict_waits)
12851267
{
@@ -1696,7 +1678,6 @@ ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus)
16961678
proc->waitLock=NULL;
16971679
proc->waitProcLock=NULL;
16981680
proc->waitStatus=waitStatus;
1699-
pg_atomic_write_u64(&MyProc->waitStart,0);
17001681

17011682
/* And awaken it */
17021683
SetLatch(&proc->procLatch);

‎src/backend/utils/adt/lockfuncs.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ typedef struct
6363
}PG_Lock_Status;
6464

6565
/* Number of columns in pg_locks output */
66-
#defineNUM_LOCK_STATUS_COLUMNS16
66+
#defineNUM_LOCK_STATUS_COLUMNS15
6767

6868
/*
6969
* VXIDGetDatum - Construct a text representation of a VXID
@@ -142,8 +142,6 @@ pg_lock_status(PG_FUNCTION_ARGS)
142142
BOOLOID,-1,0);
143143
TupleDescInitEntry(tupdesc, (AttrNumber)15,"fastpath",
144144
BOOLOID,-1,0);
145-
TupleDescInitEntry(tupdesc, (AttrNumber)16,"waitstart",
146-
TIMESTAMPTZOID,-1,0);
147145

148146
funcctx->tuple_desc=BlessTupleDesc(tupdesc);
149147

@@ -338,10 +336,6 @@ pg_lock_status(PG_FUNCTION_ARGS)
338336
values[12]=CStringGetTextDatum(GetLockmodeName(instance->locktag.locktag_lockmethodid,mode));
339337
values[13]=BoolGetDatum(granted);
340338
values[14]=BoolGetDatum(instance->fastpath);
341-
if (!granted&&instance->waitStart!=0)
342-
values[15]=TimestampTzGetDatum(instance->waitStart);
343-
else
344-
nulls[15]= true;
345339

346340
tuple=heap_form_tuple(funcctx->tuple_desc,values,nulls);
347341
result=HeapTupleGetDatum(tuple);
@@ -412,7 +406,6 @@ pg_lock_status(PG_FUNCTION_ARGS)
412406
values[12]=CStringGetTextDatum("SIReadLock");
413407
values[13]=BoolGetDatum(true);
414408
values[14]=BoolGetDatum(false);
415-
nulls[15]= true;
416409

417410
tuple=heap_form_tuple(funcctx->tuple_desc,values,nulls);
418411
result=HeapTupleGetDatum(tuple);

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO202102091
56+
#defineCATALOG_VERSION_NO202102021
5757

5858
#endif

‎src/include/catalog/pg_proc.dat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5994,9 +5994,9 @@
59945994
{ oid => '1371', descr => 'view system lock information',
59955995
proname => 'pg_lock_status', prorows => '1000', proretset => 't',
59965996
provolatile => 'v', prorettype => 'record', proargtypes => '',
5997-
proallargtypes => '{text,oid,oid,int4,int2,text,xid,oid,oid,int2,text,int4,text,bool,bool,timestamptz}',
5998-
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
5999-
proargnames => '{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted,fastpath,waitstart}',
5997+
proallargtypes => '{text,oid,oid,int4,int2,text,xid,oid,oid,int2,text,int4,text,bool,bool}',
5998+
proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
5999+
proargnames => '{locktype,database,relation,page,tuple,virtualxid,transactionid,classid,objid,objsubid,virtualtransaction,pid,mode,granted,fastpath}',
60006000
prosrc => 'pg_lock_status' },
60016001
{ oid => '2561',
60026002
descr => 'get array of PIDs of sessions blocking specified backend PID from acquiring a heavyweight lock',

‎src/include/storage/lock.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include"storage/lockdefs.h"
2323
#include"storage/lwlock.h"
2424
#include"storage/shmem.h"
25-
#include"utils/timestamp.h"
2625

2726
/* struct PGPROC is declared in proc.h, but must forward-reference it */
2827
typedefstructPGPROCPGPROC;
@@ -447,8 +446,6 @@ typedef struct LockInstanceData
447446
LOCKMODEwaitLockMode;/* lock awaited by this PGPROC, if any */
448447
BackendIdbackend;/* backend ID of this PGPROC */
449448
LocalTransactionIdlxid;/* local transaction ID of this PGPROC */
450-
TimestampTzwaitStart;/* time at which this PGPROC started waiting
451-
* for lock */
452449
intpid;/* pid of this PGPROC */
453450
intleaderPid;/* pid of group leader; = pid if no group */
454451
boolfastpath;/* taken via fastpath? */

‎src/include/storage/proc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ struct PGPROC
181181
LOCKMODEwaitLockMode;/* type of lock we're waiting for */
182182
LOCKMASKheldLocks;/* bitmask for lock types already held on this
183183
* lock object by this backend */
184-
pg_atomic_uint64waitStart;/* time at which wait for lock acquisition
185-
* started */
186184

187185
booldelayChkpt;/* true if this proc delays checkpoint start */
188186

‎src/test/regress/expected/rules.out

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,9 +1394,8 @@ pg_locks| SELECT l.locktype,
13941394
l.pid,
13951395
l.mode,
13961396
l.granted,
1397-
l.fastpath,
1398-
l.waitstart
1399-
FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath, waitstart);
1397+
l.fastpath
1398+
FROM pg_lock_status() l(locktype, database, relation, page, tuple, virtualxid, transactionid, classid, objid, objsubid, virtualtransaction, pid, mode, granted, fastpath);
14001399
pg_matviews| SELECT n.nspname AS schemaname,
14011400
c.relname AS matviewname,
14021401
pg_get_userbyid(c.relowner) AS matviewowner,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp