summaryrefslogtreecommitdiff
path: root/lib/backupstore
Commit message (Collapse)AuthorAge
* 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.
* Move test utilities into a separate file, to share with testbbackupd.Chris Wilson2014-02-27
|
* Check that adding a new directory doesn't exceed store limits.Chris Wilson2014-02-13
|
* Add a shortcut interface to uploading a new file.Chris Wilson2014-02-13
| | | | Useful in tests.
* Add a convenience constructor to read a BackupStoreDirectory from a stream.Chris Wilson2014-02-13
| | | | Saves ~2 lines each time it's used. And we use it a lot in testbackupstore.
* Don't consider it an error if LastObjectIDUsed changes during check.Chris Wilson2014-02-11
| | | | | There could be many reasons for this, including an invalid object being deleted during the previous check run. And it's definitely not serious.
* Fix accounting for old and deleted files, and dirs removed by housekeeping.Chris Wilson2014-02-11
| | | | | Also pass the actual reference count of an object to RaidFileWrite instead of assuming that it's zero, to avoid accidentally deleting a referenced object.
* Fix accounting for old and deleted files and blocks during backup operations.Chris Wilson2014-02-10
| | | | Adding and deleting files was not always accounted properly before.
* Add a ClearDirectoryCache method to BackupStoreContext.Chris Wilson2014-02-10
| | | | It's used in several places, and about to be one more.
* Reformat for readability, add defensive comment.Chris Wilson2014-02-10
|
* Fix wrong output of client store marker in bbstoraccounts info.Chris Wilson2014-02-10
|
* Fix testbackupstore, apart from wrong accounting for old files.Chris Wilson2014-02-10
|
* Rename BackupStoreInfo variable NumFiles to NumCurrentFiles.Chris Wilson2014-02-09
| | | | | Will hopefully prevent future confusion about the meaning of this info variable.
* Fix wrong handling of objects with multiple references in housekeeping.Chris Wilson2014-02-09
| | | | | | We don't have a test for it yet, and won't until snapshots are implemented, but it's a bad idea to merge patches to remove an old version when another directory is still holding a reference to the patch.
* Fix accounting in bbstoreaccounts check.Chris Wilson2014-02-09
| | | | | | Fix accounting for current, old and deleted files and blocks. Previously there was confusion over the meaning of NumFiles, now it's defined to mean the number of current files (neither old nor deleted), similar to BlocksInCurrentFiles.
* The user asked us to fix errors, so it's not a very important notification ↵Chris Wilson2014-02-09
| | | | that we're doing so.
* Add new exception to denote a corrupt refcount db.Chris Wilson2014-02-07
|
* Fix compile error.Chris Wilson2014-02-07
| | | | | | | | | | Caused by removal of BackupStoreRefCountDatabase::CreateForRegeneration. It's not safe to do this in housekeeping anyway, because it might not complete the scan, leaving an incomplete database, that might persuade BackupStoreContext that it's OK to delete an object that still really has references to it. If your refcount db disappears or is damaged, you need to run a check fix.
* Create new refcount database atomically during account check.Chris Wilson2014-02-07
| | | | | | | | | | | Use a temporary refcount db for check instead of an in-memory vector. This avoid the memory usage problems created by using the vector on large accounts, but may require us to improve the efficiency of the refcount database itself to avoid large numbers of small I/O operations. That is very doable now that we're using a class for it. Fix some inconsistencies and mistakes in handling reference counts and info counters during account checks (more to come).
* Fix compile error.Chris Wilson2014-02-07
| | | | | Caused by premature switch from GetNumFiles to GetNumCurrentFiles.
* Add an AccountUsage2 command to backup protocol.Chris Wilson2014-02-07
| | | | | Allows us to get information about the account that's not available using the old AccountUsage command. Currently only used in tests.