You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/05/02 06:31:28 UTC
[4/4] git commit: add debug messages to commitlog allocator
add debug messages to commitlog allocator
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/116d8a1a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/116d8a1a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/116d8a1a
Branch: refs/heads/trunk
Commit: 116d8a1a7cfe585affbd8ab09115cc5ff620d56e
Parents: bc37988
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue May 1 16:58:49 2012 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue May 1 16:58:54 2012 -0500
----------------------------------------------------------------------
.../cassandra/db/commitlog/CommitLogAllocator.java | 4 ++++
.../cassandra/db/commitlog/CommitLogSegment.java | 9 ++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/116d8a1a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
index 963e41e..0359c58 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
@@ -101,6 +101,7 @@ public class CommitLogAllocator
// almost always a segment available when it's needed.
if (availableSegments.isEmpty() && (activeSegments.isEmpty() || createReserveSegments))
{
+ logger.debug("No segments in reserve; creating a fresh one");
createFreshSegment();
}
}
@@ -156,6 +157,8 @@ public class CommitLogAllocator
discardSegment(segment, true);
return;
}
+
+ logger.debug("Recycling {}", segment);
queue.add(new Runnable()
{
public void run()
@@ -205,6 +208,7 @@ public class CommitLogAllocator
*/
private void discardSegment(final CommitLogSegment segment, final boolean deleteFile)
{
+ logger.debug("Segment {} is no longer active and will be deleted {}", segment, deleteFile ? "now" : "by the archive script");
size.addAndGet(-DatabaseDescriptor.getCommitLogSegmentSize());
queue.add(new Runnable()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/116d8a1a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index 2ee90ad..0449c47 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@ -100,8 +100,9 @@ public class CommitLogSegment
if (oldFile.exists())
{
- logger.debug("Re-using discarded CommitLog segment for " + id + " from " + filePath);
- oldFile.renameTo(logFile);
+ logger.debug("Re-using discarded CommitLog segment for {} from {}", id, filePath);
+ if (!oldFile.renameTo(logFile))
+ throw new IOException("Rename from " + filePath + " to " + id + " failed");
isCreating = false;
}
}
@@ -110,9 +111,7 @@ public class CommitLogSegment
logFileAccessor = new RandomAccessFile(logFile, "rw");
if (isCreating)
- {
- logger.debug("Creating new commit log segment " + logFile.getPath());
- }
+ logger.debug("Creating new commit log segment {}", logFile.getPath());
// Map the segment, extending or truncating it to the standard segment size
logFileAccessor.setLength(DatabaseDescriptor.getCommitLogSegmentSize());