Re: [HACKERS] bug? autovacuum is not launched even if autovacuum_freeze_max_age is reached

2010-02-16 Thread Alvaro Herrera
Fujii Masao escribió:
 Hi,
 
 In HEAD, when autovacuum is disabled, autovacuum process is not
 launched forcibly to prevent XID wraparound even if we go through
 autovacuum_freeze_max_age. This seems to be because
 ShmemVariableCache-xidVacLimit is not initialized (i.e.,
 SetTransactionIdLimit() is not called) until VACUUM is performed.
 
 OTOH, in older version, ShmemVariableCache-xidVacLimit is always
 initialized when backend updates the flat database file, and then
 autovacuum process seems to be launched forcibly as expected.

Hmm.  Yeah, this is a serious problem.  The only caller of
SetTransactionIdLimit is now vac_truncate_clog.  We need another one,
but where?  For a moment I thought about adding one to autovacuum
launcher's initialization, but what if it's disabled?

Maybe check at backend startup whether the limit is valid, and call
SetTransactionIdLimit if not?

Related commit history: the call to update the xid limit was removed
here:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=186b10c1f0a61f90d320a4ccce2ff8b31fa55210

which introduced a function TransactionIdLimitIsValid which could
presumably have been used as I propose above.  However, it was taken out
in
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=1a7bbfe645b8379e368ec9969f99fee455e3ecf3

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] bug? autovacuum is not launched even if autovacuum_freeze_max_age is reached

2010-02-16 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes:
 Fujii Masao escribió:
 In HEAD, when autovacuum is disabled, autovacuum process is not
 launched forcibly to prevent XID wraparound even if we go through
 autovacuum_freeze_max_age. This seems to be because
 ShmemVariableCache-xidVacLimit is not initialized (i.e.,
 SetTransactionIdLimit() is not called) until VACUUM is performed.
 
 OTOH, in older version, ShmemVariableCache-xidVacLimit is always
 initialized when backend updates the flat database file, and then
 autovacuum process seems to be launched forcibly as expected.

 Hmm.  Yeah, this is a serious problem.

I thought I had put in some workaround for that when I did the flat
file changes.  I don't remember what though, and it's evidently
broken now in any case.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] bug? autovacuum is not launched even if autovacuum_freeze_max_age is reached

2010-02-16 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes:
 Maybe check at backend startup whether the limit is valid, and call
 SetTransactionIdLimit if not?

Actually, the intent was that that would get called during startup,
but it seems I forgot to actually plug that in :-(.  Loose wires now
reattached in the right places.  Please test.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] bug? autovacuum is not launched even if autovacuum_freeze_max_age is reached

2010-02-16 Thread Fujii Masao
On Wed, Feb 17, 2010 at 12:12 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Alvaro Herrera alvhe...@commandprompt.com writes:
 Maybe check at backend startup whether the limit is valid, and call
 SetTransactionIdLimit if not?

 Actually, the intent was that that would get called during startup,
 but it seems I forgot to actually plug that in :-(.  Loose wires now
 reattached in the right places.  Please test.

It works fine in my box. Thanks!

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers