fix bug of access database flat file concurrently
@@ -982,10 +982,19 @@ DatabaseInfo_Scan(
if(IsLocalPath(fromfile)){//on local disk
struct stat fst;
- if (lstat(fromfile, &fst) < 0)
+ if (lstat(fromfile, &fst) < 0) {
+ if (errno != ENOENT)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m", fromfile)));
+ /*
+ * If the file went away while scanning, it's no error.
+ * This could happen especillay with shared relcache init file
+ * that is stored in global tablespace.
+ */
+ elog(LOG, "skipping missing file %s", fromfile);
+ continue;
+ }
if (S_ISDIR(fst.st_mode))
{
