This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git


The following commit(s) were added to refs/heads/master by this push:
     new 187e98e9c HAWQ-1843. fix bug of access database flat file concurrently
187e98e9c is described below

commit 187e98e9c14baecd09e607304d82c50f808df2b4
Author: ztao1987 <zhenglin.ta...@gmail.com>
AuthorDate: Sat Jul 16 00:23:50 2022 +0800

    HAWQ-1843. fix bug of access database flat file concurrently
---
 src/backend/cdb/cdbdatabaseinfo.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/backend/cdb/cdbdatabaseinfo.c 
b/src/backend/cdb/cdbdatabaseinfo.c
index d49219b39..0d24e25fc 100644
--- a/src/backend/cdb/cdbdatabaseinfo.c
+++ b/src/backend/cdb/cdbdatabaseinfo.c
@@ -982,10 +982,19 @@ DatabaseInfo_Scan(
                if(IsLocalPath(fromfile)){//on local disk
                        struct stat fst;
                        
-                       if (lstat(fromfile, &fst) < 0)
-                               ereport(ERROR,
-                                               (errcode_for_file_access(),
-                                                errmsg("could not stat file 
\"%s\": %m", fromfile)));
+                       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))
                        {

Reply via email to