PHP Driver
  1. PHP Driver
  2. PHP-638

Read preference get/set methods are not consistent

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major - P3 Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.3
    • Component/s: None
    • Labels:
      None
    • Backward Breaking:
      Sometimes
    • Operating System:
      ALL
    • # Replies:
      12
    • Last comment by Customer:
      false

      Description

      See: https://github.com/doctrine/mongodb/commit/3ef26207cfd3886ef115c454ee2142a63a334dc0

      The driver returns numeric types in getReadPreference() instead of the string constants accepted by setReadPreference(). This is likely a bug.

      The format for tag sets returned by getReadPreference() differs from that accepted by setReadPreference(). This likely isn't a bug.

      Those are two inconsistencies, but I believe only the first is a bug worth fixing.

        Issue Links

          Activity

          Hide
          Derick Rethans
          added a comment - - edited

          I wonder why you think that the second issue (tagsets have a different format) is not an issue?

          Theoretically, I think you should be able to do:

          $rp = $db->getReadPreference();
          $db->setReadPreference( $rp['type'], $rp['tagsets'] );
          
          Show
          Derick Rethans
          added a comment - - edited I wonder why you think that the second issue (tagsets have a different format) is not an issue? Theoretically, I think you should be able to do: $rp = $db->getReadPreference(); $db->setReadPreference( $rp['type'], $rp['tagsets'] );
          Hide
          Jeremy Mikola
          added a comment -

          I'd have to think back a month to when I opened this, but I probably assumed that the tag set difference was not a bug because the formats differed so much. I agree it'd be great for them to be consistent, though, and I missed Hannes' first comment saying as much.

          Show
          Jeremy Mikola
          added a comment - I'd have to think back a month to when I opened this, but I probably assumed that the tag set difference was not a bug because the formats differed so much. I agree it'd be great for them to be consistent, though, and I missed Hannes' first comment saying as much.
          Hide
          auto
          added a comment -

          Author:

          {u'date': u'2013-01-08T19:26:01Z', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'}

          Message: PHP-638 Return constant string types in getReadPreference()

          Replace numeric types with the constant string values and eliminate the irrelevant "type_string" field.

          The change to mongo_read_preference_type_to_name() should also fix compatibility with mongos, as the "preferred" strings were not what the server expected in the cursor $readPreference mode.
          Branch: master
          https://github.com/mongodb/mongo-php-driver/commit/f5be5434b532820fd4508ffdd71d8b406d044a44

          Show
          auto
          added a comment - Author: {u'date': u'2013-01-08T19:26:01Z', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'} Message: PHP-638 Return constant string types in getReadPreference() Replace numeric types with the constant string values and eliminate the irrelevant "type_string" field. The change to mongo_read_preference_type_to_name() should also fix compatibility with mongos, as the "preferred" strings were not what the server expected in the cursor $readPreference mode. Branch: master https://github.com/mongodb/mongo-php-driver/commit/f5be5434b532820fd4508ffdd71d8b406d044a44
          Hide
          auto
          added a comment -

          Author:

          {u'date': u'2013-01-08T20:55:49Z', u'email': u'jmikola@gmail.com', u'name': u'Jeremy Mikola'}

          Message: PHP-638 Test $readPreference modes for mongos cursors
          Branch: master
          https://github.com/mongodb/mongo-php-driver/commit/fa2dff7c817b1d7b42235150b6f9fcfebfdf5eb4

          Show
          auto
          added a comment - Author: {u'date': u'2013-01-08T20:55:49Z', u'email': u'jmikola@gmail.com', u'name': u'Jeremy Mikola'} Message: PHP-638 Test $readPreference modes for mongos cursors Branch: master https://github.com/mongodb/mongo-php-driver/commit/fa2dff7c817b1d7b42235150b6f9fcfebfdf5eb4
          Hide
          auto
          added a comment -

          Author:

          {u'date': u'2013-01-09T20:20:27Z', u'email': u'jmikola@gmail.com', u'name': u'Jeremy Mikola'}

          Message: PHP-638 Make getReadPreference() tags consistent with those set
          Branch: master
          https://github.com/mongodb/mongo-php-driver/commit/10a18017f0895abf001754f206d29d60f6ce7af9

          Show
          auto
          added a comment - Author: {u'date': u'2013-01-09T20:20:27Z', u'email': u'jmikola@gmail.com', u'name': u'Jeremy Mikola'} Message: PHP-638 Make getReadPreference() tags consistent with those set Branch: master https://github.com/mongodb/mongo-php-driver/commit/10a18017f0895abf001754f206d29d60f6ce7af9

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 14 weeks, 6 days ago
                Date of 1st Reply: