Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Vincent Chen
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store MongoDB

Multiple servers configuration is not handled properly

Created: 21/Sep/12 11:24 PM   Updated: 24/Sep/12 03:17 PM   Resolved: 24/Sep/12 02:47 PM
Component/s: None
Affects Version/s: 3.1.0.release
Fix Version/s: 3.1.2

Datastore: MongoDB
Severity: Production

 Description  « Hide

This class cannot handle multiple servers configuration string for connecting to Mongo replicaset.
The bug is at line 101: int serverEndPos = remains.indexOf('/');

'remains' is the substring after "mongodb:", and it never gets changed to "" as intended, because the code is trying to split every comma-separated token with the same "serverEndPos" again and again.

E.g., connectionURL mongodb:localhost:27017/stores,

The second DB instance name will be interpreted as "", which is truncated with the index of the "/" in entire 'remains' string.

The fix is simply to replace int serverEndPos = remains.indexOf('/'); with int serverEndPos = token.indexOf('/');

Andy Jefferson made changes - 24/Sep/12 02:47 PM
Field Original Value New Value
Priority Blocker [ 1 ] Major [ 3 ]
Andy Jefferson added a comment - 24/Sep/12 02:47 PM
Typo of variable name fixed in SVN trunk.

Andy Jefferson made changes - 24/Sep/12 02:47 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.1.2 [ 11680 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 24/Sep/12 03:17 PM
Status Resolved [ 5 ] Closed [ 6 ]