/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
/** * Reloads the sstable metadata from disk. * * Called after level is changed on sstable, for example if the sstable is dropped to L0 * * Might be possible to remove in future versions * * @throws IOException */ public void reloadSSTableMetadata() throws IOException { this.sstableMetadata = (StatsMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.STATS); }
/** * Create a new instance of a partitioner defined in an SSTable Descriptor * @param desc Descriptor of an sstable * @return a new IPartitioner instance * @throws IOException */ public static IPartitioner newPartitioner(Descriptor desc) throws IOException { EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.HEADER); Map<MetadataType, MetadataComponent> sstableMetadata = desc.getMetadataSerializer().deserialize(desc, types); ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION); SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER); return newPartitioner(validationMetadata.partitioner, Optional.of(header.getKeyType())); }
/** * Create a new instance of a partitioner defined in an SSTable Descriptor * @param desc Descriptor of an sstable * @return a new IPartitioner instance * @throws IOException */ public static IPartitioner newPartitioner(Descriptor desc) throws IOException { EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.HEADER); Map<MetadataType, MetadataComponent> sstableMetadata = desc.getMetadataSerializer().deserialize(desc, types); ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION); SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER); return newPartitioner(validationMetadata.partitioner, Optional.of(header.getKeyType())); }
public Set<Integer> getAncestors() { try { CompactionMetadata compactionMetadata = (CompactionMetadata) descriptor.getMetadataSerializer().deserialize(descriptor, MetadataType.COMPACTION); if (compactionMetadata != null) return compactionMetadata.ancestors; return Collections.emptySet(); } catch (IOException e) { SSTableReader.logOpenException(descriptor, e); return Collections.emptySet(); } }
/** * Create a new instance of a partitioner defined in an SSTable Descriptor * @param desc Descriptor of an sstable * @return a new IPartitioner instance * @throws IOException */ public static IPartitioner newPartitioner(Descriptor desc) throws IOException { EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.HEADER); Map<MetadataType, MetadataComponent> sstableMetadata = desc.getMetadataSerializer().deserialize(desc, types); ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION); SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER); return newPartitioner(validationMetadata.partitioner, Optional.of(header.getKeyType())); }
/** * Create a new instance of a partitioner defined in an SSTable Descriptor * @param desc Descriptor of an sstable * @return a new IPartitioner instance * @throws IOException */ public static IPartitioner newPartitioner(Descriptor desc) throws IOException { EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.HEADER); Map<MetadataType, MetadataComponent> sstableMetadata = desc.getMetadataSerializer().deserialize(desc, types); ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION); SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER); return newPartitioner(validationMetadata.partitioner, Optional.of(header.getKeyType())); }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); try (SequentialWriter out = new SequentialWriter(file, writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); try (SequentialWriter out = new SequentialWriter(file, writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); try (SequentialWriter out = new SequentialWriter(file, writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
private synchronized void sendBackToL0(SSTableReader sstable) { remove(sstable); try { sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 0); sstable.reloadSSTableMetadata(); add(sstable); } catch (IOException e) { throw new RuntimeException("Could not reload sstable meta data", e); } }
private synchronized void sendBackToL0(SSTableReader sstable) { remove(sstable); try { sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 0); sstable.reloadSSTableMetadata(); add(sstable); } catch (IOException e) { throw new RuntimeException("Could not reload sstable meta data", e); } }
private synchronized void sendBackToL0(SSTableReader sstable) { remove(sstable); try { sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 0); sstable.reloadSSTableMetadata(); add(sstable); } catch (IOException e) { throw new RuntimeException("Could not reload sstable meta data", e); } }
private synchronized void sendBackToL0(SSTableReader sstable) { remove(sstable); try { sstable.descriptor.getMetadataSerializer().mutateLevel(sstable.descriptor, 0); sstable.reloadSSTableMetadata(); add(sstable); } catch (IOException e) { throw new RuntimeException("Could not reload sstable meta data", e); } }
private void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { File file = new File(desc.filenameFor(Component.STATS)); //try (SequentialWriter out = new SequentialWriter(file, writerOption)) try (SequentialWriter out = new SequentialWriter(desc.filenameFor(Component.STATS), writerOption)) { desc.getMetadataSerializer().serialize(components, out, desc.version); out.finish(); } catch (IOException e) { throw new FSWriteError(e, file.getPath()); } }
private void markAndThrow(boolean mutateRepaired) throws IOException { if (mutateRepaired) // if we are able to mutate repaired flag, an incremental repair should be enough { try { sstable.descriptor.getMetadataSerializer().mutateRepairedAt(sstable.descriptor, ActiveRepairService.UNREPAIRED_SSTABLE); sstable.reloadSSTableMetadata(); cfs.getTracker().notifySSTableRepairedStatusChanged(Collections.singleton(sstable)); } catch(IOException ioe) { outputHandler.output("Error mutating repairedAt for SSTable " + sstable.getFilename() + ", as part of markAndThrow"); } } throw new CorruptSSTableException(new Exception(String.format("Invalid SSTable %s, please force %srepair", sstable.getFilename(), mutateRepaired ? "" : "a full ")), sstable.getFilename()); }
private static void writeMetadata(Descriptor desc, Map<MetadataType, MetadataComponent> components) { SequentialWriter out = SequentialWriter.open(new File(desc.filenameFor(Component.STATS))); try { desc.getMetadataSerializer().serialize(components, out.stream); } catch (IOException e) { throw new FSWriteError(e, out.getPath()); } finally { out.close(); } }