diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/utils/pgstat_internal.h | 5 | ||||
| -rw-r--r-- | src/interfaces/libpq-oauth/meson.build | 2 | ||||
| -rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 17 | ||||
| -rw-r--r-- | src/test/modules/oauth_validator/t/002_client.pl | 24 | ||||
| -rw-r--r-- | src/test/modules/test_custom_stats/test_custom_var_stats.c | 6 | ||||
| -rw-r--r-- | src/test/recovery/t/040_standby_failover_slots_sync.pl | 8 | ||||
| -rw-r--r-- | src/test/regress/nls.mk | 2 | ||||
| -rw-r--r-- | src/test/regress/po/meson.build | 2 | ||||
| -rw-r--r-- | src/test/regress/regress.c | 2 |
9 files changed, 48 insertions, 20 deletions
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h index 5c1ce4d3d6a..7dffab8dbdd 100644 --- a/src/include/utils/pgstat_internal.h +++ b/src/include/utils/pgstat_internal.h @@ -329,13 +329,14 @@ typedef struct PgStat_KindInfo * * "statfile" is a pointer to the on-disk stats file, named * PGSTAT_STAT_PERMANENT_FILENAME. "key" is the hash key of the entry - * just written or read. "header" is a pointer to the stats data. + * just written or read. "header" is a pointer to the stats data; it may + * be modified only in from_serialized_data to reconstruct an entry. */ void (*to_serialized_data) (const PgStat_HashKey *key, const PgStatShared_Common *header, FILE *statfile); bool (*from_serialized_data) (const PgStat_HashKey *key, - const PgStatShared_Common *header, + PgStatShared_Common *header, FILE *statfile); /* diff --git a/src/interfaces/libpq-oauth/meson.build b/src/interfaces/libpq-oauth/meson.build index 505e1671b86..881e3f24f10 100644 --- a/src/interfaces/libpq-oauth/meson.build +++ b/src/interfaces/libpq-oauth/meson.build @@ -40,7 +40,7 @@ libpq_oauth_name = 'libpq-oauth-@0@'.format(pg_version_major) libpq_oauth_so = shared_module(libpq_oauth_name, libpq_oauth_sources + libpq_oauth_so_sources, include_directories: [libpq_oauth_inc, postgres_inc], - c_args: libpq_so_c_args, + c_args: libpq_oauth_so_c_args, c_pch: pch_postgres_fe_h, dependencies: [frontend_shlib_code, libpq, libpq_oauth_deps], link_depends: export_file, diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 0852584edae..877a6483b34 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -738,11 +738,15 @@ typedef struct _PGpromptOAuthDevice int expires_in; /* seconds until user code expires */ } PGpromptOAuthDevice; -/* for PGoauthBearerRequest.async() */ +/* + * For PGoauthBearerRequest.async(). This macro just allows clients to avoid + * depending on libpq-int.h or Winsock for the "socket" type; it's undefined + * immediately below. + */ #ifdef _WIN32 -#define SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */ +#define PQ_SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */ #else -#define SOCKTYPE int +#define PQ_SOCKTYPE int #endif typedef struct PGoauthBearerRequest @@ -768,10 +772,13 @@ typedef struct PGoauthBearerRequest * blocking during the original call to the PQAUTHDATA_OAUTH_BEARER_TOKEN * hook, it may be returned directly, but one of request->async or * request->token must be set by the hook. + * + * The (PQ_SOCKTYPE *) in the signature is a placeholder for the platform's + * native socket type: (SOCKET *) on Windows, and (int *) everywhere else. */ PostgresPollingStatusType (*async) (PGconn *conn, struct PGoauthBearerRequest *request, - SOCKTYPE * altsock); + PQ_SOCKTYPE * altsock); /* * Callback to clean up custom allocations. A hook implementation may use @@ -798,7 +805,7 @@ typedef struct PGoauthBearerRequest void *user; } PGoauthBearerRequest; -#undef SOCKTYPE +#undef PQ_SOCKTYPE extern char *PQencryptPassword(const char *passwd, const char *user); extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm); diff --git a/src/test/modules/oauth_validator/t/002_client.pl b/src/test/modules/oauth_validator/t/002_client.pl index aac0220d215..e6c91fc911c 100644 --- a/src/test/modules/oauth_validator/t/002_client.pl +++ b/src/test/modules/oauth_validator/t/002_client.pl @@ -29,6 +29,8 @@ $node->init; $node->append_conf('postgresql.conf', "log_connections = all\n"); $node->append_conf('postgresql.conf', "oauth_validator_libraries = 'validator'\n"); +# Needed to inspect postmaster log after connection failure: +$node->append_conf('postgresql.conf', "log_min_messages = debug2"); $node->start; $node->safe_psql('postgres', 'CREATE USER test;'); @@ -47,7 +49,7 @@ local all test oauth issuer="$issuer" scope="$scope" }); $node->reload; -my $log_start = $node->wait_for_log(qr/reloading configuration files/); +$node->wait_for_log(qr/reloading configuration files/); $ENV{PGOAUTHDEBUG} = "UNSAFE"; @@ -73,6 +75,7 @@ sub test my @cmd = ("oauth_hook_client", @{$flags}, $common_connstr); note "running '" . join("' '", @cmd) . "'"; + my $log_start = -s $node->logfile; my ($stdout, $stderr) = run_command(\@cmd); if (defined($params{expected_stdout})) @@ -88,6 +91,18 @@ sub test { is($stderr, "", "$test_name: no stderr"); } + + if (defined($params{log_like})) + { + # See Cluster::connect_fails(). To avoid races, we have to wait for the + # postmaster to flush the log for the finished connection. + $node->wait_for_log( + qr/DEBUG: (?:00000: )?forked new client backend, pid=(\d+) socket.*DEBUG: (?:00000: )?client backend \(PID \1\) exited with exit code \d/s, + $log_start); + + $node->log_check("$test_name: log matches", + $log_start, log_like => $params{log_like}); + } } test( @@ -97,11 +112,8 @@ test( "--expected-uri", "$issuer/.well-known/openid-configuration", "--expected-scope", $scope, ], - expected_stdout => qr/connection succeeded/); - -$node->log_check("validator receives correct token", - $log_start, - log_like => [ qr/oauth_validator: token="my-token", role="$user"/, ]); + expected_stdout => qr/connection succeeded/, + log_like => [qr/oauth_validator: token="my-token", role="$user"/]); if ($ENV{with_libcurl} ne 'yes') { diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index c71922dc4a8..294085d6866 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -92,7 +92,7 @@ static void test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, /* Deserialization callback: read auxiliary entry data */ static bool test_custom_stats_var_from_serialized_data(const PgStat_HashKey *key, - const PgStatShared_Common *header, + PgStatShared_Common *header, FILE *statfile); /* Finish callback: end of statistics file operations */ @@ -196,7 +196,7 @@ test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, { char *description; size_t len; - PgStatShared_CustomVarEntry *entry = (PgStatShared_CustomVarEntry *) header; + const PgStatShared_CustomVarEntry *entry = (const PgStatShared_CustomVarEntry *) header; bool found; uint32 magic_number = TEST_CUSTOM_VAR_MAGIC_NUMBER; @@ -276,7 +276,7 @@ test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, */ static bool test_custom_stats_var_from_serialized_data(const PgStat_HashKey *key, - const PgStatShared_Common *header, + PgStatShared_Common *header, FILE *statfile) { PgStatShared_CustomVarEntry *entry; diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl index 20f942cfd14..7dadd8647e5 100644 --- a/src/test/recovery/t/040_standby_failover_slots_sync.pl +++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl @@ -1080,6 +1080,14 @@ $result = $standby2->safe_psql('postgres', ); is($result, 't', "check slot sync skip count increments"); +# Configure primary to disallow any logical slots that have enabled failover +# from getting ahead of the specified physical replication slot (sb2_slot). +$primary->append_conf( + 'postgresql.conf', qq( +synchronized_standby_slots = 'sb2_slot' +)); +$primary->reload; + # Enable the Subscription, so that the remote slot catches up $subscriber1->safe_psql('postgres', "ALTER SUBSCRIPTION regress_mysub1 ENABLE"); $subscriber1->wait_for_subscription_sync; diff --git a/src/test/regress/nls.mk b/src/test/regress/nls.mk index 43227c64f09..4051c965933 100644 --- a/src/test/regress/nls.mk +++ b/src/test/regress/nls.mk @@ -1,5 +1,5 @@ # src/test/regress/nls.mk -CATALOG_NAME = regress +CATALOG_NAME = postgresql-regress GETTEXT_FILES = regress.c GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) GETTEXT_FLAGS = $(BACKEND_COMMON_GETTEXT_FLAGS) diff --git a/src/test/regress/po/meson.build b/src/test/regress/po/meson.build index e9bd964aa7f..84b98a80df5 100644 --- a/src/test/regress/po/meson.build +++ b/src/test/regress/po/meson.build @@ -1,3 +1,3 @@ # Copyright (c) 2022-2025, PostgreSQL Global Development Group -nls_targets += [i18n.gettext('regress-' + pg_version_major.to_string())] +nls_targets += [i18n.gettext('postgresql-regress-' + pg_version_major.to_string())] diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index acac34d40b9..b7a926c6f01 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -50,7 +50,7 @@ /* define our text domain for translations */ #undef TEXTDOMAIN -#define TEXTDOMAIN PG_TEXTDOMAIN("regress") +#define TEXTDOMAIN PG_TEXTDOMAIN("postgresql-regress") #define EXPECT_TRUE(expr) \ do { \ |
