Skip to content

Commit

Permalink
prevent issue report on read_object_md if the object doesn't exist
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Srivastava <[email protected]>

add todo comment to be able to handle GLACIER objects

Signed-off-by: Utkarsh Srivastava <[email protected]>
(cherry picked from commit ea8d44c)
(cherry picked from commit 835063d)
  • Loading branch information
tangledbytes committed Dec 9, 2024
1 parent bb2a33c commit 51ce748
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
16 changes: 11 additions & 5 deletions src/sdk/namespace_blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,17 @@ class NamespaceBlob {
} catch (err) {
this._translate_error_code(err);
dbg.warn('NamespaceBlob.read_object_md:', inspect(err));
object_sdk.rpc_client.pool.update_issues_report({
namespace_resource_id: this.namespace_resource_id,
error_code: err.code || (err.details && err.details.errorCode) || 'InternalError',
time: Date.now(),
});

// It's totally expected to issue `HeadObject` against an object that doesn't exist
// this shouldn't be counted as an issue for the namespace store
if (err.rpc_code !== 'NO_SUCH_OBJECT') {
object_sdk.rpc_client.pool.update_issues_report({
namespace_resource_id: this.namespace_resource_id,
error_code: err.code || (err.details && err.details.errorCode) || 'InternalError',
time: Date.now(),
});
}

throw err;
}
}
Expand Down
20 changes: 15 additions & 5 deletions src/sdk/namespace_s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,21 @@ class NamespaceS3 {
} catch (err) {
this._translate_error_code(params, err);
dbg.warn('NamespaceS3.read_object_md:', inspect(err));
object_sdk.rpc_client.pool.update_issues_report({
namespace_resource_id: this.namespace_resource_id,
error_code: String(err.code),
time: Date.now(),
});

// It's totally expected to issue `HeadObject` against an object that doesn't exist
// this shouldn't be counted as an issue for the namespace store
//
// @TODO: Another error to tolerate is 'InvalidObjectState'. This shouldn't also
// result in IO_ERROR for the namespace however that means we can not do `getObject`
// even when `can_use_get_inline` is true.
if (err.rpc_code !== 'NO_SUCH_OBJECT') {
object_sdk.rpc_client.pool.update_issues_report({
namespace_resource_id: this.namespace_resource_id,
error_code: String(err.code),
time: Date.now(),
});
}

throw err;
}
}
Expand Down

0 comments on commit 51ce748

Please sign in to comment.