Exemplo n.º 1
0
    def wal_s3_restore(self, wal_name, wal_destination):
        """
        Downloads a WAL file from S3

        This code is intended to typically be called from Postgres's
        restore_command feature.

        NB: Postgres doesn't guarantee that wal_name ==
        basename(wal_path), so both are required.

        """

        s3_url = '{0}/wal_{1}/{2}.lzo'.format(
            self.s3_prefix, FILE_STRUCTURE_VERSION, wal_name)

        logger.info(
            msg='begin wal restore',
            structured={'action': 'wal-fetch',
                        'key': s3_url,
                        'seg': wal_name,
                        'prefix': self.s3_prefix,
                        'state': 'begin'})

        ret = s3_worker.do_lzop_s3_get(
            s3_url, wal_destination, self.gpg_key_id is not None)

        logger.info(
            msg='complete wal restore',
            structured={'action': 'wal-fetch',
                        'key': s3_url,
                        'seg': wal_name,
                        'prefix': self.s3_prefix,
                        'state': 'complete'})

        return ret
Exemplo n.º 2
0
    def wal_s3_restore(self, wal_name, wal_destination):
        """
        Downloads a WAL file from S3

        This code is intended to typically be called from Postgres's
        restore_command feature.

        NB: Postgres doesn't guarantee that wal_name ==
        basename(wal_path), so both are required.

        """
        s3_worker.do_lzop_s3_get(
            '{0}/wal_{1}/{2}.lzo'.format(self.s3_prefix,
                                         FILE_STRUCTURE_VERSION,
                                         wal_name),
            wal_destination)
Exemplo n.º 3
0
    def wal_s3_restore(self, wal_name, wal_destination):
        """
        Downloads a WAL file from S3

        This code is intended to typically be called from Postgres's
        restore_command feature.

        NB: Postgres doesn't guarantee that wal_name ==
        basename(wal_path), so both are required.

        """
        return s3_worker.do_lzop_s3_get(
            '{0}/wal_{1}/{2}.lzo'.format(self.s3_prefix,
                                         FILE_STRUCTURE_VERSION,
                                         wal_name),
            wal_destination, (self.gpg_key_id is not None))
Exemplo n.º 4
0
    def wal_s3_restore(self, wal_name, wal_destination):
        """
        Downloads a WAL file from S3

        This code is intended to typically be called from Postgres's
        restore_command feature.

        NB: Postgres doesn't guarantee that wal_name ==
        basename(wal_path), so both are required.

        """

        s3_url = "{0}/wal_{1}/{2}.lzo".format(self.s3_prefix, FILE_STRUCTURE_VERSION, wal_name)

        logger.info(
            msg="begin wal restore",
            structured={
                "action": "wal-fetch",
                "key": s3_url,
                "seg": wal_name,
                "prefix": self.s3_prefix,
                "state": "begin",
            },
        )

        ret = s3_worker.do_lzop_s3_get(s3_url, wal_destination, self.gpg_key_id is not None)

        logger.info(
            msg="complete wal restore",
            structured={
                "action": "wal-fetch",
                "key": s3_url,
                "seg": wal_name,
                "prefix": self.s3_prefix,
                "state": "complete",
            },
        )

        return ret
Exemplo n.º 5
0
    def wal_s3_restore(self, wal_name, wal_destination):
        """
        Downloads a WAL file from S3

        This code is intended to typically be called from Postgres's
        restore_command feature.

        NB: Postgres doesn't guarantee that wal_name ==
        basename(wal_path), so both are required.

        """

        s3_url = '{0}/wal_{1}/{2}.lzo'.format(self.s3_prefix,
                                              FILE_STRUCTURE_VERSION, wal_name)

        logger.info(msg='begin wal restore',
                    structured={
                        'action': 'wal-fetch',
                        'key': s3_url,
                        'seg': wal_name,
                        'prefix': self.s3_prefix,
                        'state': 'begin'
                    })

        ret = s3_worker.do_lzop_s3_get(self.aws_access_key_id,
                                       self.aws_secret_access_key, s3_url,
                                       wal_destination, self.gpg_key_id
                                       is not None)

        logger.info(msg='complete wal restore',
                    structured={
                        'action': 'wal-fetch',
                        'key': s3_url,
                        'seg': wal_name,
                        'prefix': self.s3_prefix,
                        'state': 'complete'
                    })

        return ret