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

MetadataManager init #1202

Merged
merged 1 commit into from
Feb 21, 2024
Merged

MetadataManager init #1202

merged 1 commit into from
Feb 21, 2024

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Feb 20, 2024

MetadataManager init

This introduces MetadataManager, a node-level service that provides uniform access to different metadata kinds. This PR focuses on the nodes configuration only.

Metadata is a cheaply cloneable handle that components can use to access metadata. MetadataWriter is only shared with components that can propose updates to the cached metadata.

Additionally, this changes the node startup procedure to be one step closer to the original design. Worker attachment is only concerned with partition assignment and node IDs are directly fetched from NodesConfiguration.

In this, nodes configuration will be statically created on startup if the bootstrap_cluster option is set (set by default at the moment). The server will fail to start if this is unset until we implement fetching nodes configuration from metadata store.

The admin_address is not used anymore on startup but will be replaced with metadata address later for remote nodes config fetching.


Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

Test Results

111 files  ±0  111 suites  ±0   10m 29s ⏱️ +24s
100 tests ±0  100 ✅ ±0  0 💤 ±0  0 ❌ ±0 
255 runs  ±0  255 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit f46b7e8. ± Comparison against base commit f243ab2.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Great work @AhmedSoliman. I like it a lot :-) +1 for merging.

let channel = match address {
AdvertisedAddress::Uds(uds_path) => {
// dummy endpoint required to specify an uds connector, it is not used anywhere
Endpoint::try_from("/")
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to put a valid uri with scheme and authority here. Otherwise tonic complains. So maybe http://127.0.0.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix. I think I just moved this code over, but it's a good catch.

Ok(*v)
}

// Returns when the metadata kind is at the provided version (or newer)
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment seems not correct.

Comment on lines +77 to +89
// Returns when the metadata kind is at the provided version (or newer)
pub async fn wait_for_version(
&self,
metadata_kind: MetadataKind,
min_version: Version,
) -> Result<Version, ShutdownError> {
let mut recv = self.inner.write_watches[metadata_kind].receive.clone();
let v = recv
.wait_for(|v| *v >= min_version)
.await
.map_err(|_| ShutdownError)?;
Ok(*v)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :-)

Comment on lines 194 to 201
biased;
_ = cancellation_watcher() => {
info!("Metadata manager stopped");
break;
}
Some(cmd) = self.inbound.recv() => {
self.handle_command(cmd)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks a bit off. Might be GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Macros and rustfmt don't like each other :)

Will indent.

}

/// Start and wait for shutdown signal.
pub async fn run(mut self /*, network_sender: NetworkSender*/) -> anyhow::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the network_sender be used to actively fetch metadata updates from the metadata store?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a possible future, yes.

info!("Metadata manager started");

loop {
tokio::select! {
Copy link
Contributor

Choose a reason for hiding this comment

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

🐱💀 ;-)

crates/node/src/metadata.rs Outdated Show resolved Hide resolved
This introduces `MetadataManager`, a node-level service that provides uniform access to different metadata kinds. This PR focuses on the nodes configuration only.

`Metadata` is a cheaply cloneable handle that components can use to access metadata. `MetadataWriter` is only shared with components that can propose updates to the cached metadata.

Additionally, this changes the node startup procedure to be one step closer to the original design. Worker attachment is only concerned with partition assignment and node IDs are directly fetched from NodesConfiguration.

In this, nodes configuration will be statically created on startup if the bootstrap_cluster option is set (set by default at the moment). The server will fail to start if this is unset until we implement fetching nodes configuration from metadata store.

The admin_address is not used anymore on startup but will be replaced with metadata address later for remote nodes config fetching.
@AhmedSoliman AhmedSoliman merged commit 80017d0 into main Feb 21, 2024
10 checks passed
@AhmedSoliman AhmedSoliman deleted the pr1202 branch February 21, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants