In the recovery_1st_stage script, the file deletion command has been modified.
Previously, files under ARCHIVEDIR were deleted using "rm *", but when the total size of the target files exceeded ARG_MAX, it resulted in an "Argument list too long" error and caused the recovery_1st_stage script to fail.
By switching to the find command to delete files one by one, this error is avoided.
Discussion: https://github.com/pgpool/pgpool2/issues/94
Backpatch-through: v4.2
set -o errexit
- [ -d \"${DEST_NODE_PGDATA}\" ] && rm -rf ${DEST_NODE_PGDATA}
- [ -d \"${ARCHIVEDIR}\" ] && rm -rf ${ARCHIVEDIR}/*
+ [ -d \"${DEST_NODE_PGDATA}\" ] && rm -rf \"${DEST_NODE_PGDATA}\"
+ [ -d \"${ARCHIVEDIR}\" ] && find \"${ARCHIVEDIR}\" -type f -exec rm -f {} \;
${PGHOME}/bin/pg_basebackup -h $PRIMARY_NODE_HOST -U $REPLUSER -p $PRIMARY_NODE_PORT -D $DEST_NODE_PGDATA -X stream