Skip to content

NSFS | NC | fix versions_dir_cache validation #8321

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 14 additions & 10 deletions src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,17 +399,21 @@ const versions_dir_cache = new LRUCache({
},
validate: async ({ stat, ver_dir_stat }, { dir_path, fs_context }) => {
const new_stat = await nb_native().fs.stat(fs_context, dir_path);
if (ver_dir_stat) {
const versions_dir_path = path.normalize(path.join(dir_path, '/', HIDDEN_VERSIONS_PATH));
const new_versions_stat = await nb_native().fs.stat(fs_context, versions_dir_path);
return (new_stat.ino === stat.ino &&
new_stat.mtimeNsBigint === stat.mtimeNsBigint &&
new_versions_stat.ino === ver_dir_stat.ino &&
new_versions_stat.mtimeNsBigint === ver_dir_stat.mtimeNsBigint);
} else {
return (new_stat.ino === stat.ino &&
new_stat.mtimeNsBigint === stat.mtimeNsBigint);
const versions_dir_path = path.normalize(path.join(dir_path, '/', HIDDEN_VERSIONS_PATH));
let new_versions_stat;
try {
new_versions_stat = await nb_native().fs.stat(fs_context, versions_dir_path);
} catch (err) {
if (err.code === 'ENOENT') {
dbg.log0('NamespaceFS: Version dir not found, ', versions_dir_path);
} else {
throw err;
}
}
return (new_stat.ino === stat.ino &&
new_stat.mtimeNsBigint === stat.mtimeNsBigint &&
new_versions_stat?.ino === ver_dir_stat?.ino &&
new_versions_stat?.mtimeNsBigint === ver_dir_stat?.mtimeNsBigint);
},
item_usage: ({ usage }, dir_path) => usage,
max_usage: config.NSFS_DIR_CACHE_MAX_TOTAL_SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ s3tests_boto3/functional/test_s3.py::test_multipart_upload_missing_part
s3tests_boto3/functional/test_s3.py::test_multipart_upload_incorrect_etag
s3tests_boto3/functional/test_s3.py::test_set_bucket_tagging
s3tests_boto3/functional/test_s3.py::test_atomic_dual_conditional_write_1mb
s3tests_boto3/functional/test_s3.py::test_versioning_obj_create_read_remove
s3tests_boto3/functional/test_s3.py::test_versioning_obj_create_versions_remove_all
s3tests_boto3/functional/test_s3.py::test_versioning_obj_create_versions_remove_special_names
s3tests_boto3/functional/test_s3.py::test_versioned_concurrent_object_create_concurrent_remove
s3tests_boto3/functional/test_s3.py::test_encrypted_transfer_1b
s3tests_boto3/functional/test_s3.py::test_encrypted_transfer_1kb
Expand Down