mongodb-core
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -0,1 +1,7 @@ | ||
2.1.3 2017-01-03 | ||
---------------- | ||
* Monitoring operations are re-scheduled in pool if it cannot find a connection that does not already have scheduled work on it, this is to avoid the monitoring socket timeout being applied to any existing operations on the socket due to pipelining | ||
* Moved replicaset monitoring away from serial mode and to parallel mode. | ||
* updated bson and bson-ext dependencies to 1.0.2. | ||
2.1.2 2016-12-10 | ||
@@ -2,0 +8,0 @@ ---------------- |
@@ -158,2 +158,3 @@ "use strict"; | ||
function deleteConnection(id) { | ||
// console.log("=== deleted connection " + id) | ||
delete connections[id]; | ||
@@ -163,2 +164,3 @@ } | ||
function addConnection(id, connection) { | ||
// console.log("=== added connection " + id) | ||
connections[id] = connection; | ||
@@ -165,0 +167,0 @@ } |
@@ -104,2 +104,4 @@ "use strict"; | ||
// console.log("====== create pool with id :: " + this.id) | ||
// Logger instance | ||
@@ -990,2 +992,3 @@ this.logger = Logger('Pool', options); | ||
function _createConnection(self) { | ||
// console.log("====== create connection on pool :: " + self.id) | ||
var connection = new Connection(messageHandler(self), self.options); | ||
@@ -1082,2 +1085,3 @@ | ||
return function() { | ||
// console.log("==== _execute") | ||
if(self.state == DESTROYED) return; | ||
@@ -1126,2 +1130,47 @@ // Already executing, skip | ||
// If we are monitoring we need to use a connection that is not | ||
// running another operation to avoid socket timeout changes | ||
// affecting an existing operation | ||
if (workItem.monitoring) { | ||
var foundValidConnection = false; | ||
for (var i = 0; i < self.availableConnections.length; i++) { | ||
// If the connection is connected | ||
// And there are no pending workItems on it | ||
// Then we can safely use it for monitoring. | ||
if(self.availableConnections[i].isConnected() | ||
&& self.availableConnections[i].workItems.length == 0) { | ||
foundValidConnection = true; | ||
connection = self.availableConnections[i]; | ||
break; | ||
} | ||
} | ||
// No safe connection found, attempt to grow the connections | ||
// if possible and break from the loop | ||
if(!foundValidConnection) { | ||
// console.log("!!!!!!!!!!!!!!!!!!!!!! foundValidConnection failed") | ||
// console.log("============== :: " + self.queue.length) | ||
// Put workItem back on the queue | ||
self.queue.unshift(workItem); | ||
// // Flush any monitoring operations in the queue, failing fast | ||
// flushMonitoringOperations(self.queue); | ||
// Attempt to grow the pool if it's not yet maxsize | ||
if(totalConnections < self.options.size | ||
&& self.queue.length > 0) { | ||
// Create a new connection | ||
_createConnection(self); | ||
} | ||
// Re-execute the operation | ||
setTimeout(function() { | ||
_execute(self)(); | ||
}, 10); | ||
break; | ||
} | ||
} | ||
// Get actual binary commands | ||
@@ -1128,0 +1177,0 @@ var buffer = workItem.buffer; |
@@ -81,2 +81,14 @@ "use strict" | ||
ReplSetState.prototype.get = function(host) { | ||
var servers = this.allServers(); | ||
for(var i = 0; i < servers.length; i++) { | ||
if(servers[i].name.toLowerCase() === host.toLowerCase()) { | ||
return servers[i]; | ||
} | ||
} | ||
return null; | ||
} | ||
ReplSetState.prototype.allServers = function(options) { | ||
@@ -148,2 +160,8 @@ options = options || {}; | ||
// Push to unknownServers | ||
this.unknownServers.push(server.name); | ||
// console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!") | ||
// console.dir(server) | ||
// Do we have a removeType | ||
@@ -150,0 +168,0 @@ if(removeType) { |
@@ -216,2 +216,3 @@ "use strict" | ||
var start = new Date().getTime(); | ||
// Execute the ismaster query | ||
@@ -739,2 +740,5 @@ self.s.pool.write(query, { | ||
// No pool, return | ||
if(!self.s.pool) return; | ||
// Emit close event | ||
@@ -741,0 +745,0 @@ if(options.emitClose) { |
{ | ||
"name": "mongodb-core", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"bson": "~1.0.1", | ||
"bson": "~1.0.2", | ||
"require_optional": "~1.0.0" | ||
@@ -32,3 +32,3 @@ }, | ||
"mkdirp": "0.5.0", | ||
"mongodb-topology-manager": "1.0.6", | ||
"mongodb-topology-manager": "1.0.x", | ||
"mongodb-version-manager": "christkv/mongodb-version-manager#master", | ||
@@ -42,3 +42,3 @@ "nyc": "^5.5.0", | ||
"kerberos": "~0.0", | ||
"bson-ext": "1.0.1" | ||
"bson-ext": "1.0.2" | ||
}, | ||
@@ -45,0 +45,0 @@ "author": "Christian Kvalheim", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
607327
10592
Updatedbson@~1.0.2