[SERVER-14419] Introduce HostAndPort::parse method Created: 01/Jul/14  Updated: 04/Sep/14  Resolved: 02/Jul/14

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 2.7.3

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Participants:

 Description   

The HostAndPort(String) constructor parses and throws an exception on error. Sometimes, it is helpful to get back a status, instead. Implement StatusWith<HostAndPort> HostAndPort::parse(const StringData&) to provide this behavior.



 Comments   
Comment by Andy Schwerin [ 02/Jul/14 ]

Changes error codes and messages when HostAndPort parses fail; messages should generally be more informative.

Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14419 Implement HostAndPort::parse.
Branch: master
https://github.com/mongodb/mongo/commit/13693a083ef299c2de0759ed34c53b9370c850f6

Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14419 Introduce unittest of HostAndPort; make ":123" unparseable due to lack of host component.
Branch: master
https://github.com/mongodb/mongo/commit/484a5bb3542a73f4a10bc962e2b1b0f05a402659

Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14419 Correctly parse the "masterHost" argument to Cloner::go into a ConnectionString, not a HostAndPort.

The argument represents a ConnectionString, but we parse it into a HostAndPort
when doing isSelf checks. This was an error before that led checks to succeed
incorrectly, but fails with the new HostAndPort parsing code from SERVER-14419.
Branch: master
https://github.com/mongodb/mongo/commit/e8b6969143e1d218a105c64716203fd7b74137d4

Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14419 Correctly parse the "masterHost" argument to Cloner::go into a ConnectionString, not a HostAndPort.

The argument represents a ConnectionString, but we parse it into a HostAndPort
when doing isSelf checks. This was an error before that led checks to succeed
incorrectly, but fails with the new HostAndPort parsing code from SERVER-14419.
Branch: master
https://github.com/mongodb/mongo/commit/e8b6969143e1d218a105c64716203fd7b74137d4

Comment by Githook User [ 02/Jul/14 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-14419 Improve error message when parseNumberFromString encounters a bad digit.
Branch: master
https://github.com/mongodb/mongo/commit/eb379a2c8c2ae9e6ba580020631f9b7efce7026e

Generated at Thu Feb 08 03:34:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.