Skip to content

Commit

Permalink
fix: Remove usage for pg-primary-dsn (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
TianyuZhang1214 authored Nov 26, 2024
1 parent 95af164 commit 148b867
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 2 additions & 4 deletions devtools/htap-setup-pg/pgpool2/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ services:
container_name: htap-pg-setup
command: >
sh -c "
PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"CREATE PUBLICATION myduck_subscription FOR ALL TABLES;\" &&
PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"SELECT PG_CREATE_LOGICAL_REPLICATION_SLOT('myduck_subscription', 'pgoutput');\" &&
PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR(255));\" &&
PGPASSWORD=postgres psql -h pgsql -p 5432 -U postgres -d postgres -c \"INSERT INTO test (id, name) VALUES (1, 'test');\"
"
Expand All @@ -37,8 +35,8 @@ services:
pull_policy: always
container_name: htap-myduck
environment:
PGSQL_PRIMARY_DSN: postgres://postgres:postgres@pgsql:5432/postgres?sslmode=disable
PGSQL_SLOT_NAME: myduck_subscription
SETUP_MODE: REPLICA
SOURCE_DSN: postgres://postgres:postgres@pgsql:5432/postgres
depends_on:
pgsql:
condition: service_healthy
Expand Down
9 changes: 1 addition & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ var (

replicaOptions replica.ReplicaOptions

postgresPort = 5432
postgresPrimaryDsn string
postgresSlotName = "myduck"
postgresPort = 5432
)

func init() {
Expand All @@ -77,8 +75,6 @@ func init() {
// The following options are used to configure the Postgres server.

flag.IntVar(&postgresPort, "pg-port", postgresPort, "The port to bind to for PostgreSQL wire protocol.")
flag.StringVar(&postgresPrimaryDsn, "pg-primary-dsn", postgresPrimaryDsn, "The DSN of the primary server for logical replication.")
flag.StringVar(&postgresSlotName, "pg-slot-name", postgresSlotName, "The name of the logical replication slot to use.")
}

func ensureSQLTranslate() {
Expand Down Expand Up @@ -152,9 +148,6 @@ func main() {
if err != nil {
logrus.WithError(err).Fatalln("Failed to create Postgres-protocol server")
}
if postgresPrimaryDsn != "" && postgresSlotName != "" {
go pgServer.StartReplication(postgresPrimaryDsn, postgresSlotName)
}
go pgServer.Start()
}

Expand Down

0 comments on commit 148b867

Please sign in to comment.