/** * Mark sstables repairing - either all sstables or only the unrepaired ones depending on * * whether this is an incremental or full repair * * @param cfId the column family * @param parentSessionId the parent repair session id, used to make sure we don't start multiple repairs over the same sstables */ public synchronized void markSSTablesRepairing(UUID cfId, UUID parentSessionId) { if (!marked.contains(cfId)) { List<SSTableReader> sstables = columnFamilyStores.get(cfId).select(View.select(SSTableSet.CANONICAL, (s) -> !isIncremental || !s.isRepaired())).sstables; Set<SSTableReader> currentlyRepairing = ActiveRepairService.instance.currentlyRepairing(cfId, parentSessionId); if (!Sets.intersection(currentlyRepairing, Sets.newHashSet(sstables)).isEmpty()) { logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, sstables); marked.add(cfId); } }
public synchronized void maybeSnapshot(UUID cfId, UUID parentSessionId) { String snapshotName = parentSessionId.toString(); if (!columnFamilyStores.get(cfId).snapshotExists(snapshotName)) { Set<SSTableReader> snapshottedSSTables = columnFamilyStores.get(cfId).snapshot(snapshotName, new Predicate<SSTableReader>() { public boolean apply(SSTableReader sstable) { return sstable != null && (!isIncremental || !sstable.isRepaired()) && !(sstable.metadata.isIndex()) && // exclude SSTables from 2i new Bounds<>(sstable.first.getToken(), sstable.last.getToken()).intersects(ranges); } }, true, false); if (isAlreadyRepairing(cfId, parentSessionId, snapshottedSSTables)) { columnFamilyStores.get(cfId).clearSnapshot(parentSessionId.toString()); logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, snapshottedSSTables); marked.add(cfId); } }
/** * Mark sstables repairing - either all sstables or only the unrepaired ones depending on * * whether this is an incremental or full repair * * @param cfId the column family * @param parentSessionId the parent repair session id, used to make sure we don't start multiple repairs over the same sstables */ public synchronized void markSSTablesRepairing(UUID cfId, UUID parentSessionId) { if (!marked.contains(cfId)) { List<SSTableReader> sstables = columnFamilyStores.get(cfId).select(View.select(SSTableSet.CANONICAL, (s) -> !isIncremental || !s.isRepaired())).sstables; Set<SSTableReader> currentlyRepairing = ActiveRepairService.instance.currentlyRepairing(cfId, parentSessionId); if (!Sets.intersection(currentlyRepairing, Sets.newHashSet(sstables)).isEmpty()) { logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, sstables); marked.add(cfId); } }
public synchronized void maybeSnapshot(UUID cfId, UUID parentSessionId) { String snapshotName = parentSessionId.toString(); if (!columnFamilyStores.get(cfId).snapshotExists(snapshotName)) { Set<SSTableReader> snapshottedSSTables = columnFamilyStores.get(cfId).snapshot(snapshotName, new Predicate<SSTableReader>() { public boolean apply(SSTableReader sstable) { return sstable != null && (!isIncremental || !sstable.isRepaired()) && !(sstable.metadata.isIndex()) && // exclude SSTables from 2i new Bounds<>(sstable.first.getToken(), sstable.last.getToken()).intersects(ranges); } }, true, false); if (isAlreadyRepairing(cfId, parentSessionId, snapshottedSSTables)) { columnFamilyStores.get(cfId).clearSnapshot(parentSessionId.toString()); logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, snapshottedSSTables); marked.add(cfId); } }
/** * Marks all the unrepaired sstables as repairing unless we have already done so. * * Any of these sstables that are still on disk are then anticompacted once the streaming and validation phases are done. * * @param cfId * @param parentSessionId used to check that we don't start multiple inc repair sessions over the same sstables */ public synchronized void markSSTablesRepairing(UUID cfId, UUID parentSessionId) { if (!marked.contains(cfId)) { List<SSTableReader> sstables = columnFamilyStores.get(cfId).select(ColumnFamilyStore.UNREPAIRED_SSTABLES).sstables; Set<SSTableReader> currentlyRepairing = ActiveRepairService.instance.currentlyRepairing(cfId, parentSessionId); if (!Sets.intersection(currentlyRepairing, Sets.newHashSet(sstables)).isEmpty()) { logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, sstables); marked.add(cfId); } }
public synchronized void maybeSnapshot(UUID cfId, UUID parentSessionId) { String snapshotName = parentSessionId.toString(); if (!columnFamilyStores.get(cfId).snapshotExists(snapshotName)) { Set<SSTableReader> snapshottedSSTables = columnFamilyStores.get(cfId).snapshot(snapshotName, new Predicate<SSTableReader>() { public boolean apply(SSTableReader sstable) { return sstable != null && (!isIncremental || !sstable.isRepaired()) && !(sstable.metadata.isIndex()) && // exclude SSTables from 2i new Bounds<>(sstable.first.getToken(), sstable.last.getToken()).intersects(ranges); } }, true, false); if (isAlreadyRepairing(cfId, parentSessionId, snapshottedSSTables)) { columnFamilyStores.get(cfId).clearSnapshot(parentSessionId.toString()); logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, snapshottedSSTables); marked.add(cfId); } }
/** * Mark sstables repairing - either all sstables or only the unrepaired ones depending on * * whether this is an incremental or full repair * * @param cfId the column family * @param parentSessionId the parent repair session id, used to make sure we don't start multiple repairs over the same sstables */ public synchronized void markSSTablesRepairing(UUID cfId, UUID parentSessionId) { if (!marked.contains(cfId)) { List<SSTableReader> sstables = columnFamilyStores.get(cfId).select(View.select(SSTableSet.CANONICAL, (s) -> !isIncremental || !s.isRepaired())).sstables; Set<SSTableReader> currentlyRepairing = ActiveRepairService.instance.currentlyRepairing(cfId, parentSessionId); if (!Sets.intersection(currentlyRepairing, Sets.newHashSet(sstables)).isEmpty()) { logger.error("Cannot start multiple repair sessions over the same sstables"); throw new RuntimeException("Cannot start multiple repair sessions over the same sstables"); } addSSTables(cfId, sstables); marked.add(cfId); } }