Skip to content

[PBCKP-564] Don't spam with "skip empty file" message #36

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions ptrack.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -322,14 +322,22 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)

if (sret < 0)
{
ereport(LOG,
ereport(WARNING,
(errcode_for_file_access(),
errmsg("ptrack: could not stat file \"%s\": %m", subpath)));
continue;
}

if (S_ISREG(fst.st_mode))
{
if (fst.st_size == 0)
{
elog(DEBUG3, "ptrack: skip empty file %s", subpath);

/* But try the next one */
continue;
}

/* Regular file inside database directory, otherwise skip it */
if (dbOid != InvalidOid || spcOid == GLOBALTABLESPACE_OID)
{
Expand DownExpand Up@@ -406,6 +414,8 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
RelFileNodeBackend rnodebackend;
#endif

get_next:

/* No more file in the list */
if (list_length(ctx->filelist) == 0)
return -1;
Expand DownExpand Up@@ -440,15 +450,15 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
elog(WARNING, "ptrack: cannot stat file %s", fullpath);

/* But try the next one */
return ptrack_filelist_getnext(ctx);
goto get_next;
}

if (fst.st_size == 0)
{
elog(WARNING, "ptrack: skip empty file %s", fullpath);
elog(DEBUG3, "ptrack: skip empty file %s", fullpath);

/* But try the next one */
return ptrack_filelist_getnext(ctx);
goto get_next;
}

#if CFS_SUPPORT
Expand All@@ -460,7 +470,7 @@ ptrack_filelist_getnext(PtScanCtx * ctx)

// Could not open fullpath for some reason, trying the next file.
if(rel_st_size == -1)
return ptrack_filelist_getnext(ctx);
goto get_next;
} else
#endif
rel_st_size = fst.st_size;
Expand Down