You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2014/08/21 23:07:24 UTC
git commit: cqlsh: allow COPY FROM to be interrupted with ctrl-c
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 edbd7d392 -> cc2f45237
cqlsh: allow COPY FROM to be interrupted with ctrl-c
Patch by Tyler Hobbs; review by Mikhail Stepura for CASSANDRA-7815
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cc2f4523
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cc2f4523
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cc2f4523
Branch: refs/heads/cassandra-2.1
Commit: cc2f45237aeed66d73893e4f7f4c04e4c9c16cfb
Parents: edbd7d3
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Thu Aug 21 16:06:34 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Thu Aug 21 16:06:34 2014 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/async_insert.py | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cc2f4523/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 80eb279..fc6c942 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.1
+ * (cqlsh) Don't ignore CTRL-C during COPY FROM execution (CASSANDRA-7815)
* (cqlsh) Order UDTs according to cross-type dependencies in DESCRIBE
output (CASSANDRA-7659)
* (cqlsh) Fix handling of CAS statement results (CASSANDRA-7671)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cc2f4523/pylib/cqlshlib/async_insert.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/async_insert.py b/pylib/cqlshlib/async_insert.py
index 145b0d6..a4adcd2 100644
--- a/pylib/cqlshlib/async_insert.py
+++ b/pylib/cqlshlib/async_insert.py
@@ -33,7 +33,9 @@ class _CountDownLatch(object):
def await(self):
with self._lock:
while self._count > 0:
- self._lock.wait()
+ # use a timeout so that the main thread wakes up occasionally
+ # so it can see keyboard interrupts (CASSANDRA-7815)
+ self._lock.wait(0.5)
class _ChainedWriter(object):
@@ -57,7 +59,13 @@ class _ChainedWriter(object):
for i in xrange(self.CONCURRENCY):
self._execute_next(self._sentinel, 0)
- self._task_counter.await()
+ try:
+ self._task_counter.await()
+ except KeyboardInterrupt:
+ self._cancellation_event.set()
+ sys.stdout.write('Aborting due to keyboard interrupt\n')
+ self._task_counter.await()
+
return next(self._num_finished), self._first_error
def _abort(self, error, failed_record):