org.apache.cassandra.io.util.FileUtils.renameWithConfirm()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.cassandra.io.util.FileUtils.renameWithConfirm()方法的一些代码示例,展示了FileUtils.renameWithConfirm()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.renameWithConfirm()方法的具体详情如下:
包路径:org.apache.cassandra.io.util.FileUtils
类名称:FileUtils
方法名:renameWithConfirm

FileUtils.renameWithConfirm介绍

暂无

代码示例

代码示例来源:origin: jsevellec/cassandra-unit

public static void renameWithConfirm(String from, String to)
{
  renameWithConfirm(new File(from), new File(to));
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static void renameWithConfirm(String from, String to)
{
  renameWithConfirm(new File(from), new File(to));
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static void renameWithConfirm(String from, String to)
{
  renameWithConfirm(new File(from), new File(to));
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static void renameWithConfirm(String from, String to)
{
  renameWithConfirm(new File(from), new File(to));
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static void renameWithConfirm(String from, String to)
{
  renameWithConfirm(new File(from), new File(to));
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

/**
 * Move files to cdc_raw after replay, since recovery will flush to SSTable and these mutations won't be available
 * in the CL subsystem otherwise.
 */
void handleReplayedSegment(final File file)
{
  logger.trace("Moving (Unopened) segment {} to cdc_raw directory after replay", file);
  FileUtils.renameWithConfirm(file.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + file.getName());
  cdcSizeTracker.addFlushedSize(file.length());
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

/**
 * Move files to cdc_raw after replay, since recovery will flush to SSTable and these mutations won't be available
 * in the CL subsystem otherwise.
 */
void handleReplayedSegment(final File file)
{
  logger.trace("Moving (Unopened) segment {} to cdc_raw directory after replay", file);
  FileUtils.renameWithConfirm(file.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + file.getName());
  cdcSizeTracker.addFlushedSize(file.length());
}

代码示例来源:origin: jsevellec/cassandra-unit

/**
 * Move files to cdc_raw after replay, since recovery will flush to SSTable and these mutations won't be available
 * in the CL subsystem otherwise.
 */
void handleReplayedSegment(final File file)
{
  logger.trace("Moving (Unopened) segment {} to cdc_raw directory after replay", file);
  FileUtils.renameWithConfirm(file.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + file.getName());
  cdcSizeTracker.addFlushedSize(file.length());
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

private static File handleHistoryFiles()
{
  File outputDir = FBUtilities.getToolsOutputDirectory();
  File historyFile = new File(outputDir, HISTORYFILE);
  File oldHistoryFile = new File(System.getProperty("user.home"), OLD_HISTORYFILE);
  if(oldHistoryFile.exists())
    FileUtils.renameWithConfirm(oldHistoryFile, historyFile);
  return historyFile;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
  for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
  {
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
  }
  // do -Data last because -Data present should mean the sstable was completely renamed before crash
  FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));
  // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
  FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
  for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
  {
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
  }
  // do -Data last because -Data present should mean the sstable was completely renamed before crash
  FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));
  // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
  FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
  for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
  {
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
  }
  // do -Data last because -Data present should mean the sstable was completely renamed before crash
  FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));
  // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
  FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}

代码示例来源:origin: jsevellec/cassandra-unit

public void discard(CommitLogSegment segment, boolean delete)
{
  segment.close();
  addSize(-segment.onDiskSize());
  cdcSizeTracker.processDiscardedSegment(segment);
  if (segment.getCDCState() == CDCState.CONTAINS)
    FileUtils.renameWithConfirm(segment.logFile.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + segment.logFile.getName());
  else
  {
    if (delete)
      FileUtils.deleteWithConfirm(segment.logFile);
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public void discard(CommitLogSegment segment, boolean delete)
{
  segment.close();
  addSize(-segment.onDiskSize());
  cdcSizeTracker.processDiscardedSegment(segment);
  if (segment.getCDCState() == CDCState.CONTAINS)
    FileUtils.renameWithConfirm(segment.logFile.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + segment.logFile.getName());
  else
  {
    if (delete)
      FileUtils.deleteWithConfirm(segment.logFile);
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public void discard(CommitLogSegment segment, boolean delete)
{
  segment.close();
  addSize(-segment.onDiskSize());
  cdcSizeTracker.processDiscardedSegment(segment);
  if (segment.getCDCState() == CDCState.CONTAINS)
    FileUtils.renameWithConfirm(segment.logFile.getAbsolutePath(), DatabaseDescriptor.getCDCLogLocation() + File.separator + segment.logFile.getName());
  else
  {
    if (delete)
      FileUtils.deleteWithConfirm(segment.logFile);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
  {
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
      serialize(currentComponents, out, descriptor.version);
      out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows)
      FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

  }
}

代码示例来源:origin: jsevellec/cassandra-unit

public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
  for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
  {
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
  }
  // do -Data last because -Data present should mean the sstable was completely renamed before crash
  FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));
  // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
  FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
  {
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
      serialize(currentComponents, out, descriptor.version);
      out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows)
      FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
  {
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
      serialize(currentComponents, out, descriptor.version);
      out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows)
      FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
  for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
  {
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
  }
  // do -Data last because -Data present should mean the sstable was completely renamed before crash
  FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));
  // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
  FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}

相关文章