def __startSegments(self): """ Start the segments themselves """ self.logger.info("Starting segments... (mirroringMode %s)" % self.mirroringMode) for datadir, seg in self.overall_status.dirmap.items(): if self.master_checksum_version != None: cmd = PgControlData(name='run pg_controldata', datadir=datadir) cmd.run(validateAfter=True) res = cmd.get_results() if res.rc != 0: msg = "pg_controldata failed.\nstdout:%s\nstderr:%s\n" % ( res.stdout, res.stderr) reasoncode = gp.SEGSTART_ERROR_PG_CONTROLDATA_FAILED self.overall_status.mark_failed(datadir, msg, reasoncode) continue segment_heap_checksum_version = cmd.get_value( 'Data page checksum version') if segment_heap_checksum_version != self.master_checksum_version: msg = "Segment checksum %s does not match master checksum %s.\n" % ( segment_heap_checksum_version, self.master_checksum_version) reasoncode = gp.SEGSTART_ERROR_CHECKSUM_MISMATCH self.overall_status.mark_failed(datadir, msg, reasoncode) continue cmd = gp.SegmentStart("Starting seg at dir %s" % datadir, seg, self.num_cids, self.era, self.mirroringMode, self.master_checksum_version, timeout=self.timeout, specialMode=self.specialMode, wrapper=self.wrapper, wrapper_args=self.wrapper_args) self.pool.addCommand(cmd) self.pool.join() for cmd in self.pool.getCompletedItems(): res = cmd.get_results() if res.rc != 0: # we should also read in last entries in startup.log here datadir = cmd.segment.getSegmentDataDirectory() msg = "PG_CTL failed.\nstdout:%s\nstderr:%s\n" % (res.stdout, res.stderr) reasoncode = gp.SEGSTART_ERROR_PG_CTL_FAILED self.overall_status.mark_failed(datadir, msg, reasoncode) self.pool.empty_completed_items()
def get_master_value(self): """ can raise :return: the heap checksum setting (1 or 0) for the master """ master_gpdb = self.gparray.master cmd = PgControlData(name='run pg_controldata', datadir=master_gpdb.getSegmentDataDirectory()) cmd.run(validateAfter=True) value = cmd.get_value('Data page checksum version') return value
def get_coordinator_value(self): """ can raise :return: the heap checksum setting (1 or 0) for the coordinator """ coordinator_gpdb = self.gparray.coordinator cmd = PgControlData(name='run pg_controldata', datadir=coordinator_gpdb.getSegmentDataDirectory()) cmd.run(validateAfter=True) value = cmd.get_value('Data page checksum version') return value
def get_standby_value(self): """ can raise :return: the heap checksum setting (1 or 0) for the standby master """ standbyMaster_gpdb = self.gparray.standbyMaster cmd = PgControlData(name='run pg_controldata', datadir=standbyMaster_gpdb.getSegmentDataDirectory(), ctxt=REMOTE, remoteHost=standbyMaster_gpdb.getSegmentHostName()) cmd.run(validateAfter=True) value = cmd.get_value('Data page checksum version') return value
def __startSegments(self): """ Start the segments themselves """ self.logger.info("Starting segments... (mirroringMode %s)" % self.mirroringMode) for datadir, seg in self.overall_status.dirmap.items(): if self.master_checksum_version != None: cmd = PgControlData(name='run pg_controldata', datadir=datadir) cmd.run(validateAfter=True) res = cmd.get_results() if res.rc != 0: msg = "pg_controldata failed.\nstdout:%s\nstderr:%s\n" % (res.stdout, res.stderr) reasoncode = gp.SEGSTART_ERROR_PG_CONTROLDATA_FAILED self.overall_status.mark_failed(datadir, msg, reasoncode) continue segment_heap_checksum_version = cmd.get_value('Data page checksum version') if segment_heap_checksum_version != self.master_checksum_version: msg = "Segment checksum %s does not match master checksum %s.\n" % (segment_heap_checksum_version, self.master_checksum_version) reasoncode = gp.SEGSTART_ERROR_CHECKSUM_MISMATCH self.overall_status.mark_failed(datadir, msg, reasoncode) continue cmd = gp.SegmentStart("Starting seg at dir %s" % datadir, seg, self.num_cids, self.era, self.mirroringMode, self.master_checksum_version, timeout=self.timeout, specialMode=self.specialMode, wrapper=self.wrapper, wrapper_args=self.wrapper_args) self.pool.addCommand(cmd) self.pool.join() for cmd in self.pool.getCompletedItems(): res = cmd.get_results() if res.rc != 0: # we should also read in last entries in startup.log here datadir = cmd.segment.getSegmentDataDirectory() msg = "PG_CTL failed.\nstdout:%s\nstderr:%s\n" % (res.stdout, res.stderr) reasoncode = gp.SEGSTART_ERROR_PG_CTL_FAILED self.overall_status.mark_failed(datadir, msg, reasoncode) self.pool.empty_completed_items()
def get_standby_value(self): """ can raise :return: the heap checksum setting (1 or 0) for the standby coordinator """ standbyCoordinator_gpdb = self.gparray.standbyCoordinator cmd = PgControlData( name='run pg_controldata', datadir=standbyCoordinator_gpdb.getSegmentDataDirectory(), ctxt=REMOTE, remoteHost=standbyCoordinator_gpdb.getSegmentHostName()) cmd.run(validateAfter=True) value = cmd.get_value('Data page checksum version') return value