On 2018-05-22 20:54:46 +0200, Dmitry Dolgov wrote:
> > On 22 May 2018 at 18:47, Andres Freund <and...@anarazel.de> wrote:
> > On 2018-05-22 08:57:18 -0700, Andres Freund wrote:
> >> Hi,
> >>
> >>
> >> On 2018-05-22 17:37:28 +0200, Dmitry Dolgov wrote:
> >> > Thanks for the patch. Out of curiosity I tried to play with it a bit.
> >>
> >> Thanks.
> >>
> >>
> >> > `pgbench -i -s 100` actually hang on my machine, because the
> >> > copy process ended up with waiting after `pg_uds_send_with_fd`
> >> > had
> >>
> >> Hm, that had worked at some point...
> >>
> >>
> >> >     errno == EWOULDBLOCK || errno == EAGAIN
> >> >
> >> > as well as the checkpointer process.
> >>
> >> What do you mean with that latest sentence?
> 
> To investigate what's happening I attached with gdb to two processes, COPY
> process from pgbench and checkpointer (since I assumed it may be involved).
> Both were waiting in WaitLatchOrSocket right after SendFsyncRequest.

Huh? Checkpointer was in SendFsyncRequest()? Coudl you share the
backtrace?


> >> > Looks like with the default
> >> > configuration and `max_wal_size=1GB` it writes more than reads to a
> >> > socket, and a buffer eventually becomes full.
> >>
> >> That's intended to then wake up the checkpointer immediately, so it can
> >> absorb the requests.  So something isn't right yet.
> >
> > Doesn't hang here, but it's way too slow.
> 
> Yep, in my case it was also getting slower, but eventually hang.
> 
> > Reason for that is that I've wrongly resolved a merge conflict. Attached is 
> > a
> > fixup patch - does that address the issue for you?
> 
> Hm...is it a correct patch? I see the same committed in
> 8c3debbbf61892dabd8b6f3f8d55e600a7901f2b, so I can't really apply it.

Yea, sorry for that. Too many files in my patch directory... Right one
attached.

Greetings,

Andres Freund
>From 483b98fd21b40e2997a1f164155cae698204ec25 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Tue, 22 May 2018 09:38:58 -0700
Subject: [PATCH] fixup! WIP: Optimize register_dirty_segment() to not
 repeatedly queue fsync requests.

Merge failure.
---
 src/backend/storage/smgr/md.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index ae3a5bf023f..942e2dcf788 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1540,6 +1540,8 @@ register_dirty_segment(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
 	}
 	else
 		ForwardFsyncRequest(reln->smgr_rnode.node, forknum, seg->mdfd_segno, seg->mdfd_vfd);
+
+	seg->mdfd_dirtied_cycle = cycle;
 }
 
 /*
-- 
2.17.0.rc1.dirty

Reply via email to