Uploaded image for project: 'Spark Connector'
  1. Spark Connector
  2. SPARK-370

Spark connector writeConcern not properly supported

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 10.0.5
    • Affects Version/s: None
    • Component/s: Stream
    • 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@mongodb.com Ross Lawley
            Reporter:
            shawn.hawkins@mongodb.com Shawn Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: