Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/follow-wal2json/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WORKDIR /usr/src/pgcopydb
COPY ./copydb.sh copydb.sh
COPY ./dml.sql dml.sql
COPY ./ddl.sql ddl.sql
COPY ./extras.sql extras.sql

USER docker
CMD /usr/src/pgcopydb/copydb.sh
3 changes: 2 additions & 1 deletion tests/follow-wal2json/copydb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ psql -o /tmp/d.out -d ${PGCOPYDB_SOURCE_PGURI} -1 -f /usr/src/pagila/pagila-data

# alter the pagila schema to allow capturing DDLs without pkey
psql -d ${PGCOPYDB_SOURCE_PGURI} -f /usr/src/pgcopydb/ddl.sql
psql -d ${PGCOPYDB_SOURCE_PGURI} -f /usr/src/pgcopydb/extras.sql

# pgcopydb copy db uses the environment variables
pgcopydb copy-db --follow --plugin wal2json
pgcopydb copy-db --follow --plugin wal2json --notice

# cleanup
pgcopydb stream sentinel get
Expand Down
1 change: 1 addition & 0 deletions tests/follow-wal2json/extras.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create table foo(f1 int, f2 text);
9 changes: 8 additions & 1 deletion tests/follow-wal2json/inject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ do
sleep 1
done

#
# produce a single transaction with more contents than fits in a single PIPE
# buffer/write
#
sql="insert into foo select x, repeat('a', x) from generate_series(1, 60000) as t(x)"
psql -d ${PGCOPYDB_SOURCE_PGURI} -c "${sql}"

# grab the current LSN, it's going to be our streaming end position
lsn=`psql -At -d ${PGCOPYDB_SOURCE_PGURI} -c 'select pg_current_wal_flush_lsn()'`
pgcopydb stream sentinel set endpos --current
pgcopydb stream sentinel get

#
# Becaure we're using docker-compose --abort-on-container-exit make sure
# Because we're using docker-compose --abort-on-container-exit make sure
# that the other process in the pgcopydb service is done before exiting
# here.
#
Expand Down