Skip to content

Commit 1b27969

Browse files
sui-indexer-alt-framework: fix indexer startup during streaming hang (#26198)
## Description **Commit 1:** Adds back #26096 and #26116 which were reverted in #26188. **Commit 2:** Specify `timeout` along with `connect_timeout` when creating the gRPC client. * `connect_timeout` only bounds the TCP/TLS handshake - the low-level socket connect. Once the TCP connection is established, `connect_timeout` has no further effect. The `subscribe_checkpoints` RPC is a separate HTTP/2 request sent over the already-established connection, so it's not covered by that setting. If a server accepts TCP, but stalls before sending response headers, the client hangs the indefinitely. * `timeout` is the counterpart that bounds individual RPC calls on the channel. **Commit 3:** Include changes from #26182. ## Test plan Added new unit test to prove indexer does not hang during startup when streaming hangs. --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
1 parent be9e865 commit 1b27969

22 files changed

Lines changed: 908 additions & 324 deletions

File tree

Cargo.lock

Lines changed: 41 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,9 @@ anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "9248f8d395
665665
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "9248f8d3951df750360308df22618e5978ad6dc0" }
666666

667667
# core-types from the new sdk for use in gRPC
668-
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e5c53de2e9570229b63bd0508b43f27c11cb5f76", features = [ "hash", "serde" ] }
669-
sui-crypto = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e5c53de2e9570229b63bd0508b43f27c11cb5f76", features = [ "ed25519", "secp256r1", "secp256k1", "passkey", "zklogin" ] }
670-
sui-rpc = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e5c53de2e9570229b63bd0508b43f27c11cb5f76" }
668+
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e494a36a76a0aab8c5d66d5557995faee5c1fb09", features = [ "hash", "serde" ] }
669+
sui-crypto = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e494a36a76a0aab8c5d66d5557995faee5c1fb09", features = [ "ed25519", "secp256r1", "secp256k1", "passkey", "zklogin" ] }
670+
sui-rpc = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "e494a36a76a0aab8c5d66d5557995faee5c1fb09" }
671671

672672
### Workspace Members ###
673673
anemo-benchmark = { path = "crates/anemo-benchmark" }

crates/sui-bridge-indexer-alt/src/handlers/token_transfer_data_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Handler for TokenTransferDataHandler {
9595
async fn commit<'a>(
9696
values: &[Self::Value],
9797
conn: &mut Connection<'a>,
98-
) -> sui_indexer_alt_framework::Result<usize> {
98+
) -> anyhow::Result<usize> {
9999
Ok(diesel::insert_into(token_transfer_data::table)
100100
.values(values)
101101
.on_conflict_do_nothing()

crates/sui-indexer-alt-consistent-store/src/restore/formal_snapshot.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,15 @@ impl FormalSnapshot {
146146
info!(epoch, "Connected to valid formal snapshot");
147147

148148
// Use the remote store to associate the epoch with a watermark pointing to its last
149-
// transaction.
149+
// transaction. We only use `end_of_epoch_checkpoints` here, so no byte counter is needed.
150150
let client = StoreIngestionClient::new(
151151
HttpBuilder::new()
152152
.with_url(snapshot_args.remote_store_url.to_string())
153153
.with_client_options(ClientOptions::new().with_allow_http(true))
154154
.build()
155155
.map(Arc::new)
156156
.context("Failed to connect to remote checkpoint store")?,
157+
None,
157158
);
158159

159160
let end_of_epoch_checkpoints: Vec<_> = client

crates/sui-indexer-alt-framework/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ diesel = { workspace = true, features = ["chrono"] }
1919
diesel-async = { workspace = true, features = ["bb8", "postgres", "async-connection-wrapper"] }
2020
diesel_migrations.workspace = true
2121
futures.workspace = true
22+
http.workspace = true
23+
mysten-network.workspace = true
2224
num_cpus.workspace = true
23-
pin-project-lite.workspace = true
2425
prometheus.workspace = true
2526
object_store.workspace = true
2627
serde_json.workspace = true

0 commit comments

Comments
 (0)