Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #66 from caskdata/feature/tephra-112_tx-snapshot-s…
Browse files Browse the repository at this point in the history
…tats

TEPHRA-112 Log basic stats when loading a transaction snapshot
  • Loading branch information
ghelmling committed Jul 23, 2015
2 parents 479ea5c + 42f8d15 commit 8af70d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ private void refreshState() throws IOException {
} else {
latestState = currentSnapshot;
LOG.info("Transaction state reloaded with snapshot from " + latestState.getTimestamp());
if (LOG.isDebugEnabled()) {
LOG.debug("Latest transaction snapshot: " + latestState.toString());
}
lastRefresh = now;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.io.CountingInputStream;
import com.google.common.primitives.Longs;
import com.google.inject.Inject;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -161,7 +162,10 @@ private InputStream getLatestSnapshotInputStream() throws IOException {
}

private TransactionSnapshot readSnapshotInputStream(InputStream in) throws IOException {
return codecProvider.decode(in);
CountingInputStream countingIn = new CountingInputStream(in);
TransactionSnapshot snapshot = codecProvider.decode(countingIn);
LOG.info("Read encoded transaction snapshot of {} bytes", countingIn.getCount());
return snapshot;
}

private TransactionSnapshot readSnapshotFile(Path filePath) throws IOException {
Expand Down

0 comments on commit 8af70d2

Please sign in to comment.