Re: Ragged latency log data in multi-threaded pgbench
Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>
From: Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>
To: Greg Smith <greg@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-03-16T00:46:47Z
Lists: pgsql-hackers
Greg Smith <greg@2ndquadrant.com> wrote:
> It looks like the switch between clients running on separate workers can
> lead to a mix of their respective lines showing up though.
Oops. There might be two solutions for the issue:
1. Use explicit locks. The lock primitive will be pthread_mutex for
multi-threaded implementations or semaphore for multi-threaded ones.
2. Use per-thread log files.
File names would be "pgbench_log.<main-process-id>.<thread-id>".
Which is better, or another idea?
Regards,
---
Takahiro Itagaki
NTT Open Source Software Center