Commit e1c1c30f authored by Andrew Dunstan's avatar Andrew Dunstan

Pre branch pgindent / pgperltidy run

Along the way make a slight adjustment to
src/include/utils/queryjumble.h to avoid an unused typedef.
parent c3183377
...@@ -410,8 +410,8 @@ RelationGetBufferForTuple(Relation relation, Size len, ...@@ -410,8 +410,8 @@ RelationGetBufferForTuple(Relation relation, Size len,
} }
/* /*
* If the FSM knows nothing of the rel, try the last page before we * If the FSM knows nothing of the rel, try the last page before we give
* give up and extend. This avoids one-tuple-per-page syndrome during * up and extend. This avoids one-tuple-per-page syndrome during
* bootstrapping or in a recently-started system. * bootstrapping or in a recently-started system.
*/ */
if (targetBlock == InvalidBlockNumber) if (targetBlock == InvalidBlockNumber)
......
...@@ -704,12 +704,12 @@ ExecInsert(ModifyTableState *mtstate, ...@@ -704,12 +704,12 @@ ExecInsert(ModifyTableState *mtstate,
} }
/* /*
* Initialize the batch slots. We don't know how many slots will be * Initialize the batch slots. We don't know how many slots will
* needed, so we initialize them as the batch grows, and we keep * be needed, so we initialize them as the batch grows, and we
* them across batches. To mitigate an inefficiency in how resource * keep them across batches. To mitigate an inefficiency in how
* owner handles objects with many references (as with many slots * resource owner handles objects with many references (as with
* all referencing the same tuple descriptor) we copy the tuple * many slots all referencing the same tuple descriptor) we copy
* descriptor for each slot. * the tuple descriptor for each slot.
*/ */
if (resultRelInfo->ri_NumSlots >= resultRelInfo->ri_NumSlotsInitialized) if (resultRelInfo->ri_NumSlots >= resultRelInfo->ri_NumSlotsInitialized)
{ {
...@@ -3183,8 +3183,9 @@ ExecEndModifyTable(ModifyTableState *node) ...@@ -3183,8 +3183,9 @@ ExecEndModifyTable(ModifyTableState *node)
resultRelInfo); resultRelInfo);
/* /*
* Cleanup the initialized batch slots. This only matters for FDWs with * Cleanup the initialized batch slots. This only matters for FDWs
* batching, but the other cases will have ri_NumSlotsInitialized == 0. * with batching, but the other cases will have ri_NumSlotsInitialized
* == 0.
*/ */
for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++) for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
{ {
......
...@@ -2215,8 +2215,8 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn, ...@@ -2215,8 +2215,8 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
change_done: change_done:
/* /*
* If speculative insertion was confirmed, the record isn't * If speculative insertion was confirmed, the record
* needed anymore. * isn't needed anymore.
*/ */
if (specinsert != NULL) if (specinsert != NULL)
{ {
......
...@@ -1031,7 +1031,8 @@ get_rel_sync_entry(PGOutputData *data, Oid relid) ...@@ -1031,7 +1031,8 @@ get_rel_sync_entry(PGOutputData *data, Oid relid)
entry->pubactions.pubinsert = entry->pubactions.pubupdate = entry->pubactions.pubinsert = entry->pubactions.pubupdate =
entry->pubactions.pubdelete = entry->pubactions.pubtruncate = false; entry->pubactions.pubdelete = entry->pubactions.pubtruncate = false;
entry->publish_as_relid = InvalidOid; entry->publish_as_relid = InvalidOid;
entry->map = NULL; /* will be set by maybe_send_schema() if needed */ entry->map = NULL; /* will be set by maybe_send_schema() if
* needed */
} }
/* Validate the entry */ /* Validate the entry */
......
...@@ -53,12 +53,12 @@ typedef struct JumbleState ...@@ -53,12 +53,12 @@ typedef struct JumbleState
} JumbleState; } JumbleState;
/* Values for the compute_query_id GUC */ /* Values for the compute_query_id GUC */
typedef enum enum ComputeQueryIdType
{ {
COMPUTE_QUERY_ID_OFF, COMPUTE_QUERY_ID_OFF,
COMPUTE_QUERY_ID_ON, COMPUTE_QUERY_ID_ON,
COMPUTE_QUERY_ID_AUTO COMPUTE_QUERY_ID_AUTO
} ComputeQueryIdType; };
/* GUC parameters */ /* GUC parameters */
extern int compute_query_id; extern int compute_query_id;
......
...@@ -2126,8 +2126,8 @@ sub poll_query_until ...@@ -2126,8 +2126,8 @@ sub poll_query_until
$expected = 't' unless defined($expected); # default value $expected = 't' unless defined($expected); # default value
my $cmd = [ my $cmd = [
$self->installed_command('psql'), $self->installed_command('psql'), '-XAt',
'-XAt', '-d', $self->connstr($dbname) '-d', $self->connstr($dbname)
]; ];
my ($stdout, $stderr); my ($stdout, $stderr);
my $max_attempts = 180 * 10; my $max_attempts = 180 * 10;
......
...@@ -64,9 +64,10 @@ $node_standby2->init_from_backup($node_primary, $backup_name, ...@@ -64,9 +64,10 @@ $node_standby2->init_from_backup($node_primary, $backup_name,
$node_standby2->start; $node_standby2->start;
# Recovery is not yet paused. # Recovery is not yet paused.
is($node_standby2->safe_psql('postgres', is( $node_standby2->safe_psql(
"SELECT pg_get_wal_replay_pause_state()"), 'postgres', "SELECT pg_get_wal_replay_pause_state()"),
'not paused', 'pg_get_wal_replay_pause_state() reports not paused'); 'not paused',
'pg_get_wal_replay_pause_state() reports not paused');
# Request to pause recovery and wait until it's actually paused. # Request to pause recovery and wait until it's actually paused.
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_pause()"); $node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_pause()");
...@@ -78,24 +79,24 @@ $node_standby2->poll_query_until('postgres', ...@@ -78,24 +79,24 @@ $node_standby2->poll_query_until('postgres',
# Even if new WAL records are streamed from the primary, # Even if new WAL records are streamed from the primary,
# recovery in the paused state doesn't replay them. # recovery in the paused state doesn't replay them.
my $receive_lsn = $node_standby2->safe_psql('postgres', my $receive_lsn =
"SELECT pg_last_wal_receive_lsn()"); $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_receive_lsn()");
my $replay_lsn = $node_standby2->safe_psql('postgres', my $replay_lsn =
"SELECT pg_last_wal_replay_lsn()"); $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()");
$node_primary->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(31,40))"); "INSERT INTO tab_int VALUES (generate_series(31,40))");
$node_standby2->poll_query_until('postgres', $node_standby2->poll_query_until('postgres',
"SELECT '$receive_lsn'::pg_lsn < pg_last_wal_receive_lsn()") "SELECT '$receive_lsn'::pg_lsn < pg_last_wal_receive_lsn()")
or die "Timed out while waiting for new WAL to be streamed"; or die "Timed out while waiting for new WAL to be streamed";
is($node_standby2->safe_psql('postgres', is( $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"),
"SELECT pg_last_wal_replay_lsn()"), qq($replay_lsn),
qq($replay_lsn), 'no WAL is replayed in the paused state'); 'no WAL is replayed in the paused state');
# Request to resume recovery and wait until it's actually resumed. # Request to resume recovery and wait until it's actually resumed.
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_resume()"); $node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_resume()");
$node_standby2->poll_query_until('postgres', $node_standby2->poll_query_until('postgres',
"SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn") "SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn"
or die "Timed out while waiting for recovery to be resumed"; ) or die "Timed out while waiting for recovery to be resumed";
# Check that the paused state ends and promotion continues if a promotion # Check that the paused state ends and promotion continues if a promotion
# is triggered while recovery is paused. # is triggered while recovery is paused.
...@@ -107,6 +108,5 @@ $node_standby2->poll_query_until('postgres', ...@@ -107,6 +108,5 @@ $node_standby2->poll_query_until('postgres',
or die "Timed out while waiting for recovery to be paused"; or die "Timed out while waiting for recovery to be paused";
$node_standby2->promote; $node_standby2->promote;
$node_standby2->poll_query_until('postgres', $node_standby2->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
"SELECT NOT pg_is_in_recovery()")
or die "Timed out while waiting for promotion to finish"; or die "Timed out while waiting for promotion to finish";
...@@ -32,13 +32,14 @@ my $perlbin = TestLib::perl2host($^X); ...@@ -32,13 +32,14 @@ my $perlbin = TestLib::perl2host($^X);
$perlbin =~ s!\\!/!g if $TestLib::windows_os; $perlbin =~ s!\\!/!g if $TestLib::windows_os;
my $archivedir_primary = $node_primary->archive_dir; my $archivedir_primary = $node_primary->archive_dir;
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os; $archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;
$node_primary->append_conf('postgresql.conf', qq( $node_primary->append_conf(
'postgresql.conf', qq(
archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"' archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
wal_keep_size=128MB wal_keep_size=128MB
)); ));
# Make sure that Msys perl doesn't complain about difficulty in setting locale # Make sure that Msys perl doesn't complain about difficulty in setting locale
# when called from the archive_command. # when called from the archive_command.
local $ENV{PERL_BADLANG}=0; local $ENV{PERL_BADLANG} = 0;
$node_primary->start; $node_primary->start;
# Take backup from primary # Take backup from primary
...@@ -47,8 +48,11 @@ $node_primary->backup($backup_name); ...@@ -47,8 +48,11 @@ $node_primary->backup($backup_name);
# Create streaming standby linking to primary # Create streaming standby linking to primary
my $node_standby = get_new_node('standby'); my $node_standby = get_new_node('standby');
$node_standby->init_from_backup($node_primary, $backup_name, $node_standby->init_from_backup(
allows_streaming => 1, has_streaming => 1, has_archiving => 1); $node_primary, $backup_name,
allows_streaming => 1,
has_streaming => 1,
has_archiving => 1);
$node_standby->start; $node_standby->start;
# Take backup of standby, use -Xnone so that pg_wal is empty. # Take backup of standby, use -Xnone so that pg_wal is empty.
...@@ -60,7 +64,8 @@ my $node_cascade = get_new_node('cascade'); ...@@ -60,7 +64,8 @@ my $node_cascade = get_new_node('cascade');
$node_cascade->init_from_backup($node_standby, $backup_name, $node_cascade->init_from_backup($node_standby, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_cascade->enable_restoring($node_primary); $node_cascade->enable_restoring($node_primary);
$node_cascade->append_conf('postgresql.conf', qq( $node_cascade->append_conf(
'postgresql.conf', qq(
recovery_target_timeline='latest' recovery_target_timeline='latest'
)); ));
...@@ -68,8 +73,7 @@ recovery_target_timeline='latest' ...@@ -68,8 +73,7 @@ recovery_target_timeline='latest'
$node_standby->promote; $node_standby->promote;
# Wait for promotion to complete # Wait for promotion to complete
$node_standby->poll_query_until('postgres', $node_standby->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery();")
"SELECT NOT pg_is_in_recovery();")
or die "Timed out while waiting for promotion"; or die "Timed out while waiting for promotion";
# Find next WAL segment to be archived # Find next WAL segment to be archived
......
...@@ -51,8 +51,11 @@ $node_publisher->safe_psql('postgres', ...@@ -51,8 +51,11 @@ $node_publisher->safe_psql('postgres',
"ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING"); "ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING");
# Replicate the changes without replica identity index # Replicate the changes without replica identity index
$node_publisher->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)"); $node_publisher->safe_psql('postgres',
$node_publisher->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"); "CREATE TABLE tab_no_replidentity_index(c1 int)");
$node_publisher->safe_psql('postgres',
"CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
);
# Setup structure on subscriber # Setup structure on subscriber
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)");
...@@ -78,8 +81,11 @@ $node_subscriber->safe_psql('postgres', ...@@ -78,8 +81,11 @@ $node_subscriber->safe_psql('postgres',
); );
# replication of the table without replica identity index # replication of the table without replica identity index
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)"); $node_subscriber->safe_psql('postgres',
$node_subscriber->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"); "CREATE TABLE tab_no_replidentity_index(c1 int)");
$node_subscriber->safe_psql('postgres',
"CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
);
# Setup logical replication # Setup logical replication
my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
...@@ -137,7 +143,8 @@ $node_publisher->safe_psql('postgres', ...@@ -137,7 +143,8 @@ $node_publisher->safe_psql('postgres',
"DELETE FROM tab_include WHERE a > 20"); "DELETE FROM tab_include WHERE a > 20");
$node_publisher->safe_psql('postgres', "UPDATE tab_include SET a = -a"); $node_publisher->safe_psql('postgres', "UPDATE tab_include SET a = -a");
$node_publisher->safe_psql('postgres', "INSERT INTO tab_no_replidentity_index VALUES(1)"); $node_publisher->safe_psql('postgres',
"INSERT INTO tab_no_replidentity_index VALUES(1)");
$node_publisher->wait_for_catchup('tap_sub'); $node_publisher->wait_for_catchup('tap_sub');
...@@ -162,8 +169,10 @@ $result = $node_subscriber->safe_psql('postgres', ...@@ -162,8 +169,10 @@ $result = $node_subscriber->safe_psql('postgres',
is($result, qq(20|-20|-1), is($result, qq(20|-20|-1),
'check replicated changes with primary key index with included columns'); 'check replicated changes with primary key index with included columns');
is($node_subscriber->safe_psql('postgres', q(SELECT c1 FROM tab_no_replidentity_index)), is( $node_subscriber->safe_psql(
1, "value replicated to subscriber without replica identity index"); 'postgres', q(SELECT c1 FROM tab_no_replidentity_index)),
1,
"value replicated to subscriber without replica identity index");
# insert some duplicate rows # insert some duplicate rows
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
......
...@@ -197,11 +197,9 @@ $node_publisher->safe_psql('postgres', "SELECT pg_reload_conf()"); ...@@ -197,11 +197,9 @@ $node_publisher->safe_psql('postgres', "SELECT pg_reload_conf()");
# test that truncate works for logical replication when there are multiple # test that truncate works for logical replication when there are multiple
# subscriptions for a single table # subscriptions for a single table
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
"CREATE TABLE tab5 (a int)");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
"CREATE TABLE tab5 (a int)");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION pub5 FOR TABLE tab5"); "CREATE PUBLICATION pub5 FOR TABLE tab5");
...@@ -235,8 +233,7 @@ $node_publisher->wait_for_catchup('sub5_2'); ...@@ -235,8 +233,7 @@ $node_publisher->wait_for_catchup('sub5_2');
$result = $node_subscriber->safe_psql('postgres', $result = $node_subscriber->safe_psql('postgres',
"SELECT count(*), min(a), max(a) FROM tab5"); "SELECT count(*), min(a), max(a) FROM tab5");
is($result, qq(0||), is($result, qq(0||), 'truncate replicated for multiple subscriptions');
'truncate replicated for multiple subscriptions');
# check deadlocks # check deadlocks
$result = $node_subscriber->safe_psql('postgres', $result = $node_subscriber->safe_psql('postgres',
......
...@@ -673,7 +673,8 @@ is($result, qq(), 'truncate of tab3_1 replicated'); ...@@ -673,7 +673,8 @@ is($result, qq(), 'truncate of tab3_1 replicated');
# check that the map to convert tuples from leaf partition to the root # check that the map to convert tuples from leaf partition to the root
# table is correctly rebuilt when a new column is added # table is correctly rebuilt when a new column is added
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text"); "ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text"
);
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"INSERT INTO tab2 (a, b) VALUES (1, 'xxx'), (3, 'yyy'), (5, 'zzz')"); "INSERT INTO tab2 (a, b) VALUES (1, 'xxx'), (3, 'yyy'), (5, 'zzz')");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
......
...@@ -11,8 +11,7 @@ use Test::More tests => 5; ...@@ -11,8 +11,7 @@ use Test::More tests => 5;
# Create publisher node # Create publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = get_new_node('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->append_conf('postgresql.conf', $node_publisher->append_conf('postgresql.conf', 'autovacuum = off');
'autovacuum = off');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
...@@ -43,8 +42,10 @@ $node_publisher->wait_for_catchup('tap_sub'); ...@@ -43,8 +42,10 @@ $node_publisher->wait_for_catchup('tap_sub');
$node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE"); $node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE");
# wait for the replication slot to become inactive in the publisher # wait for the replication slot to become inactive in the publisher
$node_publisher->poll_query_until('postgres', $node_publisher->poll_query_until(
"SELECT COUNT(*) FROM pg_catalog.pg_replication_slots WHERE slot_name = 'tap_sub' AND active='f'", 1); 'postgres',
"SELECT COUNT(*) FROM pg_catalog.pg_replication_slots WHERE slot_name = 'tap_sub' AND active='f'",
1);
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')" "SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')"
......
...@@ -113,6 +113,7 @@ Append ...@@ -113,6 +113,7 @@ Append
AppendPath AppendPath
AppendRelInfo AppendRelInfo
AppendState AppendState
ApplyExecutionData
ApplySubXactData ApplySubXactData
Archive Archive
ArchiveEntryPtrType ArchiveEntryPtrType
...@@ -1163,6 +1164,7 @@ IpcSemaphoreKey ...@@ -1163,6 +1164,7 @@ IpcSemaphoreKey
IsForeignPathAsyncCapable_function IsForeignPathAsyncCapable_function
IsForeignRelUpdatable_function IsForeignRelUpdatable_function
IsForeignScanParallelSafe_function IsForeignScanParallelSafe_function
IsoConnInfo
IspellDict IspellDict
Item Item
ItemId ItemId
...@@ -1683,7 +1685,6 @@ PLpgSQL_stmt_return ...@@ -1683,7 +1685,6 @@ PLpgSQL_stmt_return
PLpgSQL_stmt_return_next PLpgSQL_stmt_return_next
PLpgSQL_stmt_return_query PLpgSQL_stmt_return_query
PLpgSQL_stmt_rollback PLpgSQL_stmt_rollback
PLpgSQL_stmt_set
PLpgSQL_stmt_type PLpgSQL_stmt_type
PLpgSQL_stmt_while PLpgSQL_stmt_while
PLpgSQL_trigtype PLpgSQL_trigtype
...@@ -1872,6 +1873,9 @@ PerlInterpreter ...@@ -1872,6 +1873,9 @@ PerlInterpreter
Perl_check_t Perl_check_t
Perl_ppaddr_t Perl_ppaddr_t
Permutation Permutation
PermutationStep
PermutationStepBlocker
PermutationStepBlockerType
PgArchData PgArchData
PgBackendGSSStatus PgBackendGSSStatus
PgBackendSSLStatus PgBackendSSLStatus
...@@ -2416,7 +2420,6 @@ SlabBlock ...@@ -2416,7 +2420,6 @@ SlabBlock
SlabChunk SlabChunk
SlabContext SlabContext
SlabSlot SlabSlot
SlotAcquireBehavior
SlotErrCallbackArg SlotErrCallbackArg
SlotNumber SlotNumber
SlruCtl SlruCtl
...@@ -2496,6 +2499,7 @@ StatsData ...@@ -2496,6 +2499,7 @@ StatsData
StatsElem StatsElem
StatsExtInfo StatsExtInfo
StdAnalyzeData StdAnalyzeData
StdRdOptIndexCleanup
StdRdOptions StdRdOptions
Step Step
StopList StopList
...@@ -2777,7 +2781,7 @@ UserOpts ...@@ -2777,7 +2781,7 @@ UserOpts
VacAttrStats VacAttrStats
VacAttrStatsP VacAttrStatsP
VacErrPhase VacErrPhase
VacOptTernaryValue VacOptValue
VacuumParams VacuumParams
VacuumRelation VacuumRelation
VacuumStmt VacuumStmt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment