Skip to content

v0.10.0 - SDAM (legacy)

Choose a tag to compare

@paulocoghi paulocoghi released this 27 Jul 09:20
· 40 commits to master since this release

"Legacy" specification for Server Discovery and Monitoring (SDAM) added, now passing a total of 562 test scenarios.

It also brings performance improvements to multi-threaded and multi-client scenarios.

Highlights

  • SDAM Pub/Sub Events: You can now monitor the exact lifecycle of your MongoDB clusters using client.subscribe_sdam { |event| ... }.
  • IPv6 & TLS: Fixed parsing bugs on IPv6 literals (e.g., [::1]) which would fail OpenSSL certificate hostname validation or shatter the underlying TCPSocket.
  • Load Balancer Support: Added native topology states for LoadBalanced clusters.
  • Concurrency: Fixed internal synchronization from class-level (@@) to instance-level (@) locks, allowing multiple Mongo::Client instances to operate correctly.

Changelog

Added

  • sdam: Added the complete SDAM Pub/Sub Event API (TopologyOpeningEvent, TopologyDescriptionChangedEvent, ServerOpeningEvent, ServerClosedEvent, ServerDescriptionChangedEvent, TopologyClosedEvent).
  • sdam: Added support for the LoadBalanced topology type and LoadBalancer server type.
  • testing: Created a dedicated spec/sdam_runner_spec.cr test runner for the SDAM legacy test suite, passing 100%.

Changed

  • performance: Eliminated global class-level locks (@@) in favor of instance-level locks (@) in Mongo::Client.
  • performance: Restructured Mongo::Connection::Pool checkout logic to reduce the scope of locks, preventing thread starvation during network I/O.
  • testing: Reorganized the spec test folders into spec/tests/unified/ and spec/tests/legacy/.

Fixed

  • connection: Fixed IPv6 literal parsing ([::1]) to safely strip brackets for TCPSocket and TLS certificate validation while preserving them for SDAM string-matching.
  • sdam: Fixed a bug where logical_session_timeout_minutes was not properly cleared when a cluster lost its last data-bearing node.
  • sdam: Implemented MongoDB 6.0+ staleness tuple comparison (electionId takes precedence over setVersion on wire versions >= 17).
  • sdam: Fixed an issue where ServerClosedEvent was not emitted when a server was evicted from a primary's host list.
  • sdam: Enforced strict fallback to Unknown server types whenever a server responds with ok: 0.0.
  • uri: Corrected URI path decoding