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

Suggestion for change #22073

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sharma-shray
Copy link

Summary

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Please read our Vector contributor resources.
  • [] If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run dd-rust-license-tool write to regenerate the license inventory and commit the changes (if any). More details here.

References

@sharma-shray sharma-shray requested a review from a team as a code owner December 21, 2024 18:41
@bits-bot
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sharma-shray ,

Can you explain the intent of these changes? It is unclear to me.

Comment on lines -295 to +300
// WARN: The paired `BufReader::consume` is not called intentionally. If we
// do we'll chop a decent part of the potential gzip stream off.
Ok(header_bytes.starts_with(GZIP_MAGIC))
if header_bytes.starts_with(GZIP_MAGIC) {
r.consume(GZIP_MAGIC.len()); // To avoid interfering with the next read
Ok(true)
} else {
Ok(false)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong. is_gzipped should just be checking if the stream is gzip and not consuming any bytes, as the comment says.

Comment on lines +267 to -281
// Load the current state of the tables (this is a lock-free operation).
let tables = tables.load();
match **tables {
Some(ref tables) => {
let mut tables = tables.iter().fold(String::from("("), |mut s, (key, _)| {
s.push_str(key);
s.push_str(", ");
s
});

tables.truncate(std::cmp::max(tables.len(), 0));
tables.push(')');

write!(f, "{} {}", name, tables)
// Check if the tables are loaded or still in the loading state.
match &**tables {
Some(ref tables) => {
// Map the keys to &str and join them with a comma.
let table_names = tables
.keys()
.map(|s| s.as_str())
.collect::<Vec<_>>()
.join(", ");
write!(f, "{} ({})", name, table_names)
}
None => {
// If the tables are still loading, indicate the loading state.
write!(f, "{} loading", name)
}
None => write!(f, "{} loading", name),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intent of this change?

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 this pull request may close these issues.

3 participants