Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af385f0bac | |||
| 02c5b8664e |
@ -1,6 +1,14 @@
|
|||||||
[[changelog-client]]
|
[[changelog-client]]
|
||||||
== Release notes
|
== Release notes
|
||||||
|
|
||||||
|
[discrete]
|
||||||
|
=== 7.17.13
|
||||||
|
|
||||||
|
[discrete]
|
||||||
|
==== Fixes
|
||||||
|
|
||||||
|
Fixes a bug where newly-added nodes that don't have HTTP information yet should be skipped during sniffing, to prevent an unexpected `TypeError`. https://github.com/elastic/elasticsearch-js/issues/1230[#1230]
|
||||||
|
|
||||||
[discrete]
|
[discrete]
|
||||||
=== 7.17.12
|
=== 7.17.12
|
||||||
|
|
||||||
|
|||||||
@ -206,6 +206,10 @@ class BaseConnectionPool {
|
|||||||
|
|
||||||
for (let i = 0, len = ids.length; i < len; i++) {
|
for (let i = 0, len = ids.length; i < len; i++) {
|
||||||
const node = nodes[ids[i]]
|
const node = nodes[ids[i]]
|
||||||
|
|
||||||
|
// newly-added nodes do not have http assigned yet, so skip
|
||||||
|
if (node.http === undefined) continue
|
||||||
|
|
||||||
// If there is no protocol in
|
// If there is no protocol in
|
||||||
// the `publish_address` new URL will throw
|
// the `publish_address` new URL will throw
|
||||||
// the publish_address can have two forms:
|
// the publish_address can have two forms:
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
"./*": "./*.js"
|
"./*": "./*.js"
|
||||||
},
|
},
|
||||||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
||||||
"version": "7.17.12",
|
"version": "7.17.13",
|
||||||
"versionCanary": "7.17.12-canary.1",
|
"versionCanary": "7.17.13-canary.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"elasticsearch",
|
"elasticsearch",
|
||||||
"elastic",
|
"elastic",
|
||||||
|
|||||||
@ -313,6 +313,36 @@ test('API', t => {
|
|||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.test('Should skip nodes that do not have an http property yet', t => {
|
||||||
|
const pool = new BaseConnectionPool({ Connection })
|
||||||
|
const nodes = {
|
||||||
|
a1: {
|
||||||
|
http: {
|
||||||
|
publish_address: '127.0.0.1:9200'
|
||||||
|
},
|
||||||
|
roles: ['master', 'data', 'ingest']
|
||||||
|
},
|
||||||
|
a2: {
|
||||||
|
roles: ['master', 'data', 'ingest']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t.same(pool.nodesToHost(nodes, 'http:'), [{
|
||||||
|
url: new URL('http://127.0.0.1:9200'),
|
||||||
|
id: 'a1',
|
||||||
|
roles: {
|
||||||
|
master: true,
|
||||||
|
data: true,
|
||||||
|
ingest: true,
|
||||||
|
ml: false
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
t.equal(pool.nodesToHost(nodes, 'http:').length, 1)
|
||||||
|
t.equal(pool.nodesToHost(nodes, 'http:')[0].url.host, '127.0.0.1:9200')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user