citusdata / pg_shard

ATTENTION: pg_shard is superseded by Citus, its more powerful replacement
https://github.com/citusdata/citus
GNU Lesser General Public License v3.0
1.06k stars 63 forks source link

Create databases/schemas during shard creation #3

Open jberkus opened 9 years ago

jberkus commented 9 years ago

Currently the user has to manually create databases on each worker to match the master. Since we require that the database names match anyways, and there are no real options here, we should just have master_create_worker_shards create the databases on workers if they don't already exist. Probably we should do this by connecting to the "postgres" database first, which would then require some extra error handling.

jasonmp85 commented 9 years ago

We'll have to scope this one, and I think the more general story at work here is "there are primitives above TABLE that may need to be created". We should probably enumerate them and decide which we will/won't create.

Creating a database may prove a bit problematic as I believe it's something that must be specified at connection-time, so this might involve:

I could be wrong about connections being DB-bound, but that was my impression.

jberkus commented 9 years ago

No, that sounds right. That's what I meant by "additional error-handling"; we'll need to handle situations like if the "postgres" database doesn't exist or we can't reach it.