Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3484

MongoDB Java driver SRV record resolving is ignoring the port from the record

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • None
    • None
    • Cluster Management
    • None

    Description

      Hi,

       

      According to the public documentation regarding the "DNS Seedlist Connection Format" and its examples, the java driver is supposed to resolve both the hostname and port behind the SRV record.

       

      However, in the implementation of DnsSrvResolver, it is only getting the host from the SRV record and it constructs the ServerAddress assuming the mongo instance is running on the default port: 27017.

       

      Is this a bug in the code or is this by design? If it is by design, I suggest we update the documentation and clearly states that the java driver assumes the mongo is running on the default port.

       

      Related source code:

      https://github.com/mongodb/mongo-java-driver/blob/29edbd42c9acce4e197e764c481b58808bb45f73/driver-core/src/main/com/mongodb/internal/connection/DefaultDnsSrvRecordMonitor.java#L77-L78

       

      Thanks a lot,

      Atwood

       

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            wangzicong@bytedance.com Atwood Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: