# Now the slot is active so last_inactive_time value must be NULL
# Now the slot is active so inactive_since value must be NULL
is($primary4->safe_psql(
is($primary4->safe_psql(
'postgres',
'postgres',
qq[SELECT last_inactive_time IS NULL FROM pg_replication_slots WHERE slot_name = '$sb4_slot';]
qq[SELECT inactive_since IS NULL FROM pg_replication_slots WHERE slot_name = '$sb4_slot';]
),
),
't',
't',
'last inactive time for an active physical slot is NULL');
'last inactive time for an active physical slot is NULL');
# Stop the standby to check its last_inactive_time value is updated
# Stop the standby to check its inactive_since value is updated
$standby4->stop;
$standby4->stop;
# Let's restart the primary so that the last_inactive_time is set upon
# Let's restart the primary so that the inactive_since is set upon loading the
# loading the slot from the disk.
# slot from the disk.
$primary4->restart;
$primary4->restart;
is($primary4->safe_psql(
is($primary4->safe_psql(
'postgres',
'postgres',
qq[SELECT last_inactive_time > '$last_inactive_time'::timestamptz FROM pg_replication_slots WHERE slot_name = '$sb4_slot' AND last_inactive_time IS NOT NULL;]
qq[SELECT inactive_since > '$inactive_since'::timestamptz FROM pg_replication_slots WHERE slot_name = '$sb4_slot' AND inactive_since IS NOT NULL;]
),
),
't',
't',
'last inactive time for an inactive physical slot is updated correctly');
'last inactive time for an inactive physical slot is updated correctly');
$standby4->stop;
$standby4->stop;
# Testcase end: Check last_inactive_time property of the streaming standby's slot
# Testcase end: Check inactive_since property of the streaming standby's slot
# Now the slot is active so last_inactive_time value must be NULL
# Now the slot is active so inactive_since value must be NULL
is($publisher4->safe_psql(
is($publisher4->safe_psql(
'postgres',
'postgres',
qq[SELECT last_inactive_time IS NULL FROM pg_replication_slots WHERE slot_name = '$lsub4_slot';]
qq[SELECT inactive_since IS NULL FROM pg_replication_slots WHERE slot_name = '$lsub4_slot';]
),
),
't',
't',
'last inactive time for an active logical slot is NULL');
'last inactive time for an active logical slot is NULL');
# Stop the subscriber to check its last_inactive_time value is updated
# Stop the subscriber to check its inactive_since value is updated
$subscriber4->stop;
$subscriber4->stop;
# Let's restart the publisher so that the last_inactive_time is set upon
# Let's restart the publisher so that the inactive_since is set upon
# loading the slot from the disk.
# loading the slot from the disk.
$publisher4->restart;
$publisher4->restart;
is($publisher4->safe_psql(
is($publisher4->safe_psql(
'postgres',
'postgres',
qq[SELECT last_inactive_time > '$last_inactive_time'::timestamptz FROM pg_replication_slots WHERE slot_name = '$lsub4_slot' AND last_inactive_time IS NOT NULL;]
qq[SELECT inactive_since > '$inactive_since'::timestamptz FROM pg_replication_slots WHERE slot_name = '$lsub4_slot' AND inactive_since IS NOT NULL;]
),
),
't',
't',
'last inactive time for an inactive logical slot is updated correctly');
'last inactive time for an inactive logical slot is updated correctly');
# Testcase end: Check last_inactive_time property of the logical subscriber's slot
# Testcase end: Check inactive_since property of the logical subscriber's slot