Re: New statistics for WAL buffer dirty writes

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Satoshi Nagayasu <snaga(at)uptime(dot)jp>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New statistics for WAL buffer dirty writes
Date: 2012-11-26 22:42:21
Message-ID: 20121126224221.GF4227@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Satoshi Nagayasu escribió:

> I attached the latest one, which splits the reset_time
> for bgwriter and walwriter, and provides new system view,
> called pg_stat_walwriter, to show the dirty write counter
> and the reset time.

Thanks. I gave this a look and I have a couple of comments:

1. The counter is called dirty_write. I imagine that this comes
directly from the name of the nearby DTrace probe,
TRACE_POSTGRESQL_WAL_BUFFER_WRITE_DIRTY_START. That probe comes from
email 494C1565(dot)3060105(at)sun(dot)com committed in 4ee79fd20d9a. But there
wasn't much discussion about the name back then. Maybe that was fine at
the time because it was pretty much an internal matter, being so deep in
the code. But we're now going to expose it to regular users, so we'd
better choose a very good name because we're going to be stuck with it
for a very long time. And the name "dirty" doesn't ring with me too
well; what matters here is not that we're writing a buffer that is
dirty, but the fact that we're writing while holding the WalInsertLock,
so the name should convey the fact that this is a "locked" write or
something like that. Or at least that's how I see the issue. Note the
documentation wording:

+ <entry><structfield>dirty_writes</></entry>
+ <entry><type>bigint</type></entry>
+ <entry>Number of dirty writes, which means flushing wal buffers
+ because of its full.</entry>

2. Should we put bgwriter and walwriter data in separate structs? I
don't think this is necessary, but maybe someone opines differently?

3.
+/*
+ * WalWriter global statistics counter.
+ * Despite its name, this counter is actually used not only in walwriter,
+ * but also in each backend process to sum up xlog dirty writes.
+ * Those processes would increment this counter in each XLogWrite call,
+ * then send it to the stat collector process.
+ */
+PgStat_MsgWalWriter WalWriterStats;

Maybe we should use a different name for the struct, to avoid having to
excuse ourselves for the name being wrong ...

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-11-26 22:42:40 Re: Suggestion for --truncate-tables to pg_restore
Previous Message Bruce Momjian 2012-11-26 22:26:42 Re: Further pg_upgrade analysis for many tables