Postgreql wal archive keeps failing: archive command failed with exit code 1 - postgresql

I have a file that keeps failing to archive.
The failed archive command was: test ! -f /mnt/wal_archive/archivedir/00000001000003F000000072 && cp pg_wal/00000001000003F000000072 /mnt/wal_archive/archivedir/00000001000003F000000072
As instructed in other questions, I already manually deleted the file manually on the archivedir, and the file was copied again automatically, once that occurs, I start seeing the fail command again.
At the moment the file is in the pg_wal and in the archivedir. Once the file is in the archivedir shouldn't it be removed from from the pg_wal?
I'm a bit lost and out of ideas, any help would be appreciated. thanks
UPDATE:
This is all I get from the logs
DETAIL: The failed archive command was: test ! -f /mnt/wal_archive/archivedir/00000001000003F000000072 && cp pg_wal/00000001000003F000000072 /mnt/wal_archive/archivedir/00000001000003F000000072
Error
2022-05-12 09:54:29.207 CEST2022-05-12 07:54:29.206 UTC [18] LOG: archive command failed with exit code 1
Error
2022-05-12 09:54:29.207 CEST2022-05-12 07:54:29.206 UTC [18] DETAIL: The failed archive command was: test ! -f /mnt/wal_archive/archivedir/00000001000003F000000072 && cp pg_wal/00000001000003F000000072 /mnt/wal_archive/archivedir/00000001000003F000000072
Error
2022-05-12 09:54:29.207 CEST2022-05-12 07:54:29.207 UTC [18] WARNING: archiving write-ahead log file "00000001000003F000000072" failed too many times, will try again later
2nd Update:
Furthermore the wal_keep_segments and the max_wal_size settings are being ignored.

Related

Archiving not works

I've setup the WAL archiving already and when I'm running the following query,
SELECT * FROM pg_stat archiver; The system gives me back this:
Archived count 0, last_archived_wal (empty), last_archived_time (empty), failed_count, 40 (keep growing), last_failed_wal (lot of numbers, always same), and the fail time and stat reset.
The log file:
2023-01-13 00:01:37.846 JST [5456] LOG: archive command failed with exit code 1 2023-01-13 00:01:37.846 JST [5456] DETAIL: The failed archive command was: copy "pg_wal\000000010000002300000063" "C:\server\archivedir\000000010000002300000063" 2023-01-13 00:01:37.848 JST [5456] WARNING: archiving write-ahead log file "000000010000002300000063" failed too many times, will try again later The system cannot find the path specified.
The psql create the files, 16 MB each and also create the .ready files. Bit when I like to check the status ( SELECT * FROM pg_stat_archiver; )

archive command failed with exit code 1

WAL files are not archiving to archive location, even space is available on mount point.
Please find below errors.
cp: write error: No space left on device
2021-11-29 11:27:08.672 UTC [3725060] LOG: archive command failed with exit code 1
2021-11-29 11:27:08.672 UTC [3725060] DETAIL: The failed archive command was: cp pg_wal/000000010000096B00000011 /home/ericsson/Backup/postgresql/pgbackup/wals/000000010000096B00000011
Please can any one provide the solution for this issue..

Deploying a custom cartridge on openshift online

