PostgreSQL Source Code: src/bin/pg_upgrade/server.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
11
16
18
19
20
21
22
23
24
25
26
29{
31
33 {
35
38
39 printf(_("Failure, exiting\n"));
41 }
42
44
46}
47
48
49
50
51
52
53
54
55
58{
61
62
70 {
73 }
76
80}
81
82
83
84
85
86
87
88
89
90
91
92
93char *
95{
97
100 else
102
104 {
108 }
111
112 return buf->data;
113}
114
115
116
117
118
119
120
121
122
125{
130
134
138
140 {
145 printf(_("Failure, exiting\n"));
147 }
148 else
149 return result;
150}
151
152
153static void
158
159
160bool
162{
168
170
172 {
175 }
176
178
179#if !defined(WIN32)
180
182 " -c listen_addresses='' -c unix_socket_permissions=0700");
183
184
188 " -c %s='%s'",
190 "unix_socket_directory" : "unix_socket_directories",
192#endif
193
195
196
197
198
199
200
201
202
203
205 appendPQExpBufferStr(&pgoptions, " -c synchronous_commit=off -c fsync=off -c full_page_writes=off");
206
207
208
209
210
212 "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d -b%s %s%s\" start",
216 pgoptions.data,
218
220
221
222
223
224
226
231 "%s", cmd);
232
233
235 return false;
236
237
238
239
240
241
242
243
244
245
246
247
248
249
252
253
254
255
256
257
258
261 {
266 pg_fatal("could not connect to source postmaster started with the command:\n"
267 "%s",
268 cmd);
269 else
270 pg_fatal("could not connect to target postmaster started with the command:\n"
271 "%s",
272 cmd);
273 }
275
276
277
278
279
280
282 {
284 pg_fatal("pg_ctl failed to start the source server, or connection failed");
285 else
286 pg_fatal("pg_ctl failed to start the target server, or connection failed");
287 }
288
289 return true;
290}
291
292
293void
295{
297
302 else
303 return;
304
306 "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" %s stop",
309 in_atexit ? "-m fast" : "-m smart");
310
312}
313
314
315
316
317
318
319
320void
322{
325
326
327
329
332
334 {
337 {
339
341
344 pg_fatal("libpq environment variable %s has a non-local server value: %s",
346 }
347 }
348
349
351}
bool exec_prog(const char *log_filename, const char *opt_log_file, bool report_error, bool exit_on_error, const char *fmt,...)
void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
#define ALWAYS_SECURE_SEARCH_PATH_SQL
PGconn * PQconnectdb(const char *conninfo)
void PQconninfoFree(PQconninfoOption *connOptions)
ConnStatusType PQstatus(const PGconn *conn)
void PQfinish(PGconn *conn)
PQconninfoOption * PQconndefaults(void)
char * PQerrorMessage(const PGconn *conn)
PGresult * PQexec(PGconn *conn, const char *query)
static pid_t start_postmaster(void)
static void stop_postmaster(void)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define SERVER_START_LOG_FILE
#define SERVER_STOP_LOG_FILE
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define GET_MAJOR_VERSION(v)
bool protocol_negotiation_supported(const ClusterInfo *cluster)
static bool is_unixsock_path(const char *path)
PQExpBuffer createPQExpBuffer(void)
void initPQExpBuffer(PQExpBuffer str)
void resetPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
static PGconn * get_db_conn(ClusterInfo *cluster, const char *db_name)
void check_pghost_envvar(void)
PGresult * executeQueryOrDie(PGconn *conn, const char *fmt,...)
PGconn * connectToServer(ClusterInfo *cluster, const char *db_name)
char * cluster_conn_opts(ClusterInfo *cluster)
static void stop_postmaster_atexit(void)
void appendShellString(PQExpBuffer buf, const char *str)
void appendConnStrVal(PQExpBuffer buf, const char *str)
ClusterInfo * running_cluster