Permalink
Browse files

Fix Issue #3: Node dies when HBase is offline

  • Loading branch information...
1 parent 9314910 commit 6d74a86d7e9daaedb6e4231dc68b443bfd984802 @wdavidw wdavidw committed Dec 2, 2011
Showing with 18 additions and 8 deletions.
  1. +4 −4 lib/hbase-client.js
  2. +3 −0 lib/hbase-connection.js
  3. +7 −0 test/testClient.coffee
  4. +4 −4 test/utils.coffee
View
@@ -1,8 +1,8 @@
-var Connection = require('./hbase-connection')
- , Table = require('./hbase-table')
- , Row = require('./hbase-row')
- , Scanner = require('./hbase-scanner');
+var Connection = require('./hbase-connection');
+var Table = require('./hbase-table');
+var Row = require('./hbase-row');
+var Scanner = require('./hbase-scanner');
var Client = function(options){
if(!options) options = {};
View
@@ -37,6 +37,9 @@ Connection.prototype.makeRequest = function(method, command, data, callback) {
callback(e,null);
});
});
+ req.on('error', function(err){
+ callback(err);
+ });
if (data && data != '') {
data = typeof data === 'string' ? data : JSON.stringify(data);
req.write(data, 'utf8');
View
@@ -1,4 +1,5 @@
+hbase = require '..'
utils = require './utils'
assert = require 'assert'
@@ -29,3 +30,9 @@ module.exports =
assert.ifError err
assert.strictEqual 1, tables.filter( (table) -> table.name is 'node_table' ).length
next()
+ 'Test': (next) ->
+ # Hopefully, 456789 isnt used, might worth checking it with `nc`
+ hbase({host: 'localhost', port: 456789})
+ .getVersionCluster (err, versionCluster) ->
+ assert.ok err instanceof Error
+ next()
View
@@ -1,8 +1,8 @@
-hbase = require('hbase')
-fs = require('fs')
-path = require('path')
-assert = require('assert')
+hbase = require '..'
+fs = require 'fs'
+path = require 'path'
+assert = require 'assert'
module.exports.getClient = (callback) ->
configFile = "#{__dirname}/properties.json"

1 comment on commit 6d74a86

getTable method of hbase-client recreates the table in hbase everytime it is called. So previous data and table is removed.

Please sign in to comment.