Skip to content

Commit 9578457

Browse files
Increase size of bgw_library_name.
This commit increases the size of the bgw_library_name member of the BackgroundWorker struct from BGW_MAXLEN (96) bytes to MAXPGPATH (default of 1024) bytes so that it can store longer file names (e.g., absolute paths). Author: Yurii Rashkovskii Reviewed-by: Daniel Gustafsson, Aleksander Alekseev Discussion: https://postgr.es/m/CA%2BRLCQyjFV5Y8tG5QgUb6gjteL4S3p%2B1gcyqWTqigyM93WZ9Pg%40mail.gmail.com
1 parent 126552c commit 9578457

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

doc/src/sgml/bgworker.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef struct BackgroundWorker
5959
int bgw_flags;
6060
BgWorkerStartTime bgw_start_time;
6161
int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */
62-
char bgw_library_name[BGW_MAXLEN];
62+
char bgw_library_name[MAXPGPATH];
6363
char bgw_function_name[BGW_MAXLEN];
6464
Datum bgw_main_arg;
6565
char bgw_extra[BGW_EXTRALEN];

src/backend/postmaster/bgworker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
362362
ascii_safe_strlcpy(rw->rw_worker.bgw_type,
363363
slot->worker.bgw_type, BGW_MAXLEN);
364364
ascii_safe_strlcpy(rw->rw_worker.bgw_library_name,
365-
slot->worker.bgw_library_name, BGW_MAXLEN);
365+
slot->worker.bgw_library_name, MAXPGPATH);
366366
ascii_safe_strlcpy(rw->rw_worker.bgw_function_name,
367367
slot->worker.bgw_function_name, BGW_MAXLEN);
368368

src/backend/replication/logical/launcher.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
456456
bgw.bgw_flags = BGWORKER_SHMEM_ACCESS |
457457
BGWORKER_BACKEND_DATABASE_CONNECTION;
458458
bgw.bgw_start_time = BgWorkerStart_RecoveryFinished;
459-
snprintf(bgw.bgw_library_name, BGW_MAXLEN, "postgres");
459+
snprintf(bgw.bgw_library_name, MAXPGPATH, "postgres");
460460

461461
if (is_parallel_apply_worker)
462462
snprintf(bgw.bgw_function_name, BGW_MAXLEN, "ParallelApplyWorkerMain");
@@ -910,7 +910,7 @@ ApplyLauncherRegister(void)
910910
bgw.bgw_flags = BGWORKER_SHMEM_ACCESS |
911911
BGWORKER_BACKEND_DATABASE_CONNECTION;
912912
bgw.bgw_start_time = BgWorkerStart_RecoveryFinished;
913-
snprintf(bgw.bgw_library_name, BGW_MAXLEN, "postgres");
913+
snprintf(bgw.bgw_library_name, MAXPGPATH, "postgres");
914914
snprintf(bgw.bgw_function_name, BGW_MAXLEN, "ApplyLauncherMain");
915915
snprintf(bgw.bgw_name, BGW_MAXLEN,
916916
"logical replication launcher");

src/include/postmaster/bgworker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typedef struct BackgroundWorker
9393
int bgw_flags;
9494
BgWorkerStartTime bgw_start_time;
9595
int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */
96-
char bgw_library_name[BGW_MAXLEN];
96+
char bgw_library_name[MAXPGPATH];
9797
char bgw_function_name[BGW_MAXLEN];
9898
Datum bgw_main_arg;
9999
char bgw_extra[BGW_EXTRALEN];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy