@@ -260,33 +260,25 @@ namespace {
260260} // namespace
261261
262262
263- Status CatalogManagerLegacy::init (const vector<string>& configHosts ) {
263+ Status CatalogManagerLegacy::init (const ConnectionString& configDBCS ) {
264264 // Initialization should not happen more than once
265265 invariant (!_configServerConnectionString.isValid ());
266266 invariant (_configServers.empty ());
267-
268- if (configHosts.empty ()) {
269- return Status (ErrorCodes::InvalidOptions, " No config server hosts specified" );
270- }
267+ invariant (configDBCS.isValid ());
271268
272269 // Extract the hosts in HOST:PORT format
273- set<HostAndPort> configHostsAndPorts ;
270+ set<HostAndPort> configHostsAndPortsSet ;
274271 set<string> configHostsOnly;
275- for (size_t i = 0 ; i < configHosts.size (); i++) {
276- // Parse the config host string
277- StatusWith<HostAndPort> status = HostAndPort::parse (configHosts[i]);
278- if (!status.isOK ()) {
279- return status.getStatus ();
280- }
281-
272+ std::vector<HostAndPort> configHostAndPorts = configDBCS.getServers ();
273+ for (size_t i = 0 ; i < configHostAndPorts.size (); i++) {
282274 // Append the default port, if not specified
283- HostAndPort configHost = status. getValue () ;
275+ HostAndPort configHost = configHostAndPorts[i] ;
284276 if (!configHost.hasPort ()) {
285277 configHost = HostAndPort (configHost.host (), ServerGlobalParams::ConfigServerPort);
286278 }
287279
288280 // Make sure there are no duplicates
289- if (!configHostsAndPorts .insert (configHost).second ) {
281+ if (!configHostsAndPortsSet .insert (configHost).second ) {
290282 StringBuilder sb;
291283 sb << " Host " << configHost.toString ()
292284 << " exists twice in the config servers listing." ;
@@ -329,15 +321,12 @@ namespace {
329321 }
330322 }
331323
332- string fullString;
333- joinStringDelim (configHosts, &fullString, ' ,' );
334-
335- LOG (1 ) << " config string : " << fullString;
324+ LOG (1 ) << " config string : " << configDBCS.toString ();
336325
337326 // Now that the config hosts are verified, initialize the catalog manager. The code below
338327 // should never fail.
339328
340- _configServerConnectionString = ConnectionString (fullString, ConnectionString::SYNC) ;
329+ _configServerConnectionString = configDBCS ;
341330
342331 if (_configServerConnectionString.type () == ConnectionString::MASTER) {
343332 _configServers.push_back (_configServerConnectionString);
0 commit comments