driver-sync/src/main/com/mongodb/client/internal/ClientSessionImpl.java
private void applyMajorityWriteConcernToTransactionOptions() {
        if (transactionOptions != null) {
            WriteConcern writeConcern = transactionOptions.getWriteConcern();
            if (writeConcern != null) {
                transactionOptions = TransactionOptions.merge(TransactionOptions.builder()
                        .writeConcern(writeConcern.withW("majority")).build(), transactionOptions);
            } else {
                transactionOptions = TransactionOptions.merge(TransactionOptions.builder()
                        .writeConcern(WriteConcern.MAJORITY).build(), transactionOptions);
            }
        } else {
            transactionOptions = TransactionOptions.builder().writeConcern(WriteConcern.MAJORITY).build();
        }
    }
private void applyMajorityWriteConcernToTransactionOptions() {
        if (transactionOptions != null) {
            WriteConcern writeConcern = transactionOptions.getWriteConcern();
            if (writeConcern != null) {
                transactionOptions = TransactionOptions.merge(TransactionOptions.builder()
                        .writeConcern(writeConcern.withW("majority")).build(), transactionOptions);
            } else {
                transactionOptions = TransactionOptions.merge(TransactionOptions.builder()
                        .writeConcern(WriteConcern.MAJORITY).build(), transactionOptions);
            }
        } else {
            transactionOptions = TransactionOptions.builder().writeConcern(WriteConcern.MAJORITY).build();
        }
    }
Apply majority write concern if the commit is to be retried.