You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ca...@codespot.com on 2011/10/27 19:53:36 UTC
[cassandra-node] 5 new revisions pushed by gdusbabek@gmail.com on
2011-10-27 17:52 GMT
5 new revisions:
Revision: eba8f7832224
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:21:05 2011
Log: upgrade to generic-pool 1.0.7. patch by Tomaz Muraus
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=eba8f7832224
Revision: 988090d8208d
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:23:13 2011
Log: propagate errors inside conn.connect to pool.acquire. patch by
Tomaz M...
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=988090d8208d
Revision: c13e33235bbc
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:29:36 2011
Log: add tests for error propagation. patch by Tomaz Muraus
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c13e33235bbc
Revision: dac333117c3c
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:50:32 2011
Log: add a test to verify the message for no host
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=dac333117c3c
Revision: c211ecc305cf
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:51:24 2011
Log: bump version to 0.3.1
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c211ecc305cf
==============================================================================
Revision: eba8f7832224
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:21:05 2011
Log: upgrade to generic-pool 1.0.7. patch by Tomaz Muraus
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=eba8f7832224
Modified:
/package.json
=======================================
--- /package.json Mon Aug 8 13:58:53 2011
+++ /package.json Thu Oct 27 10:21:05 2011
@@ -25,7 +25,7 @@
"dependencies" : {
"thrift" : ">= 0.6.0",
"logmagic": ">= 0.1.1",
- "generic-pool" : ">= 1.0.5",
+ "generic-pool" : ">= 1.0.7",
"whiskey": ">= 0.3.0"
},
"devDependencies": {},
==============================================================================
Revision: 988090d8208d
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:23:13 2011
Log: propagate errors inside conn.connect to pool.acquire. patch by
Tomaz Muraus
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=988090d8208d
Modified:
/lib/driver.js
=======================================
--- /lib/driver.js Wed Aug 3 08:25:13 2011
+++ /lib/driver.js Thu Oct 27 10:23:13 2011
@@ -233,7 +233,7 @@
node.holdUntil = new Date().getTime() + self.holdFor;
retry(curNode);
} else { // Exhausted all options
- callback(null);
+ callback(err);
}
});
}
@@ -263,9 +263,10 @@
var seen = false;
var exe = function(errback) {
- self.pool.acquire(function(conn) {
- if (!conn) {
- callback(Error('Unable to acquire an open connection from the
pool!'));
+ self.pool.acquire(function(err, conn) {
+ if (err) {
+ log.err("Unable to acquire connection from the pool: " +
err.toString());
+ callback(err);
} else {
conn.execute(query, args, function(err, res) {
if (err) {
==============================================================================
Revision: c13e33235bbc
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:29:36 2011
Log: add tests for error propagation. patch by Tomaz Muraus
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c13e33235bbc
Modified:
/test/test_driver.js
=======================================
--- /test/test_driver.js Mon Aug 8 13:34:01 2011
+++ /test/test_driver.js Thu Oct 27 10:29:36 2011
@@ -32,6 +32,22 @@
var CASSANDRA_PORT = 19170;
+function merge(a, b) {
+ var c = {}, attrname;
+
+ for (attrname in a) {
+ if (a.hasOwnProperty(attrname)) {
+ c[attrname] = a[attrname];
+ }
+ }
+ for (attrname in b) {
+ if (b.hasOwnProperty(attrname)) {
+ c[attrname] = b[attrname];
+ }
+ }
+ return c;
+};
+
function stringToHex(s) {
var buf = '';
for (var i = 0; i < s.length; i++) {
@@ -41,7 +57,19 @@
}
-function connect(callback) {
+function connect(options, callback) {
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+
+ var defaultOptions = {
+ host: '127.0.0.1',
+ port: CASSANDRA_PORT,
+ keyspace: 'Keyspace1',
+ use_bigints: true
+ };
+ var connOptions = merge(defaultOptions, options);
var handler = new EventEmitter();
handler.on('error', function(err) {
callback(err, null);
@@ -49,10 +77,7 @@
handler.on('ready', function(con) {
callback(null, con);
});
- var con = new Connection({host: '127.0.0.1',
- port: CASSANDRA_PORT,
- keyspace: 'Keyspace1',
- use_bigints: true});
+ var con = new Connection(connOptions);
con.connect(function(err) {
if (err) {
callback(err, null);
@@ -177,6 +202,26 @@
});
};
+exports.testConnectionKeyspaceDoesNotExistConnect = function(test, assert)
{
+ connect({keyspace: 'doesnotexist.'}, function(err, conn) {
+ assert.ok(err);
+ assert.equal(err.name, 'NotFoundException');
+ assert.ok(!conn);
+ test.finish();
+ });
+};
+
+exports.testPooledConnectionKeyspaceDoesNotExistConnect = function(test,
assert) {
+ var con = new PooledConnection({hosts: ['127.0.0.1:19170'],
+ keyspace: 'doesNotExist.',
+ use_bigints: false});
+ con.execute('SELECT * FROM foo', [], function(err) {
+ assert.ok(err);
+ assert.equal(err.name, 'NotFoundException');
+ test.finish();
+ });
+};
+
exports.testCounterUpdate = function(test, assert) {
connect(function(err0, con) {
assert.ifError(err0);
==============================================================================
Revision: dac333117c3c
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:50:32 2011
Log: add a test to verify the message for no host
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=dac333117c3c
Modified:
/test/test_driver.js
=======================================
--- /test/test_driver.js Thu Oct 27 10:29:36 2011
+++ /test/test_driver.js Thu Oct 27 10:50:32 2011
@@ -202,10 +202,18 @@
});
};
+exports.testConnectToBadUrl = function(test, assert) {
+ connect({port:19171}, function(err, con) {
+ assert.ok(err);
+ assert.strictEqual(err.toString(), 'Error: ECONNREFUSED, Connection
refused');
+ test.finish();
+ });
+};
+
exports.testConnectionKeyspaceDoesNotExistConnect = function(test, assert)
{
connect({keyspace: 'doesnotexist.'}, function(err, conn) {
assert.ok(err);
- assert.equal(err.name, 'NotFoundException');
+ assert.equal(err.toString(), 'NotFoundException');
assert.ok(!conn);
test.finish();
});
@@ -217,7 +225,7 @@
use_bigints: false});
con.execute('SELECT * FROM foo', [], function(err) {
assert.ok(err);
- assert.equal(err.name, 'NotFoundException');
+ assert.equal(err.toString(), 'NotFoundException');
test.finish();
});
};
==============================================================================
Revision: c211ecc305cf
Author: gdusbabek <gd...@gmail.com>
Date: Thu Oct 27 10:51:24 2011
Log: bump version to 0.3.1
http://code.google.com/a/apache-extras.org/p/cassandra-node/source/detail?r=c211ecc305cf
Modified:
/package.json
=======================================
--- /package.json Thu Oct 27 10:21:05 2011
+++ /package.json Thu Oct 27 10:51:24 2011
@@ -6,7 +6,7 @@
],
"name": "cassandra-client",
"description": "Node.js CQL driver for Apache Cassandra",
- "version": "0.3.0",
+ "version": "0.3.1",
"homepage": "https://github.com/racker/node-cassandra-client",
"repository": {
"type": "git",