Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 a89fd4d1d -> 0b26c778b refs/heads/trunk 94c029924 -> 10aef4d87
inline Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0b26c778 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0b26c778 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0b26c778 Branch: refs/heads/cassandra-2.1 Commit: 0b26c778bcdbef83cb5e0480a8c7b38d58d2aec6 Parents: 134e022 Author: Jonathan Ellis <jbel...@apache.org> Authored: Thu May 8 16:00:01 2014 -0500 Committer: Jonathan Ellis <jbel...@apache.org> Committed: Thu May 8 16:00:09 2014 -0500 ---------------------------------------------------------------------- .../cassandra/db/commitlog/CommitLogArchiver.java | 6 +++--- .../db/commitlog/CommitLogDescriptor.java | 7 +------ .../cassandra/db/commitlog/CommitLogReplayer.java | 17 ++++++++--------- 3 files changed, 12 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b26c778/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java index d715fcc..2795cae 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java @@ -168,14 +168,14 @@ public class CommitLogArchiver throw new IllegalStateException("Cannot safely construct descriptor for segment, either from its name or its header: " + fromFile.getPath()); else if (fromHeader != null && fromName != null && !fromHeader.equals(fromName)) throw new IllegalStateException(String.format("Cannot safely construct descriptor for segment, as name and header descriptors do not match (%s vs %s): %s", fromHeader, fromName, fromFile.getPath())); - else if (fromName != null && fromHeader == null && fromName.getVersion() >= CommitLogDescriptor.VERSION_21) + else if (fromName != null && fromHeader == null && fromName.version >= CommitLogDescriptor.VERSION_21) throw new IllegalStateException("Cannot safely construct descriptor for segment, as name descriptor implies a version that should contain a header descriptor, but that descriptor could not be read: " + fromFile.getPath()); else if (fromHeader != null) descriptor = fromHeader; else descriptor = fromName; - if (descriptor.getVersion() > CommitLogDescriptor.VERSION_21) - throw new IllegalStateException("Unsupported commit log version: " + descriptor.getVersion()); + if (descriptor.version > CommitLogDescriptor.VERSION_21) + throw new IllegalStateException("Unsupported commit log version: " + descriptor.version); File toFile = new File(DatabaseDescriptor.getCommitLogLocation(), descriptor.fileName()); if (toFile.exists()) http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b26c778/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java index b11da94..91c81e1 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java @@ -53,7 +53,7 @@ public class CommitLogDescriptor // [version, id, checksum] static final int HEADER_SIZE = 4 + 8 + 4; - private final int version; + final int version; public final long id; public CommitLogDescriptor(int version, long id) @@ -132,11 +132,6 @@ public class CommitLogDescriptor } } - public int getVersion() - { - return version; - } - public String fileName() { return FILENAME_PREFIX + version + SEPARATOR + id + FILENAME_EXTENSION; http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b26c778/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java index 59ae4e4..1012829 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java @@ -22,7 +22,6 @@ import java.io.*; import java.util.*; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; -import java.util.zip.Checksum; import com.google.common.base.Predicate; import com.google.common.collect.HashMultimap; @@ -129,7 +128,7 @@ public class CommitLogReplayer crc.updateInt((int) reader.getPosition()); int end = reader.readInt(); long filecrc; - if (descriptor.getVersion() < CommitLogDescriptor.VERSION_21) + if (descriptor.version < CommitLogDescriptor.VERSION_21) filecrc = reader.readLong(); else filecrc = reader.readInt() & 0xffffffffL; @@ -234,14 +233,14 @@ public class CommitLogReplayer final long segmentId = desc.id; logger.info("Replaying {} (CL version {}, messaging version {})", file.getPath(), - desc.getVersion(), + desc.version, desc.getMessagingVersion()); RandomAccessReader reader = RandomAccessReader.open(new File(file.getAbsolutePath())); try { assert reader.length() <= Integer.MAX_VALUE; - int offset = getStartOffset(segmentId, desc.getVersion()); + int offset = getStartOffset(segmentId, desc.version); if (offset < 0) { logger.debug("skipping replay of fully-flushed {}", file); @@ -253,7 +252,7 @@ public class CommitLogReplayer { int end = prevEnd; - if (desc.getVersion() < CommitLogDescriptor.VERSION_21) + if (desc.version < CommitLogDescriptor.VERSION_21) end = Integer.MAX_VALUE; else { @@ -295,12 +294,12 @@ public class CommitLogReplayer break main; long claimedSizeChecksum; - if (desc.getVersion() < CommitLogDescriptor.VERSION_21) + if (desc.version < CommitLogDescriptor.VERSION_21) claimedSizeChecksum = reader.readLong(); else claimedSizeChecksum = reader.readInt() & 0xffffffffL; checksum.reset(); - if (desc.getVersion() < CommitLogDescriptor.VERSION_20) + if (desc.version < CommitLogDescriptor.VERSION_20) checksum.update(serializedSize); else checksum.updateInt(serializedSize); @@ -312,7 +311,7 @@ public class CommitLogReplayer if (serializedSize > buffer.length) buffer = new byte[(int) (1.2 * serializedSize)]; reader.readFully(buffer, 0, serializedSize); - if (desc.getVersion() < CommitLogDescriptor.VERSION_21) + if (desc.version < CommitLogDescriptor.VERSION_21) claimedCRC32 = reader.readLong(); else claimedCRC32 = reader.readInt() & 0xffffffffL; @@ -429,7 +428,7 @@ public class CommitLogReplayer } } - if (desc.getVersion() < CommitLogDescriptor.VERSION_21) + if (desc.version < CommitLogDescriptor.VERSION_21) break; offset = end + CommitLogSegment.SYNC_MARKER_SIZE;