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

[dnr] copy from demo #31160

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions Cargo.lock

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

11 changes: 11 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,17 @@ crates_repository(
# Note: This is a target we add from the additive build file above.
deps = [":zlib"],
)],
# TODO(parkmycar): Refactor this to build the version of zlib from the `bzip2-sys` crate.
"bzip2-sys": [crate.annotation(
gen_build_script = False,
deps = ["@bzip2"],
)],
"lzma-sys": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.lzma-sys.bazel",
gen_build_script = False,
# Note: This is a target we add from the additive build file above.
deps = [":xz"],
)],
"openssl-sys": [crate.annotation(
build_script_data = [
"@openssl//:openssl_lib",
Expand Down
68 changes: 68 additions & 0 deletions misc/bazel/c_deps/rust-sys/BUILD.lzma-sys.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# 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 in the LICENSE file at the
# root of this repository, or online 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.

"""Builds xz from the lzma-sys crate."""

cc_library(
name = "xz",
srcs = glob(
include = [
"xz-5.2/src/liblzma/api/**/*.c",
"xz-5.2/src/liblzma/lzma/**/*.c",
"xz-5.2/src/liblzma/lzma/**/*.h",
"xz-5.2/src/liblzma/lz/**/*.c",
"xz-5.2/src/liblzma/lz/**/*.h",
"xz-5.2/src/liblzma/check/**/*.c",
"xz-5.2/src/liblzma/check/**/*.h",
"xz-5.2/src/liblzma/simple/**/*.c",
"xz-5.2/src/liblzma/simple/**/*.h",
"xz-5.2/src/liblzma/delta/**/*.c",
"xz-5.2/src/liblzma/delta/**/*.h",
"xz-5.2/src/liblzma/common/**/*.c",
"xz-5.2/src/liblzma/common/**/*.h",
"xz-5.2/src/liblzma/rangecoder/**/*.c",
"xz-5.2/src/liblzma/rangecoder/**/*.h",
"xz-5.2/src/common/**/*.h",
],
exclude = [
"**/*crc32_small*",
"**/*crc64_small*",
"**/*tablegen*",
],
) + [
"config.h",
"xz-5.2/src/common/tuklib_cpucores.c",
"xz-5.2/src/common/tuklib_physmem.c",
],
hdrs = glob(["xz-5.2/src/liblzma/api/**/*.h"]),
copts = [
"-std=c99",
"-pthread",
],
includes = [
"xz-5.2/src/common",
"xz-5.2/src/liblzma/api",
"xz-5.2/src/liblzma/check",
"xz-5.2/src/liblzma/common",
"xz-5.2/src/liblzma/delta",
"xz-5.2/src/liblzma/lz",
"xz-5.2/src/liblzma/lzma",
"xz-5.2/src/liblzma/rangecoder",
"xz-5.2/src/liblzma/simple",
# The current working directory.
"",
],
local_defines = ["HAVE_CONFIG_H=1"],
)
11 changes: 10 additions & 1 deletion src/adapter/src/active_compute_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use tokio::sync::{mpsc, oneshot};
use uuid::Uuid;

use crate::coord::peek::PeekResponseUnary;
use crate::{AdapterError, ExecuteResponse};
use crate::{AdapterError, ExecuteContext, ExecuteResponse};

#[derive(Debug)]
/// A description of an active compute sink from the coordinator's perspective.
Expand Down Expand Up @@ -435,3 +435,12 @@ impl ActiveCopyTo {
let _ = self.tx.send(message);
}
}

/// State we keep in the `Coordinator` to track active `COPY FROM` statements.
#[derive(Debug)]
pub(crate) struct ActiveCopyFrom {
/// ID of the ingestion running in clusterd.
pub ingestion_id: uuid::Uuid,
/// Context of the SQL session that ran the statement.
pub ctx: ExecuteContext,
}
4 changes: 2 additions & 2 deletions src/adapter/src/coord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ use tracing::{debug, info, info_span, span, warn, Instrument, Level, Span};
use tracing_opentelemetry::OpenTelemetrySpanExt;
use uuid::Uuid;

use crate::active_compute_sink::ActiveComputeSink;
use crate::active_compute_sink::{ActiveComputeSink, ActiveCopyFrom};
use crate::catalog::{BuiltinTableUpdate, Catalog, OpenCatalogResult};
use crate::client::{Client, Handle};
use crate::command::{Command, ExecuteResponse};
Expand Down Expand Up @@ -1667,7 +1667,7 @@ pub struct Coordinator {
active_webhooks: BTreeMap<CatalogItemId, WebhookAppenderInvalidator>,
/// A map of active `COPY FROM` statements. The Coordinator waits for `clusterd`
/// to stage Batches in Persist that we will then link into the shard.
active_copies: BTreeMap<ConnectionId, ExecuteContext>,
active_copies: BTreeMap<ConnectionId, ActiveCopyFrom>,

/// A map from connection ids to a watch channel that is set to `true` if the connection
/// received a cancel request.
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/src/coord/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl Coordinator {
session,
);
}
CopyFromSource::Url(_) => {
CopyFromSource::Url(_) | CopyFromSource::AwsS3 { .. } => {
self.sequence_copy_from(ctx, plan, target_cluster).await;
}
},
Expand Down
Loading
Loading