public IMetadataSerializer getMetadataSerializer() { return new MetadataSerializer(); }
public void mutateRepairedAt(Descriptor descriptor, long newRepairedAt) throws IOException { logger.trace("Mutating {} to repairedAt time {}", descriptor.filenameFor(Component.STATS), newRepairedAt); Map<MetadataType, MetadataComponent> currentComponents = deserialize(descriptor, EnumSet.allOf(MetadataType.class)); StatsMetadata stats = (StatsMetadata) currentComponents.remove(MetadataType.STATS); // mutate level currentComponents.put(MetadataType.STATS, stats.mutateRepairedAt(newRepairedAt)); rewriteSSTableMetadata(descriptor, currentComponents); }
public MetadataComponent deserialize(Descriptor descriptor, MetadataType type) throws IOException { return deserialize(descriptor, EnumSet.of(type)).get(type); }
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException { String filePath = descriptor.tmpFilenameFor(Component.STATS); try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath))) { serialize(currentComponents, out, descriptor.version); out.flush(); } // we cant move a file on top of another file in windows: if (FBUtilities.isWindows) FileUtils.delete(descriptor.filenameFor(Component.STATS)); FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS)); } }
public MetadataComponent deserialize(Descriptor descriptor, MetadataType type) throws IOException { return deserialize(descriptor, EnumSet.of(type)).get(type); }
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException { String filePath = descriptor.tmpFilenameFor(Component.STATS); try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath))) { serialize(currentComponents, out, descriptor.version); out.flush(); } // we cant move a file on top of another file in windows: if (FBUtilities.isWindows) FileUtils.delete(descriptor.filenameFor(Component.STATS)); FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS)); } }
public void mutateLevel(Descriptor descriptor, int newLevel) throws IOException { logger.trace("Mutating {} to level {}", descriptor.filenameFor(Component.STATS), newLevel); Map<MetadataType, MetadataComponent> currentComponents = deserialize(descriptor, EnumSet.allOf(MetadataType.class)); StatsMetadata stats = (StatsMetadata) currentComponents.remove(MetadataType.STATS); // mutate level currentComponents.put(MetadataType.STATS, stats.mutateLevel(newLevel)); rewriteSSTableMetadata(descriptor, currentComponents); }
public MetadataComponent deserialize(Descriptor descriptor, MetadataType type) throws IOException { return deserialize(descriptor, EnumSet.of(type)).get(type); }
public IMetadataSerializer getMetadataSerializer() { if (version.newStatsFile) return new MetadataSerializer(); else return new LegacyMetadataSerializer(); }
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException { String filePath = descriptor.tmpFilenameFor(Component.STATS); try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath))) { serialize(currentComponents, out, descriptor.version); out.flush(); } // we cant move a file on top of another file in windows: if (FBUtilities.isWindows) FileUtils.delete(descriptor.filenameFor(Component.STATS)); FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS)); } }
public void mutateRepairedAt(Descriptor descriptor, long newRepairedAt) throws IOException { logger.trace("Mutating {} to repairedAt time {}", descriptor.filenameFor(Component.STATS), newRepairedAt); Map<MetadataType, MetadataComponent> currentComponents = deserialize(descriptor, EnumSet.allOf(MetadataType.class)); StatsMetadata stats = (StatsMetadata) currentComponents.remove(MetadataType.STATS); // mutate level currentComponents.put(MetadataType.STATS, stats.mutateRepairedAt(newRepairedAt)); rewriteSSTableMetadata(descriptor, currentComponents); }
public MetadataComponent deserialize(Descriptor descriptor, MetadataType type) throws IOException { return deserialize(descriptor, EnumSet.of(type)).get(type); }
public IMetadataSerializer getMetadataSerializer() { if (version.hasNewStatsFile()) return new MetadataSerializer(); else return new LegacyMetadataSerializer(); }
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException { String filePath = descriptor.tmpFilenameFor(Component.STATS); try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath))) { serialize(currentComponents, out, descriptor.version); out.flush(); } // we cant move a file on top of another file in windows: if (FBUtilities.isWindows) FileUtils.delete(descriptor.filenameFor(Component.STATS)); FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS)); } }
public void mutateLevel(Descriptor descriptor, int newLevel) throws IOException { logger.trace("Mutating {} to level {}", descriptor.filenameFor(Component.STATS), newLevel); Map<MetadataType, MetadataComponent> currentComponents = deserialize(descriptor, EnumSet.allOf(MetadataType.class)); StatsMetadata stats = (StatsMetadata) currentComponents.remove(MetadataType.STATS); // mutate level currentComponents.put(MetadataType.STATS, stats.mutateLevel(newLevel)); rewriteSSTableMetadata(descriptor, currentComponents); }
public MetadataComponent deserialize(Descriptor descriptor, MetadataType type) throws IOException { return deserialize(descriptor, EnumSet.of(type)).get(type); }
public IMetadataSerializer getMetadataSerializer() { if (version.hasNewStatsFile()) return new MetadataSerializer(); else return new LegacyMetadataSerializer(); }
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException { Descriptor tmpDescriptor = descriptor.asType(Descriptor.Type.TEMP); try (DataOutputStreamAndChannel out = new DataOutputStreamAndChannel(new FileOutputStream(tmpDescriptor.filenameFor(Component.STATS)))) { serialize(currentComponents, out); out.flush(); } // we cant move a file on top of another file in windows: if (FBUtilities.isWindows()) FileUtils.delete(descriptor.filenameFor(Component.STATS)); FileUtils.renameWithConfirm(tmpDescriptor.filenameFor(Component.STATS), descriptor.filenameFor(Component.STATS)); } }
public void mutateRepairedAt(Descriptor descriptor, long newRepairedAt) throws IOException { logger.debug("Mutating {} to repairedAt time {}", descriptor.filenameFor(Component.STATS), newRepairedAt); Map<MetadataType, MetadataComponent> currentComponents = deserialize(descriptor, EnumSet.allOf(MetadataType.class)); StatsMetadata stats = (StatsMetadata) currentComponents.remove(MetadataType.STATS); // mutate level currentComponents.put(MetadataType.STATS, stats.mutateRepairedAt(newRepairedAt)); rewriteSSTableMetadata(descriptor, currentComponents); }
public Map<MetadataType, MetadataComponent> deserialize( Descriptor descriptor, EnumSet<MetadataType> types) throws IOException { Map<MetadataType, MetadataComponent> components; logger.trace("Load metadata for {}", descriptor); File statsFile = new File(descriptor.filenameFor(Component.STATS)); if (!statsFile.exists()) { logger.trace("No sstable stats for {}", descriptor); components = new EnumMap<>(MetadataType.class); components.put(MetadataType.STATS, MetadataCollector.defaultStatsMetadata()); } else { try (RandomAccessReader r = RandomAccessReader.open(statsFile)) { components = deserialize(descriptor, r, types); } } return components; }