Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 65db0cf

Browse files
committed
Revert "Add recovery TAP test for race condition with slot invalidations"
This reverts commit 08a52ab, due to some sporadic instability in the test. Getting the test right should require some redesign with a second injection point, but let's revert it for now to avoid these issues in the CI as a lot of patches are under discussion in this last commit fest. Per buildfarm members hachi and gokiburi. Discussion: https://postgr.es/m/ZekQQHCrIqLVpGz5@paquier.xyz
1 parent 099ca50 commit 65db0cf

File tree

2 files changed

+2
-123
lines changed

2 files changed

+2
-123
lines changed

src/backend/replication/slot.c

-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#include "storage/proc.h"
5454
#include "storage/procarray.h"
5555
#include "utils/builtins.h"
56-
#include "utils/injection_point.h"
5756

5857
/*
5958
* Replication slot on-disk data structure.
@@ -1659,14 +1658,6 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
16591658
last_signaled_pid = active_pid;
16601659
terminated = true;
16611660
conflict_prev = conflict;
1662-
1663-
/*
1664-
* This injection point needs to be after kill() to ensure
1665-
* that the slot is not "active" anymore. It also has to be
1666-
* after ReportSlotInvalidation() to ensure that the
1667-
* invalidation message is logged.
1668-
*/
1669-
INJECTION_POINT("terminate-process-holding-slot");
16701661
}
16711662

16721663
/* Wait until the slot is released. */

src/test/recovery/t/035_standby_logical_decoding.pl

+2-114
Original file line numberDiff line numberDiff line change
@@ -733,126 +733,14 @@ sub wait_until_vacuum_can_remove
733733

734734
##################################################
735735
# Recovery conflict: Invalidate conflicting slots, including in-use slots
736-
# Scenario 6: Race condition between slot invalidation and active process
737-
# termination.
738-
##################################################
739-
SKIP:
740-
{
741-
skip "Injection points not supported by this build", 1
742-
if ($ENV{enable_injection_points} ne 'yes');
743-
744-
# Get the position to search from in the standby logfile
745-
$logstart = -s $node_standby->logfile;
746-
747-
# Drop the slots, re-create them, change hot_standby_feedback,
748-
# check xmin and catalog_xmin values, make slot active and reset stat.
749-
reactive_slots_change_hfs_and_wait_for_xmins('pruning_', 'injection_', 0,
750-
1);
751-
752-
# Create the injection_points extension.
753-
$node_primary->safe_psql('testdb', 'CREATE EXTENSION injection_points;');
754-
755-
# Wait until the extension has been created on the standby.
756-
$node_primary->wait_for_replay_catchup($node_standby);
757-
758-
# Attach the injection point.
759-
$node_standby->safe_psql('testdb',
760-
"SELECT injection_points_attach('terminate-process-holding-slot', 'wait');"
761-
);
762-
763-
# Trigger a conflict and insert an XLOG_RUNNING_XACTS before triggering
764-
# the vacuum.
765-
$node_primary->safe_psql(
766-
'testdb', qq[CREATE TABLE injection_test(x integer);
767-
DROP TABLE injection_test;
768-
SELECT pg_log_standby_snapshot();]);
769-
770-
# Now launch the vacuum.
771-
wait_until_vacuum_can_remove('',
772-
'CREATE TABLE injection_test2(x integer);', 'pg_class');
773-
774-
# Wait until the startup process hits the injection point by looking at
775-
# pg_stat_activity; the termination LOG message has been emitted and
776-
# the process has been killed once we wait at the injection point.
777-
$node_standby->wait_for_event('startup',
778-
'terminate-process-holding-slot');
779-
780-
# Note: $node_primary->wait_for_replay_catchup($node_standby) would be
781-
# hanging here due to the injection point, so check the log instead.
782-
783-
ok( $node_standby->log_contains(
784-
"terminating process .* to release replication slot \"injection_activeslot\"",
785-
$logstart),
786-
"terminating process holding the active slot is logged with injection point"
787-
);
788-
789-
# Extract xid_horizon from the logfile.
790-
my $log_contents = slurp_file($node_standby->logfile, $logstart);
791-
(my $xid_horizon) =
792-
$log_contents =~ m/The slot conflicted with xid horizon ([0-9]*)./
793-
or die "could not get xid horizon";
794-
795-
# Ensure the slot is not active.
796-
$node_standby->poll_query_until('testdb',
797-
"SELECT active_pid is NULL from pg_catalog.pg_replication_slots where slot_name = 'injection_activeslot'"
798-
) or die "injection_activeslot is still active";
799-
800-
# Decode changes from the slot to reach
801-
# LogicalConfirmReceivedLocation().
802-
$node_standby->safe_psql('testdb',
803-
qq[SELECT pg_logical_slot_get_changes('injection_activeslot', NULL, NULL);]
804-
);
805-
806-
# Wait until catalog_xmin advances after the xid_horizon. A conflict
807-
# reason has to be reported.
808-
$node_standby->poll_query_until('testdb',
809-
"SELECT (SELECT catalog_xmin::text::int - $xid_horizon from pg_catalog.pg_replication_slots where slot_name = 'injection_activeslot') > 0"
810-
) or die "catalog_xmin did not advance";
811-
812-
# Get the position to search from in the standby logfile.
813-
$logstart = -s $node_standby->logfile;
814-
815-
# Wakeup the injection point.
816-
$node_standby->safe_psql('testdb',
817-
"SELECT injection_points_wakeup('terminate-process-holding-slot');");
818-
819-
# Wait for the standby to catchup.
820-
$node_primary->wait_for_replay_catchup($node_standby);
821-
822-
# Check invalidation in the logfile for the active slot.
823-
ok( $node_standby->log_contains(
824-
"invalidating obsolete replication slot \"injection_activeslot\"",
825-
$logstart),
826-
"activeslot slot invalidation is logged with injection point");
827-
828-
# Verify conflict_reason is 'rows_removed' in pg_replication_slots.
829-
check_slots_conflict_reason('injection_', 'rows_removed');
830-
831-
# Detach from the injection point
832-
$node_standby->safe_psql('testdb',
833-
"SELECT injection_points_detach('terminate-process-holding-slot');");
834-
835-
# Turn hot_standby_feedback back on
836-
change_hot_standby_feedback_and_wait_for_xmins(1, 1);
837-
}
838-
839-
##################################################
840-
# Recovery conflict: Invalidate conflicting slots, including in-use slots
841-
# Scenario 7: incorrect wal_level on primary.
736+
# Scenario 6: incorrect wal_level on primary.
842737
##################################################
843738

844739
# get the position to search from in the standby logfile
845740
$logstart = -s $node_standby->logfile;
846741

847742
# drop the logical slots
848-
if ($ENV{enable_injection_points} ne 'yes')
849-
{
850-
drop_logical_slots('pruning_');
851-
}
852-
else
853-
{
854-
drop_logical_slots('injection_');
855-
}
743+
drop_logical_slots('pruning_');
856744

857745
# create the logical slots
858746
create_logical_slots($node_standby, 'wal_level_');

0 commit comments

Comments
 (0)