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

all: Indicate whether to only locate active deployment #4395

Merged
merged 2 commits into from
Feb 24, 2023

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented Feb 23, 2023

The reassign_subgraph JSON-RPC call will fail if a deployment exists in multiple shards. To disambiguate that, change the call so that it only affects the active deployment.

Fixes #4394

@@ -411,7 +411,7 @@ where
hash: &DeploymentHash,
node_id: &NodeId,
) -> Result<(), SubgraphRegistrarError> {
let locations = self.store.locators(hash)?;
let locations = self.store.locators(hash, true)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

We expect this to return a vector with a single DeploymentLocator (the active copy), right?

/// If `only_active` is `true`, only the locator for the active
/// deployment will be returned. If it is `false`, locators for all
/// deployments with this hash will be returned.
fn locators(&self, hash: &str, only_active: bool)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should split this into something like all_locators and active_locators instead of using a flag, when someone is using or reading this function with a bool they need to go read the docs to figure what the bool is used for, when using all/active naming then it's obvious both when writing and when reading the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just removed the boolean flag and added a fn active_locator to the trait

@lutter lutter force-pushed the lutter/reassign-rpc branch 2 times, most recently from 2b58fb9 to 6e5b2dd Compare February 24, 2023 17:39
The reassign_subgraph JSON-RPC call will fail if a deployment exists in
multiple shards. To disambiguate that, change the call so that it only
affects the active deployment.

Fixes #4394
@lutter lutter merged commit 3f7fe67 into master Feb 24, 2023
@lutter lutter deleted the lutter/reassign-rpc branch March 20, 2023 19:12
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.

JSON-RPC call reassign_subgraph in graph-node fails if a deployment has been copied
3 participants