Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1543

Some write operations raise WriteConcernError instead of WTimeoutError

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7
    • Affects Version/s: 3.4, 3.5, 3.6
    • Component/s: None
    • None

      The following helpers raise WriteConcernError instead of the more specific WTimeoutError:

      1. MongoClient.drop_database
      2. Database.create_collection
      3. Database.drop_collection
      4. Collection.aggregate with $out
      5. Collection.create_index
      6. Collection.create_indexes
      7. Collection.drop_index
      8. Collection.rename

      For example:

      >>> c = MongoClient(w='majority', wtimeoutms=1)
      >>> c.t.create_collection("test")
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/database.py", line 377, in create_collection
          read_concern, session=s, **kwargs)
        File "pymongo/collection.py", line 181, in __init__
          self.__create(kwargs, collation, session)
        File "pymongo/collection.py", line 260, in __create
          collation=collation, session=session)
        File "pymongo/collection.py", line 245, in _command
          retryable_write=retryable_write)
        File "pymongo/pool.py", line 515, in command
          collation=collation)
        File "pymongo/network.py", line 126, in command
          parse_write_concern_error=parse_write_concern_error)
        File "pymongo/helpers.py", line 104, in _check_command_response
          raise WriteConcernError(wce['errmsg'], wce['code'], wce)
      pymongo.errors.WriteConcernError: waiting for replication timed out
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: