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
914307ac8f
ci: add golangci-lint config and fix formatting
...
- Add .golangci.yml with minimal linters (govet, ineffassign)
- Run gofmt -s and goimports on all files to fix formatting
- Disable fieldalignment and copylocks checks in govet
2025-12-11 17:53:28 +01:00
98d23a2322
feat: Week 3 Phase 3 - Timeline Management
...
- Created internal/wal/timeline.go (450+ lines)
- Implemented TimelineManager for PostgreSQL timeline tracking
- Parse .history files to build timeline branching structure
- Validate timeline consistency and parent relationships
- Track WAL segment ranges per timeline
- Display timeline tree with visual hierarchy
- Show timeline details (parent, switch LSN, reason, WAL range)
- Added 'wal timeline' command to CLI
Features:
- ParseTimelineHistory: Scan .history files and WAL archives
- ValidateTimelineConsistency: Check parent-child relationships
- GetTimelinePath: Find path from base timeline to target
- FindTimelineAtPoint: Determine timeline at specific LSN
- GetRequiredWALFiles: Collect all WAL files for timeline path
- FormatTimelineTree: Beautiful tree visualization with indentation
Timeline visualization example:
● Timeline 1
WAL segments: 2 files
├─ Timeline 2 (switched at 0/3000000)
├─ Timeline 3 [CURRENT] (switched at 0/5000000)
Tested with mock timeline data - validation and display working perfectly.
2025-11-26 11:44:25 +00:00
1421fcb5dd
feat: Week 3 Phase 2 - WAL Compression & Encryption
...
- Added compression support (gzip with configurable levels)
- Added AES-256-GCM encryption support for WAL files
- Integrated compression/encryption into WAL archiver
- File format: .gz for compressed, .enc for encrypted, .gz.enc for both
- Uses same encryption key infrastructure as backups
- Added --encryption-key-file and --encryption-key-env flags to wal archive
- Fixed cfg.RetentionDays nil pointer issue
New files:
- internal/wal/compression.go (190 lines)
- internal/wal/encryption.go (270 lines)
Modified:
- internal/wal/archiver.go: Integrated compression/encryption pipeline
- cmd/pitr.go: Added encryption key handling and flags
2025-11-26 11:25:40 +00:00
8a1e2daa29
feat: Week 3 Phase 1 - WAL Archiving & PITR Setup
...
## WAL Archiving Implementation (Phase 1/5)
### Core Components Created
- ✅ internal/wal/archiver.go (280 lines)
- WAL file archiving with timeline/segment parsing
- Archive statistics and cleanup
- Compression/encryption scaffolding (TODO)
- ✅ internal/wal/pitr_config.go (360 lines)
- PostgreSQL configuration management
- auto-detects postgresql.conf location
- Backs up config before modifications
- Recovery configuration for PG 12+ and legacy
- ✅ cmd/pitr.go (350 lines)
- pitr enable/disable/status commands
- wal archive/list/cleanup commands
- Integrated with existing CLI
### Features Implemented
**WAL Archiving:**
- ParseWALFileName: Extract timeline + segment from WAL files
- ArchiveWALFile: Copy WAL to archive directory
- ListArchivedWALFiles: View all archived WAL segments
- CleanupOldWALFiles: Retention-based cleanup
- GetArchiveStats: Statistics (total size, file count, date range)
**PITR Configuration:**
- EnablePITR: Auto-configure postgresql.conf for PITR
- Sets wal_level=replica, archive_mode=on
- Configures archive_command to call dbbackup
- Creates WAL archive directory
- DisablePITR: Turn off WAL archiving
- GetCurrentPITRConfig: Read current settings
- CreateRecoveryConf: Generate recovery config (PG 12+ & legacy)
**CLI Commands:**
```bash
# Enable PITR
dbbackup pitr enable --archive-dir /backups/wal_archive
# Check PITR status
dbbackup pitr status
# Archive WAL file (called by PostgreSQL)
dbbackup wal archive <path> <filename> --archive-dir /backups/wal
# List WAL archives
dbbackup wal list --archive-dir /backups/wal_archive
# Cleanup old WAL files
dbbackup wal cleanup --archive-dir /backups/wal_archive --retention-days 7
```
### Architecture
- Modular design: Separate archiver and PITR manager
- PostgreSQL version detection (12+ vs legacy)
- Automatic config file discovery
- Safe config modifications with backups
### Next Steps (Phase 2)
- [ ] Compression support (gzip)
- [ ] Encryption support (AES-256-GCM)
- [ ] Continuous WAL monitoring
- [ ] Timeline management
- [ ] Point-in-time restore command
Time: ~1.5h (3h estimated for Phase 1)
2025-11-26 10:49:57 +00:00