COPY FROM should raise error for non-existing input files

patch by Hiroyuki Nishi; reviewed by Stefania Alborghetti for CASSANDRA-12174
This commit is contained in:
Hiroyuki Nishi 2016-07-26 09:50:15 +08:00 committed by Stefania Alborghetti
parent 6ca39ea424
commit a59689ad81
2 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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