Skip to content

Commit

Permalink
chore: patch enterprise back to core (#25798)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltontj authored Jan 11, 2025
1 parent e421baf commit 0bdc2fa
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 100 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

14 changes: 9 additions & 5 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Configuration documentation:
#  https://embarkstudios.github.io/cargo-deny/index.html
# https://embarkstudios.github.io/cargo-deny/index.html

[advisories]
version = 2
yanked = "deny"
ignore = [
# dependent on datafusion-common moving away from instant
Expand All @@ -11,6 +12,8 @@ ignore = [
git-fetch-with-cli = true

[licenses]
version = 2
unused-allowed-license = "warn"
allow = [
"Apache-2.0",
"BSD-2-Clause",
Expand All @@ -22,7 +25,6 @@ allow = [
"Unicode-3.0",
"Zlib",
]

exceptions = [
# We should probably NOT bundle CA certs but use the OS ones.
{ name = "webpki-roots", allow = ["MPL-2.0"] },
Expand All @@ -41,10 +43,10 @@ license-files = [
github = ["influxdata"]

[bans]
multiple-versions = "warn"
multiple-versions = "allow"
deny = [
# We are using rustls as the TLS implementation, so we shouldn't be linking
# in OpenSSL too.
# We are using rustls as the TLS implementation, so we shouldn't be linking
# in OpenSSL too.
#
# If you're hitting this, you might want to take a look at what new
# dependencies you have introduced and check if there's a way to depend on
Expand All @@ -53,4 +55,6 @@ deny = [
# We've decided to use the `humantime` crate to parse and generate friendly time formats; use
# that rather than chrono-english.
{ name = "chrono-english" },
# Use stdlib ( https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html )
{ name = "atty" },
]
2 changes: 1 addition & 1 deletion influxdb3_cache/src/distinct_cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ impl Node {
let block = builder.append_block(value.0.as_bytes().into());
for _ in 0..count {
builder
.try_append_view(block, 0u32, value.0.as_bytes().len() as u32)
.try_append_view(block, 0u32, value.0.len() as u32)
.expect("append view for known valid block, offset and length");
}
}
Expand Down
1 change: 1 addition & 0 deletions influxdb3_catalog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ influxdb3_id = { path = "../influxdb3_id" }
influxdb3_wal = { path = "../influxdb3_wal" }

# crates.io dependencies
anyhow.workspace = true
arrow.workspace = true
bimap.workspace = true
chrono.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion influxdb3_clap_blocks/src/datafusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use datafusion::config::ConfigExtension;
use iox_query::config::IoxConfigExt;

/// Extends the standard [`HashMap`] based DataFusion config option in the CLI with specific
/// options (along with defaults) for InfluxDB 3 OSS/Pro. This is intended for customization of
/// options (along with defaults) for InfluxDB 3 Core/Enterprise. This is intended for customization of
/// options that are defined in the `iox_query` crate, e.g., those defined in [`IoxConfigExt`]
/// that are relevant to the monolithinc versions of InfluxDB 3.
#[derive(Debug, clap::Parser, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions influxdb3_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ impl<'c> WriteRequestBuilder<'c, NoBody> {
}
}

impl<'c> WriteRequestBuilder<'c, Body> {
impl WriteRequestBuilder<'_, Body> {
/// Send the request to the server
pub async fn send(self) -> Result<()> {
let url = self.client.base_url.join("/api/v3/write_lp")?;
Expand Down Expand Up @@ -900,7 +900,7 @@ pub struct QueryRequestBuilder<'c> {
// TODO - for now the send method just returns the bytes from the response.
// It may be nicer to have the format parameter dictate how we return from
// send, e.g., using types more specific to the format selected.
impl<'c> QueryRequestBuilder<'c> {
impl QueryRequestBuilder<'_> {
/// Specify the format, `json`, `csv`, `pretty`, or `parquet`
pub fn format(mut self, format: Format) -> Self {
self.format = Some(format);
Expand Down Expand Up @@ -1101,7 +1101,7 @@ pub struct ShowDatabasesRequestBuilder<'c> {
show_deleted: bool,
}

impl<'c> ShowDatabasesRequestBuilder<'c> {
impl ShowDatabasesRequestBuilder<'_> {
/// Specify whether or not to show deleted databases in the output
pub fn with_show_deleted(mut self, show_deleted: bool) -> Self {
self.show_deleted = show_deleted;
Expand Down
2 changes: 2 additions & 0 deletions influxdb3_internal_api/src/query_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub enum QueryExecutorError {
DatabasesToRecordBatch(#[source] ArrowError),
#[error("unable to compose record batches from retention policies: {0}")]
RetentionPoliciesToRecordBatch(#[source] ArrowError),
#[error("invokded a method that is not implemented: {0}")]
MethodNotImplemented(&'static str),
}

#[async_trait]
Expand Down
8 changes: 6 additions & 2 deletions influxdb3_server/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ impl Error {
fn into_response(self) -> Response<Body> {
debug!(error = ?self, "API error");
match self {
Self::Query(err @ QueryExecutorError::MethodNotImplemented(_)) => Response::builder()
.status(StatusCode::METHOD_NOT_ALLOWED)
.body(Body::from(err.to_string()))
.unwrap(),
Self::WriteBuffer(err @ WriteBufferError::DatabaseNotFound { db_name: _ }) => {
Response::builder()
.status(StatusCode::NOT_FOUND)
Expand Down Expand Up @@ -1254,7 +1258,7 @@ fn json_content_type(headers: &HeaderMap) -> bool {
};

let is_json_content_type = mime.type_() == "application"
&& (mime.subtype() == "json" || mime.suffix().map_or(false, |name| name == "json"));
&& (mime.subtype() == "json" || mime.suffix().is_some_and(|name| name == "json"));

is_json_content_type
}
Expand Down Expand Up @@ -1329,7 +1333,7 @@ fn validate_db_name(name: &str, accept_rp: bool) -> Result<(), ValidateDbNameErr
let mut rp_seperator_found = false;
let mut last_char = None;
for grapheme in name.graphemes(true) {
if grapheme.as_bytes().len() > 1 {
if grapheme.len() > 1 {
// In the case of a unicode we need to handle multibyte chars
return Err(ValidateDbNameError::InvalidChar);
}
Expand Down
4 changes: 2 additions & 2 deletions influxdb3_server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! InfluxDB 3 Core server implementation
//! InfluxDB 3 Enterprise server implementation
//!
//! The server is responsible for handling the HTTP API
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
Expand Down Expand Up @@ -789,7 +789,7 @@ mod tests {
let parquet_metrics_provider: Arc<PersistedFiles> =
Arc::clone(&write_buffer_impl.persisted_files());
let sample_telem_store =
TelemetryStore::new_without_background_runners(parquet_metrics_provider);
TelemetryStore::new_without_background_runners(Some(parquet_metrics_provider));
let write_buffer: Arc<dyn WriteBuffer> = write_buffer_impl;
let common_state = crate::CommonServerState::new(
Arc::clone(&metrics),
Expand Down
Loading

0 comments on commit 0bdc2fa

Please sign in to comment.