예제 #1
0
void
ApplyBucketsWork::advance(std::string const& bucketName,
                          BucketApplicator& applicator)
{
    assert(applicator);
    assert(mTotalSize != 0);
    auto sz = applicator.advance(mCounters);
    mAppliedEntries += sz;
    mCounters.logDebug(bucketName, mLevel, mApp.getClock().now());

    auto log = false;
    if (applicator)
    {
        mAppliedSize += (applicator.pos() - mLastPos);
        mLastPos = applicator.pos();
    }
    else
    {
        mAppliedSize += (applicator.size() - mLastPos);
        mAppliedBuckets++;
        mLastPos = 0;
        log = true;
        mCounters.logInfo(bucketName, mLevel, mApp.getClock().now());
        mCounters.reset(mApp.getClock().now());
    }

    auto appliedSizeMb = mAppliedSize / 1024 / 1024;
    if (appliedSizeMb > mLastAppliedSizeMb)
    {
        log = true;
        mLastAppliedSizeMb = appliedSizeMb;
    }

    if (log)
    {
        CLOG(INFO, "Bucket")
            << "Bucket-apply: " << mAppliedEntries << " entries in "
            << formatSize(mAppliedSize) << "/" << formatSize(mTotalSize)
            << " in " << mAppliedBuckets << "/" << mTotalBuckets << " files ("
            << (100 * mAppliedSize / mTotalSize) << "%)";
    }
}
예제 #2
0
void
ApplyBucketsWork::advance(BucketApplicator& applicator)
{
    if (!applicator)
    {
        return;
    }

    assert(mTotalSize != 0);
    mAppliedEntries += applicator.advance();

    auto log = false;
    if (applicator)
    {
        mAppliedSize += (applicator.pos() - mLastPos);
        mLastPos = applicator.pos();
    }
    else
    {
        mAppliedSize += (applicator.size() - mLastPos);
        mAppliedBuckets++;
        mLastPos = 0;
        log = true;
    }

    auto appliedSizeMb = mAppliedSize / 1024 / 1024;
    if (appliedSizeMb > mLastAppliedSizeMb)
    {
        log = true;
        mLastAppliedSizeMb = appliedSizeMb;
    }

    if (log)
    {
        CLOG(INFO, "Bucket")
            << "Bucket-apply: " << mAppliedEntries << " entries in "
            << formatSize(mAppliedSize) << "/" << formatSize(mTotalSize)
            << " in " << mAppliedBuckets << "/" << mTotalBuckets << " files ("
            << (100 * mAppliedSize / mTotalSize) << "%)";
    }
}