-
Notifications
You must be signed in to change notification settings - Fork 611
Threadsafe Manticore #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Threadsafe Manticore #296
Conversation
745507b
to
1de8c97
Compare
@karmi can you give this a review? |
@andrewvc, nice! I'm afraid I won't be able to do a full review this week, I need to keep focus on some internal applications, but I'll try to find some time, if I fail, let's sync in the beginning of the next week. |
@@ -12,13 +12,10 @@ branches: | |||
- travis | |||
|
|||
rvm: | |||
- 1.8.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are Ruby 1.8 compatible in the low-level client, what's the reason for removing 1.8.7 from the Travis configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I thought these were failing on Master. I see the unit tests are passing here: https://travis-ci.org/elastic/elasticsearch-ruby/builds/120013643 . I must have been mistaken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests might have failed, but I'd like to keep 1.8 compatibility for the low level gems (transport+api) as long as technically possible. (The Rails integration and the elasticsearch-dsl
gem are already 1.9+ only.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby 1.8.7-p370 was released Jun 29. 2012, almost four years ago at this point.
Are people still using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd be amazed :D
I started leaving comments on specific points in the codebase, and will also leave general comments here. The PR fails at TravisCI with |
I think that given how much logic is specific to the Manticore adapter, it would be safer to add real, integrations tests for it, loosely modeled after the |
::Manticore::ClientProtocolException, | ||
::Manticore::ResolutionFailure | ||
] | ||
def enriching_response(method, path, params, body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about with_enriched_response
to better match with_request_retries
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make this not a block per @jsvd above.
Also, another "administrative" comment -- since the Manticore classes implement and add a suite of methods, can we have proper RDoc/Yardoc style documentation for them? Notably parameters and return values. (Many of those are "internal", so I don't think they need usage examples that much.) |
module Transport | ||
module HTTP | ||
class Manticore | ||
class Adapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a "header" documentation text here, describing the purpose of this class, and how it fits with the Manticore-specific architecture?
|
||
def wait_for_open_connections | ||
until open_connections.empty? | ||
logger.info "Blocked on shutdown to to open connections #{@state_mutex.synchronize {@url_info}}" if logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/to to/to
I got the following test failure (seed 15751):
|
see full run with the 2 errors here https://gist.github.com/jsvd/8e27df94a8448964f1ce11c20d87fb1b |
7be6ebd
to
5abd114
Compare
5abd114
to
6475183
Compare
I'm no longer seeing test failures <3 |
212c0a8
to
eef970a
Compare
@karmi I added the 1.8.7 tests back in, but they are not passing on master. https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch/test/integration/client_integration_test.rb Uses 1.9 syntax. FWIW I think it's fine to require people on old rubies to use old libraries. |
That's an integration test and these are skipped on Ruby 1.8 intentionally -- see Travis configuration.
|
47ada71
to
1700ff8
Compare
da87796
to
2857ab4
Compare
@andrewvc I was able to make travis build successfully by applying the following patch: diff --git a/.travis.yml b/.travis.yml
index 556d43b..1390ff7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,7 +36,8 @@ before_script:
- gem install bundler -v 1.11.2
- rake setup
- rake elasticsearch:update
- - echo elasticsearch-* elasticsearch | xargs -n1 -IFF bash -c 'echo processing bundle for FF && cd FF && bundle && cd ..'
+ - find . -maxdepth 1 -type d -name 'elasticsearch*' | xargs -n1 -IFF bash -c 'echo "processing bundle for FF"; cd FF; BUNDLE_GEMFILE= bundle; cd ..'
script:
- SERVER=start TEST_CLUSTER_LOGS=/tmp/log TEST_BUILD_REF=tags/v$ES_VERSION TEST_CLUSTER_COMMAND=/tmp/elasticsearch-$ES_VERSION/bin/elasticsearch rake test:$TEST_SUITE
diff --git a/elasticsearch-extensions/elasticsearch-extensions.gemspec b/elasticsearch-extensions/elasticsearch-extensions.gemspec
index 2fcf967..c069ded 100644
--- a/elasticsearch-extensions/elasticsearch-extensions.gemspec
+++ b/elasticsearch-extensions/elasticsearch-extensions.gemspec
@@ -54,8 +54,4 @@ Gem::Specification.new do |s|
if defined?(RUBY_VERSION) && RUBY_VERSION > '2.2'
s.add_development_dependency "test-unit", '~> 2'
end
-
- # Gems for testing integrations
- s.add_development_dependency "patron" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
- s.add_development_dependency "oj" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
end
diff --git a/elasticsearch-extensions/lib/elasticsearch/extensions/backup.rb b/elasticsearch-extensions/lib/elasticsearch/extensions/backup.rb
index 01a0a53..85eec0f 100644
--- a/elasticsearch-extensions/lib/elasticsearch/extensions/backup.rb
+++ b/elasticsearch-extensions/lib/elasticsearch/extensions/backup.rb
@@ -4,10 +4,8 @@ require 'pathname'
require 'fileutils'
require 'multi_json'
-require 'oj'
require 'elasticsearch'
-require 'patron'
module Backup
module Database |
We'll just merge this directly into the ls output. Too much fuss to put this into this lib. |
Continues work from #284 making Manticore connections threadsafe. Renamed the branch because this only touches Manticore.