summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* 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.
* Refactor logging option processing out of Daemon class.Chris Wilson2014-04-09
| | | | Allows command-line tools to reuse the same option processing.
* Improve error message when fatal exception aborts a command-line tool.Chris Wilson2014-04-09
| | | | | Report the exception message details if it's a BoxException, so it's more user friendly.
* Improve error messages when FileHandleGuard fails to open a file.Chris Wilson2014-04-09
| | | | | Use the standard macros to report file error messages in the standard format, including a filename and message in the exception.
* Remove NoObject reply, and adapt BackupQueries accordingly.Chris Wilson2014-04-09
|
* Add a capturing logger.Chris Wilson2014-04-09
| | | | Useful in testing whether code logs the expected messages or not.
* Add a guard that can temporarily add a Logger to the logging system.Chris Wilson2014-04-09
| | | | This is very useful with the forthcoming Capture logger.
* 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.
* Add a static GetMessage() to BackupProtocolError.Chris Wilson2014-04-09
| | | | | | | | | Allows retrieving the error message for a given code, when we no longer have the protocol object handy. Conflicts: lib/server/makeprotocol.pl.in
* Support microsecond timestamps for files on Linux.Chris Wilson2014-04-09
|
* 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.
* Use static_cast instead of C-style casts, for C++ style and safety.Chris Wilson2014-03-02
|
* Fix whitespace and comments, remove redundant code in protocol generator.Chris Wilson2014-03-02
|
* Add convenience macro for testing commands that return errors.Chris Wilson2014-03-02
|
* Fix memory leak in local protocol.Chris Wilson2014-03-02
| | | | | When a command fails with an error, and CheckReply throws an exception, the mStreamsToSend were not deleted.
* Add information about last exchange when wrong type of object received.Chris Wilson2014-03-02
| | | | | | | | | | Helps with debugging ConnectionException::Protocol_StreamWhenObjExpected and ConnectionException::Protocol_ObjWhenStreamExpected errors, which may be caused by a command returning an error message and failing to consume any uploaded streams first. Add extra debugging in ProtocolLocal objects to detect when this happens during the command itself, which helps with debugging.
* SpellingChris 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 compile error in MemBlockStream.Chris Wilson2014-02-11
| | | | | | Fix test/common memory leak checks now that MemBlockStream allocates another block.
* Fix double parentheses, which llvm complains about.Chris Wilson2014-02-11
|
* Simplify C++ name demangling code, and its memory allocation tracking.Chris Wilson2014-02-11
|
* Add a TEST_THAT_THROWONFAIL macro that throws an AssertFailed exception.Chris Wilson2014-02-11
| | | | Allows aborting tests from any depth of function calls.
* Give tests access to the list of tests requested by the user.Chris Wilson2014-02-11
|
* Add a MemBlockStream constructor from a simple string.Chris Wilson2014-02-11
| | | | | | Useful for sending simple string messages through Protocols or writing them to streams. Takes a copy of the string, so you don't need to worry about object lifetime.
* Record mallocs that happen while the memleak finder is disabled.Chris Wilson2014-02-11
| | | | | | | | Track them as not leaks, and suppress warnings about realloc() and free() on these blocks, because they are actually tracked. Add missing "throw (std::bad_alloc)" to "operator new" to silence warnings from the llvm compiler.