src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
// find available generation and pick up filename from that
find available generation and pick up filename from that
find available generation and pick up filename from that
private static String makeFilename(File directory, final String keyspace, final String columnFamily)
    {
        final Set<Descriptor> existing = new HashSet<Descriptor>();
        directory.list(new FilenameFilter()
        {
            @Override
            public boolean accept(File dir, String name)
            {
                Pair<Descriptor, Component> p = SSTable.tryComponentFromFilename(dir, name);
                Descriptor desc = p == null ? null : p.left;
                if (desc == null)
                    return false;
                if (desc.cfname.equals(columnFamily))
                    existing.add(desc);
                return false;
            }
        });
        int maxGen = 0;
        for (Descriptor desc : existing)
            maxGen = Math.max(maxGen, desc.generation);
        return new Descriptor(directory, keyspace, columnFamily, maxGen + 1, false).filenameFor(Component.DATA);
    }
private static String makeFilename ( File directory , final String keyspace , final String columnFamily ) { final Set < Descriptor > existing = new HashSet < Descriptor > ( ) ; directory . list ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { Pair < Descriptor , Component > p = SSTable . tryComponentFromFilename ( dir , name ) ; Descriptor desc = p == null ? null : p . left ; if ( desc == null ) return false ; if ( desc . cfname . equals ( columnFamily ) ) existing . add ( desc ) ; return false ; } } ) ; int maxGen = 0 ; for ( Descriptor desc : existing ) maxGen = Math . max ( maxGen , desc . generation ) ; return new Descriptor ( directory , keyspace , columnFamily , maxGen + 1 , false ) . filenameFor ( Component . DATA ) ; }
find available generation and pick up filename from that
find available generation and pick up filename from that