Skip to content

Commit

Permalink
Azure blob storage support (#5546)
Browse files Browse the repository at this point in the history
Adds prototype-level support for [Azure blob storage](https://azure.microsoft.com/en-us/products/storage/blobs). Some corners were cut, see the TODOs and the followup issue #5567 for details.

Steps to try it out:

* Create a storage account with block blobs (this is a per-storage
account setting).
* Create a container inside that storage account.
* Set the appropriate env vars: `AZURE_STORAGE_ACCOUNT,
AZURE_STORAGE_ACCESS_KEY, REMOTE_STORAGE_AZURE_CONTAINER,
REMOTE_STORAGE_AZURE_REGION`
* Set the env var `ENABLE_REAL_AZURE_REMOTE_STORAGE=y` and run `cargo
test -p remote_storage azure`

Fixes  #5562
  • Loading branch information
arpad-m authored Oct 16, 2023
1 parent 8c522ea commit e09d5ad
Show file tree
Hide file tree
Showing 11 changed files with 2,096 additions and 149 deletions.
952 changes: 884 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ license = "Apache-2.0"
[workspace.dependencies]
anyhow = { version = "1.0", features = ["backtrace"] }
async-compression = { version = "0.4.0", features = ["tokio", "gzip"] }
azure_core = "0.16.0"
azure_storage = "0.16"
azure_storage_blobs = "0.16.0"
flate2 = "1.0.26"
async-stream = "0.3"
async-trait = "0.1"
Expand Down Expand Up @@ -76,6 +79,7 @@ hex = "0.4"
hex-literal = "0.4"
hmac = "0.12.1"
hostname = "0.3.1"
http-types = "2"
humantime = "2.1"
humantime-serde = "1.1.1"
hyper = "0.14"
Expand Down
6 changes: 4 additions & 2 deletions control_plane/src/background_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
.stdout(process_log_file)
.stderr(same_file_for_stderr)
.args(args);
let filled_cmd = fill_aws_secrets_vars(fill_rust_env_vars(background_command));
let filled_cmd = fill_remote_storage_secrets_vars(fill_rust_env_vars(background_command));
filled_cmd.envs(envs);

let pid_file_to_check = match initial_pid_file {
Expand Down Expand Up @@ -238,11 +238,13 @@ fn fill_rust_env_vars(cmd: &mut Command) -> &mut Command {
filled_cmd
}

fn fill_aws_secrets_vars(mut cmd: &mut Command) -> &mut Command {
fn fill_remote_storage_secrets_vars(mut cmd: &mut Command) -> &mut Command {
for env_key in [
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"AWS_SESSION_TOKEN",
"AZURE_STORAGE_ACCOUNT",
"AZURE_STORAGE_ACCESS_KEY",
] {
if let Ok(value) = std::env::var(env_key) {
cmd = cmd.env(env_key, value);
Expand Down
10 changes: 10 additions & 0 deletions docs/pageserver-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ prefix_in_bucket = '/test_prefix/'

`AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` env variables can be used to specify the S3 credentials if needed.

or

```toml
[remote_storage]
container_name = 'some-container-name'
container_region = 'us-east'
prefix_in_container = '/test-prefix/'
```

`AZURE_STORAGE_ACCOUNT` and `AZURE_STORAGE_ACCESS_KEY` env variables can be used to specify the azure credentials if needed.

## Repository background tasks

Expand Down
7 changes: 7 additions & 0 deletions libs/remote_storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ aws-types.workspace = true
aws-config.workspace = true
aws-sdk-s3.workspace = true
aws-credential-types.workspace = true
bytes.workspace = true
camino.workspace = true
hyper = { workspace = true, features = ["stream"] }
serde.workspace = true
Expand All @@ -26,6 +27,12 @@ metrics.workspace = true
utils.workspace = true
pin-project-lite.workspace = true
workspace_hack.workspace = true
azure_core.workspace = true
azure_storage.workspace = true
azure_storage_blobs.workspace = true
futures-util.workspace = true
http-types.workspace = true
itertools.workspace = true

[dev-dependencies]
camino-tempfile.workspace = true
Expand Down
Loading

1 comment on commit e09d5ad

@github-actions
Copy link

Choose a reason for hiding this comment

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

2354 tests run: 2232 passed, 0 failed, 122 skipped (full report)


Flaky tests (4)

Postgres 16

  • test_competing_branchings_from_loading_race_to_ok_or_err: release

Postgres 15

  • test_crafted_wal_end[last_wal_record_crossing_segment]: debug
  • test_emergency_mode: release

Postgres 14

  • test_timeline_physical_size_init: debug

Code coverage (full report)

  • functions: 52.8% (8228 of 15598 functions)
  • lines: 80.3% (47964 of 59711 lines)

The comment gets automatically updated with the latest test results
e09d5ad at 2023-10-16T16:26:49.234Z :recycle:

Please sign in to comment.