pg_ls_dir_files issue with concurrent file unlink
От | Sergei Kornilov |
---|---|
Тема | pg_ls_dir_files issue with concurrent file unlink |
Дата | |
Msg-id | 52030281541150710@myt6-27270b78ac4f.qloud-c.yandex.net обсуждение исходный текст |
Список | pgsql-hackers |
Hello We have some functions for directory listing, e.g. pg_ls_dir, pg_ls_logdir, pg_ls_waldir. All of them call pg_ls_dir_filesfunction (src/backend/utils/adt/genfile.c) and i have question about per file error in this function. > /* Get the file info */ > snprintf(path, sizeof(path), "%s/%s", fctx->location, de->d_name); > if (stat(path, &attrib) < 0) > ereport(ERROR, > (errcode_for_file_access(), > errmsg("could not stat directory \"%s\": %m", dir))); We tried stat file in direectory, but error say only about directory. For example it is possible have very unexpected (andfearful) error for pg_ls_dir during checkpoint: > postgres=# SELECT sum(size) AS size_bytes FROM pg_ls_waldir(); > ERROR: could not stat directory "pg_wal": No such file or directory It is expected? Maybe it is better skip ENOENT files during directory listing? Or change error to "could not stat file indirectory \"%s\"" if we do not want report filename for some reason. Or report error for file path instead of dir. regards, Sergei
В списке pgsql-hackers по дате отправления: