Skip to content

Multiple Bug Fixes across MSSQL, SMB, Retention, and Storage Adapters - #103

Merged
Skyfay merged 8 commits into
mainfrom
dev
May 27, 2026
Merged

Multiple Bug Fixes across MSSQL, SMB, Retention, and Storage Adapters#103
Skyfay merged 8 commits into
mainfrom
dev

Conversation

@Skyfay

@Skyfay Skyfay commented May 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

Skyfay added 8 commits May 27, 2026 19:24
Always attempt to remove the SMB connection test file and local temp file in a finally block. Move client and tmpPath initialization outside the try so deleteFile/unlink are always accessible, remove the fragile remoteFileCreated flag, and unconditionally call client.deleteFile(destination) with errors ignored. Add unit tests that verify cleanup runs when sendFile throws and that deleteFile is retried when it initially fails. Update changelog to document the bug fix and new tests.
Cast MSSQL size values to BIGINT before multiplying to avoid "Arithmetic overflow error converting expression to data type int" for large databases. Updated queries in src/lib/adapters/database/mssql/browser.ts (CAST a.total_pages AS BIGINT) and src/lib/adapters/database/mssql/connection.ts (CAST mf.size AS BIGINT) and added a changelog entry in docs/changelog.md describing the fix.
Standardize the Grandfather-Father-Son retention abbreviation to GFS across the codebase and docs. Updated documentation, README, UI strings, and unit test descriptions to use "GFS" instead of "GVS", and adjusted function/documentation references accordingly. Added a Prisma migration to rename the built-in retention template from "Smart GVS (7/4/12/2)" to "Smart GFS (7/4/12/2)" (conditional update by id/name). This change is purely a terminology correction for clarity and consistency.
Ensure SMART/GFS tiers do not collapse onto the same newest backup by refactoring retention logic into non-overlapping tiers. RetentionService.applySmartPolicy now uses a generic applyTier helper that picks unique UTC bucket representatives per tier (daily, weekly, monthly, yearly) using date-fns-tz formatInTimeZone. Added retentionPolicyName and retentionPolicySource to DestinationContext and populated them in stepInitialize; stepRetention now logs the applied policy with template/source details. Updated unit tests to cover the regression and logging, and updated changelog entries.
Close and destroy read streams to prevent FD leaks that left temporary .tar files holding disk blocks indefinitely. Updated tar-utils to keep createReadStream instances in variables and destroy them on error, and wrapped stream usage in FTP, S3, SFTP and OneDrive adapters with try/finally blocks that call fileStream.destroy(). Also updated changelog to document the fix (addresses #100). This ensures uploaded/processed temporary files are released promptly and avoids ghost disk usage.
Cache and reuse the SFTP session in the MSSQL SSH transfer adapter instead of opening a new SFTP channel on every operation. Add a sftpSession field, return the cached session from getSftp(), and explicitly end() the session in end() before disconnecting. Also update the changelog to document the bug fix (avoids exhausting SSH server channel limits such as OpenSSH's default 10, which caused "Channel open failure: open failed" and aborted backups when processing many databases).
Streamline docs/changelog.md entries into concise bullet lines, correct the retention term from GVS to GFS across changelog text, and update test and improvement notes for SMB, retention, storage, and history. Modify prisma/migrations/20260527000001_fix_gfs_retention_name/migration.sql to add a guard (NOT EXISTS) and comment so the built-in retention rename to 'Smart GFS (7/4/12/2)' skips if that target name already exists, preventing a unique-constraint failure.
Bump project and docs versions to 2.4.1 (package.json, docs/package.json, api-docs/openapi.yaml, public/openapi.yaml) and update changelog/Docker tags for the release. Fix broken FTP/SFTP unit tests by adding destroy: vi.fn() to fs.createReadStream mocks so adapters that call fileStream.destroy() in finally blocks no longer throw TypeError.
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

@Skyfay
Skyfay merged commit 210b2de into main May 27, 2026
9 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.

1 participant