Re: Why archives are hanging ...

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: pgsql-www(at)postgresql(dot)org
Subject: Re: Why archives are hanging ...
Date: 2005-12-30 17:27:12
Message-ID: 20051230172711.GA1750@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On Fri, Dec 30, 2005 at 10:54:57AM -0400, Marc G. Fournier wrote:
> Here is the cause:
>
> root 66170 96.2 0.1 2316 792 ?? RJ 6:59AM 430:11.37 perl -e
> $i=<STDIN>;print substr($i,0,4) . "-" . substr($i,4,2); (perl5.8.7)
>
> Specifically, in my script:
>
> set fdate = `echo $j | \
> awk -F. '{print $4}' | \
> perl -e '$i=<STDIN>;print substr($i,0,4) . "-" .
> substr($i,4,2);'`
>
>
> Where $j would be equal to something like:
>
> /usr/local/www/archives.postgresql.org/majordomo/pgsql-hackers/files/public/archive/pgsql-hackers.200512
>
> Can someone suggest a cleaner way of doing this? Specifically, I'm just
> converting the last part (200512) to 2005-12 ...

As for a cleaner way, there's no need to use both awk and perl since
either can do the whole job. Here are some possibilities:

awk -F. '{print substr($4,1,4) "-" substr($4,5,2)}'
perl -F'\.' -lane 'print substr($F[3],0,4) . "-" . substr($F[3],4,2)'
perl -lne 'if (/\.(\d{4})(\d{2})$/) {print "$1-$2"}'

As for why the existing command is sucking up CPU time, I can't
think of why it would be. Have you done a process trace? You
probably won't see anything if it's not making any system calls
but it might be worth checking out.

Does the "J" indicate that the process is running in a jail? If
so, could that be causing a problem? Might the process be confused
because it's looking for something (e.g., a device file) that doesn't
exist in the jail? What OS and version are you using? Does it
have any known jail bugs? Can you duplicate this problem in a
controlled test (jailed)? If so, does it happen if you don't run
in a jail?

--
Michael Fuhr

In response to

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Marc G. Fournier 2005-12-30 18:54:35 Re: Why archives are hanging ...
Previous Message Marc G. Fournier 2005-12-30 14:54:57 Why archives are hanging ...