add debug messages to commitlog allocator

This commit is contained in:
Jonathan Ellis 2012-05-01 16:58:49 -05:00
parent bc37988129
commit 116d8a1a7c
2 changed files with 8 additions and 5 deletions

View File

@ -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()

View File

@ -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());