Re: [Patch] New pg_stat_tablespace view - Mailing list pgsql-hackers

From shihao zhong
Subject Re: [Patch] New pg_stat_tablespace view
Date
Msg-id CAGRkXqQsLfecnoA+NZvMW+Q2Z+nKGsdexeignD6utE0RWsHdQA@mail.gmail.com
Whole thread
In response to Re: [Patch] New pg_stat_tablespace view  (Zsolt Parragi <zsolt.parragi@percona.com>)
Responses Re: [Patch] New pg_stat_tablespace view
List pgsql-hackers
Hi Zsolt,

Thanks, both are real. v10 is attached.

> 1: there's a window for a permanent statistics leak when a tablespace
> is dropped.

Fixed. A flush only looks up the entry now. If it is gone, the counts
are dropped.

CREATE TABLESPACE creates the entry, as you suggested. That alone
misses pg_default, standbys, and everything after a crash. So a
process also creates it the first time it counts something for a
tablespace. A relation or a temp file in the tablespace is in use at
that moment, so it cannot be dropped.

Your spec is in the patch as an isolation test.

> 2: Are you sure the transaction move behavior is correct?

No, it was wrong. Counts from before the move now go to the old
tablespace. The test checks both tablespaces.

Andres, counting a block time is now an add into a small local array.
v9 did a hash lookup each time the tablespace changed. The only lookup
now is when a tablespace is added to that array, once per tablespace
between two flushes.

Thanks,
Shihao
Attachment

pgsql-hackers by date:

Previous
From: Sho Ito
Date:
Subject: Re: [PATCH v1] Reject zero resource kinds in test_resowner_many()
Next
From: Bharath Rupireddy
Date:
Subject: Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish