Search in sources :

Example 1 with DataSetStats

use of voldemort.store.stats.DataSetStats in project voldemort by voldemort.

the class StorageService method calculateStats.

private DataSetStats calculateStats(StorageEngine<ByteArray, byte[], byte[]> store) {
    DataSetStats stats = new DataSetStats();
    ClosableIterator<Pair<ByteArray, Versioned<byte[]>>> iter = store.entries();
    try {
        int count = 0;
        while (iter.hasNext()) {
            Pair<ByteArray, Versioned<byte[]>> pair = iter.next();
            VectorClock clock = (VectorClock) pair.getSecond().getVersion();
            stats.countEntry(pair.getFirst().length(), pair.getSecond().getValue().length + clock.sizeInBytes());
            if (count % 10000 == 0)
                logger.debug("Processing key " + count);
            count++;
        }
    } finally {
        iter.close();
    }
    return stats;
}
Also used : Versioned(voldemort.versioning.Versioned) VectorClock(voldemort.versioning.VectorClock) ByteArray(voldemort.utils.ByteArray) DataSetStats(voldemort.store.stats.DataSetStats) Pair(voldemort.utils.Pair)

Aggregations

DataSetStats (voldemort.store.stats.DataSetStats)1 ByteArray (voldemort.utils.ByteArray)1 Pair (voldemort.utils.Pair)1 VectorClock (voldemort.versioning.VectorClock)1 Versioned (voldemort.versioning.Versioned)1