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

Move shard API #869

Merged
merged 4 commits into from
Jul 28, 2022
Merged

Move shard API #869

merged 4 commits into from
Jul 28, 2022

Conversation

agourlay
Copy link
Member

@agourlay agourlay commented Jul 27, 2022

This PR adds a new API to trigger the shard transfers explicitly. (#861)

It contains a new consensus test showing that the transfer works in practice.

@agourlay agourlay linked an issue Jul 27, 2022 that may be closed by this pull request
@agourlay agourlay requested review from generall and e-ivkov July 27, 2022 16:08
@agourlay agourlay force-pushed the move-transfer-API branch from 07d04fd to 09f41d3 Compare July 27, 2022 16:15
schema:
$ref: "#/components/schemas/ClusterOperations"
parameters:
Copy link
Member

Choose a reason for hiding this comment

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

it also requires definition for {collection_name} in path

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch 👍
c05f7a7

@e-ivkov
Copy link
Contributor

e-ivkov commented Jul 28, 2022

Will the user then select if he wants automatic or manual shard movement mode?

@agourlay agourlay force-pushed the move-transfer-API branch from 09f41d3 to cec2ecc Compare July 28, 2022 13:44
@agourlay
Copy link
Member Author

@e-ivkov I do not think we have a clear vision regarding manual vs automatic shard movement mode.
I think your idea makes sense, it could be a user settings at term. We could also propose to pin shards to certain peers.

In the absence of automatic shard re-balancing, this endpoint enables us to test the transfer feature at various scales or to perform admin tasks manually.

@agourlay
Copy link
Member Author

agourlay commented Jul 28, 2022

I have added a basic report of ongoing shard transfers in the collection cluster info API (#866)
9bd2c01

I just wanted to validate that it works properly

{
    "peer_id": 13493294820967747131,
    "shard_count": 2,
    "local_shards": [
        {
            "shard_id": 0,
            "points_count": 4
        }
    ],
    "remote_shards": [
        {
            "shard_id": 1,
            "peer_id": 15343882160508435617
        }
    ],
    "shard_transfers": [
        {
            "shard_id": 0,
            "to": 15343882160508435617
        }
    ]
}

@@ -423,7 +427,7 @@ impl Collection {
existing_temporary_shard.before_drop().await;

match existing_temporary_shard {
Local(local_shard) => {
Shard::Local(local_shard) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this was the only spot using the import

@agourlay agourlay linked an issue Jul 28, 2022 that may be closed by this pull request
@agourlay agourlay merged commit 320b220 into master Jul 28, 2022
@agourlay agourlay deleted the move-transfer-API branch July 28, 2022 18:14
Comment on lines +68 to +73
if dispatcher.consensus_state().is_none() {
return Err(StorageError::BadRequest {
description: "Distributed mode disabled".to_string(),
});
}
let consensus_state = dispatcher.consensus_state().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably looks cleaner and no unwraps there 😄

let consensus_state = dispatcher.consensus_state() {
    Some(state) => state,
    None => return Err(..),
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, it does look better.
I will remember this trick 👍

@agourlay agourlay mentioned this pull request Aug 5, 2022
2 tasks
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.

Collection cluster API should report ongoing shard transfers API for manually trigger the shard transfer
3 participants