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

Let CitusDB invalidate pg_shard's shard interval cache #133

Open jasonmp85 opened 9 years ago

jasonmp85 commented 9 years ago

pg_shard keeps a cache of shard interval metadata within each session which is never refreshed. Within pg_shard this is fine, since all shards are created up front: caching forever isn't wrong. But now that Citus integration is more full-fledged, we're noticing that things like appending new shards or rebalancing existing ones results in pg_shard operating using stale metadata.

We need to come up with some sort of contract to let other pieces of software tell pg_shard about changes in the shard intervals of a distributed table. We may be able to reuse some existing pieces of invalidation logic within PostgreSQL, but that requires some reading to determine.