Giter Club home page Giter Club logo

pgdo's Introduction

⚠️ ALPHA QUALITY ⚠️

This project is in the early stages of development. It is far from feature complete. It likely contains many bugs and inconsistencies. Documentation is limited or non-existent. It will change in ways that break backwards compatibility. It is not ready for production use.

That said, if you want to try it out, please do! But bear in mind that it is being updated frequently, at least at the time I'm writing this, and you should expect to update it frequently too. Please check out known issues and file new ones here.

Thanks! Gavin.


The pgdo project

The convenience of SQLite – but with PostgreSQL.

See pgdo-cli for the command-line application, or pgdo-lib for the Rust library.

License

This project is licensed under the Apache 2.0 License.

pgdo's People

Contributors

allenap avatar ekleog avatar dependabot-preview[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

pgdo's Issues

`pgdo something …` should expand to `pgdo exec something …`

Already a bare pgdo command will expand to pgdo shell. In practice I find myself wanting to type pgdo a_thing to run a_thing in configured PostgreSQL environment – I keep forgetting to type exec. It would be cool if pgdo could retain its present behaviour, but when extra arguments are provided they should elicit an exec-like behaviour. Then it might be worth removing pgdo shell in favour of pgdo psql, perhaps pgdo exec too.

Allow setting configuration parameters to the postgres cluster

Hey! I'm looking into postgresfixture for running tests, and after submitting allenap/rust-postgresfixture#124 I noticed that it does not actually seem to support setting postgresql.conf parameters from the API.

Is it true, or did I miss the place to do it?

I'd need it in order to implement the optimizations listed here (eg. fsync=off), for test running.

(Maybe postgresqlfixture could even come with an unsafe set of settings optimized for speed so that not everyone has to read through the same documentation in order to get fast tests)

What do you think?

Create new database with random name

It could be an option, or even the default, to create a database with random name (e.g. petname), so that concurrent processes by default do not tread on one another's toes.

$ postgresfixture shell
enough-lamprey# …

$ postgresfixture shell
divine-minnow# …

Some care might be needed to avoid accidental collisions. CREATE DATABASE will error if one tries to create a database that already exists, so either it will need to recover from that, or need to look before it leaps.

Default date style to "dmy" (or something less ambiguous)

The default "mdy" (month, day, year) configuration is appropriate for the US, but that's about it. It's confusing for everyone else. It would be nice to find a default that is not ambiguous/confusing for everyone. Failing that, "dmy" might be a more appropriate default than "mdy". This may equally be a non-issue if clients like psql do something locale-specific already.

Add `coordinate::run_and_leave_running`

There are run_and_stop and run_and_destroy at present, but sometimes you want to leave the cluster running even if you're the last user. This can be relevant with two or more concurrent processes each using the cluster for brief periods to avoid stop-start churn as they interleave.

Connecting to restored cluster can be fraught

Especially after restoring from a backup, it's important to know a database role to use, otherwise it's not actually possible to connect to the database. For example, a cluster created as system user gavin will have a superuser role, by default, also named gavin. If this cluster is restored in another account, say bobby, then pgdo will not be able to connect to the restored cluster.

A superuser role can be determined in single-user mode like so:

$ postgres --single -D cluster postgres \
>   <<< 'select rolname from pg_roles where rolsuper and rolcanlogin' \
>     2> /dev/null | sed 's/^.*\brolname\s*=\s*"\(.*\)".*/\1/p;d'
gavin

(Update: function that does this added as cluster::determine_superuser_role_names.)

so pgdo could use this to guess, but perhaps something more/different can be done to make it Just Work.

Note, this might all be moot if pg_hba.conf doesn't allow local connections, for example.

Backups cannot be pruned

Want to be able to prune, say, backups older than 30 days, or limit to a certain amount of disk space, or some combination.

Runtime strategies could include uninstalled runtimes

For example, on macOS with Homebrew we can find out what PostgreSQL runtimes we could have with:

  1. Obtain list of PostgreSQL formulae: brew formulae | egrep ^postgresql@.
  2. Get JSON information (e.g. version) for these with brew info --json ....

We can select an appropriate runtime the same as now, but then install it if necessary.

Similar story for Debian/Ubuntu and other platforms.

Restored cluster still tries to backup to previous backup location

If the backup location no longer exists or was moved, this will fail. It's also probably not a good idea to automatically backup a restored cluster to the same backup location, especially because a fully restored cluster (i.e. restored from all WAL, not to a particular point in time) doesn't appear to get a new timeline.

The cleanest option: set archive_mode to "off" and clear archive_command.

Allow runtime selection at the command-line

At present the runtime can only be selected at the command-line by manipulating PATH in advance. It would be a better experience if postgresfixture could discover runtimes and allow selection by version, say, by path matching, or providing a path. Perhaps postgresfixture also has some local smarts, e.g. it knows that Homebrew puts runtimes in /usr/local/Cellar/postgresql@${version} on macOS.

By version:

$ postgresfixture shell --runtime 12

Match by path:

$ postgresfixture shell --runtime postgresql@11

Provide a path to the runtime. To be honest, this isn't much more convenient than PATH=/path/to/runtime:$PATH postgresfixture shell but it is more discoverable:

$ postgresfixture shell --runtime /usr/local/Cellar/postgresql@11/11.15_1

NOTE that selecting the runtime is only useful before the cluster has been created. When moving between major versions (in one direction: up) one must upgrade the cluster explicitly, e.g. with pg_upgrade.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.