Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,35 @@ public static CommitLogReplayer construct(CommitLog commitLog, UUID localHostId)
cfPersisted.put(cfs.metadata.id, filter);
}
CommitLogPosition globalPosition = firstNotCovered(cfPersisted.values());
logger.debug("Global replay position is {} from columnfamilies {}", globalPosition, FBUtilities.toString(cfPersisted));

// Limit the amount of column family data logged to prevent massive log lines
if (logger.isDebugEnabled())
{
int maxColumnFamiliesToLog = 10;
int cfCount = cfPersisted.size();
if (cfCount <= maxColumnFamiliesToLog)
{
logger.debug("Global replay position is {} from {} columnfamilies: {}",
globalPosition, cfCount, FBUtilities.toString(cfPersisted));
}
else
{
// For large numbers of column families, just log the count and a sample
Map<TableId, IntervalSet<CommitLogPosition>> sample = new HashMap<>();
int count = 0;
for (Map.Entry<TableId, IntervalSet<CommitLogPosition>> entry : cfPersisted.entrySet())
{
if (count++ >= maxColumnFamiliesToLog)
break;
sample.put(entry.getKey(), entry.getValue());
}
logger.debug("Global replay position is {} from {} columnfamilies (showing first {}): {}",
globalPosition, cfCount, maxColumnFamiliesToLog, FBUtilities.toString(sample));
logger.debug("Use TRACE level to see all {} columnfamilies", cfCount);
logger.trace("Full columnfamilies list: {}", FBUtilities.toString(cfPersisted));
}
}

return new CommitLogReplayer(commitLog, globalPosition, cfPersisted, replayFilter);
}

Expand Down Expand Up @@ -429,7 +457,25 @@ public static IntervalSet<CommitLogPosition> persistedIntervals(Iterable<SSTable

if (!skippedSSTables.isEmpty()) {
logger.warn("Origin of {} sstables is unknown or doesn't match the local node; commitLogIntervals for them were ignored", skippedSSTables.size());
logger.debug("Ignored commitLogIntervals from the following sstables: {}", skippedSSTables);

// Limit the number of SSTable names logged to prevent massive log lines
int maxSSTablesToLog = 100;
if (skippedSSTables.size() <= maxSSTablesToLog) {
logger.debug("Ignored commitLogIntervals from the following sstables: {}", skippedSSTables);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering: Do we always hit this in CNDB replayer? If yes, is there a way we can turn the log off if it's not useful?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want them just in CNDB, we should be able to suppress them with logback. If you'd prefer that I can do it in a different PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I think we'd have to suppress all the logs from CommitLogReplayer if we do it though logback.

} else {
List<String> sample = new ArrayList<>();
int count = 0;
for (String sstable : skippedSSTables)
{
if (count++ >= maxSSTablesToLog)
break;
sample.add(sstable);
}
logger.debug("Ignored commitLogIntervals from {} sstables (showing first {}): {}",
skippedSSTables.size(), maxSSTablesToLog, sample);
logger.debug("Use TRACE level to see all {} skipped sstables", skippedSSTables.size());
logger.trace("Full list of ignored sstables: {}", skippedSSTables);
}
}

if (truncatedAt != null)
Expand Down