cassandra 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.11.3
2
+ - Fix login after reconnect
3
+
1
4
  v0.11.2
2
5
  - Update thrift_client gem to deal with failover bug.
3
6
 
data/cassandra.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cassandra}
5
- s.version = "0.11.2"
5
+ s.version = "0.11.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Evan Weaver, Ryan King}]
9
- s.date = %q{2011-06-30}
9
+ s.date = %q{2011-07-05}
10
10
  s.description = %q{A Ruby client for the Cassandra distributed database.}
11
11
  s.email = %q{}
12
12
  s.executables = [%q{cassandra_helper}]
@@ -116,9 +116,15 @@ class Cassandra
116
116
  # * password
117
117
  #
118
118
  def login!(username, password)
119
- @auth_request = CassandraThrift::AuthenticationRequest.new
120
- @auth_request.credentials = {'username' => username, 'password' => password}
121
- client.login(@auth_request)
119
+ request = CassandraThrift::AuthenticationRequest.new
120
+ request.credentials = {'username' => username, 'password' => password}
121
+ ret = client.login(request)
122
+
123
+ # To avoid a double login on the initial connect, we set
124
+ # @auth_request after the first successful login.
125
+ #
126
+ @auth_request = request
127
+ ret
122
128
  end
123
129
 
124
130
  def inspect
@@ -1007,7 +1013,6 @@ class Cassandra
1007
1013
  def client
1008
1014
  if @client.nil? || @client.current_server.nil?
1009
1015
  reconnect!
1010
- @client.set_keyspace(@keyspace)
1011
1016
  end
1012
1017
  @client
1013
1018
  end
@@ -1015,6 +1020,13 @@ class Cassandra
1015
1020
  def reconnect!
1016
1021
  @servers = all_nodes
1017
1022
  @client = new_client
1023
+ @client.add_callback :post_connect do |cli|
1024
+ # Set the active keyspace after connecting
1025
+ cli.set_keyspace(@keyspace)
1026
+
1027
+ # If using an authenticated keyspace, ensure we relogin
1028
+ cli.login(@auth_request) if @auth_request
1029
+ end
1018
1030
  end
1019
1031
 
1020
1032
  def all_nodes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 2
10
- version: 0.11.2
9
+ - 3
10
+ version: 0.11.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Weaver, Ryan King
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-30 00:00:00 Z
18
+ date: 2011-07-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thrift_client