Обсуждение: Cannot change archive_command with a reload

Поиск
Список
Период
Сортировка

Cannot change archive_command with a reload

От
CS DBA
Дата:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv
/data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


Thoughts?

Thanks in advance


Re: Cannot change archive_command with a reload

От
Strahinja Kustudić
Дата:
What version of Postgres are you using? What OS? Have you tried editing the archive_command in postgresql.conf and then reload?

Strahinja Kustudić
| Lead System Engineer | Nordeus


On Sun, Feb 2, 2014 at 4:52 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


Thoughts?

Thanks in advance


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

Re: Cannot change archive_command with a reload

От
CS DBA
Дата:
We're running version 9.2.4,  on Redhat 5.1
I have tried changing the config file and running "service postgresql-9.2 reload"

I've also tried (as user postgres): pg_ctl -D /var/lib/pgsql/9.2/data reload

no luck with either approach




 On 2/2/14, 8:58 AM, Strahinja Kustudić wrote:
What version of Postgres are you using? What OS? Have you tried editing the archive_command in postgresql.conf and then reload?

Strahinja Kustudić
| Lead System Engineer | Nordeus


On Sun, Feb 2, 2014 at 4:52 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


Thoughts?

Thanks in advance


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


Re: Cannot change archive_command with a reload

От
Raghavendra
Дата:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

Link on archive_command:


---
Regards,
Raghavendra
EnterpriseDB Corporation

Re: Cannot change archive_command with a reload

От
CS DBA
Дата:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)



---
Regards,
Raghavendra
EnterpriseDB Corporation


Re: Cannot change archive_command with a reload

От
Erik Darling
Дата:
Unsubscribe


On Sun, Feb 2, 2014 at 11:26 AM, CS DBA <cs_dba@consistentstate.com> wrote:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)



---
Regards,
Raghavendra
EnterpriseDB Corporation



Re: Cannot change archive_command with a reload

От
Raghavendra
Дата:

On Sun, Feb 2, 2014 at 9:56 PM, CS DBA <cs_dba@consistentstate.com> wrote:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)

'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f',

Seems you are missing something here, you have two action commands in your archive_command. One is copy "cp" and another is "mv" move. Once you are copying file to the directory you are moving that entire directory and not keeping the place available for archiver process to copy next file in that location on its next arrival.

Because, every transaction logs first go to archive directory as you mentioned "cp %p /data/wal_tmp/%f". Next it will execute the other command too since its one command string, i.e, move "mv /data/wal_tmp/%f /data/wal&f".

Hence, you need to have unique place for archives and it should not be disturbed in any case. If you want to ship a copy to standby server then have another directory with same set of copies at OS level.

--Raghav

Re: Cannot change archive_command with a reload

От
CS DBA
Дата:
On 2/2/14, 9:26 AM, CS DBA wrote:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)



---
Regards,
Raghavendra
EnterpriseDB Corporation




So, I found that the archive command has a typeo (using a &f instead of a %f at the end):
cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f


I don't see any way to make the command as is "work" so I suspect the only option is a restart.

Question:  as a growing stack of archive commands fails (see log entry example below), is it going to take an increasingly longer and longer time to do a restart?

Log entry:
sh: f: command not found
11631    2014-02-02 09:49:41 MST [2014-02-02 01:04:54 MST] [3820] LOG:  archive command failed with exit code 127
11631    2014-02-02 09:49:41 MST [2014-02-02 01:04:54 MST] [3821] DETAIL:  The failed archive command was: test ! -f /data/wal/00000001000006E50000001C && cp pg_xlog/00000001000006E50000001C /data/wal_tmp/00000001000006E50000001C && mv /data/wal_tmp/00000001000006E50000001C /data/wal/&f
11631    2014-02-02 09:49:41 MST [2014-02-02 01:04:54 MST] [3822] WARNING:  transaction log file "00000001000006E50000001C" could not be archived: too many failures




Re: Cannot change archive_command with a reload

От
CS DBA
Дата:
On 2/2/14, 9:51 AM, Raghavendra wrote:

On Sun, Feb 2, 2014 at 9:56 PM, CS DBA <cs_dba@consistentstate.com> wrote:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)

'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f',

Seems you are missing something here, you have two action commands in your archive_command. One is copy "cp" and another is "mv" move. Once you are copying file to the directory you are moving that entire directory and not keeping the place available for archiver process to copy next file in that location on its next arrival.

Because, every transaction logs first go to archive directory as you mentioned "cp %p /data/wal_tmp/%f". Next it will execute the other command too since its one command string, i.e, move "mv /data/wal_tmp/%f /data/wal&f".

Hence, you need to have unique place for archives and it should not be disturbed in any case. If you want to ship a copy to standby server then have another directory with same set of copies at OS level.

--Raghav

My issue is the &f instead of %f at the end.  However here's the intent:

if the first command is true (cp %p /data/wal_tmp/%f) then I want the second command to execute (mv /data/wal_tmp/%f /data/wal/%f)

since both directories are in the same file system the mv is immediate so any process watching for files to show up in /data/wal will never see a partial file


Re: Cannot change archive_command with a reload

От
Scott Ribe
Дата:
On Feb 2, 2014, at 9:51 AM, Raghavendra <raghavendra.rao@enterprisedb.com> wrote:

> Once you are copying file to the directory you are moving that entire directory and not keeping the place available
forarchiver process to copy next file in that location on its next arrival. 

No, he's just mv'ing the file, not the directory.

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice






Re: Cannot change archive_command with a reload

От
Raghavendra
Дата:

My issue is the &f instead of %f at the end.  However here's the intent:

if the first command is true (cp %p /data/wal_tmp/%f) then I want the second command to execute (mv /data/wal_tmp/%f /data/wal/%f)


In this case archiver process fail, because there won't be directory called /data/wal_tmp anymore with your your "mv" command. 
since both directories are in the same file system the mv is immediate so any process watching for files to show up in /data/wal will never see a partial file


"partial file" ?
Its 16MB file in any case there won't be any partial files, because after completion of writing 16mb file in xlog it will come to archive location else not. 

--Raghav

 

Re: Cannot change archive_command with a reload

От
Raghavendra
Дата:
On Sun, Feb 2, 2014 at 10:33 PM, Scott Ribe <scott_ribe@elevated-dev.com> wrote:
On Feb 2, 2014, at 9:51 AM, Raghavendra <raghavendra.rao@enterprisedb.com> wrote:

> Once you are copying file to the directory you are moving that entire directory and not keeping the place available for archiver process to copy next file in that location on its next arrival.

No, he's just mv'ing the file, not the directory.


Yeah, my bad. I overlooked...

Re: Cannot change archive_command with a reload

От
CS DBA
Дата:
On 2/2/14, 10:04 AM, Raghavendra wrote:

My issue is the &f instead of %f at the end.  However here's the intent:

if the first command is true (cp %p /data/wal_tmp/%f) then I want the second command to execute (mv /data/wal_tmp/%f /data/wal/%f)


In this case archiver process fail, because there won't be directory called /data/wal_tmp anymore with your your "mv" command.
were moving the file %f not the directory


since both directories are in the same file system the mv is immediate so any process watching for files to show up in /data/wal will never see a partial file


"partial file" ?
Its 16MB file in any case there won't be any partial files, because after completion of writing 16mb file in xlog it will come to archive location else not.

we dont want the log shipper process to ship a file that is still being copied from pg_xlog




--Raghav

 


Re: Cannot change archive_command with a reload

От
deepak
Дата:
Please  Unsubscribe me

On Sun, Feb 2, 2014 at 11:32 AM, Erik Darling <edarling80@gmail.com> wrote:
Unsubscribe


