gpexpand: need to start and stop the primaries with convertMasterDataDirToSegment.
This reverts partial part of commit
as primaries need to be
started once using convertMasterDataDirToSegment.
@@ -745,6 +745,45 @@ class SegmentTemplate:
self.pool.join()
self.pool.check_results()
+ def _start_new_primary_segments(self):
+ newSegments = self.gparray.getExpansionSegDbList()
+ for seg in newSegments:
+ if seg.isSegmentMirror():
+ continue
+ """ Start all the new segments in utilty mode. """
+ segStartCmd = SegmentStart(
+ name="Starting new segment dbid %s on host %s." % (str(seg.getSegmentDbId()), seg.getSegmentHostName())
+ , gpdb=seg
+ , numContentsInCluster=0 # Starting seg on it's own.
+ , era=None
+ , mirrormode=MIRROR_MODE_MIRRORLESS
+ , utilityMode=True
+ , specialMode='convertMasterDataDirToSegment'
+ , ctxt=REMOTE
+ , remoteHost=seg.getSegmentHostName()
+ , pg_ctl_wait=True
+ , timeout=SEGMENT_TIMEOUT_DEFAULT)
+ self.pool.addCommand(segStartCmd)
+ self.pool.join()
+ self.pool.check_results()
+
+ def _stop_new_primary_segments(self):
+ newSegments = self.gparray.getExpansionSegDbList()
+ for seg in newSegments:
+ if seg.isSegmentMirror() == True:
+ continue
+ segStopCmd = SegmentStop(
+ name="Stopping new segment dbid %s on host %s." % (str(seg.getSegmentDbId), seg.getSegmentHostName())
+ , dataDir=seg.getSegmentDataDirectory()
+ , mode='smart'
+ , nowait=False
+ , ctxt=REMOTE
+ , remoteHost=seg.getSegmentHostName()
+ )
+ self.pool.addCommand(segStopCmd)
+ self.pool.join()
+ self.pool.check_results()
+
def _configure_new_segments(self):
"""Configures new segments. This includes modifying the postgresql.conf file
and setting up the gp_id table"""
@@ -763,6 +802,9 @@ class SegmentTemplate:
self.pool.join()
self.pool.check_results()
+ self._start_new_primary_segments()
+ self._stop_new_primary_segments()
+
def _fixup_template(self):
"""Copies postgresql.conf and pg_hba.conf files from a valid segment on the system.
Then modifies the template copy of pg_hba.conf"""
