Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb0b9260

Browse files
macdicepull[bot]
authored andcommitted
Remove configure probes for symlink/readlink, and dead code.
symlink() and readlink() are in SUSv2 and all targeted Unix systems havethem. We have partial emulation on Windows. Code that raised runtimeerrors on systems without it has been dead for years, so we can removethat and also references to such systems in the documentation.Define HAVE_READLINK and HAVE_SYMLINK macros on Unix. Our Windowsreplacement functions based on junction points can't be used forrelative paths or for non-directories, so the macros can be used tocheck for full symlink support. The places that deal with tablespacescan just use symlink functions without checking the macros. (If theydid check the macros, they'd need to provide an #else branch with aruntime or compile time error, and it'd be dead code.)Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
1 parent6efcc5b commitb0b9260

File tree

15 files changed

+13
-86
lines changed

15 files changed

+13
-86
lines changed

‎configure‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16039,7 +16039,7 @@ fi
1603916039
LIBS_including_readline="$LIBS"
1604016040
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
1604116041

16042-
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_npreadlinkreadv setproctitle setproctitle_fast strchrnul strsignal symlink syncfs sync_file_range uselocale wcstombs_l writev
16042+
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_np readv setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l writev
1604316043
do :
1604416044
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1604516045
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -17083,9 +17083,6 @@ esac
1708317083
;;
1708417084
esac
1708517085

17086-
17087-
$as_echo "#define HAVE_SYMLINK 1" >>confdefs.h
17088-
1708917086
ac_fn_c_check_type "$LINENO" "MINIDUMP_TYPE" "ac_cv_type_MINIDUMP_TYPE" "
1709017087
#define WIN32_LEAN_AND_MEAN
1709117088
#include <windows.h>

