| From: | torikoshia <torikoshia(at)oss(dot)nttdata(dot)com> | 
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> | 
| Cc: | Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: adding wait_start column to pg_locks | 
| Date: | 2021-02-04 15:03:51 | 
| Message-ID: | b8425207811a6b99d0ecd76844906a8e@oss.nttdata.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 2021-02-03 11:23, Fujii Masao wrote:
>> 64-bit fetches are not atomic on some platforms. So spinlock is 
>> necessary when updating "waitStart" without holding the partition 
>> lock? Also GetLockStatusData() needs spinlock when reading 
>> "waitStart"?
> 
> Also it might be worth thinking to use 64-bit atomic operations like
> pg_atomic_read_u64(), for that.
Thanks for your suggestion and advice!
In the attached patch I used pg_atomic_read_u64() and 
pg_atomic_write_u64().
waitStart is TimestampTz i.e., int64, but it seems pg_atomic_read_xxx 
and pg_atomic_write_xxx only supports unsigned int, so I cast the type.
I may be using these functions not correctly, so if something is wrong, 
I would appreciate any comments.
About the documentation, since your suggestion seems better than v6, I 
used it as is.
Regards,
--
Atsushi Torikoshi
| Attachment | Content-Type | Size | 
|---|---|---|
| v7-0001-To-examine-the-duration-of-locks-we-did-join-on-p.patch | text/x-diff | 11.8 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mahendra Singh Thalor | 2021-02-04 15:04:13 | Re: Faulty HEAP_XMAX_LOCK_ONLY & HEAP_KEYS_UPDATED hintbit combination | 
| Previous Message | John Naylor | 2021-02-04 15:02:08 | get rid of <foreignphrase> tags in the docs? |