我在Windows 7中使用Cassandra 2.0.11。我有一个包含40多个表创建查询的cql文件,我正在使用System.Diagnostics.Process
从C#执行它。我正在使用该进程调用cqlsh批处理脚本以运行此命令:cqlsh -f file.cql host
我有这个例外:
ERROR [NonPeriodicTasks:1] 2017-06-16 12:50:38,461 CassandraDaemon.java (line 199) Exception in thread Thread[NonPeriodicTasks:1,5,main]
FSWriteError in ...\system\schema_columnfamilies\system-schema_columnfamilies-jb-42-Index.db
at org.apache.cassandra.io.util.FileUtils.deleteWithConfirm(FileUtils.java:122)
at org.apache.cassandra.io.util.FileUtils.deleteWithConfirm(FileUtils.java:108)
at org.apache.cassandra.io.sstable.SSTable.delete(SSTable.java:145)
at org.apache.cassandra.io.sstable.SSTableDeletingTask.run(SSTableDeletingTask.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.FileSystemException: ...\system\schema_columnfamilies\system-schema_columnfamilies-jb-42-Index.db: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at org.apache.cassandra.io.util.FileUtils.deleteWithConfirm(FileUtils.java:118)
... 10 more
答案 0 :(得分:1)
此问题(以及其他一些问题)阻止了Cassandra在版本3.x之前在Windows上正常运行。 Windows不喜欢同时访问同一文件的多个进程。
基本上,你有两个选择: