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

Builder: file dump order does not match prefetch list #1488

Closed
hangvane opened this issue Nov 21, 2023 · 0 comments · Fixed by #1492
Closed

Builder: file dump order does not match prefetch list #1488

hangvane opened this issue Nov 21, 2023 · 0 comments · Fixed by #1492

Comments

@hangvane
Copy link
Contributor

Additional Information

The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all.

The order of files/paths in the provided prefetch list is not used to guide the file dump order currently, since the dump order is built by iterating Tree and check if node is in the prefetch list;

if !child_node.is_dir() && ctx.fs_version.is_v6() {
child_node.v6_set_offset(bootstrap_ctx, v6_hardlink_offset, block_size)?;
}
ctx.prefetch.insert_if_need(&child.node, child_node.deref());
if child_node.is_dir() {
dirs.push(child);
}
}

Besides, the tree is iterated at least two times. For the first time is to build prefetch.files:

Self::build_rafs(ctx, bootstrap_ctx, dir)?;

For the second time is to classify the nodes in tree into prefetch and non-prefetch, with the need of prefetch.files to be BTreeMap for supporting random searching:

tree.walk_bfs(true, &mut |n| -> Result<()> {
let node = n.lock_node();
// Ignore lower layer node when dump blob
if !prefetch.contains(node.deref()) && Self::should_dump_node(node.deref()) {
inodes.push(n.node.clone());
}
Ok(())
})?;

Seems it's better to iterate tree only once to build the prefetch Vec<Node> and non-prefetch Vec<Node> in build_rafs(), and then sort the prefetch Vec<Node> by the order of the provided prefetch list.

hangvane added a commit to hangvane/image-service that referenced this issue Nov 22, 2023


1. The dump order for prefetch files does not match the order specified in prefetch list,
so let's fix it.
2. The construction of `Prefetch` is slow due to inefficient matching of prefetch patterns,
By adopting a more efficient data structure, this process has been accelerated.
3. Unit tests for prefetch are added.

Signed-off-by: Wenhao Ren <[email protected]>
hangvane added a commit to hangvane/image-service that referenced this issue Nov 22, 2023


1. The dump order for prefetch files does not match the order specified in prefetch list,
so let's fix it.
2. The construction of `Prefetch` is slow due to inefficient matching of prefetch patterns,
By adopting a more efficient data structure, this process has been accelerated.
3. Unit tests for prefetch are added.

Signed-off-by: Wenhao Ren <[email protected]>
jiangliu pushed a commit that referenced this issue Nov 27, 2023
1. The dump order for prefetch files does not match the order specified in prefetch list,
so let's fix it.
2. The construction of `Prefetch` is slow due to inefficient matching of prefetch patterns,
By adopting a more efficient data structure, this process has been accelerated.
3. Unit tests for prefetch are added.

Signed-off-by: Wenhao Ren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant