You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "hubcio (via GitHub)" <gi...@apache.org> on 2026/09/01 20:21:56 UTC
[PR] refactor(server): split bootstrap.rs into the boot/ tree [iggy]
hubcio opened a new pull request, #4031:
URL: https://github.com/apache/iggy/pull/4031
bootstrap.rs had grown to 5.1k lines holding every boot concern at
once: config and credential loading, listener start-up, partition
recovery, shard thread handles, the metadata handoff and the
cluster topology. None of it could be read or tested in isolation.
Move each concern into its own boot/ module and keep the shard_main
narrative, with its ordering invariants, whole in boot/mod.rs. Fold
three duplications the split exposed. The five-channel stop
fan-out was copied between the listener-failure and normal
shutdown paths; StopSignals owns it now. The rustls crypto provider
was installed at four sites; bootstrap installs it once before any
shard thread exists. The cluster roster carried the config-declared
ports while the HTTP state patched in the bound one, so the two
disagreed under port-0 binds; shard 0 now publishes the bound ports
into the one roster, and current_config.toml gains the bound HTTP
address so a harness can discover an ephemeral HTTP port like the
other transports.
New integration tests pin the iggy-view header on success, denial,
ping and follower relay, and bound-port discovery under port-0
binds.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): split bootstrap.rs into the boot/ tree [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #4031:
URL: https://github.com/apache/iggy/pull/4031#discussion_r3912193966
##########
core/server/src/boot/listeners.rs:
##########
@@ -0,0 +1,631 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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.
+
+//! Shard 0 listener start-up and the accept-fn factories.
+
+use crate::boot::credentials::{
+ load_quic_server_credentials, load_tcp_tls_server_credentials, load_wss_server_credentials,
+};
+use crate::boot::topology::{
+ TcpTopology, client_listeners, derived_address_misses_listener, derived_bind_ip,
+ wildcard_listener_under_loopback_address,
+};
+use crate::cluster_meta::{ClusterRoster, self_advertised_address};
+use crate::config_writer::{BoundAddresses, write_current_config};
+use crate::http;
+use crate::server_error::ServerError;
+use crate::shell::ServerShard;
+use configs::cluster::TransportPorts;
+use configs::server::ServerConfig;
+use message_bus::client_listener::{self, RequestHandler};
+use message_bus::installer::conn_info::{ClientConnMeta, ClientTransportKind};
+use message_bus::replica::io as replica_io;
+use message_bus::replica::listener::{self as replica_listener};
+use message_bus::transports::quic::server_config_with_cert;
+use message_bus::{
+ AcceptedClientFn, AcceptedQuicClientFn, AcceptedReplicaFn, AcceptedTlsClientFn,
+ AcceptedWsClientFn, AcceptedWssClientFn, DialedReplicaFn, IggyMessageBus,
+ MAX_INFLIGHT_REPLICA_HANDSHAKES, connector, installer,
+};
+use shard::metrics::ShardMetrics;
+use std::net::SocketAddr;
+use std::rc::Rc;
+use std::sync::Arc;
+use tracing::{error, info, warn};
+
+pub(in crate::boot) struct LocalClientAcceptFns {
+ tcp: AcceptedClientFn,
+ ws: AcceptedWsClientFn,
+ quic: AcceptedQuicClientFn,
+ tcp_tls: AcceptedTlsClientFn,
+ wss: AcceptedWssClientFn,
+}
+
+#[allow(clippy::too_many_arguments)]
+pub(in crate::boot) async fn start_tcp_runtime(
+ shard: &Rc<ServerShard>,
+ config: &ServerConfig,
+ topology: &TcpTopology,
+ roster: Rc<ClusterRoster>,
+ accepted_replica: AcceptedReplicaFn,
+ dialed_replica: DialedReplicaFn,
+ accepted_clients: LocalClientAcceptFns,
+ shard_metrics_all: &[ShardMetrics],
+) -> Result<(), ServerError> {
+ // HTTP is served over TCP but sits outside the replica_io / manual client
+ // reactor, so it binds on its own: first, so its port is known when the
+ // roster and `current_config.toml` are written, and served last, so no
+ // request is answered before they are. Shard-0 gating comes from the sole
+ // caller of this function.
+ let http = topology
+ .http_listen_addr
+ .map(|addr| http::bind(addr, &config.http, &config.cluster))
+ .transpose()?;
Review Comment:
done in 4bdf28de6 - `http::bind` is now `http::prepare` (validation, still first) plus `PreparedHttp::bind` (socket only, right above the publish), so the port opens after the peer dial returns.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): split bootstrap.rs into the boot/ tree [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #4031:
URL: https://github.com/apache/iggy/pull/4031
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): split bootstrap.rs into the boot/ tree [iggy]
Posted by "numinnex (via GitHub)" <gi...@apache.org>.
numinnex commented on code in PR #4031:
URL: https://github.com/apache/iggy/pull/4031#discussion_r3912091693
##########
core/server/src/boot/listeners.rs:
##########
@@ -0,0 +1,631 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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.
+
+//! Shard 0 listener start-up and the accept-fn factories.
+
+use crate::boot::credentials::{
+ load_quic_server_credentials, load_tcp_tls_server_credentials, load_wss_server_credentials,
+};
+use crate::boot::topology::{
+ TcpTopology, client_listeners, derived_address_misses_listener, derived_bind_ip,
+ wildcard_listener_under_loopback_address,
+};
+use crate::cluster_meta::{ClusterRoster, self_advertised_address};
+use crate::config_writer::{BoundAddresses, write_current_config};
+use crate::http;
+use crate::server_error::ServerError;
+use crate::shell::ServerShard;
+use configs::cluster::TransportPorts;
+use configs::server::ServerConfig;
+use message_bus::client_listener::{self, RequestHandler};
+use message_bus::installer::conn_info::{ClientConnMeta, ClientTransportKind};
+use message_bus::replica::io as replica_io;
+use message_bus::replica::listener::{self as replica_listener};
+use message_bus::transports::quic::server_config_with_cert;
+use message_bus::{
+ AcceptedClientFn, AcceptedQuicClientFn, AcceptedReplicaFn, AcceptedTlsClientFn,
+ AcceptedWsClientFn, AcceptedWssClientFn, DialedReplicaFn, IggyMessageBus,
+ MAX_INFLIGHT_REPLICA_HANDSHAKES, connector, installer,
+};
+use shard::metrics::ShardMetrics;
+use std::net::SocketAddr;
+use std::rc::Rc;
+use std::sync::Arc;
+use tracing::{error, info, warn};
+
+pub(in crate::boot) struct LocalClientAcceptFns {
+ tcp: AcceptedClientFn,
+ ws: AcceptedWsClientFn,
+ quic: AcceptedQuicClientFn,
+ tcp_tls: AcceptedTlsClientFn,
+ wss: AcceptedWssClientFn,
+}
+
+#[allow(clippy::too_many_arguments)]
+pub(in crate::boot) async fn start_tcp_runtime(
+ shard: &Rc<ServerShard>,
+ config: &ServerConfig,
+ topology: &TcpTopology,
+ roster: Rc<ClusterRoster>,
+ accepted_replica: AcceptedReplicaFn,
+ dialed_replica: DialedReplicaFn,
+ accepted_clients: LocalClientAcceptFns,
+ shard_metrics_all: &[ShardMetrics],
+) -> Result<(), ServerError> {
+ // HTTP is served over TCP but sits outside the replica_io / manual client
+ // reactor, so it binds on its own: first, so its port is known when the
+ // roster and `current_config.toml` are written, and served last, so no
+ // request is answered before they are. Shard-0 gating comes from the sole
+ // caller of this function.
+ let http = topology
+ .http_listen_addr
+ .map(|addr| http::bind(addr, &config.http, &config.cluster))
+ .transpose()?;
Review Comment:
Binding here opens the socket, but the serve loop only starts at line 144. Everything in between runs with the HTTP port `listen()`ing and nothing accepting, including the replica peer dial: `connect_one` (`core/message_bus/src/connector.rs:151`) is a bare `TcpStream::connect().await` with no timeout, joined across peers.
Against a peer that DROPs SYN rather than refusing (a security group with no matching ingress rule, a node mid-replacement) that blocks for the kernel SYN-retry budget, ~127s at the Linux default `tcp_syn_retries=6`. The kernel completes the handshake into the backlog, so a TCP-level readiness probe passes and traffic routes to a node with no HTTP serve loop. On master the socket was still unbound at this point and the probe got `ECONNREFUSED`.
The comment above is right that the port has to be known before the roster and `current_config.toml` are written, but that only requires binding before line 141, not before the client binds.
`bind()` is already ordered validation-then-socket (JWT, forward state, CORS, metrics endpoint, then `client_listener::tcp::bind` at `http.rs:145`), so splitting it keeps both properties: leave the validation here, so a bad `[http.cors]` or `[http.jwt]` still fails before any listener accepts, and move only the socket bind down to just above the `publish` at line 140.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): split bootstrap.rs into the boot/ tree [iggy]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4031:
URL: https://github.com/apache/iggy/pull/4031#issuecomment-5499943533
## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/4031?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 84.70%. Comparing base ([`f45f9dd`](https://app.codecov.io/gh/apache/iggy/commit/f45f9dda9bcfb4b74723650fafd8933cc7ed19c9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e849636`](https://app.codecov.io/gh/apache/iggy/commit/e8496360c31e69e45fbb1f23d1250e4647817916?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #4031 +/- ##
============================================
- Coverage 85.15% 84.70% -0.45%
Complexity 1402 1402
============================================
Files 1230 1228 -2
Lines 181317 181022 -295
Branches 147611 147521 -90
============================================
- Hits 154392 153339 -1053
- Misses 22874 23626 +752
- Partials 4051 4057 +6
```
| [Components](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.06% <ø> (-0.01%)` | :arrow_down: |
| [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.29% <ø> (ø)` | |
| [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `75.53% <ø> (ø)` | |
| [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.06% <ø> (ø)` | |
| [PHP SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.65% <ø> (ø)` | |
| [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `89.92% <ø> (-6.33%)` | :arrow_down: |
| [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/4031/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.31% <ø> (ø)` | |
| [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4031?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [core/metadata/src/impls/metadata.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fmetadata%2Fsrc%2Fimpls%2Fmetadata.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9tZXRhZGF0YS9zcmMvaW1wbHMvbWV0YWRhdGEucnM=) | `88.09% <ø> (ø)` | |
| [core/server/src/cluster\_meta.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fcluster_meta.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2NsdXN0ZXJfbWV0YS5ycw==) | `99.05% <ø> (-0.02%)` | :arrow_down: |
| [core/server/src/config\_writer.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fconfig_writer.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2NvbmZpZ193cml0ZXIucnM=) | `67.27% <ø> (-7.02%)` | :arrow_down: |
| [core/server/src/dispatch/mod.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fdispatch%2Fmod.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2Rpc3BhdGNoL21vZC5ycw==) | `92.25% <ø> (-0.01%)` | :arrow_down: |
| [core/server/src/http.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAucnM=) | `93.07% <ø> (+0.11%)` | :arrow_up: |
| [core/server/src/http/error.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp%2Ferror.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAvZXJyb3IucnM=) | `90.57% <ø> (-0.03%)` | :arrow_down: |
| [core/server/src/http/forward.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp%2Fforward.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAvZm9yd2FyZC5ycw==) | `64.92% <ø> (-0.25%)` | :arrow_down: |
| [core/server/src/http/state.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp%2Fstate.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAvc3RhdGUucnM=) | `88.42% <ø> (ø)` | |
| [core/server/src/http/tls.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fhttp%2Ftls.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL2h0dHAvdGxzLnJz) | `84.61% <ø> (-0.14%)` | :arrow_down: |
| [core/server/src/main.rs](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree&filepath=core%2Fserver%2Fsrc%2Fmain.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29yZS9zZXJ2ZXIvc3JjL21haW4ucnM=) | `66.66% <ø> (ø)` | |
| ... and [4 more](https://app.codecov.io/gh/apache/iggy/pull/4031?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
... and [54 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/4031/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org