Skip to content

node, store: Add fdw_host and fdw_port to set the address for cross-shard postgres_fdw - #6827

Open
cjorge-thegraph wants to merge 1 commit into
masterfrom
cjorge-thegraph/fdw-host
Open

cjorge-thegraph wants to merge 1 commit into
masterfrom
cjorge-thegraph/fdw-host

Conversation

@cjorge-thegraph

Copy link
Copy Markdown

Each shard's database reaches the other shards through postgres_fdw, and graph-node creates those foreign servers with the host and port from each shard's connection. That assumes the address graph-node uses is one the databases can use too. It isn't when graph-node connects through something only it can reach, such as a connection pooler, or a private endpoint in its own network (for example a Private Service Connect endpoint for Cloud SQL, whose name the database instances themselves can't resolve). The foreign servers then point at an address the databases can't connect to, and cross-shard work fails, e.g. Mirroring primary tables failed … could not connect to server "shard_primary".

This adds two optional settings to [store.<name>]:

  • fdw_host: the host the other shards' databases use to reach this shard through postgres_fdw
  • fdw_port: the port that goes with it

Both default to the host and port in connection, so existing configurations behave exactly as before. User, password and database name still come from connection. fdw_host gets the same environment variable expansion as connection.

docs/config.md documents the settings, and there are tests for parsing the configuration and for the override in ForeignServer.

🤖 Generated with Claude Code

…hard postgres_fdw

Each shard's database reaches the other shards through postgres_fdw, and
graph-node creates those foreign servers with the host and port from each
shard's connection. When graph-node reaches a database at an address the
databases can't use themselves, such as a connection pooler or a private
endpoint in graph-node's own network, the foreign servers point at an
address the databases can't connect to.

fdw_host and fdw_port in [store.<name>] set the address the other shards'
databases use for this shard. Both default to the host and port in
connection, so existing configurations are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant