Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
  • Loading branch information...
commit dcca99684f7225a94253d94220d2fb8b0e7c5e4e 2 parents bbad16b + b3a9a44
@yukim yukim authored
View
1  CHANGES.txt
@@ -35,6 +35,7 @@ Merged from 2.0:
* Optimize single partition batch statements (CASSANDRA-6737)
* Disallow post-query re-ordering when paging (CASSANDRA-6722)
* Fix potential paging bug with deleted columns (CASSANDRA-6748)
+ * Fix NPE on BulkLoader caused by losing StreamEvent (CASSANDRA-6636)
* Add CMSClassUnloadingEnabled JVM option (CASSANDRA-6541)
* Catch memtable flush exceptions during shutdown (CASSANDRA-6735)
* Fix upgradesstables NPE for non-CF-based indexes (CASSANDRA-6645)
View
7 src/java/org/apache/cassandra/io/sstable/SSTableLoader.java
@@ -145,7 +145,7 @@ public StreamResultFuture stream()
return stream(Collections.<InetAddress>emptySet());
}
- public StreamResultFuture stream(Set<InetAddress> toIgnore)
+ public StreamResultFuture stream(Set<InetAddress> toIgnore, StreamEventHandler... listeners)
{
client.init(keyspace);
outputHandler.output("Established connection to initial hosts");
@@ -176,9 +176,8 @@ public StreamResultFuture stream(Set<InetAddress> toIgnore)
plan.transferFiles(remote, streamingDetails.get(remote));
}
- StreamResultFuture bulkResult = plan.execute();
- bulkResult.addEventListener(this);
- return bulkResult;
+ plan.listeners(this, listeners);
+ return plan.execute();
}
public void onSuccess(StreamState finalState) {}
View
11 src/java/org/apache/cassandra/streaming/StreamPlan.java
@@ -34,6 +34,7 @@
{
private final UUID planId = UUIDGen.getTimeUUID();
private final String description;
+ private final List<StreamEventHandler> handlers = new ArrayList<>();
// sessions per InetAddress of the other end.
private final Map<InetAddress, StreamSession> sessions = new HashMap<>();
@@ -130,6 +131,14 @@ public StreamPlan transferFiles(InetAddress to, Collection<StreamSession.SSTable
return this;
}
+ public StreamPlan listeners(StreamEventHandler handler, StreamEventHandler... handlers)
+ {
+ this.handlers.add(handler);
+ if (handlers != null)
+ Collections.addAll(this.handlers, handlers);
+ return this;
+ }
+
/**
* @return true if this plan has no plan to execute
*/
@@ -145,7 +154,7 @@ public boolean isEmpty()
*/
public StreamResultFuture execute()
{
- return StreamResultFuture.init(planId, description, sessions.values());
+ return StreamResultFuture.init(planId, description, sessions.values(), handlers);
}
/**
View
7 src/java/org/apache/cassandra/streaming/StreamResultFuture.java
@@ -75,9 +75,14 @@ private StreamResultFuture(UUID planId, String description, Collection<StreamSes
set(getCurrentState());
}
- static StreamResultFuture init(UUID planId, String description, Collection<StreamSession> sessions)
+ static StreamResultFuture init(UUID planId, String description, Collection<StreamSession> sessions, Collection<StreamEventHandler> listeners)
{
StreamResultFuture future = createAndRegister(planId, description, sessions);
+ if (listeners != null)
+ {
+ for (StreamEventHandler listener : listeners)
+ future.addEventListener(listener);
+ }
logger.info("[Stream #{}] Executing streaming plan for {}", planId, description);
// start sessions
View
7 src/java/org/apache/cassandra/tools/BulkLoader.java
@@ -78,7 +78,10 @@ public static void main(String args[])
StreamResultFuture future = null;
try
{
- future = loader.stream(options.ignores);
+ if (options.noProgress)
+ future = loader.stream(options.ignores);
+ else
+ future = loader.stream(options.ignores, new ProgressIndicator());
}
catch (Exception e)
{
@@ -93,8 +96,6 @@ public static void main(String args[])
}
handler.output(String.format("Streaming session ID: %s", future.planId));
- if (!options.noProgress)
- future.addEventListener(new ProgressIndicator());
try
{
Please sign in to comment.
Something went wrong with that request. Please try again.