Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-168

WriteConcern constructor sets getlasterror incorrectly for w<1

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 2.1
    • None
    • None

    Description

      Creating a WriteConcern with a w value of 0 or -1 incorrectly sets getlasterror to 1 instead of 0.

      The callGetLastError method correctly returns true only if w > 0.

      It appears that this line in the constructor WriteConcern( int w , int wtimeout , boolean fsync):
      _command = new BasicDBObject( "getlasterror" , 1 );
      should be change to:
      _command = new BasicDBObject( "getlasterror" , _w > 0 ? 1 : 0 );

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            dan.flye@hp.com Dan Flye
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: