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

Commit d90bd24

Browse files
committed
Remove am_syslogger global variable
Use the new MyBackendType instead. More similar changes for other "am something" variables are possible. This one was just particularly simple. Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/c65e5196-4f04-4ead-9353-6088c19615a3@2ndquadrant.com
1 parent 8e8a0be commit d90bd24

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

src/backend/postmaster/syslogger.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ char *Log_filename = NULL;
7474
bool Log_truncate_on_rotation = false;
7575
int Log_file_mode = S_IRUSR | S_IWUSR;
7676

77-
/*
78-
* Globally visible state (used by elog.c)
79-
*/
80-
bool am_syslogger = false;
81-
8277
extern bool redirection_done;
8378

8479
/*
@@ -177,8 +172,6 @@ SysLoggerMain(int argc, char *argv[])
177172
syslogger_parseArgs(argc, argv);
178173
#endif /* EXEC_BACKEND */
179174

180-
am_syslogger = true;
181-
182175
MyBackendType = B_LOGGER;
183176
init_ps_display(NULL);
184177

@@ -1078,7 +1071,7 @@ flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
10781071
/*
10791072
* Write text to the currently open logfile
10801073
*
1081-
* This is exported so that elog.c can call it when am_syslogger is true.
1074+
* This is exported so that elog.c can call it when MyBackendType is B_LOGGER.
10821075
* This allows the syslogger process to record elog messages of its own,
10831076
* even though its stderr does not point at the syslog pipe.
10841077
*/

src/backend/utils/error/elog.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2923,7 +2923,7 @@ write_csvlog(ErrorData *edata)
29232923
appendStringInfoChar(&buf, '\n');
29242924

29252925
/* If in the syslogger process, try to write messages direct to file */
2926-
if (am_syslogger)
2926+
if (MyBackendType == B_LOGGER)
29272927
write_syslogger_file(buf.data, buf.len, LOG_DESTINATION_CSVLOG);
29282928
else
29292929
write_pipe_chunks(buf.data, buf.len, LOG_DESTINATION_CSVLOG);
@@ -3117,7 +3117,7 @@ send_message_to_server_log(ErrorData *edata)
31173117
* catching stderr output, and we are not ourselves the syslogger.
31183118
* Otherwise, just do a vanilla write to stderr.
31193119
*/
3120-
if (redirection_done && !am_syslogger)
3120+
if (redirection_done && MyBackendType != B_LOGGER)
31213121
write_pipe_chunks(buf.data, buf.len, LOG_DESTINATION_STDERR);
31223122
#ifdef WIN32
31233123

@@ -3136,13 +3136,13 @@ send_message_to_server_log(ErrorData *edata)
31363136
}
31373137

31383138
/* If in the syslogger process, try to write messages direct to file */
3139-
if (am_syslogger)
3139+
if (MyBackendType == B_LOGGER)
31403140
write_syslogger_file(buf.data, buf.len, LOG_DESTINATION_STDERR);
31413141

31423142
/* Write to CSV log if enabled */
31433143
if (Log_destination & LOG_DESTINATION_CSVLOG)
31443144
{
3145-
if (redirection_done || am_syslogger)
3145+
if (redirection_done || MyBackendType == B_LOGGER)
31463146
{
31473147
/*
31483148
* send CSV data if it's safe to do so (syslogger doesn't need the

src/include/postmaster/syslogger.h

-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ extern PGDLLIMPORT char *Log_filename;
7070
extern bool Log_truncate_on_rotation;
7171
extern int Log_file_mode;
7272

73-
extern bool am_syslogger;
74-
7573
#ifndef WIN32
7674
extern int syslogPipe[2];
7775
#else

0 commit comments

Comments
 (0)