Skip to content

mssqlvdi-fd: add support for filestream backups#2072

Merged
BareosBot merged 12 commits intomasterfrom
dev/ssura/master/switch-mssql-provider
Mar 26, 2025
Merged

mssqlvdi-fd: add support for filestream backups#2072
BareosBot merged 12 commits intomasterfrom
dev/ssura/master/switch-mssql-provider

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Dec 17, 2024

Thank you for contributing to the Bareos Project!

The plugin was written during a time where the VDC_Flush command was only emitted at the end of a backup.
This caused our logic to conflate the two: whenever VDC_Flush was requested, we told the core (implicitly by returning count=0 from read) that the single file we backup is done.

As mentioned in this article this is (and was) always a bad assumption.

Fixing this without changing the complete logic of the plugin was hard, but thanks to the introduction of the VDC_Complete command it was possible.

The way it works is like so: When starting a backup, we request from the vdi device that it should notify us when the backup is complete by setting VDF_RequestComplete in the configuration.
If this succeeds (completion_support = true) then during IO operations we ignore VDC_Flush and continue on until we hit VDC_Complete at which point we actually tell the core that we are done.

This also fixes a small mistake from #2120.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@sebsura sebsura added nobuild bug This addresses a bug labels Dec 17, 2024
@sebsura sebsura added this to the 25.0.0 milestone Dec 17, 2024
@sebsura sebsura self-assigned this Dec 17, 2024
@sebsura sebsura removed the nobuild label Dec 17, 2024
@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch 2 times, most recently from afd26d9 to 2674c03 Compare December 18, 2024 10:57
@arogge arogge requested a review from pstorz January 7, 2025 11:23
@pstorz pstorz force-pushed the dev/ssura/master/switch-mssql-provider branch from 2674c03 to 9134b30 Compare February 7, 2025 15:53
Copy link
Contributor Author

@sebsura sebsura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have a test that actually back ups/ restores a filestream object.

@pstorz pstorz force-pushed the dev/ssura/master/switch-mssql-provider branch 2 times, most recently from 336ad68 to 30c6bb6 Compare February 13, 2025 08:48
@bruno-at-bareos bruno-at-bareos force-pushed the dev/ssura/master/switch-mssql-provider branch from 2c6b663 to a9cba08 Compare February 20, 2025 13:16
@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch 2 times, most recently from 91decd4 to fcad22f Compare March 3, 2025 12:35
@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch from 8f1bbac to 2217719 Compare March 12, 2025 08:45
@bruno-at-bareos bruno-at-bareos self-requested a review March 17, 2025 09:30
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this last review I've added or confirmed some request changes asked by @sebsura
A complete manual test on a separated host with database with other name has been successfully backup-ed and restored. Especially checked the recreation of the Attachment folder.

Plus we need to address the last bits of complain from pr-tool

 ✗  Commit checks failed:
        221771925 [fixup] tests: add debug logging: headline starts with '[fixup]'
        fcad22f9c [fixup] remove `set -x`: headline starts with '[fixup]'
 ✗  bareos-check-sources --since=13c0881293fcb435b9aeb1dcce42f124ba3bfd65 reported:
        Plugin 'fix copyright year' would modify 'core/src/plugins/filed/CMakeLists.txt'

@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch 4 times, most recently from 9f25f65 to 317dfe2 Compare March 20, 2025 09:36
@sebsura sebsura requested a review from bruno-at-bareos March 20, 2025 12:00
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost done. I requested a few changes please check them.

@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch from 41c46c2 to f9a4b8b Compare March 26, 2025 06:08
sebsura and others added 8 commits March 26, 2025 10:06
See here:
https://techcommunity.microsoft.com/blog/sqlserver
  /introducing-vdc-complete-for
    -backup-and-restore-applications-using-sqlvdi/385126
We use a standard DB called `DBNormalTest` with simple table
`samples` and a `Filestream` feature enabled database `DBFilestreamTest`
with two tables `samples` and `files`

- setup license on all testrunner and sqlfiles
- find_program SQLCMD: remove HINTS
- use recommend primary key for filestream table
  `UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE`
- environment.in: move SQLCMD upwards
- minimize configuration files
- properly escape all variables (shellcheck)
- remove set -x in testrunner-01-DBNormal-prepare
  testrunner-11-DBFileStream-prepare
- make tests portable on `CORE` so use `regedit.exe` and `write.exe`
  as sample for Filestream `files` table

Co-authored-by: Philipp Storz <philipp.storz@bareos.com>
Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch from f9a4b8b to b9a3fa5 Compare March 26, 2025 09:07
@bruno-at-bareos bruno-at-bareos self-requested a review March 26, 2025 09:08
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final review, with approval.

@sebsura sebsura force-pushed the dev/ssura/master/switch-mssql-provider branch from c25f471 to 40b20bf Compare March 26, 2025 10:08
@BareosBot BareosBot merged commit dce95e6 into master Mar 26, 2025
1 check was pending
@BareosBot BareosBot deleted the dev/ssura/master/switch-mssql-provider branch March 26, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments