diff --git a/lib/mongodb/commands/db_command.js b/lib/mongodb/commands/db_command.js index 4b8784b8f4..f8751b5e6b 100644 --- a/lib/mongodb/commands/db_command.js +++ b/lib/mongodb/commands/db_command.js @@ -208,7 +208,6 @@ DbCommand.createCreateIndexCommand = function(db, collectionName, fieldOrSpec, o DbCommand.logoutCommand = function(db, command_hash, options) { var dbName = options != null && options['authdb'] != null ? options['authdb'] : db.databaseName; - // Create logout command return new DbCommand(db, dbName + "." + DbCommand.SYSTEM_COMMAND_COLLECTION, QueryCommand.OPTS_NO_CURSOR_TIMEOUT, 0, -1, command_hash, null); } diff --git a/lib/mongodb/connection/base.js b/lib/mongodb/connection/base.js index 499c44eb92..afe34827dd 100644 --- a/lib/mongodb/connection/base.js +++ b/lib/mongodb/connection/base.js @@ -75,13 +75,10 @@ NonExecutedOperationStore.prototype.execute_writes = function() { while(this.commands.write.length > 0) { // Get the next command var command = this.commands.write.shift(); - // // Remove any connection - // if(command['options'] == null) command['options'] = {}; - // command['options'].connection = this.config.checkoutWriter(); + // Set the connection command.options.connection = connection; // Execute the next command command.executeInsertCommand(command.db, command.db_command, command.options, command.callback); - // write_func(db, command['db_command'], command['options'], command['callback']); } } diff --git a/lib/mongodb/connection/mongos.js b/lib/mongodb/connection/mongos.js index 7d139ddab6..a7fa04b5ed 100644 --- a/lib/mongodb/connection/mongos.js +++ b/lib/mongodb/connection/mongos.js @@ -120,11 +120,6 @@ Mongos.prototype.connect = function(db, options, callback) { // Error handler var errorOrCloseHandler = function(_server) { return function(err, result) { - // console.log("================================ errorOrCloseHandler :: " + _server.port) - // for(var i = 0; i < self.servers.length;i++) { - // console.log(" errorOrCloseHandler :: - " + self.servers[i].port) - // } - var validServers = []; // Execute all the callbacks with errors self.__executeAllCallbacksWithError(err); @@ -151,16 +146,12 @@ Mongos.prototype.connect = function(db, options, callback) { // Set current list of servers self.servers = validServers; - // for(var i = 0; i < self.servers.length;i++) { - // console.log(" AFTER errorOrCloseHandler :: - " + self.servers[i].port) - // } } } // Mongo function this.mongosCheckFunction = function() { if(self._haInProgress) return; - // console.log("=================================== MONGOS PING") // Set as not waiting for check event self._haInProgress = true; // Check downed servers @@ -189,16 +180,9 @@ Mongos.prototype.connect = function(db, options, callback) { // Setup the connection function var connectFunction = function(_db, _server, _options, _callback) { return function() { - // console.log("======================================= connect with options") - // console.dir(_options) // Attempt to connect _server.connect(_db, _options, function(err, result, _server2) { numberOfServersLeft = numberOfServersLeft - 1; - // console.log("=================================== MONGOS PING CONNECT") - // console.dir(err) - // console.dir(result) - // console.dir(_server2) - // console.dir(_server.isMasterDoc) if(err) { return _callback(err, _server); @@ -408,10 +392,6 @@ Mongos.prototype.isDestroyed = function() { * @ignore */ Mongos.prototype.checkoutWriter = function() { - // console.log("======================== MONGOS :: checkout writer :: " + this.servers.length) - // for(var i = 0; i < this.servers.length;i++) { - // console.log(" MONGOS :: checkout writer - " + this.servers[i].port) - // } if(this.servers.length == 0) return null; return this.servers[0].checkoutWriter(); } @@ -420,7 +400,6 @@ Mongos.prototype.checkoutWriter = function() { * @ignore */ Mongos.prototype.checkoutReader = function(read) { - // console.log("======================== MONGOS :: checkout reader") // If we have a read preference object unpack it if(typeof read == 'object' && read['_type'] == 'ReadPreference') { // Validate if the object is using a valid mode diff --git a/lib/mongodb/connection/repl_set/ha.js b/lib/mongodb/connection/repl_set/ha.js index 1a93b869cb..52f0cc201a 100644 --- a/lib/mongodb/connection/repl_set/ha.js +++ b/lib/mongodb/connection/repl_set/ha.js @@ -13,7 +13,6 @@ HighAvailabilityProcess.RUNNING = 'running'; HighAvailabilityProcess.STOPPED = 'stopped'; HighAvailabilityProcess.prototype.start = function() { - // console.log("===================== START HA Process") if(this.replset._state && Object.keys(this.replset._state.addresses).length == 0) { if(this.server) this.server.close(); @@ -123,7 +122,6 @@ var _timeoutHandle = function(self) { // If the server is connected if(self.server.isConnected() && !self._haProcessInProcess) { - // console.log("===================== HA Process") // Start HA process self._haProcessInProcess = true; // Execute is master command @@ -198,7 +196,6 @@ var _timeoutHandle = function(self) { } var _reconnect_servers = function(self, reconnect_servers) { - // console.log("============================== _reconnect_servers") if(reconnect_servers.length == 0) { self._haProcessInProcess = false return setTimeout(_timeoutHandle(self), self.options.haInterval); @@ -250,7 +247,6 @@ var _reconnect_servers = function(self, reconnect_servers) { // Let's attempt a connection over here newServer.connect(db, function(err, result, _server) { - // console.log("============================== _reconnect_servers 1") if(self.state == HighAvailabilityProcess.STOPPED) { _server.close(); } diff --git a/lib/mongodb/connection/repl_set/repl_set.js b/lib/mongodb/connection/repl_set/repl_set.js index bd32a39a6e..b2739240aa 100644 --- a/lib/mongodb/connection/repl_set/repl_set.js +++ b/lib/mongodb/connection/repl_set/repl_set.js @@ -195,7 +195,7 @@ ReplSet.prototype.connect = function(parent, options, callback) { // If we have a strategy defined start it if(self.strategyInstance) { - // self.strategyInstance.start(); + self.strategyInstance.start(); } // Finishing up the call @@ -293,7 +293,6 @@ var createServer = function(self, host, options) { var _handler = function(event, self, server) { return function(err, doc) { - // console.log("=============================================== _handler :: " + event) // The event happened to a primary // Remove it from play if(self._state.isPrimary(server)) { @@ -442,7 +441,6 @@ ReplSet.prototype.isMongos = function() { } ReplSet.prototype.checkoutWriter = function() { - // console.log("========================= checkoutWriter") if(this._state.master) return this._state.master.checkoutWriter(); return new Error("no writer connection available"); } @@ -483,8 +481,6 @@ ReplSet.prototype.allServerInstances = function() { * @ignore */ ReplSet.prototype.checkoutReader = function(readPreference, tags) { - // console.log("========================= checkoutReader") - // console.dir(readPreference) var connection = null; // If we have a read preference object unpack it diff --git a/lib/mongodb/db.js b/lib/mongodb/db.js index a1a622ac27..3ab8ed285f 100644 --- a/lib/mongodb/db.js +++ b/lib/mongodb/db.js @@ -597,14 +597,11 @@ Db.prototype.logout = function(options, callback) { // Number of connections we need to logout from var numberOfConnections = this.serverConfig.allRawConnections().length; - // console.log("========================================== logout") - // Let's generate the logout command object var logoutCommand = DbCommand.logoutCommand(self, {logout:1}, options); self._executeQueryCommand(logoutCommand, {onAll:true}, function(err, result) { // Count down numberOfConnections = numberOfConnections - 1; - // console.log("========================================== logout 1 :: " + numberOfConnections) // Work around the case where the number of connections are 0 if(numberOfConnections <= 0 && typeof callback == 'function') { var internalCallback = callback; @@ -1577,16 +1574,10 @@ Db.prototype._executeQueryCommand = function(db_command, options, callback) { var config = this.serverConfig; var read = options.read; - // console.log("================================================ _executeQueryCommand") - // console.log("canRead = " + config.canRead(read)) - // console.log("canWrite = " + config.canWrite()) - // console.log("isAutoReconnect = " + config.isAutoReconnect()) - if(!config.canRead(read) && !config.canWrite() && config.isAutoReconnect()) { if(read == ReadPreference.PRIMARY || read == ReadPreference.PRIMARY_PREFERRED || read == null) { - // console.log("= _executeQueryCommand :: 0") // Save the command self.serverConfig._commandsStore.read_from_writer( @@ -1600,8 +1591,6 @@ Db.prototype._executeQueryCommand = function(db_command, options, callback) { } ); } else { - // console.log("= _executeQueryCommand :: 1") - self.serverConfig._commandsStore.read( { type: 'query' , db_command: db_command @@ -1614,10 +1603,8 @@ Db.prototype._executeQueryCommand = function(db_command, options, callback) { ); } } else if(!config.canRead(read) && !config.canWrite() && !config.isAutoReconnect()) { - // console.log("= _executeQueryCommand :: 2") return callback(new Error("no open connections"), null); } else { - // console.log("= _executeQueryCommand :: 3") // Execute the command __executeQueryCommand(self, db_command, options, function (err, result, conn) { if(callback) callback(err, result, conn); @@ -1712,7 +1699,6 @@ Db.prototype._executeInsertCommand = function(db_command, options, callback) { var config = self.serverConfig; // Check if we are connected if(!config.canWrite() && config.isAutoReconnect()) { - // console.log("============================ _executeInsertCommand :: 0") processor(function() { self.serverConfig._commandsStore.write( { type:'insert' @@ -1726,10 +1712,8 @@ Db.prototype._executeInsertCommand = function(db_command, options, callback) { ); }) } else if(!config.canWrite() && !config.isAutoReconnect()) { - // console.log("============================ _executeInsertCommand :: 1") return callback(new Error("no open connections"), null); } else { - // console.log("============================ _executeInsertCommand :: 2") // Execute write command __executeInsertCommand(self, db_command, options, callback); }