~aglenyoung/+junk/postgres-9.3-dtrace

« back to all changes in this revision

Viewing changes to contrib/pg_upgrade/option.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Christoph Berg, Martin Pitt
  • Date: 2013-06-26 15:13:32 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130626151332-p34yjpn0txbdsdzd
Tags: 9.3~beta2-1
[ Christoph Berg ]
* hurd-i386: Ignore testsuite failures so we have a working libpq5 (they
  don't implement semaphores so the server won't even start).
* Mark postgresql-9.3 as beta in the description, suggested by Joshua D.
  Drake.

[ Martin Pitt ]
* New upstream release 9.3 beta2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
314
314
        }
315
315
 
316
316
        /*
317
 
         * Trim off any trailing path separators because we construct paths
318
 
         * by appending to this path.
 
317
         * Trim off any trailing path separators because we construct paths by
 
318
         * appending to this path.
319
319
         */
320
320
#ifndef WIN32
321
321
        if ((*dirpath)[strlen(*dirpath) - 1] == '/')
398
398
get_sock_dir(ClusterInfo *cluster, bool live_check)
399
399
{
400
400
#ifdef HAVE_UNIX_SOCKETS
 
401
 
401
402
        /*
402
 
         *      sockdir and port were added to postmaster.pid in PG 9.1.
403
 
         *      Pre-9.1 cannot process pg_ctl -w for sockets in non-default
404
 
         *      locations.
 
403
         * sockdir and port were added to postmaster.pid in PG 9.1. Pre-9.1 cannot
 
404
         * process pg_ctl -w for sockets in non-default locations.
405
405
         */
406
406
        if (GET_MAJOR_VERSION(cluster->major_version) >= 901)
407
407
        {
420
420
                else
421
421
                {
422
422
                        /*
423
 
                         *      If we are doing a live check, we will use the old cluster's Unix
424
 
                         *      domain socket directory so we can connect to the live server.
 
423
                         * If we are doing a live check, we will use the old cluster's
 
424
                         * Unix domain socket directory so we can connect to the live
 
425
                         * server.
425
426
                         */
426
427
                        unsigned short orig_port = cluster->port;
427
 
                        char            filename[MAXPGPATH], line[MAXPGPATH];
428
 
                        FILE            *fp;
 
428
                        char            filename[MAXPGPATH],
 
429
                                                line[MAXPGPATH];
 
430
                        FILE       *fp;
429
431
                        int                     lineno;
430
 
        
 
432
 
431
433
                        snprintf(filename, sizeof(filename), "%s/postmaster.pid",
432
434
                                         cluster->pgdata);
433
435
                        if ((fp = fopen(filename, "r")) == NULL)
434
436
                                pg_log(PG_FATAL, "Cannot open file %s: %m\n", filename);
435
 
        
 
437
 
436
438
                        for (lineno = 1;
437
 
                                 lineno <= Max(LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR);
 
439
                           lineno <= Max(LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR);
438
440
                                 lineno++)
439
441
                        {
440
442
                                if (fgets(line, sizeof(line), fp) == NULL)
441
443
                                        pg_log(PG_FATAL, "Cannot read line %d from %s: %m\n", lineno, filename);
442
 
        
 
444
 
443
445
                                /* potentially overwrite user-supplied value */
444
446
                                if (lineno == LOCK_FILE_LINE_PORT)
445
447
                                        sscanf(line, "%hu", &old_cluster.port);
451
453
                                }
452
454
                        }
453
455
                        fclose(fp);
454
 
        
 
456
 
455
457
                        /* warn of port number correction */
456
458
                        if (orig_port != DEF_PGUPORT && old_cluster.port != orig_port)
457
459
                                pg_log(PG_WARNING, "User-supplied old port number %hu corrected to %hu\n",
458
 
                                orig_port, cluster->port);
 
460
                                           orig_port, cluster->port);
459
461
                }
460
462
        }
461
463
        else
462
 
                /* Can't get sockdir and pg_ctl -w can't use a non-default, use default */
 
464
 
 
465
                /*
 
466
                 * Can't get sockdir and pg_ctl -w can't use a non-default, use
 
467
                 * default
 
468
                 */
463
469
                cluster->sockdir = NULL;
464
 
 
465
 
#else /* !HAVE_UNIX_SOCKETS */
 
470
#else                                                   /* !HAVE_UNIX_SOCKETS */
466
471
        cluster->sockdir = NULL;
467
472
#endif
468
473
}