Skip to content

Add backup directory creation and validation for WAL-G file backend - #29

Merged
gpas45 merged 1 commit into
mainfrom
claude/wal-g-backup-dir-check-qcypbg
Jul 15, 2026
Merged

Add backup directory creation and validation for WAL-G file backend#29
gpas45 merged 1 commit into
mainfrom
claude/wal-g-backup-dir-check-qcypbg

Conversation

@gpas45

@gpas45 gpas45 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

This change adds automatic creation and validation of backup directories for WAL-G file-based backups, ensuring proper directory structure and permissions before backup operations begin.

Key Changes

  • New ensure_backup_dir() function: Creates backup directories with proper ownership (postgres:postgres) and permissions (700) if they don't exist. Includes informative logging for all operations.
  • Base directory validation: Added check to create/validate the base WALG_FILE_PREFIX_BASE directory during initial configuration setup.
  • Per-cluster directory validation: For file backend configurations, validates that cluster-specific backup directories exist before processing each cluster. Skips clusters with missing directories and logs warnings.

Implementation Details

  • Uses install -d command for atomic directory creation with proper ownership and permissions
  • Provides clear INFO/OK/ERROR/WARN messages in Russian for operational visibility
  • Gracefully handles missing directories by skipping affected clusters rather than failing the entire operation
  • Only applies directory validation when using the file backend (BACKEND == "file")
  • Returns appropriate exit codes (0 for success, 1 for failure) for error handling

https://claude.ai/code/session_01SiMQMpcCNttwku3vbdkhjn

При конфигурации файлового хранилища проверяется наличие каталога
назначения. Если каталог отсутствует, он создаётся с правами
postgres:postgres (базовый каталог на шаге конфигурации и подкаталог
каждого кластера в цикле обработки).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SiMQMpcCNttwku3vbdkhjn
@gpas45
gpas45 merged commit 4aab823 into main Jul 15, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants