You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be great if having a replica of a table and then sharding will shard from one replica while allowing reads and writes to still fall on the other members and then when the rebalancing is done with the first group it then does the next. Just would be great for rebalaning live data sets.
This was originally part of #223, but no longer is. Moving to subsequent for now. I'll be doing more shuffling of issues tonight, so I might move to backlog depending on how things turn out. This might make it in before the LTS release.
Here's a solution which highly reduces the downtime. There would still be something like a second of downtime, depending on the speed of the nodes and the network.
This is what we could do:
Split shards, without changing their node assignment. Everything remains available
Make the machines which should end up holding the shards secondaries for those shards. The node that currently has the data remains the primary, everything remains available.
Once a shard has been backfilled, we initiate a "hand over" procedure:
The primary places a special "take over" message at the end of the write queue. At the same time, it stops accepting new queries (except outdated_ok reads). The shard is unavailable until the write queue has drained. That should usually be pretty fast, but can take a moment if the network or disk i/o is very slow.
When the secondary receives the "take over" message, it updates the blueprint and makes itself the new primary for the shard. The new primary is promoted through the directory and the shard becomes fully available again.
Merge shards on the new primaries if necessary
There are a few details that need to be sorted out, e.g. what happens if a node crashes in the middle of the hand over. Overall it sounds like it could be relatively easily implemented within our current clustering system.
I'm not sure if it is possible to avoid the last moment of downtime. It seems (theoretically) tricky, because one way or the other any existing gap (in terms of processed writes) between the old primary and the new one has to be closed before we can switch over to a new primary.
I agree with the comment by @danielmewes above: this could be done without major changes to the clustering system. In particular, incremental backfills are not a prerequisite.
Also, I want to note that some non-relational databases including Couchbase and Cassandra are already capable of rebalancing without availability loss. We really need this!
The strategy described here is implemented in 2.1.
For paving over the last few seconds of unavailability when switching over shards, we need to implement something like #4331 . Closing this, since it's 90% done and we have a separate issue to follow up for the remaining 10%.
Activity
coffeemug commentedon Dec 17, 2013
This was originally part of #223, but no longer is. Moving to subsequent for now. I'll be doing more shuffling of issues tonight, so I might move to backlog depending on how things turn out. This might make it in before the LTS release.
danielmewes commentedon Jan 28, 2014
Here's a solution which highly reduces the downtime. There would still be something like a second of downtime, depending on the speed of the nodes and the network.
This is what we could do:
The primary places a special "take over" message at the end of the write queue. At the same time, it stops accepting new queries (except outdated_ok reads). The shard is unavailable until the write queue has drained. That should usually be pretty fast, but can take a moment if the network or disk i/o is very slow.
There are a few details that need to be sorted out, e.g. what happens if a node crashes in the middle of the hand over. Overall it sounds like it could be relatively easily implemented within our current clustering system.
I'm not sure if it is possible to avoid the last moment of downtime. It seems (theoretically) tricky, because one way or the other any existing gap (in terms of processed writes) between the old primary and the new one has to be closed before we can switch over to a new primary.
coffeemug commentedon Jan 28, 2014
Pinging @timmaxw @Tryneus.
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
larkost commentedon May 21, 2014
I have a test for this on the branch
larkost/1774-online-sharding-test, up for review 1496.Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
Adding test for #1774 Sharding while keeping docs available
merging #1774 online sharding test
3 remaining items
timmaxw commentedon Jul 17, 2014
I agree with the comment by @danielmewes above: this could be done without major changes to the clustering system. In particular, incremental backfills are not a prerequisite.
barosl commentedon Jul 18, 2014
Also, I want to note that some non-relational databases including Couchbase and Cassandra are already capable of rebalancing without availability loss. We really need this!
coffeemug commentedon Jul 18, 2014
@barosl -- we're on it!
nickpoorman commentedon Aug 8, 2014
+1
thelinuxlich commentedon Aug 27, 2014
+1
danielmewes commentedon Aug 27, 2015
The strategy described here is implemented in 2.1.
For paving over the last few seconds of unavailability when switching over shards, we need to implement something like #4331 . Closing this, since it's 90% done and we have a separate issue to follow up for the remaining 10%.