Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

v15.4.0

Latest
Compare
Choose a tag to compare
@imlucas imlucas released this 12 Nov 21:02
· 136 commits to master since this release

Description

This PR updates the node.js driver from 3.3.2 to the latest release 3.3.4. It contains many improvements and bug fixes. The full changelog is below.

Changelog Highlights

High Priority SDAM Fixes

NODE-2274 "Unified topology never regains nodes which temporarily go down"

Fixes the underlying cause of timeout-related errors such as "Server selection timed out" with more details in COMPASS-3849 COMPASS-3728. The pull request mongodb/node-mongodb-native#2197 contains much more context on the fix, and a new design document includes how and why the node.js driver team chose this architecture and future improvements it will enable.

Fix unsafe Buffer usage

connect: Switch new Buffer(size) -> Buffer.alloc(size) (da90c3a)

Removes the last unsafe buffer usage warning from the devtools console/terminal output when using or developing Compass. Rejoice!

Update from an Aggregation Pipeline

Update: add the ability to specify a pipeline to an update command (#2017) (44a4110)

While it has yet to come up, it is worth noting for the future that Compass can now technically add support for updates in aggregation pipeline stages which are new in MongoDB 4.2.

sdam_viz

sdam_viz: add new tool for visualizing driver sdam changes (738189a)

An internal tool for debugging SDAM (Server Discovery and Monitoring) that could be used as a base for a more productive connection debugging feature in Compass or merely adding to data-service debug logs.

mongodb-core "deprecation"

The mongodb-core dependency has been removed from mongodb-data-service because it has been moved back into the driver codebase as of ~mongodb@3.3.0. mongodb-core will be officially deprecated in the future by the driver team.

node.js driver changelog

Diff v3.3.2...v3.3.4

3.3.4 (2019-11-11)

Bug Fixes

  • close: the unified topology emits a close event on close now (ee0db01)
  • connect: prevent multiple callbacks in error scenarios (5f6a787)
  • monitoring: incorrect states used to determine rescheduling (ec1e04c)
  • pool: don't reset a pool if we'not already connected (32316e4)
  • pool: only transition to DISCONNECTED if reconnect enabled (43d461e)
  • replset: don't leak servers failing to connect (f209160)
  • replset: use correct topologyId for event emission (19549ff)
  • sdam: minHeartbeatIntervalMS => minHeartbeatFrequencyMS (af9fb45)
  • sdam: don't emit close every time a child server closes (818055a)
  • sdam: don't lose servers when they fail monitoring (8a534bb)
  • sdam: don't remove unknown servers in topology updates (1147ebf)
  • sdam: ignore server errors when closing/closed (49d7235)
  • server: don't emit error in connect if closing/closed (62ada2a)
  • server: ensure state is transitioned to closed on connect fail (a471707)
  • topology: report unified topology as nodejs (d126665)
  • topology: set max listeners to infinity for db event relay (edb1335)

Features

  • sdam_viz: add new tool for visualizing driver sdam changes (738189a)
  • sdam_viz: support legacy topologies in sdam_viz tool (1a5537e)
  • update-hints: add support for hint to all update methods (720f5e5)

3.3.3 (2019-10-16)

Bug Fixes

  • change_stream: emit 'close' event if reconnecting failed (f24c084)
  • ChangeStream: remove startAtOperationTime once we have resumeToken (362afd8)
  • connect: Switch new Buffer(size) -> Buffer.alloc(size) (da90c3a)
  • MongoClient: only check own properties for valid options (9cde4b9)
  • mongos: disconnect proxies which are not mongos instances (ee53983)
  • mongos: force close servers during reconnect flow (186263f)
  • monitoring: correct spelling mistake for heartbeat event (21aa117)
  • replset: correct server leak on initial connect (da39d1e)
  • replset: destroy primary before removing from replsetstate (45ac09a)
  • replset: destroy servers that are removed during SDAM flow (9ea0190)
  • saslprep: add in missing saslprep dependency (41f1165)
  • topology: don't early abort server selection on network errors (2b6a359)
  • topology: don't emit server closed event on network error (194dcf0)
  • topology: include all BSON types in ctor for bson-ext support (aa4c832)
  • topology: respect the force parameter for topology close (d6e8936)

Features

  • Update: add the ability to specify a pipeline to an update command (#2017) (44a4110)
  • urlParser: default useNewUrlParser to true (52d76e3)

Checklist

  • Tests have been updated

Two tests were failing with this update because of assumptions made on much older releases of the driver. These tests were for smoke testing functional side effects only, for example, calling count() after disconnect() always throws an immediate error. I've removed them. correct2aac96d208122cd2a92132d2dff2740eaca5cd87

  1. Test connectivity with mongodb-connection-model#test() not via a connect() call because a test should use different timeout values than a connection that will be used more than once. In the case of this test, the selection timeout in the driver is 30000ms, which caused this test to fail with exceeded test timeout of 2000.

  2. The driver supports retryable reads and writes, which invalidates the state the disconnect() test relied upon, resulting in a Topology Destroyed error for subsequent calls to the client once closed. Like #1 above, after 30000ms, the count() would eventually error, but again, there are already other test cases covering these code paths.

Motivation and Context

Dependents

Depended on by mongodb-js/compass#1834