*** a/src/backend/commands/tablespace.c --- b/src/backend/commands/tablespace.c *************** *** 780,785 **** destroy_tablespace_directories(Oid tablespaceoid, bool redo) --- 780,788 ---- * WAL replay (see TablespaceCreateDbspace), and it is also the case on * Windows where junction points lstat() as directories. * + * Also deal with the possibility that symlink is already removed as part + * of DROP TABLESPACE redo. + * * Note: in the redo case, we'll return true if this final step fails; * there's no point in retrying it. Also, ENOENT should provoke no more * than a warning. *************** *** 801,810 **** remove_symlink: { int saved_errno = errno; ! ereport(redo ? LOG : (saved_errno == ENOENT ? WARNING : ERROR), ! (errcode_for_file_access(), ! errmsg("could not remove symbolic link \"%s\": %m", ! linkloc))); } } --- 804,825 ---- { int saved_errno = errno; ! /* ! * If file does not exist incase of DROP TABLESPACE redo,then no ! * need to throw any LOG as it is very much valid scenario. ! */ ! if (saved_errno != ENOENT) ! { ! ereport(redo ? LOG : ERROR), ! (errcode_for_file_access(), ! errmsg("could not remove symbolic link \"%s\": %m", ! linkloc))); ! } ! else if (!redo) ! ereport(WARNING, ! (errcode_for_file_access(), ! errmsg("could not remove symbolic link \"%s\": %m", ! linkloc))); } }