code: protected static String makeFilename(File directory, final String keyspace, final String columnFamily)
      {
          final Set<Descriptor> existing = new HashSet<Descriptor>();
          directory.list(new FilenameFilter()
          {
              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 = generation.getAndIncrement();
          for (Descriptor desc : existing)
          {
              while (desc.generation > maxGen)
              {
                  maxGen = generation.getAndIncrement();
              }
          }
  
          return new Descriptor(directory, keyspace, columnFamily, maxGen + 1, Descriptor.Type.TEMP).filenameFor(Component.DATA);
      }
docs: find available generation and pick up filename from that