I have been trying to add a PostgreSQL database to my OpenShift online account to no avail. I am a little confused about how to go about it and I thought I could ask for someone to point me to the right direction.
I have the source cloned from https://github.com/crunchyds/openshift-postgres-cartridge and uploaded to my openshift online repo. I tried running the included scripts - setup, control and the likes but get an error each time.
So I figured this is the wrong way to go about deploying it. Can anyone please explain how to go about it or post a link that would help ?
Here's the error message :
source /usr/lib/openshift/cartridge_sdk/bash/sdk
'[' false == true ']'
OO_BASH_SDK=true
echo /var/lib/openshift/54492b5d4382ec8e52000428//app-deployments
/var/lib/openshift/54492b5d4382ec8e52000428//app-deployments
tar xzf /versions/postgresql94.tar.gz
tar (child): /versions/postgresql94.tar.gz: Cannot open: No such file or
directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
client_result 'Starting PostgreSQL server setup ...'
client_out CLIENT_RESULT 'Starting PostgreSQL server setup ...'
local type=CLIENT_RESULT
local 'output=Starting PostgreSQL server setup ...'
local 'IFS_BAK= '
IFS=''
'[' -z 'Starting PostgreSQL server setup ...' ']'
for line in '$output'
echo 'CLIENT_RESULT: Starting PostgreSQL server setup ...'
CLIENT_RESULT: Starting PostgreSQL server setup ...
IFS=''
mkdir -p /var/lib/openshift/54492b5d4382ec8e52000428/app-
root/data//postgresql/9.4/data
mkdir -p /var/lib/openshift/54492b5d4382ec8e52000428/app-
root/data//postgresql/9.4/data/logs
echo 5432
./setup: line 22: /env/PGPORT: No such file or directory
echo /var/lib/openshift/54492b5d4382ec8e52000428/app-root/data//postgresql/9.4/data
./setup: line 23: /env/PGDATA: No such file or directory
echo /var/lib/openshift/54492b5d4382ec8e52000428/app-root/data//versions/postgresql94/bin
./setup: line 24: /env/OPENSHIFT_POSTGRESQL94_PATH_ELEMENT: No such file or directory
echo /versions/postgresql94/lib
./setup: line 25: /env/OPENSHIFT_POSTGRESQL94_LD_LIBRARY_PATH_ELEMENT: No such file or directory
echo /versions/bin
./setup: line 26: /env/OPENSHIFT_POSTGRESQL94_PATH_ELEMENT: No such file or directory
client_result 'Server setup completed successfully ...'
client_out CLIENT_RESULT 'Server setup completed successfully ...'
local type=CLIENT_RESULT
local 'output=Server setup completed successfully ...'
local 'IFS_BAK= '
IFS=''
'[' -z 'Server setup completed successfully ...' ']'
for line in '$output'
echo 'CLIENT_RESULT: Server setup completed successfully ...'
CLIENT_RESULT: Server setup completed successfully ...
IFS=''
When you add the cartridge you need to pass in the url for the cartridge.
Are you trying to run this in online?
If so I am not sure if this is supposed to work in online so I put in a Github issue for them to clarify.
If it is usable on online then the command to add the cartdidge would be like this command:
rhc cartridge add -a {your app name} http://reflector-getupcloud.getup.io/github/crunchyds/openshift-postgres-cartridge
You need to ensure that the official cartridges on OpenShift Online supports the version of PostgreSQL server. You don't necessary have to setup OpenShift Origin but might help you test your cartridges before using online.
Multiple error messages reference a wrong working directory:
tar: /versions/postgresql94.tar.gz: Cannot open: No such file or directory tar (child):
/env/PGPORT: No such file or directory
/env/PGDATA: No such file or directory
/env/OPENSHIFT_POSTGRESQL94_PATH_ELEMENT
/env/OPENSHIFT_POSTGRESQL94_LD_LIBRARY_PATH_ELEMENT
/env/OPENSHIFT_POSTGRESQL94_PATH_ELEMENT: No such file or directory
Your $OPENSHIFT_PG_DIR seems to be "/" which looks wrong. According to the documentation this variable is built from the shortname in the manifest: OPENSHIFT_{Cartridge-Short-Name}_DIR . Have you changed the short name in the manifest file?

Error messages trying to build Julia language with make

This is the first time I have every used make. I am trying to install the Julia language. So I cloned from GitHub
git clone git://github.com/JuliaLang/julia.git
The instructions then say enter in the Julia directory and type make. It ran for a very long time - I ate a pizza.
When I got back, typing Julia did not work. Towards the end of the installation, I got a long error message:
/usr/bin/install -c -m 644 libpcre.pc libpcreposix.pc libpcrecpp.pc '/home/john/Downloads/julia/usr/lib/pkgconfig'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 130 100 130 0 0 243 0 --:--:-- --:--:-- --:--:-- 337
0 0 0 8773k 0 0 310k 0 --:--:-- 0:00:28 --:--:-- 0
curl: (28) Operation too slow. Less than 1 bytes/sec transferred the last 15 seconds
curl: (6) name lookup timed out
make[2]: *** [openblas-v0.2.8.tar.gz] Error 6
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2
I tried sudo make - putting sudo in front seems to solve everything but not this:
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
make[2]: *** [openblas-v0.2.8/config.status] Error 2
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2
What steps can I take to makes sure Julia installs properly?
I need version 2.0 so I can use iJulia with my iPython notebook. If there is an easier way without compiling directly, I would just do that.
The problem is that the makefile is trying to download a file (curl is a command line program that acts like a web browser, and is often used to download files from websites).
However, for whatever reason (maybe the internet was tired) the download failed and timed out.
The reason it fails now with the unexpected end of file error is that (a) the download gave you part of a file before it failed, and (b) the makefile you're using is badly written so it didn't clean up the partly-downloaded file on failure.
So, that file exists and thus make won't try to download it, but it's only partial so when you try to uncompress it, it fails.
You should delete the file it tried to download by hand (with something like rm -f openblas-v0.2.8.tar.gz) then re-run make. Maybe the internet has woken up, or drunk some coffee, and the download will work this time.

Hudson failing build w/o revealing cause

Every build has failed as of Tuesday. I'm not exactly sure what happened. The Phing targets (clean/prepare) are being executed properly. Additionally, the unit tests are passing with flying colors, with only a warning for duplicate code (not a reason for a fail). I tried removing the phpDoc target to see if that was causing the error, but the build still failed.
Started by user chris Updating
file://localhost/projects/svn/ips-com/trunk
At revision 234 no change for
file://localhost/projects/svn/ips-com/trunk
since the previous build [trunk] $
/opt/phing/bin/phing clean prepare
-logger phing.listener.NoBannerLogger Buildfile:
/var/lib/hudson/.hudson/jobs/IPS/workspace/trunk/build.xml
IPS > clean:
[echo] Clean... [delete] Deleting directory
/var/lib/hudson/.hudson/jobs/IPS/workspace/build
IPS > prepare:
[echo] Prepare...
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage-html
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/docs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/app
BUILD FINISHED
Total time: 1.0244 second
[workspace] $ /bin/bash -xe
/tmp/hudson3259012225710915845.sh
+ cd trunk/tests
+ /usr/local/bin/phpunit --verbose -d memory_limit=512M --log-junit
../../build/logs/phpunit.xml
--coverage-clover ../../build/logs/coverage/clover.xml
--coverage-html ../../build/logs/coverage-html/
PHPUnit 3.5.0 by Sebastian Bergmann.
IPS Default_IndexControllerTest .
Default_AuthControllerTest ......
Manage_UsersControllerTest .....
testDeleteInvalidUserId ..
testGetPermissionsForInvalidUserId .. Audit_OverviewControllerTest
............
Time: 14 seconds, Memory: 61.00Mb
[30;42m[2KOK (28 tests, 198
assertions) [0m[2K Writing code
coverage data to XML file, this may
take a moment.
Generating code coverage report, this
may take a moment.
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
[workspace] $ /bin/bash -xe
/tmp/hudson1439023061736436000.sh
+ /usr/local/bin/phpcpd --log-pmd ./build/logs/cpd.xml ./trunk phpcpd
1.3.2 by Sebastian Bergmann.
Found 1 exact clones with 6 duplicated
lines in 2 files:
library/Ips/Form/Decorator/SplitInput.php:8-14
library/Ips/Form/Decorator/FeetInches.php:10-16
0.04% duplicated lines out of 16585 total lines of code.
Time: 4 seconds, Memory: 19.50Mb [DRY]
Skipping publisher since build result
is FAILURE Publishing Javadoc [xUnit]
[INFO] - Starting to record. [xUnit]
[WARNING] - Can't create the path
/var/lib/hudson/.hudson/jobs/IPS/workspace/generatedJUnitFiles.
Maybe the directory already exists.
[xUnit] [INFO] - Processing
PHPUnit-3.4 (default) [xUnit] [INFO] -
[PHPUnit-3.4 (default)] - 1 test
report file(s) were found with the
pattern 'build/logs/phpunit.xml'
relative to
'/var/lib/hudson/.hudson/jobs/IPS/workspace'
for the testing framework 'PHPUnit-3.4
(default)'. [xUnit] [INFO] -
Converting
'/var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/phpunit.xml'
. [xUnit] [INFO] - Stopping recording.
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Finished: FAILURE
What changed since Tuesday? Try to manually run exactly the same commands that Hudson tries to run from the same directory that Hudson starts it from (usually the jobs workspace directory). Of course with the user account that Hudson is started under.
There are several possibilities. ranging from standard groups for a directory, to permission, or other things outside of Hudson. Was Hudson upgraded? Was a plugin upgraded? Was the OS or php upgraded? Was there a change in the default or user .profile or .env (or the equivalent files)? Does another process accesses the workspace? ......
Once I had the problem that all of the sudden my deployment scripts did not run anymore. The mystery was, that I could still run the script from command line with the Hudson user account. The reason was simple but took a while to uncover. There was a java upgrade from 5 to 6. Both versions were available. After comparing the environment variables, there was a difference in the path. The problem was that the new path was set in the global .profile. But Hudson does not open an interactive shell, therefore the .profile will not be executed. If you have a problem like this, you can put the initialization in the .env file (or whatever the filename is for your system), because this will be run regardless if it is a interactive shell or not. Alternatively you can configure Hudson to set it on master or node/slave level.
if you want a command to not break the 'build' as a failure you have to add #! in front of the command to prevent the flags -xe which produce this behaviour.