Skip to content

Commit e4b0d4e

Browse files
committed
Updated mongodb-core to 1.3.12. Mongos setting acceptableLatencyMS exposed to control the latency women for mongos selection.
1 parent bd65517 commit e4b0d4e

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

HISTORY.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2.1.12 2016-03-29
2+
-----------------
3+
* Updated mongodb-core to 1.3.12.
4+
* Mongos setting acceptableLatencyMS exposed to control the latency women for mongos selection.
5+
* Mongos pickProxies fall back to closest mongos if no proxies meet latency window specified.
6+
* isConnected method for mongos uses same selection code as getServer.
7+
* Exceptions in cursor getServer trapped and correctly delegated to high level handler.
8+
19
2.1.11 2016-03-23
210
-----------------
311
* Updated mongodb-core to 1.3.10.

docs/reference/content/reference/connecting/connection-settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ The table below shows all settings and what topology they affect.
152152
| **haInterval** | ReplicaSet, Mongos | integer | 10000,5000 | Time between each replicaset status check. |
153153
| **replicaSet** | ReplicaSet | string | null | The name of the replicaset to connect to. |
154154
| **secondaryAcceptableLatencyMS** | ReplicaSet | integer | 15 | Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms). |
155+
| **acceptableLatencyMS** | Mongos | integer | 15 | Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms). |
155156
| **connectWithNoPrimary** | ReplicaSet | boolean | false | Sets if the driver should connect even if no primary is available. |
156157
| **authSource** | Server, ReplicaSet, Mongos | string | null | If the database authentication is dependent on another databaseName. |
157158
| **w** | Server, ReplicaSet, Mongos | string, integer| null | The write concern. |

lib/mongo_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var replsetOptions = ['ha', 'haInterval', 'replicaSet', 'secondaryAcceptableLate
123123

124124
var mongosOptions = ['ha', 'haInterval', 'poolSize', 'ssl', 'checkServerIdentity', 'sslValidate',
125125
'sslCA', 'sslCert', 'sslKey', 'sslPass', 'noDelay', 'keepAlive', 'connectTimeoutMS',
126-
'socketTimeoutMS'];
126+
'socketTimeoutMS', 'acceptableLatencyMS'];
127127

128128
var dbOptions = ['authSource', 'w', 'wtimeout', 'j', 'native_parser', 'forceServerObjectId',
129129
'serializeFunctions', 'ignoreUndefined', 'raw', 'promoteLongs', 'bufferMaxEntries', 'readPreference',

lib/mongos.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var EventEmitter = require('events').EventEmitter
4444
* @param {booelan} [options.ha=true] Turn on high availability monitoring.
4545
* @param {number} [options.haInterval=5000] Time between each replicaset status check.
4646
* @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
47+
* @param {number} [options.acceptableLatencyMS=15] Cutoff latency point in MS for MongoS proxy selection
4748
* @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
4849
* @param {boolean|function} [options.checkServerIdentity=true] Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.
4950
* @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
@@ -164,8 +165,8 @@ var Mongos = function(servers, options) {
164165
finalOptions.noDelay = options.socketOptions.noDelay;
165166
}
166167

167-
if(typeof options.secondaryAcceptableLatencyMS == 'number') {
168-
finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS;
168+
if(typeof options.acceptableLatencyMS == 'number') {
169+
finalOptions.localThresholdMS = options.acceptableLatencyMS || 15;
169170
}
170171

171172
// Add the non connection store

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongodb",
3-
"version": "2.1.11",
3+
"version": "2.1.12",
44
"description": "The official MongoDB driver for Node.js",
55
"main": "index.js",
66
"repository": {
@@ -14,7 +14,7 @@
1414
],
1515
"dependencies": {
1616
"es6-promise": "3.0.2",
17-
"mongodb-core": "1.3.10",
17+
"mongodb-core": "1.3.11",
1818
"readable-stream": "1.0.31"
1919
},
2020
"devDependencies": {

test/functional/mongo_client_tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ exports['Should correctly pass through extra sharded options'] = {
232232
mongos: {
233233
ha:false
234234
, haInterval: 10000
235-
, secondaryAcceptableLatencyMS: 100
235+
, acceptableLatencyMS: 100
236236
, poolSize: 1
237237
, socketOptions: {
238238
noDelay: false
@@ -244,7 +244,7 @@ exports['Should correctly pass through extra sharded options'] = {
244244
}, function(err, db) {
245245
test.equal(false, db.s.topology.s.clonedOptions.ha);
246246
test.equal(10000, db.s.topology.s.clonedOptions.haInterval);
247-
test.equal(100, db.s.topology.s.clonedOptions.acceptableLatency);
247+
test.equal(100, db.s.topology.s.clonedOptions.localThresholdMS);
248248
test.equal(1, db.s.topology.s.clonedOptions.poolSize);
249249

250250
test.equal(444444, db.s.topology.s.clonedOptions.connectionTimeout);

0 commit comments

Comments
 (0)