Skip to content

Commit 3de421d

Browse files
authored
Couple of fixes to the demo app. (#860)
First, make it so that when no failover is scheduled to happen during the demo, we still show the summary at the end of it. Second, install constraints and indexes to the demo app schema.
1 parent 0b33c80 commit 3de421d

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/bin/pg_autoctl/demoapp.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,15 @@ demoapp_prepare_schema(const char *pguri)
150150
const char *ddls[] = {
151151
"drop schema if exists demo cascade",
152152
"create schema demo",
153+
154+
"create table demo.client(client integer primary key, pid integer, "
155+
"retry_sleep_ms integer, retry_cap_ms integer, failover_count integer, "
156+
"unique(pid))",
157+
153158
"create table demo.tracking(ts timestamptz default now(), "
154-
"client integer, loop integer, retries integer, us bigint, recovery bool)",
155-
"create table demo.client(client integer, pid integer, "
156-
"retry_sleep_ms integer, retry_cap_ms integer, failover_count integer)",
159+
"client integer, loop integer, retries integer, us bigint, recovery bool,"
160+
"primary key(client, ts),"
161+
"foreign key (client) references demo.client(client))",
157162
NULL
158163
};
159164

@@ -383,9 +388,12 @@ demoapp_process_perform_switchover(DemoAppOptions *demoAppOptions)
383388

384389
if (demoAppOptions->duration <= (demoAppOptions->firstFailover + 10))
385390
{
391+
log_warn("Using --duration %ds and --first-failover %ds",
392+
demoAppOptions->duration,
393+
demoAppOptions->firstFailover);
386394
log_error("Use a --duration of at least %ds for a failover to happen",
387395
demoAppOptions->firstFailover + 10);
388-
exit(EXIT_CODE_INTERNAL_ERROR);
396+
exit(EXIT_CODE_QUIT);
389397
}
390398

391399
log_info("Failover client is started, will failover in %ds "

0 commit comments

Comments
 (0)