Example #1
0
 public long estimatedKeys() {
   long n = 0;
   for (SSTableReader sstable : this) {
     n += sstable.estimatedKeys();
   }
   return n;
 }
Example #2
0
  public synchronized void replace(
      Collection<SSTableReader> oldSSTables, Iterable<SSTableReader> replacements)
      throws IOException {
    Set<SSTableReader> sstablesNew = new HashSet<SSTableReader>(sstables);

    for (SSTableReader sstable : replacements) {
      assert sstable.getIndexPositions() != null;
      sstablesNew.add(sstable);
      long size = sstable.bytesOnDisk();
      liveSize.addAndGet(size);
      totalSize.addAndGet(size);

      StorageService.instance.storageLiveSize.addAndGet(size); // BIGDATA
      StorageService.instance.storageTotalSize.addAndGet(size); // BIGDATA

      sstable.setTrackedBy(this);
    }

    for (SSTableReader sstable : oldSSTables) {
      boolean removed = sstablesNew.remove(sstable);
      // BIGDATA:
      // assert removed;
      // the old sstables in compacting may already be marked compacted by reset CF.
      if (removed) {
        sstable.markCompacted();
        long bytesOnDisk = sstable.bytesOnDisk(); // BIGDATA
        liveSize.addAndGet(-bytesOnDisk); // BIGDATA

        StorageService.instance.storageLiveSize.addAndGet(-bytesOnDisk); // BIGDATA
      } else {
        logger.info(
            "The old sstable in compacting may already be marked compacted: "
                + sstable.getFilename());
      }
    }

    sstables = Collections.unmodifiableSet(sstablesNew);
    updateCacheSizes();
  }