f69bfe7071
feat: Add enterprise DBA features for production reliability
...
New features implemented:
1. Backup Catalog (internal/catalog/)
- SQLite-based backup tracking
- Gap detection and RPO monitoring
- Search and statistics
- Filesystem sync
2. DR Drill Testing (internal/drill/)
- Automated restore testing in Docker containers
- Database validation with custom queries
- Catalog integration for drill-tested status
3. Smart Notifications (internal/notify/)
- Event batching with configurable intervals
- Time-based escalation policies
- HTML/text/Slack templates
4. Compliance Reports (internal/report/)
- SOC2, GDPR, HIPAA, PCI-DSS, ISO27001 frameworks
- Evidence collection from catalog
- JSON, Markdown, HTML output formats
5. RTO/RPO Calculator (internal/rto/)
- Recovery objective analysis
- RTO breakdown by phase
- Recommendations for improvement
6. Replica-Aware Backup (internal/replica/)
- Topology detection for PostgreSQL/MySQL
- Automatic replica selection
- Configurable selection strategies
7. Parallel Table Backup (internal/parallel/)
- Concurrent table dumps
- Worker pool with progress tracking
- Large table optimization
8. MySQL/MariaDB PITR (internal/pitr/)
- Binary log parsing and replay
- Point-in-time recovery support
- Transaction filtering
CLI commands added: catalog, drill, report, rto
All changes support the goal: reliable 3 AM database recovery.
2025-12-13 20:28:55 +01:00
778afc16d9
feat: Week 3 Phase 4 - Point-in-Time Restore
...
- Created internal/pitr/recovery_target.go (330 lines)
- ParseRecoveryTarget: Parse all target types (time/xid/lsn/name/immediate)
- Validate: Full validation for each target type
- ToPostgreSQLConfig: Convert to postgresql.conf format
- Support timestamp, XID, LSN, restore point name, immediate recovery
- Created internal/pitr/recovery_config.go (320 lines)
- RecoveryConfigGenerator for PostgreSQL 12+ and legacy
- Generate recovery.signal + postgresql.auto.conf (PG 12+)
- Generate recovery.conf (PG < 12)
- Auto-detect PostgreSQL version from PG_VERSION
- Validate data directory before restore
- Backup existing recovery config
- Smart restore_command with multi-extension support (.gz.enc, .enc, .gz)
- Created internal/pitr/restore.go (400 lines)
- RestoreOrchestrator for complete PITR workflow
- Extract base backup (.tar.gz, .tar, directory)
- Generate recovery configuration
- Optional auto-start PostgreSQL
- Optional recovery progress monitoring
- Comprehensive validation
- Clear user instructions
- Added 'restore pitr' command to cmd/restore.go
- All recovery target flags (--target-time, --target-xid, --target-lsn, --target-name, --target-immediate)
- Action control (--target-action: promote/pause/shutdown)
- Timeline selection (--timeline)
- Auto-start and monitoring options
- Skip extraction for existing data directories
Features:
- Support all PostgreSQL recovery targets
- PostgreSQL version detection (12+ vs legacy)
- Comprehensive validation before restore
- User-friendly output with clear next steps
- Safe defaults (promote after recovery)
Total new code: ~1050 lines
Build: ✅ Successful
Tests: ✅ Help and validation working
Example usage:
dbbackup restore pitr \
--base-backup /backups/base.tar.gz \
--wal-archive /backups/wal/ \
--target-time "2024-11-26 12:00:00" \
--target-dir /var/lib/postgresql/14/main
2025-11-26 12:00:46 +00:00