Spark connector writeConcern not properly supported

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 10.0.5
    • Affects Version/s: None
    • Component/s: Stream
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Customer reported using writeConcern.w: "Majority" causes the following error.
      Caused by: com.mongodb.spark.sql.connector.exceptions.ConfigException: writeConcern.w did not contain a valid int, got: MAJORITY
       
      Reviewing the Spark document for 10.0.4, setting "spark.mongodb.write.writeConcern.w=" you can use {}majority|0|1|2+{} values.
       
      I can see the code is checking for an integer however, the catch should cover the use of Majority. Is this an expected behavior?
       

          if (containsKey(WRITE_CONCERN_W_CONFIG)) {
              try {
                writeConcern = writeConcern.withW(getInt(WRITE_CONCERN_W_CONFIG, -1));
              } catch (NumberFormatException e) {
                // ignore
                writeConcern = writeConcern.withW(get(WRITE_CONCERN_W_CONFIG));
              }
            }
      

              Assignee:
              Ross Lawley
              Reporter:
              Shawn Hawkins
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: