// for a given column family the memtable is clean, forceFlush will return
// immediately, even though there could be a memtable being flush at the same
// time. So to guarantee that all segments can be cleaned out, we need
// "waitForActiveFlushes" after the new segment has been created.
CommitLog.instance.forceNewSegment();
ReplayPosition position = CommitLog.instance.getContext();
for (ColumnFamilyStore cfs : ColumnFamilyStore.all())
cfs.forceFlush();
waitForActiveFlushes();
// if everything was clean, flush won't have called discard
CommitLog.instance.discardCompletedSegments(metadata.cfId, position);