public CompactionStrategyManager(ColumnFamilyStore cfs) { this(cfs, cfs::getDiskBoundaries, cfs.getPartitioner().splitter().isPresent()); }
public CompactionStrategyManager(ColumnFamilyStore cfs) { this(cfs, cfs::getDiskBoundaries, cfs.getPartitioner().splitter().isPresent()); }
public CompactionStrategyManager(ColumnFamilyStore cfs) { this(cfs, cfs::getDiskBoundaries, cfs.getPartitioner().splitter().isPresent()); }
private boolean inCorrectLocation(SSTableReader sstable) { if (!cfs.getPartitioner().splitter().isPresent()) return true; int diskIndex = diskBoundaries.getDiskIndex(sstable); File diskLocation = diskBoundaries.directories.get(diskIndex).location; PartitionPosition diskLast = diskBoundaries.positions.get(diskIndex); // the location we get from directoryIndex is based on the first key in the sstable // now we need to make sure the last key is less than the boundary as well: return sstable.descriptor.directory.getAbsolutePath().startsWith(diskLocation.getAbsolutePath()) && sstable.last.compareTo(diskLast) <= 0; }
private boolean inCorrectLocation(SSTableReader sstable) { if (!cfs.getPartitioner().splitter().isPresent()) return true; int diskIndex = diskBoundaries.getDiskIndex(sstable); File diskLocation = diskBoundaries.directories.get(diskIndex).location; PartitionPosition diskLast = diskBoundaries.positions.get(diskIndex); // the location we get from directoryIndex is based on the first key in the sstable // now we need to make sure the last key is less than the boundary as well: return sstable.descriptor.directory.getAbsolutePath().startsWith(diskLocation.getAbsolutePath()) && sstable.last.compareTo(diskLast) <= 0; }
private boolean inCorrectLocation(SSTableReader sstable) { if (!cfs.getPartitioner().splitter().isPresent()) return true; int diskIndex = diskBoundaries.getDiskIndex(sstable); File diskLocation = diskBoundaries.directories.get(diskIndex).location; PartitionPosition diskLast = diskBoundaries.positions.get(diskIndex); // the location we get from directoryIndex is based on the first key in the sstable // now we need to make sure the last key is less than the boundary as well: return sstable.descriptor.directory.getAbsolutePath().startsWith(diskLocation.getAbsolutePath()) && sstable.last.compareTo(diskLast) <= 0; }
/** * Returns a list of disk boundaries, the result will differ depending on whether vnodes are enabled or not. * * What is returned are upper bounds for the disks, meaning everything from partitioner.minToken up to * getDiskBoundaries(..).get(0) should be on the first disk, everything between 0 to 1 should be on the second disk * etc. * * The final entry in the returned list will always be the partitioner maximum tokens upper key bound */ private static List<PartitionPosition> getDiskBoundaries(List<Range<Token>> sortedLocalRanges, IPartitioner partitioner, Directories.DataDirectory[] dataDirectories) { assert partitioner.splitter().isPresent(); Splitter splitter = partitioner.splitter().get(); boolean dontSplitRanges = DatabaseDescriptor.getNumTokens() > 1; List<Token> boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, dontSplitRanges); // If we can't split by ranges, split evenly to ensure utilisation of all disks if (dontSplitRanges && boundaries.size() < dataDirectories.length) boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, false); List<PartitionPosition> diskBoundaries = new ArrayList<>(); for (int i = 0; i < boundaries.size() - 1; i++) diskBoundaries.add(boundaries.get(i).maxKeyBound()); diskBoundaries.add(partitioner.getMaximumToken().maxKeyBound()); return diskBoundaries; } }
/** * Returns a list of disk boundaries, the result will differ depending on whether vnodes are enabled or not. * * What is returned are upper bounds for the disks, meaning everything from partitioner.minToken up to * getDiskBoundaries(..).get(0) should be on the first disk, everything between 0 to 1 should be on the second disk * etc. * * The final entry in the returned list will always be the partitioner maximum tokens upper key bound */ private static List<PartitionPosition> getDiskBoundaries(List<Range<Token>> sortedLocalRanges, IPartitioner partitioner, Directories.DataDirectory[] dataDirectories) { assert partitioner.splitter().isPresent(); Splitter splitter = partitioner.splitter().get(); boolean dontSplitRanges = DatabaseDescriptor.getNumTokens() > 1; List<Token> boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, dontSplitRanges); // If we can't split by ranges, split evenly to ensure utilisation of all disks if (dontSplitRanges && boundaries.size() < dataDirectories.length) boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, false); List<PartitionPosition> diskBoundaries = new ArrayList<>(); for (int i = 0; i < boundaries.size() - 1; i++) diskBoundaries.add(boundaries.get(i).maxKeyBound()); diskBoundaries.add(partitioner.getMaximumToken().maxKeyBound()); return diskBoundaries; } }
/** * Returns a list of disk boundaries, the result will differ depending on whether vnodes are enabled or not. * * What is returned are upper bounds for the disks, meaning everything from partitioner.minToken up to * getDiskBoundaries(..).get(0) should be on the first disk, everything between 0 to 1 should be on the second disk * etc. * * The final entry in the returned list will always be the partitioner maximum tokens upper key bound */ private static List<PartitionPosition> getDiskBoundaries(List<Range<Token>> sortedLocalRanges, IPartitioner partitioner, Directories.DataDirectory[] dataDirectories) { assert partitioner.splitter().isPresent(); Splitter splitter = partitioner.splitter().get(); boolean dontSplitRanges = DatabaseDescriptor.getNumTokens() > 1; List<Token> boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, dontSplitRanges); // If we can't split by ranges, split evenly to ensure utilisation of all disks if (dontSplitRanges && boundaries.size() < dataDirectories.length) boundaries = splitter.splitOwnedRanges(dataDirectories.length, sortedLocalRanges, false); List<PartitionPosition> diskBoundaries = new ArrayList<>(); for (int i = 0; i < boundaries.size() - 1; i++) diskBoundaries.add(boundaries.get(i).maxKeyBound()); diskBoundaries.add(partitioner.getMaximumToken().maxKeyBound()); return diskBoundaries; } }
public AllSSTableOpStatus relocateSSTables(final ColumnFamilyStore cfs, int jobs) throws ExecutionException, InterruptedException if (!cfs.getPartitioner().splitter().isPresent())
public AllSSTableOpStatus relocateSSTables(final ColumnFamilyStore cfs, int jobs) throws ExecutionException, InterruptedException if (!cfs.getPartitioner().splitter().isPresent())
public AllSSTableOpStatus relocateSSTables(final ColumnFamilyStore cfs, int jobs) throws ExecutionException, InterruptedException if (!cfs.getPartitioner().splitter().isPresent())
public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs) { if (!cfs.getPartitioner().splitter().isPresent()) return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion()); if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { synchronized (this) { if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName()); DiskBoundaries oldBoundaries = diskBoundaries; diskBoundaries = getDiskBoundaryValue(cfs); logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName()); } } } return diskBoundaries; }
public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs) { if (!cfs.getPartitioner().splitter().isPresent()) return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion()); if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { synchronized (this) { if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName()); DiskBoundaries oldBoundaries = diskBoundaries; diskBoundaries = getDiskBoundaryValue(cfs); logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName()); } } } return diskBoundaries; }
public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs) { if (!cfs.getPartitioner().splitter().isPresent()) return new DiskBoundaries(cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion()); if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { synchronized (this) { if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { logger.debug("Refreshing disk boundary cache for {}.{}", cfs.keyspace.getName(), cfs.getTableName()); DiskBoundaries oldBoundaries = diskBoundaries; diskBoundaries = getDiskBoundaryValue(cfs); logger.debug("Updating boundaries from {} to {} for {}.{}", oldBoundaries, diskBoundaries, cfs.keyspace.getName(), cfs.getTableName()); } } } return diskBoundaries; }