[CDRIVER-512] GridFS does not read from secondary nodes Created: 23/Jan/15  Updated: 18/Nov/15  Resolved: 09/Oct/15

Status: Closed
Project: C Driver
Component/s: GridFS
Affects Version/s: 1.2-rc0
Fix Version/s: 1.3.0-beta0

Type: Bug Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

(ported from github)

read_prefs = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);
mongoc_client_set_read_prefs(client, read_prefs);
.....
gridfs = mongoc_client_get_gridfs (client, "test", "fs", &error);
....
mongoc_gridfs_find_one_by_filename(gridfs, filename, &error);

gridfs would create "filename" index everytime, and it can not link to secondary at all.

Using the same config, bson object can read from secondary node. The c++, csharp,and python gridfs implementations allow reads from secondary nodes.

read mode add when link chunks&files

(from mongoc-gridfs.c)

bson_snprintf (buf, sizeof(buf), "%s.chunks", prefix);
//gridfs->chunks = _mongoc_collection_new (client, db, buf, NULL, NULL);
 
gridfs->chunks = _mongoc_collection_new (client, db, buf, client->read_prefs, NULL);
 
bson_snprintf (buf, sizeof(buf), "%s.files", prefix);
// gridfs->files = _mongoc_collection_new (client, db, buf, NULL, NULL);
gridfs->files = _mongoc_collection_new (client, db, buf, client->read_prefs, NULL);



 Comments   
Comment by Githook User [ 10/Oct/15 ]

Author:

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

Message: Merge pull request #287 from ksuarz/bugfix/read-prefs

CDRIVER-512: GridFS ignores read preference
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/10534325715af6bc68eea29ec168a67c5a79d2a1

Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: CDRIVER-512 gridfs ignores read preference
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b31fee7041a3c096c39055dc54df588b2ce3ddaf

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

Check what new GridFS spec says, this may work as designed.

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