@Override public String toString() { return this.name(); }
/** * @return Descriptor and Component pair. null if given file is not acceptable as SSTable component. * If component is of unknown type, returns CUSTOM component. */ public static Pair<Descriptor, Component> tryComponentFromFilename(File dir, String name) { try { return Component.fromFilename(dir, name); } catch (Throwable e) { return null; } }
private static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } return components; }
private static Set<Component> components(CFMetaData metadata) { Set<Component> components = new HashSet<Component>(Arrays.asList(Component.DATA, Component.PRIMARY_INDEX, Component.STATS, Component.SUMMARY, Component.TOC, Component.digestFor(BigFormat.latestVersion.uncompressedChecksumType()))); if (metadata.params.bloomFilterFpChance < 1.0) components.add(Component.FILTER); if (metadata.params.compression.isEnabled()) { components.add(Component.COMPRESSION_INFO); } else { // it would feel safer to actually add this component later in maybeWriteDigest(), // but the components are unmodifiable after construction components.add(Component.CRC); } return components; }
/** * We use a ReferenceQueue to manage deleting files that have been compacted * and for which no more SSTable references exist. But this is not guaranteed * to run for each such file because of the semantics of the JVM gc. So, * we write a marker to `compactedFilename` when a file is compacted; * if such a marker exists on startup, the file should be removed. * * This method will also remove SSTables that are marked as temporary. * * @return true if the file was deleted */ public static boolean delete(Descriptor desc, Set<Component> components) { logger.debug("Deleting sstable: {}", desc); // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Component component : components) { if (component.equals(Component.DATA) || component.equals(Component.SUMMARY)) continue; FileUtils.deleteWithConfirm(desc.filenameFor(component)); } if (components.contains(Component.SUMMARY)) FileUtils.delete(desc.filenameFor(Component.SUMMARY)); return true; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
private static Set<Component> components(CFMetaData metadata) { Set<Component> components = new HashSet<Component>(Arrays.asList(Component.DATA, Component.PRIMARY_INDEX, Component.STATS, Component.SUMMARY, Component.TOC, Component.digestFor(BigFormat.latestVersion.uncompressedChecksumType()))); if (metadata.params.bloomFilterFpChance < 1.0) components.add(Component.FILTER); if (metadata.params.compression.isEnabled()) { components.add(Component.COMPRESSION_INFO); } else { // it would feel safer to actually add this component later in maybeWriteDigest(), // but the components are unmodifiable after construction components.add(Component.CRC); } return components; }
/** * We use a ReferenceQueue to manage deleting files that have been compacted * and for which no more SSTable references exist. But this is not guaranteed * to run for each such file because of the semantics of the JVM gc. So, * we write a marker to `compactedFilename` when a file is compacted; * if such a marker exists on startup, the file should be removed. * * This method will also remove SSTables that are marked as temporary. * * @return true if the file was deleted */ public static boolean delete(Descriptor desc, Set<Component> components) { // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Component component : components) { if (component.equals(Component.DATA) || component.equals(Component.SUMMARY)) continue; FileUtils.deleteWithConfirm(desc.filenameFor(component)); } if (components.contains(Component.SUMMARY)) FileUtils.delete(desc.filenameFor(Component.SUMMARY)); logger.trace("Deleted {}", desc); return true; }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
@Override public String toString() { return this.name(); }
private static Set<Component> components(CFMetaData metadata) { Set<Component> components = new HashSet<Component>(Arrays.asList(Component.DATA, Component.PRIMARY_INDEX, Component.STATS, Component.SUMMARY, Component.TOC, Component.digestFor(BigFormat.latestVersion.uncompressedChecksumType()))); if (metadata.params.bloomFilterFpChance < 1.0) components.add(Component.FILTER); if (metadata.params.compression.isEnabled()) { components.add(Component.COMPRESSION_INFO); } else { // it would feel safer to actually add this component later in maybeWriteDigest(), // but the components are unmodifiable after construction components.add(Component.CRC); } return components; }
/** * We use a ReferenceQueue to manage deleting files that have been compacted * and for which no more SSTable references exist. But this is not guaranteed * to run for each such file because of the semantics of the JVM gc. So, * we write a marker to `compactedFilename` when a file is compacted; * if such a marker exists on startup, the file should be removed. * * This method will also remove SSTables that are marked as temporary. * * @return true if the file was deleted */ public static boolean delete(Descriptor desc, Set<Component> components) { logger.debug("Deleting sstable: {}", desc); // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Component component : components) { if (component.equals(Component.DATA) || component.equals(Component.SUMMARY)) continue; FileUtils.deleteWithConfirm(desc.filenameFor(component)); } if (components.contains(Component.SUMMARY)) FileUtils.delete(desc.filenameFor(Component.SUMMARY)); return true; }
/** * @return Descriptor and Component pair. null if given file is not acceptable as SSTable component. * If component is of unknown type, returns CUSTOM component. */ public static Pair<Descriptor, Component> tryComponentFromFilename(File dir, String name) { try { return Component.fromFilename(dir, name); } catch (Throwable e) { return null; } }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
@Override public String toString() { return this.name(); }
private static Set<Component> components(CFMetaData metadata) { Set<Component> components = new HashSet<Component>(Arrays.asList(Component.DATA, Component.PRIMARY_INDEX, Component.STATS, Component.SUMMARY, Component.TOC, Component.digestFor(BigFormat.latestVersion.uncompressedChecksumType()))); if (metadata.params.bloomFilterFpChance < 1.0) components.add(Component.FILTER); if (metadata.params.compression.isEnabled()) { components.add(Component.COMPRESSION_INFO); } else { // it would feel safer to actually add this component later in maybeWriteDigest(), // but the components are unmodifiable after construction components.add(Component.CRC); } return components; }
/** * We use a ReferenceQueue to manage deleting files that have been compacted * and for which no more SSTable references exist. But this is not guaranteed * to run for each such file because of the semantics of the JVM gc. So, * we write a marker to `compactedFilename` when a file is compacted; * if such a marker exists on startup, the file should be removed. * * This method will also remove SSTables that are marked as temporary. * * @return true if the file was deleted */ public static boolean delete(Descriptor desc, Set<Component> components) { // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Component component : components) { if (component.equals(Component.DATA) || component.equals(Component.SUMMARY)) continue; FileUtils.deleteWithConfirm(desc.filenameFor(component)); } if (components.contains(Component.SUMMARY)) FileUtils.delete(desc.filenameFor(Component.SUMMARY)); logger.trace("Deleted {}", desc); return true; }
/** * @return Descriptor and Component pair. null if given file is not acceptable as SSTable component. * If component is of unknown type, returns CUSTOM component. */ public static Pair<Descriptor, Component> tryComponentFromFilename(File dir, String name) { try { return Component.fromFilename(dir, name); } catch (Throwable e) { return null; } }
public static Set<Component> discoverComponentsFor(Descriptor desc) { Set<Component.Type> knownTypes = Sets.difference(Component.TYPES, Collections.singleton(Component.Type.CUSTOM)); Set<Component> components = Sets.newHashSetWithExpectedSize(knownTypes.size()); for (Component.Type componentType : knownTypes) { if (componentType == Component.Type.DIGEST) { if (desc.digestComponent != null && new File(desc.filenameFor(desc.digestComponent)).exists()) components.add(desc.digestComponent); } else { Component component = new Component(componentType); if (new File(desc.filenameFor(component)).exists()) components.add(component); } } return components; }
@Override public String toString() { return this.name(); }