about summary refs log tree commit homepage
path: root/lib
DateCommit message (Collapse)
2012-10-22new_file allows optional :info hash to be populated
This allows clients to avoid calling #file_info or #get_uris immediate after uploading a file to MogileFS. This can speed things up for cache-using clients with write-through caching.
2012-10-09client: small speedup for list_keys_verbose
Array#pop is faster than Array#shift in most Ruby versions as the latter may require memmove() of all elements. Additionally, ensure ordering is correct if a backend chokes up (for each_file_info, too).
2012-10-09client: add each_file_info iterator
This allows fast listing of keys and metadata (length, checksum, devcount, class).
2012-10-08admin: get_devices returns observed_state again
Blank observed_state (for dead devices) are mapped to nil.
2012-10-08admin: minor speedups for get_hosts, get_devices, list_fids
By avoiding #grep, installations with thousands of hosts/devices should be sped up considerably. list_fids should be roughly twice as fast. This is a followup to commit a309f22f835afe0e6be0e4e2f1a13eaead7434f2
2012-10-01admin: speed up get_domains for many domains
On an installation with 3000+ domains, get_domains gets bottlenecked by calling #grep on the keys of a hash. Allow specifying a "want" directive to filter in data we expect (instead of grepping blindly)
2012-08-01backend: respect timeout on socket/timeout errors
While retrying idempotent requests (even on timeouts) would prevent stale sockets from being noticed, it is better to kill the socket and immediately propagate the timeout error to the user. Retrying in a timeout may cause a request/response to take longer (perhaps _much_ longer) than the timeout configured by the user.
2012-07-25backend: close on timeout, even when idempotent
* backend/do_request: when a request times out for a slow server, we now continue retries until we get a socket error, and close the connection afterward so we don't get interspersed responses * test: added a test for slow servers Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-05clarify error when File.open fails on source file
Retrying to open a source file that cannot be opened (repeatedly) and finally raising NoStorageNodesError is confusing to users.
2012-06-29admin: simplify integer casting code
This makes things easier-to-read, and admin functions aren't performance critical so we won't worry about it.
2012-06-29admin: get_devices casts reject_bad_md5 to boolean
This is a boolean value on the server and we always try to make our return values Ruby-friendly
2012-06-29admin: add change_device_weight command
This feature uses the "set_weight" command to change device weights and has a part of the MogileFS protocol for many years, now.
2012-06-29admin: add support for create_device command
The ability to create devices from the Ruby API might be useful to somebody, especially when writing test cases.
2012-06-12backend: reuse connections on error responses
The server sending us a properly-formed "ERR" response is a big difference than an actual socket or connection error.
2012-06-06exist?(dkey) raises on real errors
Specifying an invalid domain will raise MogileFS::Backend::UnregDomain error instead of merely returning `false'. Only checks for keys in the correct domain (but non-existent keys) return false.
2012-06-05list_keys raises on errors properly
list_keys needs to raise UnregDomainError on invalid domains. This regression was introduced in commit 0b933fc83b8b519c8e587caa6606dd372dda18af
2012-05-04new_file: documentation for :content_md5 usage
Now that checksum support is officially a part of MogileFS, we can document (and thus encourage) it without risking compatibility issues.
2012-03-22client: add support for "updateclass" command
This changes the class associated with +key+. This is _not_ the same as the "update_class" admin command which actually modifies the class itself.
2012-02-28doc: update to not refer to MogileFS 2.55 specifically
It's more future-proof, this way.
2012-02-28Don't stop reading too early.
Leave size unchanged, so it's available for easy comparison with buf.bytesize. [ew: added test case] Acked-by: Eric Wong <normalperson@yhbt.net>
2012-02-17fix documentation of :noverify for get_paths
:noverify always defaults to _true_ (meaning verification is _off_ by default). This double negative is unfortunately a confusing part of the existing API and MogileFS protocol.
2011-12-15docs for various timeouts in MogileFS::MogileFS.new
We have lots of timeouts :x
2011-12-15backend: rely on auto-generated exceptions in const_missing
Most of these exceptions are just too rare to be useful, and code that cares for exceptions will rescue them anyways.
2011-12-14add configurable :fail_timeout for backends
This controls the retry timeout of a failed backend
2011-12-12avoid relying on exceptions for list_keys
This will make debug output quieter.
2011-12-12simplify exist? implementation for avoiding exceptions
This adds an internal :ruby_no_raise flag to the backend to avoid exceptions.
2011-12-11net-http-persistent not required for Content-Range uploads
Performance with Content-Range uploads sucks either way, so it's not noticeably worse off on a LAN /without/ persistent connections.
2011-12-11chunker: small cleanups to whitespace handling
The client-provided Content-MD5 may have leading/trailing whitespace, so we shall strip that before comparing. We also know any base64-encoded MD5 we generate will have only trailing whitespace so we can get away with the (slightly) faster and more-GC-friendly String#rstrip!
2011-12-11add :new_file_max_time parameter
This defaults to 1 hour (which matches the expiry time of a row in the MogileFS internal tempfile table).
2011-12-11misc. documentation improvements
100% RDoc coverage (not that it's an indicator of _good_ documentation, but we're getting there)
2011-12-10finalize and document improved new_file API
2011-12-10rename "Put" namespace to "NewFile"
This should make documentation easier
2011-12-09new_file_common: call "noop" before "create_close"
An upload could've taken a long time, ping and try to ensure socket is valid to minimize (but not completely eliminate) the chance create_close hits a stale socket (while reading the response after writing to it) and becomes non-retryable. We treat create_close specially as its less idempotent than any other command (even other non-idempotent ones). There may be no hope of retrying the upload at all if data was streamed and calling create_close twice will hurt us...
2011-12-08pool: shutdown backend when purging
If we started a connection, make sure it's stopped and the file descriptor closed. Relying on GC to close file descriptors is unreliable with some GC implementations.
2011-12-08pool: O(1) object validity checking
Now that pools can be arbitrarily large, using an O(n) check for object validity can be expensive.
2011-12-08pool: add @purge_threshold, @purge_keep accessors
Instead of hard coding the thresholds, allow users to change accessors
2011-12-08reorganize largefile support code
Putting this into the MogileFS::Put::* namespace will make it easier to document.
2011-12-08new_file(..., :largefile => :stream) avoids chunking
This allows us to stream files with a known Content-Length into MogileFS. This can be useful for streaming an HTTP download into MogileFS without: * saving it to the filesystem * relying on chunked encoding support on the server
2011-12-08backend: auto-generate error constants on const_missing
This way, folks can rescue for exceptions we haven't defined, yet.
2011-12-08admin: fix off-by-one in each_fid method
list_fids was being used incorrectly :x
2011-12-08store_file works on unlinked Tempfile objects
Unlinking Tempfiles is good practice, so we should allow/encourage people to use unlinked Tempfiles with store_file.
2011-12-08new_file: add :largefile => :tempfile support
This is the most-compatible way to support largefiles with the new_file interface. This will unfortunately generate disk I/O, though... Also moving the "mog" util to use this with the "tee" subcommand since it already included its own private implementation of this before.
2011-12-08http_file: big_io support for unlinked open files
This makes it easier to use an unlinked Tempfile
2011-12-07add new_file :largefile => :content_range support
This is similar to the "largefile => 1" support in the Perl MogileFS::Client package. It requires net/http/persistent to avoid repeatedly setting up and tearing down a socket.
2011-12-07new_file gains a :largefile => :chunked option
This returns a new HTTPStream object that behaves like a writable IO object with the following methods: * write * print * printf * putc * puts * syswrite * << ..and also responds to IO.select (for writability)
2011-12-07http_file: use lower keepalive times under Linux
TCP keepalives are inexpensive, so we can use them to monitor whether or not our connection is still alive while uploading. Remote servers make take an unpredictable amount of time to actually write out the data we've uploaded (and empty socket buffers to receive more), so it is extremely difficult to calculate an effective timeout for select() or poll().
2011-12-07Revert "http_file: disable MD5 checksums by default"
This reverts commit 11ee57e7aaa8766d13e29d3872bd78d50a3e5263. Bleh, checksums support is already off by default...
2011-12-06http_file: disable MD5 checksums by default
We won't force this onto the wire for trackers until upstream MogileFS decides to support it.
2011-12-06rely on SO_KEEPALIVE for upload timeouts
Users will be able to tweak these themselves in OS-dependent ways. It's probably better to rely on protocol-level timeouts when the HTTP server should be on a trusted network.
2011-12-06store_file/store_content: wire these up to new new_file opts
These allow us to specify Content-MD5 and checksums for use with the new and improved new_file interface without breaking existing apps.