Commit graph

50 commits

Author SHA1 Message Date
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Aaron Schulz
6435a6e737 [FileBackend] Purge Swift process cache before container delete for sanity.
* Also tweaked some documentation.

Change-Id: I89369d6211de216193ae1d895356137cacded5d7
2012-05-25 03:41:12 -07:00
Aaron Schulz
723b886429 [FileBackend] Avoid an extra RTT on Swift listing operations.
* Also tweaked timestamp tolerance in tests, intended for Swift
* Also made a few tweaks to speed up tests a bit

Change-Id: Ibdee36d3bf86089b027dc74bb2582acc1ab4b96b
2012-05-22 10:53:48 -07:00
Aaron
957f09b8a4 [FileBackend] Added doQuickOperations() function for things like purging thumbnails.
* doQuickOperations() lets us do things like purge thumbnails as fast as possible.
  Stat calls, SHA1 checks, and RTTs in general are avoided. It also avoids the
  slowness of lazy population of thumbnail SHA1s in Swift (for those made by rewrite.py).
* Removed supportedOperations() to avoid the extra complexity.
* Made a few variable type and exception documentation cleanups.
* Cleaned up unit test file removal a bit and made some functions private.

Change-Id: I6922368c6af7752a6927d96402519132203108a1
2012-05-16 10:30:34 -07:00
Aaron
23a0490b78 [FileBackend] Added support for concurrent file write operations.
* FS backends work via popen() and basic shell commands.
* Swift backends use the custom SwiftCloudFiles async features.
* Refactored storagePathsRead()/storagePathsChanged() to normalize the paths
  for correct dependency detection in FileOpBatch.
* Cleaned up SwiftFileBackend exception handling to make debugging easier.
* Added a quick and dirty performance testing script.
* Updated unit tests to include a run with parallelize=implicit.
* Improved file test failure output a bit.

Change-Id: I6a5ed743c30c598e0dd7301dbdb3631c460332fd
2012-05-09 05:37:41 -07:00
Aaron Schulz
a9e028e5a8 [FileBackend] File locking fixes.
* Fixed unlocking logic in FSLockManager for case when an EX lock was made, then an SH one, and then the EX one was "unlocked"
* Avoid hiding useful unlink() warnings in FSLockManager
* Reduced locking use in test cleanup code
* Added a simple testLockCalls() test function
* Made a few cleanups & fixes to backend tests

Change-Id: I1110d9b537c450d9feca5a2fb35519c22435e81d
2012-05-08 01:51:57 -07:00
Aaron
104e8bb0d7 [FileBackend] Added 'recursive' flag to directory clean() function.
Change-Id: I8fadd25c05840e2324bf8433dc0a4846daf8e2c3
2012-04-26 12:41:33 -07:00
Aaron Schulz
dd5326ccf1 [FileBackend] Added some basic directory functions.
* Added directoryExists() function to check if a dir exists.
* Added getDirectoryList() and getTopDirectoryList() functions to list out subdirs.
* Added getTopFileList() function to list out immediate files in a dir. This wraps getFileList(), which was modified.

Change-Id: I087835f40d76c41f5d6af55b9a34a51e0f44a675
2012-04-21 21:33:41 -07:00
Aaron
41831cbcfe Fixed silly backend test config bug.
Change-Id: I35b53dc609acb720c64f236cb58f91a73604e2f8
2012-04-17 10:25:52 -07:00
Aaron Schulz
19799ae5bb Tweak testFileRepoConstructionWithRequiredOptions so that it doesn't fail depending on the config of the wiki being tested on. 2012-03-13 01:44:39 +00:00
Aaron Schulz
783f7f0bd3 [FileBackend] Made doOperations() Status handling align with documentation as well as what FileRepo is essentially expecting when using the 'force' option (it assumes fatals are for total batch failures, not just partial ones). The relevant documentation was also improved. 2012-03-08 22:31:04 +00:00
Antoine Musso
f40529b464 avoid test suite file leaks 2012-02-24 20:30:55 +00:00
Aaron Schulz
c2861f924c * Corrected and improved FileBackend::getFileList() comments.
* Added unit tests for using getFileList() iterators twice.
2012-02-08 22:13:03 +00:00
Antoine Musso
6a3fb66d2d test FileRepo constructor 2012-02-07 14:54:06 +00:00
Aaron Schulz
34a8565419 Added missing tests from r110731 2012-02-06 05:26:36 +00:00
Aaron Schulz
9a1452ae92 In FileBackendBase/FileBackend:
* Moved some public static functions from FileBackend to FileBackendBase as the later defines the public API.
* Made splitStoragePath() return null if the backend or container name is empty.
* Made normalizeContainerPath() kill leading directory separators.
* Added more unit tests and made some documentation tweaks.
In FSFileBackend:
* Added resolveContainerName() to disallow '.' a container name, since this would cause a traversal.
2012-01-29 21:28:31 +00:00
Aaron Schulz
638b58c272 * In NewParserTest, made it possible to use the --use-filebackend param to run the tests on a given registered backend.
* In FileBackendTest, killed useless recursiveClean() call.
2012-01-28 01:20:42 +00:00
Aaron Schulz
ece8bb5e6f r110180: fixed copy-paste cruft for custom backend code. Also made backend names consistent. 2012-01-28 00:43:55 +00:00
Aaron Schulz
6c784b1812 Fixed a bunch of dir leakage 2012-01-27 22:46:55 +00:00
Aaron Schulz
c1c6433bfc * In NewParserTest, refactored code to use FileBackend (bug 31737). Also made some speed improvements and made regex= not flood the output with 600 items of crap.
* In FileBackendTest, call clean() on the dirs *after* deleting all the files first.
* Speed improvements to MediaWikiTestCase.
2012-01-25 23:11:53 +00:00
Aaron Schulz
d1b159ef63 In FileBackend:
* Use 'b' param in some fopen() calls as needed for Windows and newline handling.
* Removed some useless padding code in FileBackend::getContainerShard(). Initialized $m to make IDE happy.
* Updated some code comments.
In SwiftFileBackend:
* Manually set the ETag when using php-cloudfiles for creating files to avoid https://github.com/rackspace/php-cloudfiles/issues/59.
* Manually set the content type based on how StreamFile::getType(). This makes it safe to read files directly out of the proxy to end-users. The streamFile() backend functions already uses a similar content-type check.
2012-01-25 01:57:28 +00:00
Aaron Schulz
73d4d6edbf Made FileOp classes enforce required params. Also reverts r109823. 2012-01-24 05:54:47 +00:00
Antoine Musso
5eba9f361a FileRepo: check constructor parameters
new FileRepo() requires an array of parameters having at least the
'name' and 'backend' key setup.

TODO: 'backend' keyword should probably default to FileBackend.
2012-01-23 14:50:54 +00:00
Aaron Schulz
a0bce8f10e * Added some wfProfileIn() calls to file backend code.
* Made FileBackend::getFileProps() final.
* Added exception needed in SwiftFileBackend::getConnection().
* Various FileBackendTests fixes and additions. Optimized it a bit by keeping the backend instance in memory.
2012-01-23 08:33:31 +00:00
Aaron Schulz
609cf8d522 * Modified StoreBatchTest and FileBackendTest to allow specifying a registered backend to use
* Improved FileBackendTest file pruning and added more getFileList() tests
2012-01-22 00:34:04 +00:00
Aaron Schulz
eb92ac5557 * Added FileBackend::parentStoragePath() convenience function for getting parent directories.
* In StoreBatchTest: sed proper clean() function to remove temp dirs (follows up r109641). Also removed some commented out code.
* Fixed temp dir leakage in FileBackendTest.
2012-01-20 22:46:35 +00:00
Platonides
3f76d9e2b0 Fix folder leakage. 2012-01-20 20:15:26 +00:00
Platonides
fe5a57bd2e If you are going to leak folders, at least give them your surname. 2012-01-20 19:46:27 +00:00
Aaron Schulz
d0fc7d5d89 Renamed 'overwriteDest' FileBackend operation parameter to just 'overwrite', which is shorter and more consistent with 'overwriteSame' 2012-01-19 02:24:49 +00:00
Antoine Musso
79c979b4e8 tests: mark tests requiring a database connection 2012-01-18 15:50:00 +00:00
Aaron Schulz
c4a01a7afd In FileOp/FileBackend:
* Added SHA-1 to FileOp::attemptBatch $predicates (since concatenate was removed from FileOp). This lets us get rid of temp file backups, as the remaining failure case is just the backend medium going down (the ops would break in that case anyway). Doing so reduces RTTs and backup file I/O overhead. This also simplifies expiry object support by avoiding having to stash the expiry values of temp backup objects somewhere.
* Improved precheck() and attempt() status logic in FileOp::attemptBatch() a bit. Use separate $subStatus var to check if each op is OK.
* A few minor code cleanups and comment tweaks.
* Fixed MoveFileOp bug found in unit tests when the source/dest are the same and an overwriteDest/overwriteSame param is given (the file would just get deleted). Improved CopyFileOp in this case too.
Other:
* Added more unit tests.
2012-01-15 22:45:14 +00:00
Aaron Schulz
36c143110a In FileBackend:
* Made secure() call doPrepare() for caller dummy proofing (especially those that don't check the status).
In FSFileBackend:
* Removed redundant wfMkdirParents() calls in FSFileBackend, we already have prepare() for this purpose. This also keeps it's behavior more consistent with the other backends.
* Made use of 'backend-fail-store' message in doStoreInternal().
Other:
* Updated unit tests and renamed $src => $source in some functions for consistency.
* Added some documentation comments and @since tags.
2012-01-13 23:30:46 +00:00
Aaron Schulz
76298accc0 * Added 'basePath' config param to FSFileBackend and tweaked it to behave more similarly to the backends with real containers (e.g. everything else). Resolution to absolute paths is now deferred after resolveStoragePath(), using resolveToFSPath().
* Fixed whitespace in FSFileIterator.
2012-01-12 18:44:00 +00:00
Antoine Musso
0323c900f7 StoreBatchText note about using custom repo
follow up r108308
2012-01-10 14:26:17 +00:00
Aaron Schulz
3cd02f7a38 * r107986: Added readOnly checks to prepare(), secure(), and clean() in FileBackendBase.
* Added some prepare()/clean() tests.
2012-01-09 00:20:28 +00:00
Aaron Schulz
50a7097436 * Fixed 'success' value of doOperations() Status to match documentation.
* Made 'success', 'successCount', and 'failCount' fields reflect the overall operation in FileBackendMultiWrite::doOperationsInternal(). This makes it match up with single-write backends.
* Made FileBackend::clearCache() part of the public API.
2012-01-08 22:10:53 +00:00
Aaron Schulz
94c3039106 * Follow-up r107170: Moved FileBackend::concatenate() outside of doOperations() as it's own separate operation. It does not mutate storage files like the others and having it in doOperations() broke FileBackendMultiWrite. This change also makes overriding doOperationsInternal() easier (suching as using a custom batch operation storage API).
* Added sanity check to FileBackendMultiWrite constructor.
* Moved FileBackend::create() function up a bit.
2012-01-08 09:25:15 +00:00
Aaron Schulz
360e3376bf In FileBackend:
* Added getFileSize()/getFileStat() functions. Refactored some functions to use the stat function for better reuse and caching/consistency.
* Refactored streamFile() to allow for subclasses to avoid local file copying with less duplication. Also make last-modified check actually work since we always get the timestamp of the original file.
* Renamed 'ignoreErrors' parameter to 'force'.
In FileBackendMultiWrite:
* Simplified how read ops are done (use 'master' backend for consistency).
* Added consistency check to doOperationsInternal() to check if the files are synced.
* Various fixes after testing.
In StreamFile:
* Split out prepareForStream() function from stream() in StreamFile for code reuse.
In FileBackendTest:
* Properly cover FileBackendMultiWrite in tests.
* Various test improvements.
2012-01-08 08:40:00 +00:00
Aaron Schulz
d010652a6d Dependency inject the repo/backend for proper testing rather than relying on the wiki config 2012-01-07 06:13:01 +00:00
Aaron Schulz
78f5e5a63e Fixes for r106752:
* Make sure FSFileIterator::current() directly returns the string path and that it is relative to the directory being searched.
* Fixed silly bug in testGetFileList that masked any bugs.
* Added a few code comments.
2012-01-06 05:15:51 +00:00
Aaron Schulz
03ed413c93 * Added FileBackendBase::getFileContents() function with a default FileBackend version.
* Added read-only mode to FileBackendBase config.
* Moved FileBackendBase::getFileTimestamp() up slightly.
2012-01-04 02:15:07 +00:00
Aaron Schulz
875f8a28e9 In FileBackendBase/FileBackend:
* Changed concatenate to store to a specified temp FS file rather than a final storage destination. This makes it better fit the use case (chunked upload), so we can avoid extra copying around. Subclasses no longer have to implement this function now as well.
* Added extensionFromPath() helper function.
* Moved createInternal() up a bit and fixed @see comments pointing to the wrong functions.
In FSFileBackend:
* Use parent implementation of doConcatenateInternal().
In FileRepo/File:
* Added FileRepo::ALLOW_STALE and made thumbnail transforms use it.
2011-12-23 18:59:39 +00:00
Ian Baker
77320e1994 changed instances of sample.com to example.com per RFC 2606 2011-12-21 22:22:01 +00:00
Aaron Schulz
6efbf4d4fd Fixed typo in testGetFileList() and used the proper FileBackend function delete 2011-12-21 08:46:10 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Russ Nelson
7f16501760 clean up temp files. Fixes r99546 only better this time. 2011-12-16 20:01:08 +00:00
Russ Nelson
9e74cdbd21 clean up temp files. Fixes r99546 2011-12-16 19:59:58 +00:00
Russ Nelson
95971a5351 StoreBatchTest counts now correct, and using assertEquals 2011-10-16 22:18:18 +00:00
Russ Nelson
b3881a28c1 Some docs and a test for FileRepo::storeBatch() 2011-10-11 19:49:29 +00:00