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

Support having multiple head nodes #37

Open jberkus opened 9 years ago

jberkus commented 9 years ago

The missing feature for pg_shard-as-OLTP-big-data tool is the ability to have multiple head nodes so that you can support thousands of connections. This shouldn't be too hard to solve, and may actually be solvable with existing PostgreSQL 9.4 tools.

  1. replicate all of the metadata tables only: these don't get updated that often, so BDR ought to be adequate for it.
  2. streaming replication option. This one is hampered by (a) needing to figure out which node is the master, and (b) pg_shards' use of temporary tables.
  3. FDW option: have metadata be an FDW back to the master node. Likely to add latency and complexity. Also fails to provide us with easy failover from the master node.
ozgune commented 9 years ago

Hey @jberkus,

We have been thinking of ways to properly support multiple master nodes for a while. We're looking at this issue in two dimensions.

The first dimension involves a side-effect of how we currently handle Insert failures. Today, if we fail to write to a shard, we have to update its corresponding metadata. When the node that routes the write request and the one that holds the metadata are the same, that's easy. When they are different, we need to think more. On this one, we'll investigate the approach BDR takes more, and see if we can guarantee propagating changes to metadata.

Of course, if the previous requirement ends up being too burdensome, we can also look into relaxing it.

The second dimension relates more to usability. We have a small amount of metadata that changes infrequently. Do we want to have one node, multiple nodes, or all nodes to have a copy of that metadata? A few rough architectural ideas there are (more to brainstorm on):

Just a few brainstorming ideas over the weekend for now.