On Sun, Feb 2, 2014 at 11:26 AM, CS DBA <cs_dba@consistentstate.com> wrote:
On 2/2/14, 9:19 AM, Raghavendra wrote:


On Sun, Feb 2, 2014 at 9:22 PM, CS DBA <cs_dba@consistentstate.com> wrote:
Hi all;

we have a cluster running with an archive command that is failing.
I tried a reload and the value does not change


Reload with new value won't work until you fix the failing archive_command.

Eg:-

ps -ef | grep arch
postgres 29743 29736  0 Jan30 ?        00:00:00 postgres: archiver process   failed on 00000001000000010000003D

and it might cause same error you are experiencing as 

postgres=# select set_config('archive_command','cp %p /opt/PostgreSQL/9.3/a93/%f',false);
ERROR:  parameter "archive_command" cannot be changed now

So, fix the archive_command first and then give new changes.

Tried a set_config and I get this error:

select set_config ('archive_command', 'cp %p /data/wal_tmp/%f && mv /data/wal_tmp/%f /data/wal/&f', 'false');
ERROR:  parameter "archive_command" cannot be changed now


If your archive_command pointing to "/data/wal_tmp" then please ensure that directory exists there. If that directory not present then archive process fail to copy the transaction logs. When archiver process in failed state you cannot apply any new changes to the archive_command it will fail. 

Also, am surprised to see "mv" command, basically the archive_command meant to have a copies of pg_xlogs but not any OS related directory movements.

we want to copy the file to /data/wal_tmp, then do a mv to /data/wal so our process that ships a copy to the standby servers never see's a partial file (since it watches /data/wal)



---
Regards,
Raghavendra
EnterpriseDB Corporation




Re: Cannot change archive_command with a reload

От
Raghavendra
Дата:

In this case archiver process fail, because there won't be directory called /data/wal_tmp anymore with your your "mv" command.
were moving the file %f not the directory

My bad, I overlooked. Sorry for the inconvenience. 

since both directories are in the same file system the mv is immediate so any process watching for files to show up in /data/wal will never see a partial file


"partial file" ?
Its 16MB file in any case there won't be any partial files, because after completion of writing 16mb file in xlog it will come to archive location else not.
we dont want the log shipper process to ship a file that is still being copied from pg_xlog


What was the previous archive_command string ?

and

ps -ef | grep arch   output?


--Raghav

Re: Cannot change archive_command with a reload

От
Luca Ferrari
Дата:
On Sun, Feb 2, 2014 at 5:57 PM, CS DBA <cs_dba@consistentstate.com> wrote:
> On 2/2/14, 9:51 AM, Raghavendra wrote:
> My issue is the &f instead of %f at the end.  However here's the intent:
>
> if the first command is true (cp %p /data/wal_tmp/%f) then I want the second
> command to execute (mv /data/wal_tmp/%f /data/wal/%f)
>

I suggest you to wrap the commands in a shell script and to get a log
of the activity, at least in the beginning, to see what is not
working. Moreover, having a script will allow you to extend the logic.


> since both directories are in the same file system the mv is immediate so
> any process watching for files to show up in /data/wal will never see a
> partial file

As explained by others, the issue of having partial files is not an
issue at all.

Luca


Re: Cannot change archive_command with a reload

От
Scott Ribe
Дата:
On Feb 3, 2014, at 8:15 AM, Luca Ferrari <fluca1978@infinito.it> wrote:

> As explained by others, the issue of having partial files is not an
> issue at all.

It most certainly is an issue--the cp command is not atomic.

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice






Re: Cannot change archive_command with a reload

От
Scott Ribe
Дата:
On Feb 3, 2014, at 8:15 AM, Luca Ferrari <fluca1978@infinito.it> wrote:

> As explained by others, the issue of having partial files is not an
> issue at all.

I apologize for the tone of my post--early AM and as soon as I hit send, I realized how harsh it might seem.


--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice