[CDRIVER-750] Queries sent to recovering members Created: 16/Jul/15  Updated: 05/Aug/15  Resolved: 21/Jul/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 0.90.0
Fix Version/s: 1.1.10

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-201 ReadPreference Closed

 Description   

A recovering node (neither primary nor secondary) is treated as a secondary and can select be selected for queries with a non-PRIMARY read preference.



 Comments   
Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: Merge branch 'master' into 1.2.0-dev

  • master: (38 commits)
    various fixups for memory leaks and races in tests
    Fix memory leak in mongoc_uri_parse_option
    post-release bump
    1.1.10 Release
    CDRIVER-755 leaks in _mongoc_cluster_ismaster
    CDRIVER-745 test cluster node destroy, then disconnect
    CDRIVER-750 don't query recovering RS members
    spell "cyrus" correctly in install guide
    CDRIVER-745 crash in _mongoc_cluster_disconnect_node
    post-release bump
    CDRIVER-731: Do not trace SASL mutex callbacks
    debian changelog fixes for deb pkg
    1.1.9 Release
    redundant include
    CDRIVER-721 test reconnection
    CDRIVER-727 actually enable coverage in libmongoc
    update libbson to 1.1.9-dev
    CDRIVER-721 test rs and mongos, connected and not
    CDRIVER-721 additional tests
    CDRIVER-721 mongoc_client_destroy crash after connection fails
    ...

Conflicts:
CMakeLists.txt
NEWS
README.rst
build/autotools/Versions.m4
build/rpm/mongo-c-driver.spec
debian/changelog
doc/installing.page
doc/mongoc_version.page
src/libbson
src/mongoc/mongoc-cluster-private.h
src/mongoc/mongoc-cluster.c
src/mongoc/mongoc-read-prefs.c
src/mongoc/mongoc-uri.c
src/mongoc/mongoc-write-command.c
tests/mock-server.c
tests/mock-server.h
tests/test-libmongoc.c
tests/test-mongoc-client.c
tests/test-mongoc-cluster.c
tests/test-mongoc-database.c
tests/test-mongoc-read-prefs.c
tests/test-mongoc-uri.c
tests/test-sasl.c
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/e62117d12a600f6cf61eb409933af6f92a3d7c22

Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-750 don't query recovering RS members

Recovering members are not master, not secondary.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/6f18211abfa7027050cda1fac2e2092417cd4990

Comment by A. Jesse Jiryu Davis [ 21/Jul/15 ]

No need for forward-port: 1.2.x implements the Server Selection Spec which prohibits reading from recovering members, and tests that scenario.

Comment by Githook User [ 21/Jul/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-750 don't query recovering RS members

Recovering members are not master, not secondary.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6f18211abfa7027050cda1fac2e2092417cd4990

Comment by A. Jesse Jiryu Davis [ 16/Jul/15 ]

Reproduce with MockupDB:

from time import sleep
 
from mockupdb import MockupDB
 
servers = primary, recovering = [
    MockupDB(port) for port in 8000, 8001]
 
for server in servers:
    server.verbose = True
    server.autoresponds('ping')
    server.run()
 
primary.label = 'PRIMARY'
recovering.label = 'RECOVERING'
 
hosts = [server.address_string for server in servers]
 
def primary_ismaster(request):
    sleep(5)
    request.ok(ismaster=True, setName='rs', hosts=hosts)
 
primary.autoresponds('isMaster', primary_ismaster)
 
recovering.autoresponds(
    'isMaster',
    ismaster=False, secondary=False, setName='rs', hosts=hosts)
 
# Wait for Ctrl-C.
sleep(1000)

If you see a query logged with the "RECOVERING" label, the driver incorrectly selected the recovering member for a query.

Generated at Wed Feb 07 21:10:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.