summaryrefslogtreecommitdiff
path: root/lib/backupstore
Commit message (Collapse)AuthorAge
...
* Fix detection of filesystems without extended attribute support on NetBSD.Chris Wilson2014-12-06
| | | | | | | | | | | NetBSD (version 6) uses ENOTSUP as the errno code to indicate missing support for extended attribute in the filesystem. This appears to be at odds with other Unixes: https://mail-index.netbsd.org/tech-kern/2011/12/13/msg012185.html We need to detect and handle ENOTSUP to stop the backup daemon from killing itself while trying to read extended attributes from the first file in the backup set.
* Fix test failures caused by reference count database changes.Chris Wilson2014-11-16
|
* Add cache invalidation checks to BackupStoreDirectory.Chris Wilson2014-11-16
| | | | | | | | | | Allows us to catch programming errors related to use of a cached reference to a directory after the cache may have been invalidated by requesting another directory from the cache, which could clear it. In DEBUG builds, the cache is no longer cleared, but any entries in it are invalidated, which is effectively a memory leak, but these builds should only be used for running tests, where it doesn't matter.
* Repair the refcount database while checking accounts for errors.Chris Wilson2014-10-31
| | | | | | | Normally this will be done by housekeeping anyway, so it's not that useful, but it's good to check for it in tests, especially when testing BackupStoreCheck's ability to repair bad things that happened to the store when they involve references.
* Refactor handling of exceptions in protocol server command executors.Chris Wilson2014-10-31
| | | | | | | | | | Add a standard method to Replyable that will be called if a recoverable exception (a BoxException) occurs, and can return a protocol Message to be sent to the client, such as an error code for various standard errors, or rethrow the exception. If you want something different, catch exceptions and return the desired reply yourself, or you'll get the default handling.
* Whitespace, comment and readability fixesChris Wilson2014-10-31
|
* Refactor StartClient and StopClient out of testbbackupd.Chris Wilson2014-10-31
| | | | Use them in testbackupstorefix to reduce code duplication.
* Whitespace fixesChris Wilson2014-09-18
|
* Major refactor of testbbackupd.Chris Wilson2014-09-04
| | | | | | | Split single monolithic test into many smaller ones, which can be run separately. Allows easier testing of new features in isolation. Merged back changes from the test refactor branch to reduce diffs.
* Fix tests broken by changing working directory.Chris Wilson2014-09-04
| | | | | | | | | | | Store the current working directory at the beginning of the first test, and restore it at the beginning of every subsequent test. Improve cleanup after tests: delete and recreate the bbackupd state directory. Remove check for reference counts and account errors from tearDown, because they are too hard to retrofit to testbbackupd, and already copied into testbackupstore tearDown.
* Improve directory cache messages in BackupStoreContext.Chris Wilson2014-09-04
| | | | May help to debug issues with directory cache invalidation in future.
* Add EstimatedBytesToUpload to NotifyFileUploadingPatch.Chris Wilson2014-09-04
| | | | Merged back changes from the test refactor branch to reduce diffs.
* Define setup and teardown functions and macros, and use them.Chris Wilson2014-09-04
| | | | Merged back changes from the test refactor branch to reduce diffs.
* Simplify code with macros, update comments and fix whitespace.Chris Wilson2014-09-04
| | | | | | Hopefully all of these changes are inconsequential. Merged back changes from the test refactor branch to reduce diffs.
* Define some functions to reduce duplication in testbbackupd.Chris Wilson2014-09-04
| | | | | | | | | Merged back changes from the test refactor branch to reduce diffs. Fix wrong setting of log level in compare() function. We want to only show errors if we expect mismatches, and show warnings if we didn't expect mismatches. I had it the other way around before.
* Fix timing issue with bbackupd test for recovery after error.Chris Wilson2014-08-24
| | | | | | | For some reason the timing changed and the test was no longer waiting for the same length of time as bbackupd, causing it to fail. Merged back changes from the test refactor branch to reduce diffs.
* Trivial white space fixes.Chris Wilson2014-08-15
|
* Improve readability of block checksum match message.Chris Wilson2014-08-15
| | | | Mute the mismatch message, as there are just too many of them.
* Fix deadlock waiting for read or write on closed connection.Chris Wilson2014-08-15
| | | | | | | | If the system is suspended then it may not realise that a TCP connection has been closed, while waiting for data to arrive on it. We didn't used to apply a timeout to this read operation. Now we use the connection's default timeout on all read and write operations. Network operations that don't pass a timeout will be logged with a backtrace, so that they can be fixed.
* Compile fix for backwards compatibility code.Chris Wilson2014-08-15
|
* Add a TEST_PROTOCOL_ERROR_OR assertion.Chris Wilson2014-08-15
| | | | | | | | Similar to TEST_COMMAND_RETURNS_ERROR_OR, but allows any command or sequence to cause the error, without direct access to the command message. Refactor so that TEST_COMMAND_RETURNS_ERROR_OR calls TEST_PROTOCOL_ERROR_OR to make the assertion on the last error seen by the protocol.
* Whitespace fixes.Chris Wilson2014-04-29
|
* Add a ToString method to IOStream and some subclasses.Chris Wilson2014-04-29
| | | | | Useful to help debug problems such as invalid file headers when the source of the stream might not be too obvious.
* Fix error when modifying a directory with missing entry in parent.Chris Wilson2014-04-29
| | | | This is hopefully the cause of the segfaults reported by Brendon Baumgartner.
* Add a comment explaining why we can't move detached dirs back into place.Chris Wilson2014-04-29
|
* Add missing BackgroundTask headerChris Wilson2014-04-12
|
* Poll command socket regularly during file uploads.Chris Wilson2014-04-09
| | | | | Makes the daemon responsive to polling and commands, even during a file upload operation.
* Remove NoObject reply, and adapt BackupQueries accordingly.Chris Wilson2014-04-09
|
* Remove the global logging level.Chris Wilson2014-04-09
| | | | | It's incompatible with having a logger that logs everything, regardless of the global log level.
* Directories' entries in parent directory should track current size.Chris Wilson2014-04-09
| | | | | | | | | | | | | | | | | | | | | | When entries are added to a directory by a command (BackupStoreContext), and when entries are removed from a directory (by housekeeping), update the parent directory's entry for us if our size has changed. Make BackupStoreCheck check for, report and fix errors when directory entries are directories and the size is wrong (as well as files). Conflicts: test/backupstore/testbackupstore.cpp Fix directories loaded without size being set, leading to warnings later. We can't check that the old size in the parent entry matched the old real size of the directory, unless we set the old real size in the directory. And we don't need to pass the old directory size to HousekeepStoreAccount::DeleteFile, because we can get it from the directory itself.
* Add some test helper _OR macros to execute commands when conditions fail.Chris Wilson2014-04-09
| | | | | | | | This is useful to return from a test if an assertion/check fails, instead of throwing an exception. Also add logging of the actual error code received (with name) to TEST_COMMAND_RETURNS_ERROR(_OR).
* Add a Reopen method to BackupProtocolLocal2 for convenience.Chris Wilson2014-04-09
|
* Add a utility to check account for errors, expecting that there are some.Chris Wilson2014-04-09
| | | | Returns the number of errors found and fixed.
* Fix a (currently cosmetic) bug in BackupProtocolLocal2 account ID.Chris Wilson2014-04-09
| | | | It was hardcoded to 0x01234567 due to a copy and paste error.
* Don't require passing the object ID into BackupStoreContext::SaveDirectory.Chris Wilson2014-04-09
| | | | | | | Passing the wrong object ID would just result in an assertion being thrown (in debug builds) or silently doing the wrong thing (in release builds). I can't see any useful use for this extra parameter, since we can get the container ID from the directory anyway.
* Don't pass AttributesModTime as the hash of the new directory's attributes.Chris Wilson2014-04-09
| | | | | An incorrect comment led me to believe that this parameter was the new directory's AttributesModTime, but actually it was its hash.
* Fix an exception checking refcounts in housekeeping.Chris Wilson2014-03-02
| | | | | | | | | If the old refcount database was shorter than the new one, then we could end up trying to access a nonexistent refcount, triggering an exception, which prevented all comparison of the old and new refcount databases. Also, from now on, a mismatch between old and new refcounts is treated as a housekeeping error, which is detectable in tests.
* Whitespace, comments and log messages cleanups.Chris Wilson2014-03-02
|
* Replace most of APPLY_DELTA macro with a new method.Chris Wilson2014-03-02
| | | | | Using methods instead of macros where possible makes debugging easier. Especially long macros like this one.
* Always flush any incoming stream on server side.Chris Wilson2014-03-02
| | | | | | | | | | Otherwise the protocol might be broken and can't be used any more, even if we made an effort to return an Error reply instead of throwing an exception. This used to not be a problem because an Error reply would terminate the connection anyway, but it no longer does. So if the client also didn't terminate, but tried to handle the exception and keep using the connection, then it might find that its next command fails because the protocol is broken.
* Add convenience macro for testing commands that return errors.Chris Wilson2014-03-02
|
* Adding a directory when over limit returns an error instead of crashing.Chris Wilson2014-03-02
| | | | Just like adding a file does.
* Add QueryCreateDirectory2 command.Chris Wilson2014-03-02
| | | | | Allows creating a directory with a specified modtime (in the parent directory entry). Tests to come shortly.
* Make Protocol take control of the socket object passed in.Chris Wilson2014-03-01
| | | | | | | | | | | | | We pass a std::auto_ptr<SocketStream> to every Protocol subclass when we construct it, and it takes control of this object. This reduces the risk of: * accidentally reusing the same SocketStream for multiple Protocols (it happened to me in testbackupstore); * holding onto a reference to the SocketStream; * allowing a locally-scoped SocketStream to go out of scope and be released while still being referenced by a live Protocol.
* Don't throw a wobbly while backing up if files don't exist.Chris Wilson2014-02-27
| | | | | | | Reading extended attributes may fail with an error if the file was removed (race condition) or in tests when generating random nonexistent directory entries. Handle this more gracefully by not backing up the extended attributes instead of dying completely.
* Fix crash in BackupStoreContext with no HousekeepingInterface pointer.Chris Wilson2014-02-27
| | | | | | Rename mrDaemon to mpHousekeeping and make it a pointer, so that it can officially be NULL, and don't crash if it is, and we fail to get a lock on the account.
* Shorthand check for deleted flag.Chris Wilson2014-02-27
|
* Fix buggy directory deletion by housekeeping.Chris Wilson2014-02-27
| | | | Was introduced by commit bc8261347880b813af58c4b873e1847cca03778d.
* Allow read-only account check without taking a write lock on account.Chris Wilson2014-02-27
|
* Use the new test utilities to remove some duplicate code.Chris Wilson2014-02-27
| | | | Fix previous changes by waiting for forked bbstored process during termination.