Skip to content

Commit

Permalink
feat: Bump OpenDAL to 0.50.1 (#16661)
Browse files Browse the repository at this point in the history
* Save work

Signed-off-by: Xuanwo <[email protected]>

* feat: Bump OpenDAL to 0.50.1

Signed-off-by: Xuanwo <[email protected]>

* Fix cargo.lock

Signed-off-by: Xuanwo <[email protected]>

* Refactor metrics

Signed-off-by: Xuanwo <[email protected]>

* Fix build

Signed-off-by: Xuanwo <[email protected]>

* Fix header

Signed-off-by: Xuanwo <[email protected]>

* Fix build

Signed-off-by: Xuanwo <[email protected]>

* Format toml

Signed-off-by: Xuanwo <[email protected]>

* Update cargo lock

Signed-off-by: Xuanwo <[email protected]>

* Fix services for opendal

Signed-off-by: Xuanwo <[email protected]>

* Fix opendal 0.49

Signed-off-by: Xuanwo <[email protected]>

* Fix opendal compat

Signed-off-by: Xuanwo <[email protected]>

* Fix version mismatch

Signed-off-by: Xuanwo <[email protected]>

* Fix patch

Signed-off-by: Xuanwo <[email protected]>

* Add ping support in redis mock

Signed-off-by: Xuanwo <[email protected]>

* Fix hang on auto detect

Signed-off-by: Xuanwo <[email protected]>

* Ignore other errors

Signed-off-by: Xuanwo <[email protected]>

* Remove unexpected check

Signed-off-by: Xuanwo <[email protected]>

* Fix compat

Signed-off-by: Xuanwo <[email protected]>

* Format toml

Signed-off-by: Xuanwo <[email protected]>

* Use main branch of opendal_compat

Signed-off-by: Xuanwo <[email protected]>

* ignore the dir itself

Signed-off-by: Xuanwo <[email protected]>

* Fix path handling

Signed-off-by: Xuanwo <[email protected]>

* Try make sure location always end with /

Signed-off-by: Xuanwo <[email protected]>

* Revert "Try make sure location always end with /"

This reverts commit dc7eea8.

* Fix hive may return same files

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
Co-authored-by: Bohu <[email protected]>
  • Loading branch information
Xuanwo and BohuTANG authored Oct 26, 2024
1 parent 4a80ca2 commit aac746d
Show file tree
Hide file tree
Showing 20 changed files with 495 additions and 681 deletions.
213 changes: 163 additions & 50 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ criterion = "0.5"
ctor = "0.2"
dashmap = "5.4.0"
deepsize = { version = "0.2.0" }
deltalake = "0.18"
deltalake = "0.20"
derive-visitor = { version = "0.4.0", features = ["std-types-drive"] }
derive_more = "0.99.17"
enumflags2 = { version = "0.7.7", features = ["serde"] }
Expand All @@ -256,7 +256,7 @@ mysql_async = { version = "0.34", default-features = false, features = ["native-
object_store_opendal = "0.46"
once_cell = "1.15.0"
openai_api_rust = "0.1"
opendal = { version = "0.49.0", features = [
opendal = { version = "0.50.1", features = [
"layers-fastrace",
"layers-prometheus-client",
"layers-async-backtrace",
Expand All @@ -275,6 +275,7 @@ opendal = { version = "0.49.0", features = [
"services-huggingface",
"services-redis",
] }
opendal_compat = { version = "1" }
openraft = { git = "https://github.com/drmingdrmer/openraft", tag = "v0.10.0-alpha.6", features = [
"serde",
"tracing-log",
Expand Down Expand Up @@ -413,14 +414,18 @@ backtrace = { git = "https://github.com/rust-lang/backtrace-rs.git", rev = "7226
"serialize-serde",
] }
color-eyre = { git = "https://github.com/eyre-rs/eyre.git", rev = "e5d92c3" }
deltalake = { git = "https://github.com/delta-io/delta-rs", rev = "57795da" }
ethnum = { git = "https://github.com/datafuse-extras/ethnum-rs", rev = "4cb05f1" }
jsonb = { git = "https://github.com/databendlabs/jsonb", rev = "ada713c" }
openai_api_rust = { git = "https://github.com/datafuse-extras/openai-api", rev = "819a0ed" }
opendal_compat = { git = "https://github.com/apache/opendal", rev = "f6e60f6" }
orc-rust = { git = "https://github.com/datafuse-extras/datafusion-orc", rev = "03372b97" }
recursive = { git = "https://github.com/datafuse-extras/recursive.git", rev = "6af35a1" }
sled = { git = "https://github.com/datafuse-extras/sled", tag = "v0.34.7-datafuse.1" }
tantivy = { git = "https://github.com/datafuse-extras/tantivy", rev = "7502370" }
tantivy-common = { git = "https://github.com/datafuse-extras/tantivy", rev = "7502370", package = "tantivy-common" }
tantivy-jieba = { git = "https://github.com/datafuse-extras/tantivy-jieba", rev = "0e300e9" }
xorfilter-rs = { git = "https://github.com/datafuse-extras/xorfilter", tag = "databend-alpha.4" }

# This patch makes sure opendal_compat also used the same version of opendal instead of git one.
[patch.'https://github.com/apache/opendal']
opendal = { version = "0.50.1" }
2 changes: 2 additions & 0 deletions src/common/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ prometheus-parse = "0.2.3"
rand = { workspace = true, features = ["serde1"] }
regex = { workspace = true }
replace_with = "0.1.7"
reqwest = { workspace = true }
reqwest-hickory-resolver = { workspace = true }
rustix = "0.38.37"
semver = { workspace = true }
serde = { workspace = true }
Expand Down
88 changes: 88 additions & 0 deletions src/common/base/src/http_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::env;
use std::sync::Arc;
use std::sync::LazyLock;
use std::time::Duration;

use reqwest_hickory_resolver::HickoryResolver;

/// Global shared hickory resolver.
static GLOBAL_HICKORY_RESOLVER: LazyLock<Arc<HickoryResolver>> =
LazyLock::new(|| Arc::new(HickoryResolver::default()));

/// Global shared http client.
///
/// Please create your own http client if you want dedicated http connection pool.
pub static GLOBAL_HTTP_CLIENT: LazyLock<HttpClient> = LazyLock::new(HttpClient::new);

/// HttpClient that used by databend.
pub struct HttpClient {
client: reqwest::Client,
}

impl Default for HttpClient {
fn default() -> Self {
Self::new()
}
}

impl HttpClient {
/// Create a new http client.
///
/// # Notes
///
/// This client is optimized for interact with storage services.
/// Please tune the settings if you want to use it for other purposes.
pub fn new() -> Self {
let mut builder = reqwest::ClientBuilder::new();

// Disable http2 for better performance.
builder = builder.http1_only();

// Set dns resolver.
builder = builder.dns_resolver(GLOBAL_HICKORY_RESOLVER.clone());

// Pool max idle per host controls connection pool size.
// Default to no limit, set to `0` for disable it.
let pool_max_idle_per_host = env::var("_DATABEND_INTERNAL_POOL_MAX_IDLE_PER_HOST")
.ok()
.and_then(|v| v.parse::<usize>().ok())
.unwrap_or(usize::MAX);
builder = builder.pool_max_idle_per_host(pool_max_idle_per_host);

// Connect timeout default to 30s.
let connect_timeout = env::var("_DATABEND_INTERNAL_CONNECT_TIMEOUT")
.ok()
.and_then(|v| v.parse::<u64>().ok())
.unwrap_or(30);
builder = builder.connect_timeout(Duration::from_secs(connect_timeout));

// Enable TCP keepalive if set.
if let Ok(v) = env::var("_DATABEND_INTERNAL_TCP_KEEPALIVE") {
if let Ok(v) = v.parse::<u64>() {
builder = builder.tcp_keepalive(Duration::from_secs(v));
}
}

let client = builder.build().expect("http client must be created");
HttpClient { client }
}

/// Get the inner reqwest client.
pub fn inner(&self) -> reqwest::Client {
self.client.clone()
}
}
1 change: 1 addition & 0 deletions src/common/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub mod containers;
pub mod display;
pub mod future;
pub mod headers;
pub mod http_client;
pub mod mem_allocator;
pub mod rangemap;
pub mod runtime;
Expand Down
2 changes: 0 additions & 2 deletions src/common/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ opendal = { workspace = true }
parquet = { workspace = true }
prometheus-client = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }
reqwest-hickory-resolver = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

Expand Down
Loading

0 comments on commit aac746d

Please sign in to comment.