Skip to content

Commit c973335

Browse files
committed
NSFS | Improve list objects performance on top of NS FS
Signed-off-by: naveenpaul1 <[email protected]>
1 parent 1d52ffb commit c973335

13 files changed

+1750
-1058
lines changed

config.js

+3
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,9 @@ config.NSFS_GLACIER_MIGRATE_INTERVAL = 15 * 60 * 1000;
843843
// of `manage_nsfs glacier restore`
844844
config.NSFS_GLACIER_RESTORE_INTERVAL = 15 * 60 * 1000;
845845

846+
// enable/disable unsorted listing application level
847+
config.NSFS_LIST_OBJECTS_V2_UNSORTED_ENABLED = false;
848+
846849
// NSFS_GLACIER_EXPIRY_RUN_TIME must be of the format hh:mm which specifies
847850
// when NooBaa should allow running glacier expiry process
848851
// NOTE: This will also be in the same timezone as specified in

src/api/object_api.js

+6
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ module.exports = {
723723
limit: {
724724
type: 'integer'
725725
},
726+
list_type: {
727+
type: 'string',
728+
},
726729
}
727730
},
728731
reply: {
@@ -777,6 +780,9 @@ module.exports = {
777780
limit: {
778781
type: 'integer'
779782
},
783+
list_type: {
784+
type: 'string',
785+
},
780786
}
781787
},
782788
reply: {

src/endpoint/s3/ops/s3_get_bucket.js

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ async function get_bucket(req) {
4141
bucket: req.params.bucket,
4242
prefix: req.query.prefix,
4343
delimiter: req.query.delimiter,
44+
list_type: list_type,
4445
limit: Math.min(max_keys_received, 1000),
4546
key_marker: list_type === '2' ?
4647
(s3_utils.cont_tok_to_key_marker(cont_tok) || start_after) : req.query.marker,

src/native/fs/fs_napi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ struct TellDir : public FSWrapWorker<DirWrap>
21052105
}
21062106
virtual void OnOK()
21072107
{
2108-
DBG0("FS::Telldir::OnOK: " << DVAL(_wrap->_path) << DVAL(_tell_res));
2108+
DBG1("FS::Telldir::OnOK: " << DVAL(_wrap->_path) << DVAL(_tell_res));
21092109
Napi::Env env = Env();
21102110
auto res = Napi::BigInt::New(env, _tell_res);
21112111
_deferred.Resolve(res);

src/sdk/keymarker_fs.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* Copyright (C) 2020 NooBaa */
2+
'use strict';
3+
4+
class KeyMarkerFS {
5+
constructor({ marker, marker_pos, pre_dir, pre_dir_pos }, is_unsorted = false) {
6+
this.marker = marker;
7+
this.marker_pos = marker_pos.toString();
8+
this.pre_dir = pre_dir;
9+
this.pre_dir_pos = pre_dir_pos;
10+
this.key_marker_value = marker;
11+
this.current_dir = '';
12+
this.is_unsorted = is_unsorted;
13+
this.last_pre_dir = '';
14+
this.last_pre_dir_position = '';
15+
if (is_unsorted) {
16+
this.current_dir = pre_dir.length > 0 && marker.includes('/') ?
17+
marker.substring(0, marker.lastIndexOf('/') + 1) : '';
18+
}
19+
}
20+
21+
async update_key_marker(marker, marker_pos) {
22+
this.marker = marker;
23+
this.marker_pos = marker_pos;
24+
this.key_marker_value = marker;
25+
}
26+
27+
async get_previour_dir_length() {
28+
return this.pre_dir.length;
29+
}
30+
31+
async get_previour_dir_info() {
32+
return {
33+
pre_dir_path: this.pre_dir.pop(),
34+
pre_dir_position: this.pre_dir_pos.pop(),
35+
};
36+
}
37+
38+
async add_previour_dir(pre_dir, pre_dir_pos) {
39+
this.pre_dir.push(pre_dir);
40+
this.pre_dir_pos.push(pre_dir_pos.toString());
41+
}
42+
43+
async update_last_previour_dir(last_pre_dir, last_pre_dir_position) {
44+
this.last_pre_dir = last_pre_dir;
45+
this.last_pre_dir_position = last_pre_dir_position;
46+
}
47+
}
48+
49+
// EXPORTS
50+
module.exports = KeyMarkerFS;

src/sdk/list_object_fs.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Copyright (C) 2020 NooBaa */
2+
'use strict';
3+
4+
5+
class ListObjectFS {
6+
constructor({fs_context, list_versions, keymarker, prefix_dir_key, is_truncated, delimiter, prefix,
7+
version_id_marker, list_type, results, limit, skip_list, key_marker}) {
8+
this.fs_context = fs_context;
9+
this.keymarker = keymarker;
10+
this.prefix_dir_key = prefix_dir_key;
11+
this.is_truncated = is_truncated;
12+
this.delimiter = delimiter;
13+
this.prefix = prefix;
14+
this.version_id_marker = version_id_marker;
15+
this.list_type = list_type;
16+
this.results = results;
17+
this.limit = limit;
18+
this.skip_list = skip_list;
19+
this.prefix_ent = '';
20+
this.marker_dir = '';
21+
this.param_key_marker = key_marker;
22+
this.list_versions = list_versions;
23+
}
24+
25+
async update_process_dir_properties(prefix_ent, marker_curr, dir_path) {
26+
this.prefix_ent = prefix_ent;
27+
this.dir_path = dir_path;
28+
}
29+
30+
async update_is_truncated(is_truncated) {
31+
this.is_truncated = is_truncated;
32+
}
33+
34+
async get_is_truncated() {
35+
return this.is_truncated;
36+
}
37+
38+
async update_keymarker(keymarker) {
39+
this.keymarker = keymarker;
40+
}
41+
42+
async get_keymarker() {
43+
return this.keymarker;
44+
}
45+
}
46+
47+
// EXPORTS
48+
module.exports = ListObjectFS;

0 commit comments

Comments
 (0)