Repository: cassandra Updated Branches: refs/heads/trunk 6ca39ea42 -> a59689ad8
COPY FROM should raise error for non-existing input files patch by Hiroyuki Nishi; reviewed by Stefania Alborghetti for CASSANDRA-12174 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a59689ad Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a59689ad Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a59689ad Branch: refs/heads/trunk Commit: a59689ad8101440a92c0d015bac43280460f3382 Parents: 6ca39ea Author: Hiroyuki Nishi <[email protected]> Authored: Tue Jul 26 09:50:15 2016 +0800 Committer: Stefania Alborghetti <[email protected]> Committed: Wed Jul 27 12:27:44 2016 +0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + pylib/cqlshlib/copyutil.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a59689ad/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 95fbf76..52f8ccf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.10 + * COPY FROM should raise error for non-existing input files (CASSANDRA-12174) * Faster write path (CASSANDRA-12269) * Option to leave omitted columns in INSERT JSON unset (CASSANDRA-11424) * Support json/yaml output in nodetool tpstats (CASSANDRA-12035) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a59689ad/pylib/cqlshlib/copyutil.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index d0524fe..94e8fe6 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -848,15 +848,18 @@ class FilesReader(object): try: return open(fname, 'rb') except IOError, e: - printdebugmsg("Can't open %r for reading: %s" % (fname, e)) - return None + raise IOError("Can't open %r for reading: %s" % (fname, e)) for path in paths.split(','): path = path.strip() if os.path.isfile(path): yield make_source(path) else: - for f in glob.glob(path): + result = glob.glob(path) + if len(result) == 0: + raise IOError("Can't open %r for reading: no matching file found" % (path,)) + + for f in result: yield (make_source(f)) def start(self): @@ -1269,7 +1272,11 @@ class FeedingProcess(mp.Process): self.on_fork() reader = self.reader - reader.start() + try: + reader.start() + except IOError, exc: + self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message)) + channels = self.worker_channels max_pending_chunks = self.max_pending_chunks sent = 0
