use of com.cinchapi.concourse.server.storage.WriteStreamProfiler in project concourse by cinchapi.
the class Database method repair.
@Override
public void repair() {
masterLock.writeLock().lock();
try {
WriteStreamProfiler<Segment> profiler = new WriteStreamProfiler<>(segments);
Map<Segment, Segment> deduped = profiler.deduplicate(() -> Segment.create());
if (!deduped.isEmpty()) {
for (int i = 0; i < segments.size(); ++i) {
Segment segment = segments.get(i);
Segment clean = deduped.get(segment);
if (clean != null) {
clean.transfer(storage.directory().resolve(UUID.randomUUID() + ".seg"));
segments.set(i, clean);
segment.delete();
}
}
int total = profiler.duplicates().size();
Logger.warn("Replaced {} Segments that contained duplicate data. In total, across all Segments, there were {} Write{} duplicated.", deduped.size(), total, total != 1 ? "s" : "");
}
} finally {
masterLock.writeLock().unlock();
}
}
Aggregations