Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rhughes93/gpbackup

 
 

Repository files navigation

Greenplum Backup

gpbackup and gprestore are Go utilities for performing backups and restores of a Greenplum Database. They are still currently in active development.

Pre-Requisites

gpbackup requires Go version 1.8 or higher. Follow the directions here to get the language set up.

Installing

go get github.com/greenplum-db/gpbackup

This will place the code in $GOPATH/github.com/greenplum-db/gpbackup.

Building binaries

cd into the gpbackup directory and run

make depend
make build

This will put the gpbackup and gprestore binaries in $HOME/go/bin

make build_linux and make build_mac are for cross compiling between macOS and Linux

Running the utilities

The basic command for gpbackup is

gpbackup --dbname <your_db_name>

The basic command for gprestore is

gprestore --timestamp <YYYYMMDDHHMMSS>

Run --help with either command for a complete list of options.

Validation and code quality

To run all tests (unit, integration, and linters), use

make test

To run only unit tests, use

make unit

To run only integration tests (which require a running GPDB instance), use

make integration

We provide the following targets to help developers ensure their code fits Go standard formatting guidelines.

To run a linting tool that checks for basic coding errors, use

make lint

This target runs gometalinter.

Note: The lint target will fail if code is not formatted properly.

To automatically format your code and add/remove imports, use

make format

This target runs goimports and gofmt. We will only accept code that has been formatted using this target or an equaivalent gofmt call.

Cleaning up

To remove the compiled binaries and other generated files, run

make clean

Project structure

This repository has several different packages:

backup

Functions that are directly responsible for performing backup operations.

This package is organized by backup section:

  • global
  • predata
  • data
  • postdata

and object type:

  • relations: sequences, regular tables, and views
  • externals: external protocols and external tables
  • types: shell, base, composite, and enum types
  • functions: functions, aggregates, and casts
  • general: all other objects

There is also a backup_test package under the backup directory for unit tests that pertain to backup code.

restore

Functions that are directly responsible for performing restore operations.

utils

Functions and structs that are used by both the backup and restore packages. This includes operations such as database access, input parsing, and logging.

integration

Integration tests run against a Greenplum Database such as queries against the catalog and SQL generated by gpbackup.

testutils

Functions and structs that are used for testing.

How to Contribute

We accept contributions via Github Pull requests only.

Follow the steps below to contribute to gpbackup:

  1. Fork the project’s repository.
  2. Run go get github/com/greenplum-db/gpbackup and add your fork as a remote.
  3. Create your own feature branch (e.g. git checkout -b gpbackup_branch) and make changes on this branch.
    • Follow the previous sections on this page to setup and build in your environment.
    • Add new tests to cover your code. We use Ginkgo and Gomega for testing.
  4. Run make format and make test in your feature branch and ensure they are successful.
  5. Push your local branch to the fork (e.g. git push <your_fork> gpbackup_branch) and submit a pull request.

Your contribution will be analyzed for product fit and engineering quality prior to merging. Note: All contributions must be sent using GitHub Pull Requests.

Your pull request is much more likely to be accepted if it is small and focused with a clear message that conveys the intent of your change.

Overall we follow GPDB's comprehensive contribution policy. Please refer to it here for details.

About

GPDB Backup Utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.5%
  • Other 1.5%