Implement PGXC with FDW

From PostgreSQL wiki
Jump to navigationJump to search

We can implement postgres-XC feature using FDW framework.

Outline:

  • Create class catalog for fdw (namely, pgxc_fdw).
  • Implement new fdw driver called pgxc_fdw.
  • pgxc_fdw takes care of both sharded tables and replicated tables.
  • Use FDW "server" to define the group of database servers.
  • Each shard is assigned to each database in one of a database in "server".
  • Replicated table will be defined in all the databases in "server".
    • Should define "primary databsae" somewhere in this catalog (table-specific or server-specific).
  • "Server" catalog contains server host, port and connection striong.
  • Implement full set of fdw functions so that planner call it for pushdown.
  • Actual connection and data fetch can be done just inside fdw drivers.
  • In similar wary, we can mplement aggregate pushdown.
  • With parallel worker mechanism, we can implement MPP with no sweat.
  • In the case of DML against replicated tables, issue DML to the primary node, and then issue to remiaining nodes using parallel worker mechanism.
  • Implement connection pooler for performance. Pooler belongs to "server", sharing credentials and session parameters.
  • Implement consistent write using 2PC.
  • Distributed deadlock detection should be implemented as separate feature (need PG kernel modification).
  • Distributed TX management should be implemented as a separete feature, which also needs PG kernel modification.