vss: remove dependency on live system during backup#1452
Merged
pstorz merged 89 commits intobareos:masterfrom Jun 27, 2023
Merged
vss: remove dependency on live system during backup#1452pstorz merged 89 commits intobareos:masterfrom
pstorz merged 89 commits intobareos:masterfrom
Conversation
6cc8923 to
74aa9fd
Compare
6a5bb83 to
dd3fda9
Compare
e749558 to
dabf1bf
Compare
26b5a8e to
ac89b51
Compare
db7eb0a to
025ee2b
Compare
pstorz
requested changes
Jun 22, 2023
Member
pstorz
left a comment
There was a problem hiding this comment.
Good work!
Code looks much cleaner now!
Please fix the following commit comment typos:
880c28c203db8a131d1d9925163cdc29b546198f
-> WaitAndChcekForAsyncOperation
^
4ae9c1fb01206055336824516b548f200a406c76
-> We new just use a static object
^
4810f67178f4e4352a0ee825c2cba732cb9fec7f
-> Since we gi#e the functions an explicit
^
1f60fec to
2c29bd3
Compare
2c29bd3 to
505ec79
Compare
Currently we are reading the attributes from the live system. This will cause issues if the file is deleted or busy and inaccurate results if the file was touched in the mean time.
There is zero reason for this variable to exist at all let alone to be thread specific. It literally only contains two function pointers that are always the same and no thread specific data. For now, if no thread specific variable was set up, we just return a global variable if it was set up. This should enable non-main-threads to "interact" with the vss client; i.e. look up drive -> vss drive translations (which are readonly!).
Currently we only translate filepaths to vss filepaths if we are compiled without unicode support. This changes this to be always the case.
Since our char -> wchar functions cache their results we need to ensure that 1) we do not use the same path twice in the same tests after another since then we would only test our cache; and 2) we clear the cache between test runs 1) has to be done manually but 2) can be done by clearing the cache in the TearDown() of the fixture. This works because gtest does not reuse fixtures for tests but instead recreates them for every test.
We should not remove slashes that are preceded by a colon since there is a big difference for windows between "C:" and "C:\\", "C:/".
We now just use a static object. The initialization is guaranteed to be thread safe and will happen on the first call to InitializeComSecurity(). This slightly changes behaviour: we now do not retry whenever the previous call failed; since the only way for InitializeComSecurity() to fail is for the system to run out of memory (according to the documenentation), this should not be a concern.
Since strncat can write up to n+1 bytes (n bytes from src + null terminator), we need to ensure that dest can hold up to that many bytes! Another issue is that strcpy may not leave the buffer with a zero terminator. To ensure that this is always the case now we just use strncat twice!
Since codecvt is deprecated since C++17 it was replaced with FromUtf8/FromUtf16.
Also fix some related comments
Before we used the following schema: if (use_fallback) st_ctime = CreationTime else st_ctime = max(CreationTime, ChangeTime) We now use this instead to bring it more inline with how its done on unix-like systems: if (use_fallback) st_ctime = LastWriteTime else st_ctime = ChangeTime
We want to remove trailing slashes _before_ we convert them to vss paths!
5e59261 to
84c308e
Compare
|
We are getting this error, it doesn't do to all windows systems but some systems we get this error. " JobId 18896: Fatal error: VSS was not initialized properly." We are using the agent BareOS 21.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to the Bareos Project!
Sometimes bareos messes up and does not use the correct vss paths to backup data. This PR identifies those situations and fixes them.
This PR also:
Please check
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-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality
Tests