Merge remote-tracking branch 'upstream/master' into 1.5
This commit is contained in:
@ -41,6 +41,7 @@ NOTE: At this time, you must opt into the 1.0 API by setting the `apiVersion` co
|
||||
* <<api-cat-pendingtasks-1-0,cat.pendingTasks>>
|
||||
* <<api-cat-recovery-1-0,cat.recovery>>
|
||||
* <<api-cat-shards-1-0,cat.shards>>
|
||||
* <<api-cat-threadpool-1-0,cat.threadPool>>
|
||||
* <<api-cluster-getsettings-1-0,cluster.getSettings>>
|
||||
* <<api-cluster-health-1-0,cluster.health>>
|
||||
* <<api-cluster-pendingtasks-1-0,cluster.pendingTasks>>
|
||||
@ -2136,6 +2137,39 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cat-threadpool-1-0]]
|
||||
=== `cat.threadPool`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.threadPool([params, [callback]])
|
||||
--------
|
||||
|
||||
// no description
|
||||
|
||||
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`fullId`::
|
||||
`Boolean` -- Enables displaying the complete node ids
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cluster-getsettings-1-0]]
|
||||
=== `cluster.getSettings`
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` co
|
||||
* <<api-cat-pendingtasks-1-x,cat.pendingTasks>>
|
||||
* <<api-cat-recovery-1-x,cat.recovery>>
|
||||
* <<api-cat-shards-1-x,cat.shards>>
|
||||
* <<api-cat-threadpool-1-x,cat.threadPool>>
|
||||
* <<api-cluster-getsettings-1-x,cluster.getSettings>>
|
||||
* <<api-cluster-health-1-x,cluster.health>>
|
||||
* <<api-cluster-pendingtasks-1-x,cluster.pendingTasks>>
|
||||
@ -2136,6 +2137,39 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cat-threadpool-1-x]]
|
||||
=== `cat.threadPool`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.threadPool([params, [callback]])
|
||||
--------
|
||||
|
||||
// no description
|
||||
|
||||
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`fullId`::
|
||||
`Boolean` -- Enables displaying the complete node ids
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cluster-getsettings-1-x]]
|
||||
=== `cluster.getSettings`
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion`
|
||||
* <<api-cat-pendingtasks-master,cat.pendingTasks>>
|
||||
* <<api-cat-recovery-master,cat.recovery>>
|
||||
* <<api-cat-shards-master,cat.shards>>
|
||||
* <<api-cat-threadpool-master,cat.threadPool>>
|
||||
* <<api-cluster-getsettings-master,cluster.getSettings>>
|
||||
* <<api-cluster-health-master,cluster.health>>
|
||||
* <<api-cluster-pendingtasks-master,cluster.pendingTasks>>
|
||||
@ -2136,6 +2137,39 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cat-threadpool-master]]
|
||||
=== `cat.threadPool`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.threadPool([params, [callback]])
|
||||
--------
|
||||
|
||||
// no description
|
||||
|
||||
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`fullId`::
|
||||
`Boolean` -- Enables displaying the complete node ids
|
||||
|
||||
link:#[back to top]
|
||||
|
||||
[[api-cluster-getsettings-master]]
|
||||
=== `cluster.getSettings`
|
||||
|
||||
|
||||
@ -565,6 +565,48 @@ api.cat.prototype.shards = ca({
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [cat.threadPool](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
|
||||
* @param {String, String[], Boolean} params.h - Comma-separated list of column names to display
|
||||
* @param {Boolean} params.help - Return help information
|
||||
* @param {Boolean} params.v - Verbose mode. Display column headers
|
||||
* @param {Boolean} params.fullId - Enables displaying the complete node ids
|
||||
*/
|
||||
api.cat.prototype.threadPool = ca({
|
||||
params: {
|
||||
local: {
|
||||
type: 'boolean'
|
||||
},
|
||||
masterTimeout: {
|
||||
type: 'time',
|
||||
name: 'master_timeout'
|
||||
},
|
||||
h: {
|
||||
type: 'list'
|
||||
},
|
||||
help: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
v: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
fullId: {
|
||||
type: 'boolean',
|
||||
'default': false,
|
||||
name: 'full_id'
|
||||
}
|
||||
},
|
||||
url: {
|
||||
fmt: '/_cat/thread_pool'
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [clearScroll](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-request-scroll.html) request
|
||||
*
|
||||
|
||||
@ -565,6 +565,48 @@ api.cat.prototype.shards = ca({
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [cat.threadPool](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
|
||||
* @param {String, String[], Boolean} params.h - Comma-separated list of column names to display
|
||||
* @param {Boolean} params.help - Return help information
|
||||
* @param {Boolean} params.v - Verbose mode. Display column headers
|
||||
* @param {Boolean} params.fullId - Enables displaying the complete node ids
|
||||
*/
|
||||
api.cat.prototype.threadPool = ca({
|
||||
params: {
|
||||
local: {
|
||||
type: 'boolean'
|
||||
},
|
||||
masterTimeout: {
|
||||
type: 'time',
|
||||
name: 'master_timeout'
|
||||
},
|
||||
h: {
|
||||
type: 'list'
|
||||
},
|
||||
help: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
v: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
fullId: {
|
||||
type: 'boolean',
|
||||
'default': false,
|
||||
name: 'full_id'
|
||||
}
|
||||
},
|
||||
url: {
|
||||
fmt: '/_cat/thread_pool'
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [clearScroll](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-request-scroll.html) request
|
||||
*
|
||||
|
||||
@ -565,6 +565,48 @@ api.cat.prototype.shards = ca({
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [cat.threadPool](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
|
||||
*
|
||||
* @param {Object} params - An object with parameters used to carry out this action
|
||||
* @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
|
||||
* @param {String, String[], Boolean} params.h - Comma-separated list of column names to display
|
||||
* @param {Boolean} params.help - Return help information
|
||||
* @param {Boolean} params.v - Verbose mode. Display column headers
|
||||
* @param {Boolean} params.fullId - Enables displaying the complete node ids
|
||||
*/
|
||||
api.cat.prototype.threadPool = ca({
|
||||
params: {
|
||||
local: {
|
||||
type: 'boolean'
|
||||
},
|
||||
masterTimeout: {
|
||||
type: 'time',
|
||||
name: 'master_timeout'
|
||||
},
|
||||
h: {
|
||||
type: 'list'
|
||||
},
|
||||
help: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
v: {
|
||||
type: 'boolean',
|
||||
'default': false
|
||||
},
|
||||
fullId: {
|
||||
type: 'boolean',
|
||||
'default': false,
|
||||
name: 'full_id'
|
||||
}
|
||||
},
|
||||
url: {
|
||||
fmt: '/_cat/thread_pool'
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform a [clearScroll](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-request-scroll.html) request
|
||||
*
|
||||
|
||||
@ -57,17 +57,21 @@ _.inherits(HttpConnector, ConnectionAbstract);
|
||||
|
||||
HttpConnector.prototype.onStatusSet = _.handler(function (status) {
|
||||
if (status === 'closed') {
|
||||
this.agent.minSockets = this.agent.maxSockets = 0;
|
||||
var agent = this.agent;
|
||||
agent.minSockets = agent.maxSockets = 0;
|
||||
agent.requests = {};
|
||||
|
||||
_.each(this.agent.sockets, function (sockets) {
|
||||
_.each(agent.sockets, function (sockets, group) {
|
||||
_.each(sockets, function (s) {
|
||||
s.destroy();
|
||||
s && agent.removeSocket(s, group);
|
||||
s && s.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
_.each(this.agent.freeSockets, function (sockets) {
|
||||
_.each(agent.freeSockets, function (sockets, group) {
|
||||
_.each(sockets, function (s) {
|
||||
s.destroy();
|
||||
s && agent.removeSocket(s, group);
|
||||
s && s.destroy();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
12
test/fixtures/keepalive.js
vendored
12
test/fixtures/keepalive.js
vendored
@ -1,5 +1,7 @@
|
||||
var elasticsearch = require('../../src/elasticsearch');
|
||||
var _ = require('lodash');
|
||||
var clock = require('sinon').useFakeTimers();
|
||||
|
||||
var es = elasticsearch.Client({
|
||||
host: 'localhost:5555',
|
||||
log: false
|
||||
@ -16,6 +18,14 @@ es.search({
|
||||
}, function (err, resp) {
|
||||
var conn = _.union(es.transport.connectionPool._conns.dead, es.transport.connectionPool._conns.alive).pop();
|
||||
es.close();
|
||||
|
||||
if (_.size(clock.timeouts)) {
|
||||
console.log('Timeouts were left behind');
|
||||
console.log(clock);
|
||||
}
|
||||
|
||||
clock.restore();
|
||||
|
||||
var destroyedSockets = 0;
|
||||
function countDestroyed(sockets) {
|
||||
destroyedSockets += _.where(sockets, { destroyed: true}).length;
|
||||
@ -24,3 +34,5 @@ es.search({
|
||||
_.each(conn.agent.freeSockets, countDestroyed);
|
||||
console.log(destroyedSockets);
|
||||
});
|
||||
|
||||
clock.tick(1);
|
||||
@ -371,7 +371,7 @@ describe('Http Connector', function () {
|
||||
|
||||
describe('Connection cleanup', function () {
|
||||
it('destroys any connections created', function (done) {
|
||||
this.timeout(1000);
|
||||
this.timeout(4000);
|
||||
var cp = require('child_process');
|
||||
var path = require('path');
|
||||
var es = require('event-stream');
|
||||
|
||||
Reference in New Issue
Block a user