Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 def _get_pgcontrol_data_from_segments(self, gpdb_list):
     pool = WorkerPool(numWorkers=self.workers)
     try:
         for gpdb in gpdb_list:  # iterate for all segments
             cmd = PgControlData(name='run pg_controldata', datadir=gpdb.getSegmentDataDirectory(),
                                 ctxt=REMOTE, remoteHost=gpdb.getSegmentHostName())
             cmd.gparray_gpdb = gpdb
             pool.addCommand(cmd)
         pool.join()
     finally:
         # Make sure that we halt the workers or else we'll hang
         pool.haltWork()
         pool.joinWorkers()
     return pool.getCompletedItems()
Пример #6
0
 def _get_pgcontrol_data_from_segments(self, gpdb_list):
     pool = WorkerPool(numWorkers=self.workers)
     try:
         for gpdb in gpdb_list:  # iterate for all segments
             cmd = PgControlData(name='run pg_controldata',
                                 datadir=gpdb.getSegmentDataDirectory(),
                                 ctxt=REMOTE,
                                 remoteHost=gpdb.getSegmentHostName())
             cmd.gparray_gpdb = gpdb
             pool.addCommand(cmd)
         pool.join()
     finally:
         # Make sure that we halt the workers or else we'll hang
         pool.haltWork()
         pool.joinWorkers()
     return pool.getCompletedItems()
Пример #7
0
    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()
Пример #8
0
    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()