def __displayAddMirrors(self, gpEnv, mirrorBuilder, gpArray): logger.info('Greenplum Add Mirrors Parameters') logger.info( '---------------------------------------------------------') logger.info('Greenplum master data directory = %s' % gpEnv.getMasterDataDir()) logger.info('Greenplum master port = %d' % gpEnv.getMasterPort()) logger.info('Parallel batch limit = %d' % self.__options.parallelDegree) total = len(mirrorBuilder.getMirrorsToBuild()) for i, toRecover in enumerate(mirrorBuilder.getMirrorsToBuild()): logger.info( '---------------------------------------------------------') logger.info('Mirror %d of %d' % (i + 1, total)) logger.info( '---------------------------------------------------------') tabLog = TableLogger() programIoUtils.appendSegmentInfoForOutput( "Primary", gpArray, toRecover.getLiveSegment(), tabLog) programIoUtils.appendSegmentInfoForOutput( "Mirror", gpArray, toRecover.getFailoverSegment(), tabLog) tabLog.outputTable() logger.info( '---------------------------------------------------------')
def __displayAddMirrors(self, gpEnv, mirrorBuilder, gpArray): logger.info('Greenplum Add Mirrors Parameters') logger.info('---------------------------------------------------------') logger.info('Greenplum master data directory = %s' % gpEnv.getMasterDataDir()) logger.info('Greenplum master port = %d' % gpEnv.getMasterPort()) logger.info('Parallel batch limit = %d' % self.__options.parallelDegree ) total = len(mirrorBuilder.getMirrorsToBuild()) for i, toRecover in enumerate(mirrorBuilder.getMirrorsToBuild()): logger.info('---------------------------------------------------------') logger.info('Mirror %d of %d' % (i+1, total)) logger.info('---------------------------------------------------------') tabLog = TableLogger() programIoUtils.appendSegmentInfoForOutput("Primary", gpArray, toRecover.getLiveSegment(), tabLog) programIoUtils.appendSegmentInfoForOutput("Mirror", gpArray, toRecover.getFailoverSegment(), tabLog) tabLog.outputTable() logger.info('---------------------------------------------------------')
def displayRecovery(self, mirrorBuilder, gpArray): self.logger.info('Greenplum instance recovery parameters') self.logger.info( '---------------------------------------------------------') if self.__options.recoveryConfigFile: self.logger.info('Recovery from configuration -i option supplied') elif self.__options.newRecoverHosts is not None: self.logger.info('Recovery type = Pool Host') for h in self.__options.newRecoverHosts: self.logger.info('Pool host for recovery = %s' % h) elif self.__options.rebalanceSegments: self.logger.info('Recovery type = Rebalance') else: self.logger.info('Recovery type = Standard') if self.__options.rebalanceSegments: i = 1 total = len(gpArray.get_unbalanced_segdbs()) for toRebalance in gpArray.get_unbalanced_segdbs(): tabLog = TableLogger() self.logger.info( '---------------------------------------------------------' ) self.logger.info('Unbalanced segment %d of %d' % (i, total)) self.logger.info( '---------------------------------------------------------' ) programIoUtils.appendSegmentInfoForOutput( "Unbalanced", gpArray, toRebalance, tabLog) tabLog.info([ "Balanced role", "= Primary" if toRebalance.preferred_role == 'p' else "= Mirror" ]) tabLog.info([ "Current role", "= Primary" if toRebalance.role == 'p' else "= Mirror" ]) tabLog.outputTable() i += 1 else: i = 0 total = len(mirrorBuilder.getMirrorsToBuild()) for toRecover in mirrorBuilder.getMirrorsToBuild(): self.logger.info( '---------------------------------------------------------' ) self.logger.info('Recovery %d of %d' % (i + 1, total)) self.logger.info( '---------------------------------------------------------' ) tabLog = TableLogger() syncMode = "Full" if toRecover.isFullSynchronization( ) else "Incremental" tabLog.info(["Synchronization mode", "= " + syncMode]) programIoUtils.appendSegmentInfoForOutput( "Failed", gpArray, toRecover.getFailedSegment(), tabLog) programIoUtils.appendSegmentInfoForOutput( "Recovery Source", gpArray, toRecover.getLiveSegment(), tabLog) if toRecover.getFailoverSegment() is not None: programIoUtils.appendSegmentInfoForOutput( "Recovery Target", gpArray, toRecover.getFailoverSegment(), tabLog) else: tabLog.info(["Recovery Target", "= in-place"]) tabLog.outputTable() i = i + 1 self.logger.info( '---------------------------------------------------------')
def displayRecovery(self, mirrorBuilder, gpArray): self.logger.info('Greenplum instance recovery parameters') self.logger.info('---------------------------------------------------------') if self.__options.recoveryConfigFile: self.logger.info('Recovery from configuration -i option supplied') elif self.__options.newRecoverHosts is not None: self.logger.info('Recovery type = Pool Host') for h in self.__options.newRecoverHosts: self.logger.info('Pool host for recovery = %s' % h) elif self.__options.rebalanceSegments: self.logger.info('Recovery type = Rebalance') else: self.logger.info('Recovery type = Standard') if self.__options.rebalanceSegments: i = 1 total = len(gpArray.get_unbalanced_segdbs()) for toRebalance in gpArray.get_unbalanced_segdbs(): tabLog = TableLogger() self.logger.info('---------------------------------------------------------') self.logger.info('Unbalanced segment %d of %d' % (i, total)) self.logger.info('---------------------------------------------------------') programIoUtils.appendSegmentInfoForOutput("Unbalanced", gpArray, toRebalance, tabLog) tabLog.info(["Balanced role", "= Primary" if toRebalance.preferred_role == 'p' else "= Mirror"]) tabLog.info(["Current role", "= Primary" if toRebalance.role == 'p' else "= Mirror"]) tabLog.outputTable() i += 1 else: i = 0 total = len(mirrorBuilder.getMirrorsToBuild()) for toRecover in mirrorBuilder.getMirrorsToBuild(): self.logger.info('---------------------------------------------------------') self.logger.info('Recovery %d of %d' % (i + 1, total)) self.logger.info('---------------------------------------------------------') tabLog = TableLogger() syncMode = "Full" if toRecover.isFullSynchronization() else "Incremental" tabLog.info(["Synchronization mode", "= " + syncMode]) programIoUtils.appendSegmentInfoForOutput("Failed", gpArray, toRecover.getFailedSegment(), tabLog) programIoUtils.appendSegmentInfoForOutput("Recovery Source", gpArray, toRecover.getLiveSegment(), tabLog) if toRecover.getFailoverSegment() is not None: programIoUtils.appendSegmentInfoForOutput("Recovery Target", gpArray, toRecover.getFailoverSegment(), tabLog) else: tabLog.info(["Recovery Target", "= in-place"]) tabLog.outputTable() i = i + 1 self.logger.info('---------------------------------------------------------')