Skip to content
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

NSFS | Improve list objects performance on top of NS FS (PR 2/3) #8422

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,9 @@ config.NSFS_GLACIER_MIGRATE_INTERVAL = 15 * 60 * 1000;
// of `manage_nsfs glacier restore`
config.NSFS_GLACIER_RESTORE_INTERVAL = 15 * 60 * 1000;

// enable/disable unsorted listing application level
config.NSFS_LIST_OBJECTS_V2_UNSORTED_ENABLED = false;

// NSFS_GLACIER_EXPIRY_RUN_TIME must be of the format hh:mm which specifies
// when NooBaa should allow running glacier expiry process
// NOTE: This will also be in the same timezone as specified in
Expand Down
6 changes: 6 additions & 0 deletions src/api/object_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ module.exports = {
limit: {
type: 'integer'
},
list_type: {
type: 'string',
},
}
},
reply: {
Expand Down Expand Up @@ -777,6 +780,9 @@ module.exports = {
limit: {
type: 'integer'
},
list_type: {
type: 'string',
},
}
},
reply: {
Expand Down
1 change: 1 addition & 0 deletions src/endpoint/s3/ops/s3_get_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ async function get_bucket(req) {
bucket: req.params.bucket,
prefix: req.query.prefix,
delimiter: req.query.delimiter,
list_type: list_type,
limit: Math.min(max_keys_received, 1000),
key_marker: list_type === '2' ?
(s3_utils.cont_tok_to_key_marker(cont_tok) || start_after) : req.query.marker,
Expand Down
2 changes: 1 addition & 1 deletion src/native/fs/fs_napi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@ struct TellDir : public FSWrapWorker<DirWrap>
}
virtual void OnOK()
{
DBG0("FS::Telldir::OnOK: " << DVAL(_wrap->_path) << DVAL(_tell_res));
DBG1("FS::Telldir::OnOK: " << DVAL(_wrap->_path) << DVAL(_tell_res));
Napi::Env env = Env();
auto res = Napi::BigInt::New(env, _tell_res);
_deferred.Resolve(res);
Expand Down
50 changes: 50 additions & 0 deletions src/sdk/keymarker_fs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* Copyright (C) 2020 NooBaa */
'use strict';

class KeyMarkerFS {
constructor({ marker, marker_pos, pre_dir, pre_dir_pos }, is_unsorted = false) {
this.marker = marker;
this.marker_pos = marker_pos.toString();
this.pre_dir = pre_dir;
this.pre_dir_pos = pre_dir_pos;
this.key_marker_value = marker;
this.current_dir = '';
this.is_unsorted = is_unsorted;
this.last_pre_dir = '';
this.last_pre_dir_position = '';
if (is_unsorted) {
this.current_dir = pre_dir.length > 0 && marker.includes('/') ?
marker.substring(0, marker.lastIndexOf('/') + 1) : '';
}
}

async update_key_marker(marker, marker_pos) {
this.marker = marker;
this.marker_pos = marker_pos;
this.key_marker_value = marker;
}

async get_previour_dir_length() {
return this.pre_dir.length;
}

async get_previour_dir_info() {
return {
pre_dir_path: this.pre_dir.pop(),
pre_dir_position: this.pre_dir_pos.pop(),
};
}

async add_previour_dir(pre_dir, pre_dir_pos) {
this.pre_dir.push(pre_dir);
this.pre_dir_pos.push(pre_dir_pos.toString());
}

async update_last_previour_dir(last_pre_dir, last_pre_dir_position) {
this.last_pre_dir = last_pre_dir;
this.last_pre_dir_position = last_pre_dir_position;
}
}

// EXPORTS
module.exports = KeyMarkerFS;
48 changes: 48 additions & 0 deletions src/sdk/list_object_fs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* Copyright (C) 2020 NooBaa */
'use strict';


class ListObjectFS {
constructor({fs_context, list_versions, keymarker, prefix_dir_key, is_truncated, delimiter, prefix,
version_id_marker, list_type, results, limit, skip_list, key_marker}) {
this.fs_context = fs_context;
this.keymarker = keymarker;
this.prefix_dir_key = prefix_dir_key;
this.is_truncated = is_truncated;
this.delimiter = delimiter;
this.prefix = prefix;
this.version_id_marker = version_id_marker;
this.list_type = list_type;
this.results = results;
this.limit = limit;
this.skip_list = skip_list;
this.prefix_ent = '';
this.marker_dir = '';
this.param_key_marker = key_marker;
this.list_versions = list_versions;
}

async update_process_dir_properties(prefix_ent, marker_curr, dir_path) {
this.prefix_ent = prefix_ent;
this.dir_path = dir_path;
}

async update_is_truncated(is_truncated) {
this.is_truncated = is_truncated;
}

async get_is_truncated() {
return this.is_truncated;
}

async update_keymarker(keymarker) {
this.keymarker = keymarker;
}

async get_keymarker() {
return this.keymarker;
}
}

// EXPORTS
module.exports = ListObjectFS;
Loading
Loading