8 new revisions:

Revision: 1403a64d233b
Author:   Tomaz Muraus <k...@k5-storitve.net>
Date:     Sat May 19 20:07:56 2012
Log:      Update README.md
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=1403a64d233b

Revision: c80c2e1aa8df
Author:   Tomaz Muraus <k...@k5-storitve.net>
Date:     Sat May 19 20:26:02 2012
Log:      Update README.md
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c80c2e1aa8df

Revision: 1a62b66565eb
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:16:59 2012
Log:      small whitespace fixes
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=1a62b66565eb

Revision: 851479771e0d
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:17:16 2012
Log:      Fixes race condition in PooledConnection.shutdown()...
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=851479771e0d

Revision: 8fa18384916d
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:46:12 2012
Log:      Don't emit 'disconnected' event when a connection attempt errors
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=8fa18384916d

Revision: 5b6ff4041b8e
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:49:30 2012
Log:      Avoid double-callback
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=5b6ff4041b8e

Revision: 7eedb988f6f9
Author:   Gary Dusbabek <gdusba...@gmail.com>
Date:     Thu May 31 11:17:00 2012
Log: Merge pull request #31 from robert-chiniquy/fix-connection-close-race-...
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=7eedb988f6f9

Revision: ae5cc1a1933f
Author:   Gary Dusbabek <gdusba...@gmail.com>
Date:     Thu May 31 11:23:36 2012
Log:      bump to version 0.9.2
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=ae5cc1a1933f

==============================================================================
Revision: 1403a64d233b
Author:   Tomaz Muraus <k...@k5-storitve.net>
Date:     Sat May 19 20:07:56 2012
Log:      Update README.md
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=1403a64d233b

Modified:
 /README.md

=======================================
--- /README.md  Sat May 12 18:22:25 2012
+++ /README.md  Sat May 19 20:07:56 2012
@@ -29,7 +29,7 @@
 ====================

 ### Access the System keyspace
-    var System = require('node-cassandra-client').System;
+    var System = require('cassandra-client').System;
     var sys = new System('127.0.0.1:9160');

     sys.describeKeyspace('Keyspace1', function(err, ksDef) {
@@ -52,7 +52,7 @@
 ### Updating
 This example assumes you have strings for keys, column names and values:

-    var Connection = require('node-cassandra-client').Connection;
+    var Connection = require('cassandra-client').Connection;
var con = new Connection({host:'cassandra-host', port:9160, keyspace:'Keyspace1', user:'user', pass:'password'}); con.execute('UPDATE Standard1 SET ?=? WHERE key=?', ['cola', 'valuea', 'key0'], function(err) {
         if (err) {
@@ -93,7 +93,7 @@

 ### Pooled Connections
     // Creating a new connection pool.
- var PooledConnection = require('node-cassandra-client').PooledConnection;
+    var PooledConnection = require('cassandra-client').PooledConnection;
     var hosts = ['host1:9160', 'host2:9170', 'host3', 'host4'];
var connection_pool = new PooledConnection({'hosts': hosts, 'keyspace': 'Keyspace1'});


==============================================================================
Revision: c80c2e1aa8df
Author:   Tomaz Muraus <k...@k5-storitve.net>
Date:     Sat May 19 20:26:02 2012
Log:      Update README.md
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c80c2e1aa8df

Modified:
 /README.md

=======================================
--- /README.md  Sat May 19 20:07:56 2012
+++ /README.md  Sat May 19 20:26:02 2012
@@ -72,7 +72,6 @@
use_bigints: [optional] boolean. toggles whether or not BigInteger or Number instances are in results.
     timeout:     [optional] number. Connection timeout. Defaults to 4000ms.
log_time: [optional] boolean. Log execution time for all the queries. - Timing is logged to 'node-cassandra-client.driver.timing' route. Defaults to false.

 ### Getting data
**NOTE:** You'll only get ordered and meaningful results if you are using an order-preserving partitioner.
@@ -139,7 +138,7 @@
 ### Logging
Instances of `Connection()` and `PooledConnection()` are `EventEmitter`'s and emit `log` events:

-    var Connection = require('node-cassandra-client').Connection;
+    var Connection = require('cassandra-client').Connection;
var con = new Connection({host:'cassandra-host', port:9160, keyspace:'Keyspace1', user:'user', pass:'password'});
     con.on('log', function(level, message, obj) {
       console.log('log event: %s -- %j', level, message);

==============================================================================
Revision: 1a62b66565eb
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:16:59 2012
Log:      small whitespace fixes

http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=1a62b66565eb

Modified:
 /lib/driver.js
 /test/test_driver.js

=======================================
--- /lib/driver.js      Mon Apr 30 14:52:44 2012
+++ /lib/driver.js      Tue May 29 15:16:59 2012
@@ -500,7 +500,7 @@
 };

 ConnectionInPool.prototype.isHealthy = function() {
-    return this.unhealthyAt === 0;
+  return this.unhealthyAt === 0;
 }

 /**
=======================================
--- /test/test_driver.js        Sat May 12 18:19:06 2012
+++ /test/test_driver.js        Tue May 29 15:16:59 2012
@@ -881,8 +881,8 @@
       server.listen(8688, '127.0.0.1', callback);
     },

-      function executeQueryPooledConnection(callback) {
- conn.execute('UPDATE CfUgly SET A=1 WHERE KEY=1', [], function(err) {
+    function executeQueryPooledConnection(callback) {
+      conn.execute('UPDATE CfUgly SET A=1 WHERE KEY=1', [], function(err) {
         assert.ifError(err);
         callback();
       });
@@ -1084,6 +1084,7 @@
   });
 };

+
 exports.testPooledConnectionShutdownTwice = function(test, assert) {
   var hosts = ['127.0.0.1:9160'];
var conn = new PooledConnection({'hosts': hosts, 'keyspace': 'Keyspace1'});

==============================================================================
Revision: 851479771e0d
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:17:16 2012
Log:      Fixes race condition in PooledConnection.shutdown()

Previously, if PooledConnection.shutdown() was called before the connection process had completed, _closeConnections would only call ConnectionInPool.close() on each connection in the pool if that ConnectionInPool had connected == true. If the connection process was still in-progress, connected would be set to false, close() would not be called, and the socket would later connect, causing tests
to hang.

This adds two events to ConnectionInPool, 'connected' and 'disconnected' - 'disconnected' is not actually needed, just added for symmetry. Instead of setting ConnectionInPool.connected directly, call setConnected() or setDisconnected() and the appropriate event will be emitted.

ConnectionInPool.closeConnections now attaches an on('connected') handler to close the connection
if the connection completes after shutdown() has been called.

http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=851479771e0d

Modified:
 /lib/driver.js
 /test/test_driver.js

=======================================
--- /lib/driver.js      Tue May 29 15:16:59 2012
+++ /lib/driver.js      Tue May 29 15:17:16 2012
@@ -493,12 +493,28 @@
   }
   Connection.call(this, this._options);
   Connection.prototype.connect.call(this, function(err) {
-    self.connected = !err;
+    if (err) {
+      self.setDisconnected();
+    }
+    else {
+      self.setConnected();
+    }
+
     self.unhealthyAt = err ? new Date().getTime() : 0;
     callback(err);
   });
 };

+ConnectionInPool.prototype.setConnected = function() {
+  this.connected = true;
+  this.emit('connected');
+};
+
+ConnectionInPool.prototype.setDisconnected = function() {
+  this.connected = false;
+  this.emit('disconnected');
+};
+
 ConnectionInPool.prototype.isHealthy = function() {
   return this.unhealthyAt === 0;
 }
@@ -596,7 +612,7 @@
       } else if (this.connections[this.current_node].isStaleUnhealthy()) {
// unhealthy and stale, so let reset the node (appears as if unconnected).
         this.connections[this.current_node].taken = false;
-        this.connections[this.current_node].connected = false;
+        this.connections[this.current_node].setDisconnected();
         this.connections[this.current_node].unhealthyAt = 0;
         break;
       } else {
@@ -808,6 +824,9 @@
     if (con.connected) {
       con.close(cb);
     } else {
+      con.on('connected', function() {
+        con.close(cb);
+      });
       cb(null);
     }
   }, function(err) {
=======================================
--- /test/test_driver.js        Tue May 29 15:16:59 2012
+++ /test/test_driver.js        Tue May 29 15:17:16 2012
@@ -1118,3 +1118,15 @@
     secondCbCalledImmediatelyWithError = true;
   });
 };
+
+
+exports.testPooledContainerImmediateShutdown = function(test, assert) {
+  var hosts = ['127.0.0.1:9160'];
+ var pool = new PooledConnection({'hosts': hosts, 'keyspace': 'Keyspace1'});
+
+  pool.connect();
+  pool.shutdown(function(err) {
+    assert.ifError(err);
+    test.finish();
+  });
+};

==============================================================================
Revision: 8fa18384916d
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:46:12 2012
Log:      Don't emit 'disconnected' event when a connection attempt errors

http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=8fa18384916d

Modified:
 /lib/driver.js

=======================================
--- /lib/driver.js      Tue May 29 15:17:16 2012
+++ /lib/driver.js      Tue May 29 15:46:12 2012
@@ -494,7 +494,7 @@
   Connection.call(this, this._options);
   Connection.prototype.connect.call(this, function(err) {
     if (err) {
-      self.setDisconnected();
+      self.connected = false;
     }
     else {
       self.setConnected();

==============================================================================
Revision: 5b6ff4041b8e
Author:   Robert Chiniquy <robert.chini...@rackspace.com>
Date:     Tue May 29 15:49:30 2012
Log:      Avoid double-callback

http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=5b6ff4041b8e

Modified:
 /lib/driver.js

=======================================
--- /lib/driver.js      Tue May 29 15:46:12 2012
+++ /lib/driver.js      Tue May 29 15:49:30 2012
@@ -825,7 +825,7 @@
       con.close(cb);
     } else {
       con.on('connected', function() {
-        con.close(cb);
+        con.close(null);
       });
       cb(null);
     }

==============================================================================
Revision: 7eedb988f6f9
Author:   Gary Dusbabek <gdusba...@gmail.com>
Date:     Thu May 31 11:17:00 2012
Log: Merge pull request #31 from robert-chiniquy/fix-connection-close-race-condition

Fix connection close race condition
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=7eedb988f6f9



==============================================================================
Revision: ae5cc1a1933f
Author:   Gary Dusbabek <gdusba...@gmail.com>
Date:     Thu May 31 11:23:36 2012
Log:      bump to version 0.9.2

http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=ae5cc1a1933f

Modified:
 /CHANGES
 /package.json

=======================================
--- /CHANGES    Mon Apr 30 15:46:47 2012
+++ /CHANGES    Thu May 31 11:23:36 2012
@@ -1,3 +1,7 @@
+Changes with cassandra-client 0.9.2:
+
+- Fix a race condition when pooled connections are closed.
+
 Changes with cassandra-client 0.9.1:

- Emit a 'log' event with 'error' level if an error happens when connecting to
=======================================
--- /package.json       Sat May 12 18:15:18 2012
+++ /package.json       Thu May 31 11:23:36 2012
@@ -9,7 +9,7 @@
   ],
   "name": "cassandra-client",
   "description": "Node.js CQL driver for Apache Cassandra",
-  "version": "0.9.1",
+  "version": "0.9.2",
   "homepage": "http://code.google.com/a/apache-extras.org/p/cassandra-node/";,
   "repository": {
     "type": "git",

Reply via email to