Skip to content

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

Closed
wants to merge 7 commits into from
Closed

Conversation

andrewvc
Copy link
Contributor

Continues work from #284 making Manticore connections threadsafe. Renamed the branch because this only touches Manticore.

@andrewvc andrewvc force-pushed the threadsafe-manticore branch 2 times, most recently from 745507b to 1de8c97 Compare March 28, 2016 23:45
@andrewvc
Copy link
Contributor Author

@karmi can you give this a review?

@karmi
Copy link
Contributor

karmi commented Mar 29, 2016

@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
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.)

Copy link
Contributor Author

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?

Copy link
Member

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

@karmi
Copy link
Contributor

karmi commented Apr 6, 2016

I started leaving comments on specific points in the codebase, and will also leave general comments here.

The PR fails at TravisCI with An error occurred while installing manticore (0.5.5), and Bundler cannot continue -- do we know what's the reason for that?

@karmi
Copy link
Contributor

karmi commented Apr 6, 2016

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 client_test.rb?

::Manticore::ClientProtocolException,
::Manticore::ResolutionFailure
]
def enriching_response(method, path, params, body)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@karmi
Copy link
Contributor

karmi commented Apr 6, 2016

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
Copy link
Contributor

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/to to/to

@jsvd
Copy link
Member

jsvd commented Apr 11, 2016

I got the following test failure (seed 15751):

Elasticsearch::Transport::Transport::ManticoreSnifferTest
              PASS (0:00:09.134) test_: Manticore Sniffer should be initialized with a transport instance. 
I, [2016-04-11T11:20:32.797000 #28273]  INFO -- : Will sniff every 1 seconds for new Elasticsearch hosts!
              FAIL (0:00:14.154) test_: Manticore Sniffer should sniff every N seconds. 
          Expcted 5 or 4 invocations. Got 3
        @ test/unit/manticore_sniffer_test.rb:60:in `ManticoreSnifferTest'
          org/jruby/RubyBasicObject.java:1623:in `instance_exec'
          /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/shoulda-context-1.2.1/lib/shoulda/context/context.rb:413:in `create_test_from_should_hash'
          /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/shoulda-context-1.2.1/lib/shoulda/context/context.rb:401:in `create_test_from_should_hash'
          org/jruby/RubyArray.java:2414:in `map'
          org/jruby/RubyArray.java:2414:in `map'
          org/jruby/RubyArray.java:1613:in `each'

@jsvd
Copy link
Member

jsvd commented Apr 11, 2016

see full run with the 2 errors here https://gist.github.com/jsvd/8e27df94a8448964f1ce11c20d87fb1b

@andrewvc andrewvc force-pushed the threadsafe-manticore branch from 7be6ebd to 5abd114 Compare April 11, 2016 21:22
@andrewvc andrewvc force-pushed the threadsafe-manticore branch from 5abd114 to 6475183 Compare April 11, 2016 21:28
@jsvd
Copy link
Member

jsvd commented Apr 12, 2016

I'm no longer seeing test failures <3

@andrewvc andrewvc force-pushed the threadsafe-manticore branch from 212c0a8 to eef970a Compare April 12, 2016 19:01
@andrewvc
Copy link
Contributor Author

@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.

@karmi
Copy link
Contributor

karmi commented Apr 13, 2016

That's an integration test and these are skipped on Ruby 1.8 intentionally -- see Travis configuration.

On 12. 4. 2016, at 21:18, Andrew Cholakian notifications@github.com wrote:

@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.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@andrewvc andrewvc force-pushed the threadsafe-manticore branch from 47ada71 to 1700ff8 Compare April 13, 2016 14:39
@andrewvc andrewvc force-pushed the threadsafe-manticore branch from da87796 to 2857ab4 Compare April 13, 2016 15:15
@jsvd
Copy link
Member

jsvd commented Apr 14, 2016

@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

@andrewvc
Copy link
Contributor Author

We'll just merge this directly into the ls output. Too much fuss to put this into this lib.

@andrewvc andrewvc closed this Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants