/** * 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)); }
/** * 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)); }
/** * 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)); }