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

fix(query): Fix compressed buf not consumed correctly #5727

Merged
merged 13 commits into from
Jun 4, 2022
47 changes: 19 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/contexts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,5 +12,5 @@ test = false
common-base = { path = "../base" }

async-trait = "0.1.53"
opendal = { version = "0.7.1", features = ["retry"] }
opendal = { version = "0.7.2", features = ["retry"] }
time = "0.3.9"
2 changes: 1 addition & 1 deletion common/io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ chrono = "0.4.19"
chrono-tz = "0.6.1"
futures = "0.3.21"
lexical-core = "0.8.2"
opendal = { version = "0.7.1", features = ["retry"] }
opendal = { version = "0.7.2", features = ["retry"] }
serde = { version = "1.0.136", features = ["derive"] }
time = "0.3.9"

2 changes: 1 addition & 1 deletion common/streams/Cargo.toml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ async-trait = "0.1.53"
chrono-tz = "0.6.1"
csv-async = "1.2.4"
futures = "0.3.21"
opendal = { version = "0.7.1", features = ["retry", "compress"] }
opendal = { version = "0.7.2", features = ["retry", "compress"] }
pin-project-lite = "0.2.8"
serde_json = { version = "1.0.79", default-features = false, features = ["preserve_order"] }
tempfile = "3.3.0"
2 changes: 1 addition & 1 deletion query/Cargo.toml
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ num = "0.4.0"
num_cpus = "1.13.1"
octocrab = "0.15.4"
once_cell = "1.10.0"
opendal = { version = "0.7.1", features = ["retry", "compress"] }
opendal = { version = "0.7.2", features = ["retry", "compress"] }
openssl = { version = "0.10", features = ["vendored"] }
paste = "1.0.7"
petgraph = "0.6.0"
6 changes: 3 additions & 3 deletions query/src/servers/http/v1/sequential_format_source.rs
Original file line number Diff line number Diff line change
@@ -225,7 +225,9 @@ impl Processor for SequentialInputFormatSource {
let data = match &mut self.input_decompress {
None => data,
Some(decompress) => {
let mut output = Vec::new();
// Alloc with 10 times of input data at once to avoid too many alloc.
let mut output = Vec::with_capacity(10 * data.len());
let mut buf = vec![0; 1024 * 1024];
let mut amt = 0;

loop {
@@ -240,7 +242,6 @@ impl Processor for SequentialInputFormatSource {
amt += read;
}
DecompressState::Decoding => {
let mut buf = vec![0; 4 * 1024 * 1024];
let written = decompress.decode(&mut buf).map_err(|e| {
ErrorCode::InvalidCompressionData(format!(
"compression data invalid: {e}"
@@ -249,7 +250,6 @@ impl Processor for SequentialInputFormatSource {
output.extend_from_slice(&buf[..written])
}
DecompressState::Flushing => {
let mut buf = vec![0; 4 * 1024 * 1024];
let written = decompress.finish(&mut buf).map_err(|e| {
ErrorCode::InvalidCompressionData(format!(
"compression data invalid: {e}"
2 changes: 1 addition & 1 deletion query/src/sessions/session_mgr.rs
Original file line number Diff line number Diff line change
@@ -367,7 +367,7 @@ impl SessionManager {
let op = op.with_backoff(backon::ExponentialBackoff::default());
// OpenDAL will send a real request to underlying storage to check whether it works or not.
// If this check failed, it's highly possible that the users have configured it wrongly.
op.check().await.map_err(|e| {
op.check(".databend").await.map_err(|e| {
ErrorCode::StorageUnavailable(format!(
"current configured storage is not available: {e}"
))