You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by wateray <wa...@163.com> on 2015/11/20 17:54:26 UTC

Does the rebuild tools rebuild all each time it start Or rebuild the rest?

 we want deploy one more data-center for data safe.
As we rebuild one node's data from the old DC, after some hours rebuild failure due to network fault.
I can restart rebuild surely,but I'm afraid restart rebuild,
is it rebuild all rang of tokens which belong to the node or just rebuild the rest rang of tokens from last rebuild.(since last rebuild we get some data).


As I view the source, I see this code.


class RangeStreamer method getRangeFetchMap


private static Multimap<InetAddress, Range<Token>> getRangeFetchMap(Multimap<Range<Token>, InetAddress> rangesWithSources, Collection<ISourceFilter> sourceFilters, String keyspace)
    {
        Multimap<InetAddress, Range<Token>> rangeFetchMapMap = HashMultimap.create();
        for (Range<Token> range : rangesWithSources.keySet())
        {
            boolean foundSource = false;


            outer:
            for (InetAddress address : rangesWithSources.get(range))
            {
                if (address.equals(FBUtilities.getBroadcastAddress()))
                {
                    // If localhost is a source, we have found one, but we don't add it to the map to avoid streaming locally
                    foundSource = true;
                    continue;
                }


                for (ISourceFilter filter : sourceFilters)
                {
                    if (!filter.shouldInclude(address))
                        continue outer;
                }


                rangeFetchMapMap.put(address, range);
                foundSource = true;
                break; // ensure we only stream from one other node for each range
            }


            if (!foundSource)
                throw new IllegalStateException("unable to find sufficient sources for streaming range " + range + " in keyspace " + keyspace);
        }


        return rangeFetchMapMap;
    }


The bold,when found the address is localhost, It continue to find others and then put into the rangeFetchMapMap。
I think the continue key word should be break, if it just want rebuild the data it doesn't have. Is it right?




Best regards!






Re: Does the rebuild tools rebuild all each time it start Or rebuild the rest?

Posted by Robert Coli <rc...@eventbrite.com>.
On Fri, Nov 20, 2015 at 8:54 AM, wateray <wa...@163.com> wrote:

> *is it rebuild all rang of tokens which belong to the node or just rebuild
> the rest rang of tokens from last rebuild.(since last rebuild we get some
> data).*
>

There is no resume in versions before 2.2.x, it will duplicate-rebuild
anything that has already been rebuilt.

https://issues.apache.org/jira/browse/CASSANDRA-8494
and especially
https://issues.apache.org/jira/browse/CASSANDRA-8838
which should apply to "rebuild" as well as "bootstrap" ...

=Rob