Skip to content

Commit 397d025

Browse files
authored
Make dir::Size() ignore deleted files. (#1267)
Cache is the only thing we currently need to check size. During compaction leveldb moves files around. lstat() will return an error if current file is removed. In such cases dir::Size() returns 0 making it impossible to use the method for `live` cache. The issue is related only to unix systems, windows workflow shoud be fine. Resolves: OAM-1303 Signed-off-by: Kostiantyn Zvieriev <[email protected]>
1 parent f4add0a commit 397d025

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

olp-cpp-sdk-core/src/utils/Dir.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ uint64_t Dir::Size(const std::string& path, FilterFunction filter_fn) {
467467
default:
468468
break;
469469
}
470-
} else {
470+
} else if (errno != ENOENT) {
471+
// Ignore ENOENT errors as its a common case, e.g. cache compaction.
471472
result = 0;
472473
break;
473474
}

0 commit comments

Comments
 (0)