Merge branch 'main' into crepererum/issue3336
commit
38ce54c1be
10
Cargo.toml
10
Cargo.toml
|
@ -78,6 +78,8 @@ exclude = [
|
||||||
"tools/",
|
"tools/",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# This profile optimizes for runtime performance and small binary size at the expense of longer
|
||||||
|
# build times. It's most suitable for final release builds.
|
||||||
[profile.release]
|
[profile.release]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
debug = true
|
debug = true
|
||||||
|
@ -85,3 +87,11 @@ lto = "thin"
|
||||||
|
|
||||||
[profile.bench]
|
[profile.bench]
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
# This profile optimizes for short build times at the expense of larger binary size and slower
|
||||||
|
# runtime performance. It's most suitable for development iterations.
|
||||||
|
[profile.quick-release]
|
||||||
|
inherits = "release"
|
||||||
|
codegen-units = 16
|
||||||
|
lto = false
|
||||||
|
incremental = true
|
||||||
|
|
12
Dockerfile
12
Dockerfile
|
@ -14,14 +14,12 @@ COPY . /influxdb_iox
|
||||||
WORKDIR /influxdb_iox
|
WORKDIR /influxdb_iox
|
||||||
|
|
||||||
ARG CARGO_INCREMENTAL=yes
|
ARG CARGO_INCREMENTAL=yes
|
||||||
ARG CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
|
ARG PROFILE=release
|
||||||
ARG CARGO_PROFILE_RELEASE_LTO=thin
|
|
||||||
ARG FEATURES=aws,gcp,azure,jemalloc_replacing_malloc
|
ARG FEATURES=aws,gcp,azure,jemalloc_replacing_malloc
|
||||||
ARG ROARING_ARCH="haswell"
|
ARG ROARING_ARCH="haswell"
|
||||||
ARG RUSTFLAGS=""
|
ARG RUSTFLAGS=""
|
||||||
ENV CARGO_INCREMENTAL=$CARGO_INCREMENTAL \
|
ENV CARGO_INCREMENTAL=$CARGO_INCREMENTAL \
|
||||||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS=$CARGO_PROFILE_RELEASE_CODEGEN_UNITS \
|
PROFILE=$PROFILE \
|
||||||
CARGO_PROFILE_RELEASE_LTO=$CARGO_PROFILE_RELEASE_LTO \
|
|
||||||
FEATURES=$FEATURES \
|
FEATURES=$FEATURES \
|
||||||
ROARING_ARCH=$ROARING_ARCH \
|
ROARING_ARCH=$ROARING_ARCH \
|
||||||
RUSTFLAGS=$RUSTFLAGS
|
RUSTFLAGS=$RUSTFLAGS
|
||||||
|
@ -31,9 +29,9 @@ RUN \
|
||||||
--mount=type=cache,id=influxdb_iox_git,sharing=locked,target=/usr/local/cargo/git \
|
--mount=type=cache,id=influxdb_iox_git,sharing=locked,target=/usr/local/cargo/git \
|
||||||
--mount=type=cache,id=influxdb_iox_target,sharing=locked,target=/influxdb_iox/target \
|
--mount=type=cache,id=influxdb_iox_target,sharing=locked,target=/influxdb_iox/target \
|
||||||
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target && \
|
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target && \
|
||||||
cargo build --target-dir /influxdb_iox/target --release --no-default-features --features="$FEATURES" && \
|
cargo build --target-dir /influxdb_iox/target --profile="$PROFILE" --no-default-features --features="$FEATURES" && \
|
||||||
objcopy --compress-debug-sections target/release/influxdb_iox && \
|
objcopy --compress-debug-sections "target/$PROFILE/influxdb_iox" && \
|
||||||
cp /influxdb_iox/target/release/influxdb_iox /root/influxdb_iox && \
|
cp "/influxdb_iox/target/$PROFILE/influxdb_iox" /root/influxdb_iox && \
|
||||||
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target
|
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,16 @@ async fn assert_set_get_server_id(server_fixture: ServerFixture) {
|
||||||
let got = client.get_server_id().await.expect("get ID failed");
|
let got = client.get_server_id().await.expect("get ID failed");
|
||||||
assert_eq!(got, Some(test_id));
|
assert_eq!(got, Some(test_id));
|
||||||
|
|
||||||
// setting server ID a second time should fail
|
// setting server ID to same ID should be OK
|
||||||
|
client
|
||||||
|
.update_server_id(test_id)
|
||||||
|
.await
|
||||||
|
.expect("set ID again failed");
|
||||||
|
|
||||||
|
let got = client.get_server_id().await.expect("get ID failed");
|
||||||
|
assert_eq!(got, Some(test_id));
|
||||||
|
|
||||||
|
// setting server ID to a different ID should fail
|
||||||
let result = client
|
let result = client
|
||||||
.update_server_id(NonZeroU32::try_from(13).unwrap())
|
.update_server_id(NonZeroU32::try_from(13).unwrap())
|
||||||
.await;
|
.await;
|
||||||
|
|
|
@ -470,6 +470,15 @@ impl Server {
|
||||||
let mut state = self.shared.state.write();
|
let mut state = self.shared.state.write();
|
||||||
let startup = match &**state {
|
let startup = match &**state {
|
||||||
ServerState::Startup(startup) => startup.clone(),
|
ServerState::Startup(startup) => startup.clone(),
|
||||||
|
state
|
||||||
|
if state
|
||||||
|
.server_id()
|
||||||
|
.map(|existing| existing == server_id)
|
||||||
|
.unwrap_or_default() =>
|
||||||
|
{
|
||||||
|
// already set to same ID
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
_ => return Err(Error::IdAlreadySet),
|
_ => return Err(Error::IdAlreadySet),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2459,4 +2468,20 @@ mod tests {
|
||||||
])
|
])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn set_server_id_twice() {
|
||||||
|
test_helpers::maybe_start_logging();
|
||||||
|
let server = make_server(make_application());
|
||||||
|
|
||||||
|
server.set_id(ServerId::try_from(1).unwrap()).unwrap();
|
||||||
|
server.wait_for_init().await.unwrap();
|
||||||
|
|
||||||
|
server.set_id(ServerId::try_from(1).unwrap()).unwrap();
|
||||||
|
|
||||||
|
assert_error!(
|
||||||
|
server.set_id(ServerId::try_from(2).unwrap()),
|
||||||
|
Error::IdAlreadySet
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue