Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-46986

Add read_timeout setting for the client

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.3
    • Component/s: None
    • Server Programmability

      The documentation says that I should always set maxTimeMS for operations that use "linearizable" read concern:
      https://docs.mongodb.com/manual/reference/read-concern-linearizable/#performance-comparisons

      db.restaurants.find( { _id: 5 } ).readConcern("linearizable").maxTimeMS(10000)
      

      Otherwise my query will block indefinitely in case the majority of the nodes are unavailable, because the Primary node needs to check with majority of nodes that it's still the Primary.
      Originally, maxTimeMS setting purpose is to limit time that query takes to process on the server, and it seems that,  it also covering this case with majority of nodes unavailable too, what is a network issue actually. So as I understand, it works the same way as wtimeout setting for write operations.
      The only difference is that I can specify wtimeout as a part of the write concern globally for my client via the connection URI. Or even on the server in replication configuration.
      And it's not the case for the maxTimeMS, because I need to add it to every query.
      It's very inconvenient when I need my database to be highly consistent and "linearizable" is my default read concern level for the client and I specify it in my connection URI.
      I believe that we should have global read_timeout setting for the client and configure it via the connection URI as we do with wtimeout.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            georgy.savva@gmail.com Georgy Savva
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: