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

2015-11-20 Thread wateray
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> 
getRangeFetchMap(Multimap, InetAddress> rangesWithSources, 
Collection sourceFilters, String keyspace)
{
Multimap> rangeFetchMapMap = 
HashMultimap.create();
for (Range 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 lines ,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!





 

Streamsession's timeout is not reasonable

2015-12-01 Thread wateray


As the preview message, see below, after some hours rebuild failure, we found 
it is due to timeout.
The transfer side incoming socket read timeout( as 
streaming_socket_timeout_in_ms  default one hours), then the whole 
streamsession fail.


As rebuild going the transfer rate will slow down, the transferring file can't 
accomplish in the timeout time. The transfer side didn't receive any byte 
(expected RECEIVED message), then the incoming socket raised timeout.


 As incoming and outgoing belong to the streamsession, To determine timeout,we 
can't test incoming alone, as outgoing is streaming(transferring file is 
continue especially large file, low speed). In other words, when file is 
transferring, we can't raise timeout.


Question again:
  Will re-rebuild 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).

Please excuse me for my poor English.



===
At 2015-11-21 01:07:05, "wateray"  wrote:
>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> 
>getRangeFetchMap(Multimap, InetAddress> rangesWithSources, 
>Collection sourceFilters, String keyspace)
>{
>Multimap> rangeFetchMapMap = 
> HashMultimap.create();
>for (Range 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 lines ,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!
>
>
>
>
>
> 


Does anyone tell me where the nicoulaj api?

2014-08-24 Thread wateray
Hi all,

 

 I just learn Cassandra for a few days. When I want to debug Cassandra with 
eclipse.

 I follow the instruction on the Cassandra wiki page.

 

But when I import the project, there are errors report.

The following import can’t be resolved.

import net.nicoulaj.compilecommand.annotations.Inline;

 

I search on the website but can get any information. Does anyone tell me how to 
resolve this problem?

 

Thanks you all!

I got a solution//Re:how to bound in parameters with cql?

2014-09-11 Thread wateray
While inquire for sql, how to solve this problem I have found this. And it 
works.


 StringBuilder sb = new StringBuilder();
sb.append("select * from t_calllog where sds_uid=? and globalid in( ");


for (int i = 0; i < limit; i++) {
   if (i != 0) {
sb.append(",");
   }


   sb.append("?");
}
sb.append(" )");


statement = session.prepare(sb.toString());


//Then bound 


 BoundStatement bs = new BoundStatement(statement);


bs.setString(0, callLog.getSds_uid());


Row row = null;
for (int i = 1; i <= limit; i++) {
bs.setString(i, "value");
}



Are there any better solution? If have please let me know, thanks!


//////
2014-09-10 08:11:42,"wateray"  :

Hi all.


   I have a select like this:
  PrepareStatemet ps =  session.prepare("SELECT * FROM my_table where id in 
(?)");


  Then how to bound this parameter?


 I try to the following 2 method. But it didn't work. 
1. when do this, it doesn't work, nothing was selected.
   String ids = "  'id1', 'id2', 'id3' ";
   ps.bind(ids);
   
2. 
   Set ids = new HashSet();
   ids.add("id1");
   ids.add("id2");
  ids.add("id3");
 
   ps.bind(ids);  // error,it say the id is not HashSet type inconsistent.


Then how can I do? 


Thanks!