@ Override public Map < MetadataType , MetadataComponent > deserialize ( Descriptor descriptor , EnumSet < MetadataType > types ) throws IOException { Map < MetadataType , MetadataComponent > components = Maps . newHashMap ( ) ; File statsFile = new File ( descriptor . filenameFor ( Component . STATS ) ) ; if ( ! statsFile . exists ( ) && types . contains ( MetadataType . STATS ) ) { components . put ( MetadataType . STATS , MetadataCollector . defaultStatsMetadata ( ) ) ; } else { try ( DataInputStream in = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( statsFile ) ) ) ) { EstimatedHistogram rowSizes = EstimatedHistogram . serializer . deserialize ( in ) ; EstimatedHistogram columnCounts = EstimatedHistogram . serializer . deserialize ( in ) ; ReplayPosition replayPosition = ReplayPosition . serializer . deserialize ( in ) ; long minTimestamp = in . readLong ( ) ; long maxTimestamp = in . readLong ( ) ; int maxLocalDeletionTime = in . readInt ( ) ; double bloomFilterFPChance = in . readDouble ( ) ; double compressionRatio = in . readDouble ( ) ; String partitioner = in . readUTF ( ) ; int nbAncestors = in . readInt ( ) ; Set < Integer > ancestors = new HashSet <> ( nbAncestors ) ; for ( int i = 0 ; i < nbAncestors ; i ++ ) ancestors . ( in . readInt ( ) ) ; StreamingHistogram tombstoneHistogram = StreamingHistogram . serializer . deserialize ( in ) ; int sstableLevel = 0 ; if ( in . available ( ) > 0 ) sstableLevel = in . readInt ( ) ; int colCount = in . readInt ( ) ; List < ByteBuffer > minColumnNames = new ArrayList <> ( colCount ) ; for ( int i = 0 ; i < colCount ; i ++ ) minColumnNames . ( ByteBufferUtil . readWithShortLength ( in ) ) ; colCount = in . readInt ( ) ; List < ByteBuffer > maxColumnNames = new ArrayList <> ( colCount ) ; for ( int i = 0 ; i < colCount ; i ++ ) maxColumnNames . ( ByteBufferUtil . readWithShortLength ( in ) ) ; if ( types . contains ( MetadataType . VALIDATION ) ) components . put ( MetadataType . VALIDATION , new ValidationMetadata ( partitioner , bloomFilterFPChance ) ) ; if ( types . contains ( MetadataType . STATS ) ) components . put ( MetadataType . STATS , new StatsMetadata ( rowSizes , columnCounts , replayPosition , minTimestamp , maxTimestamp , maxLocalDeletionTime , compressionRatio , tombstoneHistogram , sstableLevel , minColumnNames , maxColumnNames , true , ActiveRepairService . UNREPAIRED_SSTABLE ) ) ; if ( types . contains ( MetadataType . COMPACTION ) ) components . put ( MetadataType . COMPACTION , new CompactionMetadata ( ancestors , null ) ) ; } } return components ; }
Legacy serializer deserialize all components no matter what types are specified .