/** * Guaranteed to be called before the first call to realAppend. * @param key */ protected void maybeSwitchWriter(DecoratedKey key) { if (diskBoundaries == null) { if (locationIndex < 0) { Directories.DataDirectory defaultLocation = getWriteDirectory(nonExpiredSSTables, cfs.getExpectedCompactedFileSize(nonExpiredSSTables, OperationType.UNKNOWN)); switchCompactionLocation(defaultLocation); locationIndex = 0; } return; } if (locationIndex > -1 && key.compareTo(diskBoundaries.get(locationIndex)) < 0) return; int prevIdx = locationIndex; while (locationIndex == -1 || key.compareTo(diskBoundaries.get(locationIndex)) > 0) locationIndex++; if (prevIdx >= 0) logger.debug("Switching write location from {} to {}", locations.get(prevIdx), locations.get(locationIndex)); switchCompactionLocation(locations.get(locationIndex)); }
/** * Writes a partition in an implementation specific way * @param partition the partition to append * @return true if the partition was written, false otherwise */ public final boolean append(UnfilteredRowIterator partition) { maybeSwitchWriter(partition.partitionKey()); return realAppend(partition); }
estimatedKeys = writer.estimatedKeys(); while (ci.hasNext()) throw new CompactionInterruptedException(ci.getCompactionInfo()); if (writer.append(ci.next())) totalKeysWritten++; newSStables = writer.finish();
Directories.DataDirectory d = getDirectories().getDataDirectoryForFile(directory); if (d != null) return d; d = getDirectories().getWriteableLocation(estimatedWriteSize); if (d == null) throw new RuntimeException(String.format("Not enough disk space to store %s",
estimatedKeys = writer.estimatedKeys(); while (ci.hasNext()) throw new CompactionInterruptedException(ci.getCompactionInfo()); if (writer.append(ci.next())) totalKeysWritten++; newSStables = writer.finish();
Directories.DataDirectory d = getDirectories().getDataDirectoryForFile(directory); if (d != null) return d; d = getDirectories().getWriteableLocation(estimatedWriteSize); if (d == null) throw new RuntimeException(String.format("Not enough disk space to store %s",
estimatedKeys = writer.estimatedKeys(); while (ci.hasNext()) throw new CompactionInterruptedException(ci.getCompactionInfo()); if (writer.append(ci.next())) totalKeysWritten++; newSStables = writer.finish();
/** * Writes a partition in an implementation specific way * @param partition the partition to append * @return true if the partition was written, false otherwise */ public final boolean append(UnfilteredRowIterator partition) { maybeSwitchWriter(partition.partitionKey()); return realAppend(partition); }
/** * Guaranteed to be called before the first call to realAppend. * @param key */ protected void maybeSwitchWriter(DecoratedKey key) { if (diskBoundaries == null) { if (locationIndex < 0) { Directories.DataDirectory defaultLocation = getWriteDirectory(nonExpiredSSTables, cfs.getExpectedCompactedFileSize(nonExpiredSSTables, OperationType.UNKNOWN)); switchCompactionLocation(defaultLocation); locationIndex = 0; } return; } if (locationIndex > -1 && key.compareTo(diskBoundaries.get(locationIndex)) < 0) return; int prevIdx = locationIndex; while (locationIndex == -1 || key.compareTo(diskBoundaries.get(locationIndex)) > 0) locationIndex++; if (prevIdx >= 0) logger.debug("Switching write location from {} to {}", locations.get(prevIdx), locations.get(locationIndex)); switchCompactionLocation(locations.get(locationIndex)); }
Directories.DataDirectory d = getDirectories().getDataDirectoryForFile(directory); if (d != null) return d; d = getDirectories().getWriteableLocation(estimatedWriteSize); if (d == null) throw new RuntimeException(String.format("Not enough disk space to store %s",
/** * Writes a partition in an implementation specific way * @param partition the partition to append * @return true if the partition was written, false otherwise */ public final boolean append(UnfilteredRowIterator partition) { maybeSwitchWriter(partition.partitionKey()); return realAppend(partition); }
/** * Guaranteed to be called before the first call to realAppend. * @param key */ protected void maybeSwitchWriter(DecoratedKey key) { if (diskBoundaries == null) { if (locationIndex < 0) { Directories.DataDirectory defaultLocation = getWriteDirectory(nonExpiredSSTables, cfs.getExpectedCompactedFileSize(nonExpiredSSTables, OperationType.UNKNOWN)); switchCompactionLocation(defaultLocation); locationIndex = 0; } return; } if (locationIndex > -1 && key.compareTo(diskBoundaries.get(locationIndex)) < 0) return; int prevIdx = locationIndex; while (locationIndex == -1 || key.compareTo(diskBoundaries.get(locationIndex)) > 0) locationIndex++; if (prevIdx >= 0) logger.debug("Switching write location from {} to {}", locations.get(prevIdx), locations.get(locationIndex)); switchCompactionLocation(locations.get(locationIndex)); }