vacuum rusage fix

Started by Euler Taveira de Oliveiraover 14 years ago2 messages
1 attachment(s)

Hi,

While looking at Greg's patch I spotted that resource usage code for vacuum is
initialized even if we won't use it. Attached is a small patch that moves it
to the right place (this code mimics do_analyze_rel function).

--
Euler Taveira de Oliveira - Timbira http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Attachments:

vac_rusage.difftext/x-patch; name=vac_rusage.diffDownload
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index c5bf32e..b5547c5 100644
*** a/src/backend/commands/vacuumlazy.c
--- b/src/backend/commands/vacuumlazy.c
*************** lazy_vacuum_rel(Relation onerel, VacuumS
*** 155,165 ****
  	bool		scan_all;
  	TransactionId freezeTableLimit;
  
- 	pg_rusage_init(&ru0);
- 
  	/* measure elapsed time iff autovacuum logging requires it */
! 	if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration > 0)
! 		starttime = GetCurrentTimestamp();
  
  	if (vacstmt->options & VACOPT_VERBOSE)
  		elevel = INFO;
--- 155,167 ----
  	bool		scan_all;
  	TransactionId freezeTableLimit;
  
  	/* measure elapsed time iff autovacuum logging requires it */
! 	if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0)
! 	{
! 		pg_rusage_init(&ru0);
! 		if (Log_autovacuum_min_duration > 0)
! 			starttime = GetCurrentTimestamp();
! 	}
  
  	if (vacstmt->options & VACOPT_VERBOSE)
  		elevel = INFO;
#2Robert Haas
robertmhaas@gmail.com
In reply to: Euler Taveira de Oliveira (#1)
Re: vacuum rusage fix

On Thu, Aug 18, 2011 at 7:02 AM, Euler Taveira de Oliveira
<euler@timbira.com> wrote:

While looking at Greg's patch I spotted that resource usage code for vacuum
is initialized even if we won't use it. Attached is a small patch that moves
it to the right place (this code mimics do_analyze_rel function).

Looks reasonable. Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company