Skip to content

Commit

Permalink
NSFS | GPFS | fix put object over null version in suspended mode
Browse files Browse the repository at this point in the history
Signed-off-by: nadav mizrahi <[email protected]>
  • Loading branch information
nadavMiz committed Sep 19, 2024
1 parent 3c8a29a commit 99ab82c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,22 +1420,24 @@ class NamespaceFS {
const versioned_info = latest_ver_info && await this._get_version_info(fs_context, versioned_path);

gpfs_options = is_gpfs ?
await this._open_files_gpfs(fs_context, new_ver_tmp_path, latest_ver_path, upload_file,
latest_ver_info, open_mode, undefined, versioned_info) :
undefined;
await this._open_files_gpfs(fs_context, new_ver_tmp_path, latest_ver_path, upload_file,
latest_ver_info, open_mode, undefined, versioned_info) :
undefined;

const bucket_tmp_dir_path = this.get_bucket_tmpdir_full_path();
dbg.log1('Namespace_fs._move_to_dest_version:', latest_ver_info, new_ver_info, gpfs_options);

if (this._is_versioning_suspended()) {
if (latest_ver_info?.version_id_str === NULL_VERSION_ID) {
//on GPFS safe_move overrides the latest object so no need to unlink
if (!is_gpfs && latest_ver_info?.version_id_str === NULL_VERSION_ID) {
dbg.log1('NamespaceFS._move_to_dest_version suspended: version ID of the latest version is null - the file will be unlinked');
await native_fs_utils.safe_unlink(fs_context, latest_ver_path, latest_ver_info,
gpfs_options?.delete_version, bucket_tmp_dir_path);
await native_fs_utils.safe_unlink(fs_context, latest_ver_path, latest_ver_info, undefined, bucket_tmp_dir_path);
} else {
// remove a version (or delete marker) with null version ID from .versions/ (if exists)
await this._delete_null_version_from_versions_directory(key, fs_context);
}
}

if (latest_ver_info &&
((this._is_versioning_enabled()) ||
(this._is_versioning_suspended() && latest_ver_info.version_id_str !== NULL_VERSION_ID))) {
Expand Down

0 comments on commit 99ab82c

Please sign in to comment.