mirror of https://github.com/apache/cassandra
clean up temporary for-streaming files when done
patch by jbellis; tested by Ray Slakinski for CASSANDRA-550 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@835986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
185d436fdb
commit
266e94f320
|
|
@ -41,6 +41,7 @@ import java.net.InetAddress;
|
|||
public class DatabaseDescriptor
|
||||
{
|
||||
private static Logger logger_ = Logger.getLogger(DatabaseDescriptor.class);
|
||||
public static final String STREAMING_SUBDIR = "stream";
|
||||
|
||||
// don't capitalize these; we need them to match what's in the config file for CLS.valueOf to parse
|
||||
public static enum CommitLogSync {
|
||||
|
|
@ -599,7 +600,11 @@ public class DatabaseDescriptor
|
|||
FileUtils.createDirectory(dataFile + File.separator + Table.SYSTEM_TABLE);
|
||||
for (String table : tables_)
|
||||
{
|
||||
FileUtils.createDirectory(dataFile + File.separator + table);
|
||||
String oneDir = dataFile + File.separator + table;
|
||||
FileUtils.createDirectory(oneDir);
|
||||
File streamingDir = new File(oneDir, STREAMING_SUBDIR);
|
||||
if (streamingDir.exists())
|
||||
FileUtils.deleteDir(streamingDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ public final class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
{
|
||||
if (target != null)
|
||||
{
|
||||
compactionFileLocation = compactionFileLocation + File.separator + "stream";
|
||||
compactionFileLocation = compactionFileLocation + File.separator + DatabaseDescriptor.STREAMING_SUBDIR;
|
||||
}
|
||||
FileUtils.createDirectory(compactionFileLocation);
|
||||
String newFilename = new File(compactionFileLocation, getTempSSTableFileName()).getAbsolutePath();
|
||||
|
|
|
|||
|
|
@ -94,9 +94,12 @@ public class Streaming
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("Waiting for transfer to " + target + " to complete");
|
||||
StreamManager.instance(target).waitForStreamCompletion();
|
||||
// reference sstables one more time to make sure it doesn't get GC'd early (causing delete of its files)
|
||||
for (SSTableReader sstable : sstables)
|
||||
{
|
||||
sstable.markCompacted();
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Done with transfer to " + target + " of " + StringUtils.join(sstables, ", "));
|
||||
logger.debug("Done with transfer to " + target);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue