about summary refs log tree commit homepage
path: root/lib/mogilefs
DateCommit message (Collapse)
2019-10-28fix more indentation warnings
Not sure how or why I missed these with commit 4e0f8155a62711ae ("fix indentation warnings with ruby trunk"), but this cleans them up.
2019-10-28mogilefs: actually use kwarg for Net::HTTP::Persistent.new
Ruby 2.7.0dev will warn about hashes uses as kwargs *sigh*
2018-06-19fix indentation warnings with ruby trunk
Ruby trunk started warning about more mismatched indentations starting around r62836.
2018-06-19socket/pure_ruby: favor String#clear if available
String#replace keeps garbage around a bit longer, so it's not always the better option. cf. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/86983 https://public-inbox.org/ruby-core/20180511033641.GA4459@dcvr/
2017-12-20new_file/stream: remove unused variable
oops :x
2017-06-26pool: simplify empty class definition
This should compile to smaller bytecode with YARV
2017-03-23socket_common: improve readability of case statement
Due to the release of Ruby 2.4.1 with the necessary fix, it seems likely that future releases (if any) of the 2.2 and 2.3 series will avoid garbage on IO#write, too.
2017-03-23socket_common: remove needless 'o' modifier for Regexp
There's no variable interpolation for the regexp.
2017-03-13socket_common: limit garbage workaround to Ruby <= 2.4.1
It looks like Ruby 2.4.1 will have the regression fixed backported to it: https://bugs.ruby-lang.org/issues/13299#change-63503 The next releases of Ruby 2.3 and 2.2 may, too; at the branch maintainer's decision.
2017-02-03socket_common: expand IO#write garbage workaround to 2.0 and 2.1
On reading more carefully, it seems this change is from r34847 which landed in Ruby 2.0. So we still need to support Ruby 2.0 and 2.1 users.
2017-01-31freeze string literals in a few more places
This should reduce the amount of garbage we produce and keep the process leaner and meaner.
2017-01-30socket_common: limit IO#write garbage workaround to <= 2.4
It looks like this regression will be fixed in time for Ruby 2.5.
2017-01-27avoid excessive garbage on uploads with Ruby 2.2+
This is a workaround for <https://bugs.ruby-lang.org/issues/13085> since we use non-blocking sockets anyways.
2017-01-26support net-http-persistent 3.x
The optional net-http-persistent RubyGem we use has a major incompatible change from the 2.x versions. Support them both.
2016-12-29new_file/common: simplify empty class declarations
This compiles to smaller bytecode on YARV (MRI)
2016-12-29use opt_str_freeze to avoid allocations in a few places
None of these are too performance critical, but err on the safe side and avoid allocations whenever possible.
2016-12-29avoid pointless capture in regexp
We do not emit any sort of message on successful 2XX responses, so there's no need to save the actual response after writing.
2016-08-31connect_timeout: match :timeout if unset
And add some weak tests while we're at it. Actually simulating a connection timeout on localhost will be difficult.
2016-08-31implement :connect_timeout option
This can be useful for specifying a different timeout for establishing a connection. Some requests could be expensive and want a higher :timeout measured in seconds, while the time to establish a TCP connection on a healthy LAN could be less than a millisecond. This defaults to 3s to match the existing :timeout, but only affects the amount of time the client will wait for establishing a TCP connection to a tracker.
2016-08-31socket/pure_ruby: connect with "exception:false" on Ruby 2.3+
Exceptions are expensive for common errors, so avoid raising them under Ruby 2.3+ which allows connect_nonblock to be called with "exception: false" kwarg.
2016-08-31admin: map unset reject_bad_md5 field to nil
The 'reject_bad_md5' field may be of an unknown value before the monitor is ready, so prepare for it and map it to 'nil' instead of an empty string. This hopefully makes the Ruby API more Ruby-ish.
2015-11-04socket/pure_ruby: use `:exception=>false' on Ruby 2.1+
This feature allows us to avoid expensive exceptions when doing non-blocking I/O without relying on horrible hacks like kgio.
2015-10-22socket/pure_ruby: fix Ruby 1.8 compatibility
For non-kgio users, IO#wait_readable did not appear until Ruby 2.0. Additionally, optimistically perform reads before waiting because EOF handling behavior differs in current revisions of Ruby 2.3.0dev.
2015-10-22minor garbage reductions for newer Rubies
opt_str_freeze and String#split is optimized for single-byte splits. Use bang methods for escaping, avoiding much garbage in tight loops.
2015-09-16backend: simplify regexp
We don't care if there's a \r before \n if we anchor on \z.
2015-09-16bigfile: lazily require bigfile/filter
None of the bigfile stuff is in common use, so avoid bloating user apps with more of it.
2015-09-14bigfile/filter: only update MD5 if non-nil
It is possible to disable MD5 verification, so we cannot risk updating a nil object. Also, favor explicitly calling "update" instead of using "<<" which YARV will attempt to optimize for Array/String receivers at the cost of other objects (such as Digest::MD5)
2015-09-14more idiomatic comparisons with constants
These generates smaller bytecode than explicitly comparing to a constant value.
2015-09-14admin: simplify utilization conversion
The tracker won't send a utilization field until it has that data.
2015-06-24mogilefs/socket/pure_ruby: use IO#wait_*able
IO#wait_*able methods may use the more efficient ppoll syscall under Linux to avoid performance penalties with high-numbered FDs. Use them if available. IO#wait_readable has been around since the 1.8 days at least, and IO#wait_writable was added in Ruby 2.0.0
2015-05-28avoid defineclass instructions for empty classes
This needlessly wastes bytecode and saves around 2K memory on 64-bit platforms.
2015-05-27use monotonic clock if possible on Ruby 2.1+
The monotonic clock is immune to discontinuous time jumps while still taking into account clock imperfections, making it appropriate for calculating time differences and timeouts.
2015-01-16admin: reduce bytecode overhead of get_stats
This is a deprecated call anyways and no longer supported by modern versions of the server, so avoid wasting RAM with it. We will remove this in 4.x
2015-01-16admin: flesh out get_devices
This adds the reject_bad_md5 and utilization fields. While we're at it, be more explicit with mapping and avoid creating an unnecessary hash.
2015-01-13admin (doc, get_hosts): display integers in results doc
Our code integerizes certain results nowadays, so update the documentation to match.
2013-09-10new_file/stream: correct declare errors array correctly
This caused NameError failures when we ran out of file descriptors.
2013-07-09client: each_key: accept optional :after and :limit args
This allows easy iteration while respecting :after and :limit. This gives each_key an interface consistent with each_file_info.
2013-02-21mysql: remove warning for assigned but unused variable
Note: this mysql component is still largely unmaintained.
2013-02-21backend: fix variable shadow warning
This bug was only introduced in commit 3c73f6b434a4c226c09e31c6ba3b034cb314b3fb
2013-02-05backend: retry all trackers on send failure
In single tracker configurations, a restarted tracker may cause send()/write() failure on the TCP socket. Retry immediately in this case, since there's no danger even for non-idempotent tracker requests.
2013-01-18create_open: do not set empty zone= parameter
It's a small waste and adds to visual noise.
2012-11-08new_file: don't pass private field to create_open
Avoid needless encoding and data transfer to the tracker.
2012-10-31net-http-persistent usage respects timeouts
We now have separate Net::HTTP::Persistent instances between clients that may have different timeouts and also between GET and PUT requests. This hurts our ability to reuse sockets, but correctness is probably more important.
2012-10-30new_file: support create_open_args and create_close_args
This lets us send unsupported/new arguments to plugins and matches the functionality of the Perl client library.
2012-10-30http_reader: improve robustness of header reading
It's possible for networks and servers to break up even small HTTP headers. We also better enforce the timeout if we too too long to write the request.
2012-10-24new_file: delay keepalive sockopts until read
We don't need to set socket keepalive until we've successfully written the request out and are awaiting a response.
2012-10-24optionally use net-http-persistent for StringIO
Given StringIO objects are already in memory, NHP can make small uploads which fit into memory faster. Large uploads (using big_io or :largefile => :stream still go through IO.copy_stream for now)
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).