‎configure.ac‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,13 +1805,11 @@ AC_CHECK_FUNCS(m4_normalize([
18051805
posix_fallocate
18061806
ppoll
18071807
pthread_is_threaded_np
1808-
readlink
18091808
readv
18101809
setproctitle
18111810
setproctitle_fast
18121811
strchrnul
18131812
strsignal
1814-
symlink
18151813
syncfs
18161814
sync_file_range
18171815
uselocale
@@ -1963,8 +1961,6 @@ if test "$PORTNAME" = "win32"; then
19631961
AC_LIBOBJ(win32security)
19641962
AC_LIBOBJ(win32setlocale)
19651963
AC_LIBOBJ(win32stat)
1966-
AC_DEFINE([HAVE_SYMLINK],1,
1967-
[Define to 1 if you have the `symlink' function.])
19681964
AC_CHECK_TYPES(MINIDUMP_TYPE,[pgac_minidump_type=yes],[pgac_minidump_type=no],[
19691965
#define WIN32_LEAN_AND_MEAN
19701966
#include <windows.h>

‎doc/src/sgml/manage-ag.sgml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,6 @@ SELECT spcname FROM pg_tablespace;
530530
is also useful for listing the existing tablespaces.
531531
</para>
532532

533-
<para>
534-
<productname>PostgreSQL</productname> makes use of symbolic links
535-
to simplify the implementation of tablespaces. This
536-
means that tablespaces can be used <emphasis>only</emphasis> on systems
537-
that support symbolic links.
538-
</para>
539-
540533
<para>
541534
The directory <filename>$PGDATA/pg_tblspc</filename> contains symbolic links that
542535
point to each of the non-built-in tablespaces defined in the cluster.

‎doc/src/sgml/ref/create_tablespace.sgml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
127127
<refsect1>
128128
<title>Notes</title>
129129

130-
<para>
131-
Tablespaces are only supported on systems that support symbolic links.
132-
</para>
133-
134130
<para>
135131
<command>CREATE TABLESPACE</command> cannot be executed inside a transaction
136132
block.

‎src/backend/access/transam/xlog.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8305,7 +8305,6 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
83058305
if (get_dirent_type(fullpath,de, false,ERROR)!=PGFILETYPE_LNK)
83068306
continue;
83078307

8308-
#if defined(HAVE_READLINK)|| defined(WIN32)
83098308
rllen=readlink(fullpath,linkpath,sizeof(linkpath));
83108309
if (rllen<0)
83118310
{
@@ -8358,17 +8357,6 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
83588357
ti->oid,escapedpath.data);
83598358

83608359
pfree(escapedpath.data);
8361-
#else
8362-
8363-
/*
8364-
* If the platform does not have symbolic links, it should not be
8365-
* possible to have tablespaces - clearly somebody else created
8366-
* them. Warn about it and ignore.
8367-
*/
8368-
ereport(WARNING,
8369-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
8370-
errmsg("tablespaces are not supported on this platform")));
8371-
#endif
83728360
}
83738361
FreeDir(tblspcdir);
83748362

‎src/backend/commands/tablespace.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo)
213213
Oid
214214
CreateTableSpace(CreateTableSpaceStmt*stmt)
215215
{
216-
#ifdefHAVE_SYMLINK
217216
Relationrel;
218217
Datumvalues[Natts_pg_tablespace];
219218
boolnulls[Natts_pg_tablespace]= {0};
@@ -391,12 +390,6 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
391390
table_close(rel,NoLock);
392391

393392
returntablespaceoid;
394-
#else/* !HAVE_SYMLINK */
395-
ereport(ERROR,
396-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
397-
errmsg("tablespaces are not supported on this platform")));
398-
returnInvalidOid;/* keep compiler quiet */
399-
#endif/* HAVE_SYMLINK */
400393
}
401394

402395
/*
@@ -407,7 +400,6 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
407400
void
408401
DropTableSpace(DropTableSpaceStmt*stmt)
409402
{
410-
#ifdefHAVE_SYMLINK
411403
char*tablespacename=stmt->tablespacename;
412404
TableScanDescscandesc;
413405
Relationrel;
@@ -573,11 +565,6 @@ DropTableSpace(DropTableSpaceStmt *stmt)
573565

574566
/* We keep the lock on pg_tablespace until commit */
575567
table_close(rel,NoLock);
576-
#else/* !HAVE_SYMLINK */
577-
ereport(ERROR,
578-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
579-
errmsg("tablespaces are not supported on this platform")));
580-
#endif/* HAVE_SYMLINK */
581568
}
582569

583570

‎src/backend/replication/basebackup.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,6 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
13301330
#endif
13311331
)
13321332
{
1333-
#if defined(HAVE_READLINK)|| defined(WIN32)
13341333
charlinkpath[MAXPGPATH];
13351334
intrllen;
13361335

@@ -1349,18 +1348,6 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
13491348

13501349
size+=_tarWriteHeader(sink,pathbuf+basepathlen+1,linkpath,
13511350
&statbuf,sizeonly);
1352-
#else
1353-
1354-
/*
1355-
* If the platform does not have symbolic links, it should not be
1356-
* possible to have tablespaces - clearly somebody else created
1357-
* them. Warn about it and ignore.
1358-
*/
1359-
ereport(WARNING,
1360-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1361-
errmsg("tablespaces are not supported on this platform")));
1362-
continue;
1363-
#endif/* HAVE_READLINK */
13641351
}
13651352
elseif (S_ISDIR(statbuf.st_mode))
13661353
{

‎src/backend/utils/adt/misc.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
302302
tablespaceOid==GLOBALTABLESPACE_OID)
303303
PG_RETURN_TEXT_P(cstring_to_text(""));
304304

305-
#if defined(HAVE_READLINK)|| defined(WIN32)
306-
307305
/*
308306
* Find the location of the tablespace by reading the symbolic link that
309307
* is in pg_tblspc/<oid>.
@@ -349,12 +347,6 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
349347
targetpath[rllen]='\0';
350348

351349
PG_RETURN_TEXT_P(cstring_to_text(targetpath));
352-
#else
353-
ereport(ERROR,
354-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
355-
errmsg("tablespaces are not supported on this platform")));
356-
PG_RETURN_NULL();
357-
#endif
358350
}
359351

360352
/*

‎src/bin/initdb/initdb.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,13 +2646,9 @@ create_xlog_or_symlink(void)
26462646
pg_fatal("could not access directory \"%s\": %m",xlog_dir);
26472647
}
26482648

2649-
#ifdefHAVE_SYMLINK
26502649
if (symlink(xlog_dir,subdirloc)!=0)
26512650
pg_fatal("could not create symbolic link \"%s\": %m",
26522651
subdirloc);
2653-
#else
2654-
pg_fatal("symlinks are not supported on this platform");
2655-
#endif
26562652
}
26572653
else
26582654
{

‎src/bin/pg_basebackup/pg_basebackup.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,12 +2763,8 @@ main(int argc, char **argv)
27632763
PQserverVersion(conn)<MINIMUM_VERSION_FOR_PG_WAL ?
27642764
"pg_xlog" :"pg_wal");
27652765

2766-
#ifdefHAVE_SYMLINK
27672766
if (symlink(xlog_dir,linkloc)!=0)
27682767
pg_fatal("could not create symbolic link \"%s\": %m",linkloc);
2769-
#else
2770-
pg_fatal("symlinks are not supported on this platform");
2771-
#endif
27722768
free(linkloc);
27732769
}
27742770

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp