Re: Memory leak of SMgrRelation object on standby

2025-08-25 Thread Jingtang Zhang
Hi~ > I purpose a patch which calls smgrdestroyall() when redo each > XLOG_CHECKPOINT_ONLINE, so that it can keep the same frequency of calling > smgrdestroyall() as background processes on primary. I don't call it for > XLOG_CHECKPOINT_SHUTDOWN because the process is about to exit so that the > m

Re: Memory leak of SMgrRelation object on standby

2025-08-25 Thread Jingtang Zhang
Hi~ > Agree with that. Maybe we can call smgrdestroyall in startup process when > replaying CHECKPOINT records, just like bgwriter/checkpointer, which free > all smgr objects after any checkpoint. That seems reasonable, in that case a startup process would behave just the same as bgwriter or chec

Re: Memory leak of SMgrRelation object on standby

2025-08-24 Thread 邱宇航
> 2025年8月21日 23:07,Jingtang Zhang 写道: > > Also, in this situation, should startup process be treated as a background > worker similar to bgwriter/checkpointer and call smgrdestroyall in some > period? Agree with that. Maybe we can call smgrdestroyall in startup process when replaying CHECKPOINT

Re: Memory leak of SMgrRelation object on standby

2025-08-21 Thread Jingtang Zhang
Hi~ > On Sat, Aug 16, 2025 at 12:50 AM Jingtang Zhang > wrote: >> Back to v17, commit 21d9c3ee gave SMgrRelation a well-defined lifetime, and >> smgrclose nolonger removes SMgrRelation object from the hashtable, leaving >> the work to smgrdestroyall. But I find a place that relies on the removin

Re: Memory leak of SMgrRelation object on standby

2025-08-18 Thread Jingtang Zhang
Hi~ Thanks for looking. > DropRelationFiles() is also called by FinishPreparedTransaction(). At > first I thought that might be a problem too, but looking a bit more > closely and trying it out... if a prepared transaction dropped a > table, then it called RelationDropStorage(), RelationCloseSmg

Re: Memory leak of SMgrRelation object on standby

2025-08-17 Thread Thomas Munro
On Sat, Aug 16, 2025 at 12:50 AM Jingtang Zhang wrote: > Back to v17, commit 21d9c3ee gave SMgrRelation a well-defined lifetime, and > smgrclose nolonger removes SMgrRelation object from the hashtable, leaving > the work to smgrdestroyall. But I find a place that relies on the removing > behavior

Memory leak of SMgrRelation object on standby

2025-08-15 Thread Jingtang Zhang
Hi~ hackers Back to v17, commit 21d9c3ee gave SMgrRelation a well-defined lifetime, and smgrclose nolonger removes SMgrRelation object from the hashtable, leaving the work to smgrdestroyall. But I find a place that relies on the removing behavior previously, but is still calling smgrclose. Startu