@@ -180,7 +180,35 @@ public static CommitLogReplayer construct(CommitLog commitLog, UUID localHostId)
180
180
cfPersisted .put (cfs .metadata .id , filter );
181
181
}
182
182
CommitLogPosition globalPosition = firstNotCovered (cfPersisted .values ());
183
- logger .debug ("Global replay position is {} from columnfamilies {}" , globalPosition , FBUtilities .toString (cfPersisted ));
183
+
184
+ // Limit the amount of column family data logged to prevent massive log lines
185
+ if (logger .isDebugEnabled ())
186
+ {
187
+ int maxColumnFamiliesToLog = 10 ;
188
+ int cfCount = cfPersisted .size ();
189
+ if (cfCount <= maxColumnFamiliesToLog )
190
+ {
191
+ logger .debug ("Global replay position is {} from {} columnfamilies: {}" ,
192
+ globalPosition , cfCount , FBUtilities .toString (cfPersisted ));
193
+ }
194
+ else
195
+ {
196
+ // For large numbers of column families, just log the count and a sample
197
+ Map <TableId , IntervalSet <CommitLogPosition >> sample = new HashMap <>();
198
+ int count = 0 ;
199
+ for (Map .Entry <TableId , IntervalSet <CommitLogPosition >> entry : cfPersisted .entrySet ())
200
+ {
201
+ if (count ++ >= maxColumnFamiliesToLog )
202
+ break ;
203
+ sample .put (entry .getKey (), entry .getValue ());
204
+ }
205
+ logger .debug ("Global replay position is {} from {} columnfamilies (showing first {}): {}" ,
206
+ globalPosition , cfCount , maxColumnFamiliesToLog , FBUtilities .toString (sample ));
207
+ logger .debug ("Use TRACE level to see all {} columnfamilies" , cfCount );
208
+ logger .trace ("Full columnfamilies list: {}" , FBUtilities .toString (cfPersisted ));
209
+ }
210
+ }
211
+
184
212
return new CommitLogReplayer (commitLog , globalPosition , cfPersisted , replayFilter );
185
213
}
186
214
@@ -429,7 +457,18 @@ public static IntervalSet<CommitLogPosition> persistedIntervals(Iterable<SSTable
429
457
430
458
if (!skippedSSTables .isEmpty ()) {
431
459
logger .warn ("Origin of {} sstables is unknown or doesn't match the local node; commitLogIntervals for them were ignored" , skippedSSTables .size ());
432
- logger .debug ("Ignored commitLogIntervals from the following sstables: {}" , skippedSSTables );
460
+
461
+ // Limit the number of SSTable names logged to prevent massive log lines
462
+ int maxSSTablesToLog = 100 ;
463
+ if (skippedSSTables .size () <= maxSSTablesToLog ) {
464
+ logger .debug ("Ignored commitLogIntervals from the following sstables: {}" , skippedSSTables );
465
+ } else {
466
+ List <String > sample = new ArrayList <>(skippedSSTables ).subList (0 , maxSSTablesToLog );
467
+ logger .debug ("Ignored commitLogIntervals from {} sstables (showing first {}): {}" ,
468
+ skippedSSTables .size (), maxSSTablesToLog , sample );
469
+ logger .debug ("Use TRACE level to see all {} skipped sstables" , skippedSSTables .size ());
470
+ logger .trace ("Full list of ignored sstables: {}" , skippedSSTables );
471
+ }
433
472
}
434
473
435
474
if (truncatedAt != null )
0 commit comments