Skip to content

Commit

Permalink
fun. Print some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
symious committed May 7, 2024
1 parent a792e1e commit efd10fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ private RunnableImpl(Runnable runMethod) {
public void run() {
while(!Thread.currentThread().isInterrupted()) {
try {
System.out.println("YYYY Before awaitForSignal.await()");
awaitForSignal.await();
System.out.println("YYYY After awaitForSignal.await()");
} catch (InterruptedException e) {
LOG.info("{} is interrupted", awaitForSignal);
Thread.currentThread().interrupt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,14 @@ long getOpenSegmentSizeInBytes() {

boolean shouldEvict() {
final CacheInfo closedSegmentsCacheInfo = closedSegments.getCacheInfo();
System.out.println("YYYY: should: " + (closedSegmentsCacheInfo.getCount() > maxCachedSegments) + ", closedSegmentsCacheInfo.getCount(): " + closedSegmentsCacheInfo.getCount() + ", maxCachedSegments: " + maxCachedSegments);
if (closedSegmentsCacheInfo.getCount() > maxCachedSegments) {
return true;
}

final long size = closedSegmentsCacheInfo.getSize()
+ Optional.ofNullable(openSegment).map(LogSegment::getTotalCacheSize).orElse(0L);
System.out.println("YYYY: should: " + (size > maxSegmentCacheSize) + " size: " + size + ", maxSegmentCacheSize: " + maxSegmentCacheSize);
return size > maxSegmentCacheSize;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ private void testTruncate(List<LogEntryProto> entries, long fromIndex)
private void checkEntries(RaftLog raftLog, List<LogEntryProto> expected,
int offset, int size) throws IOException {
if (size > 0) {
for (int i = offset; i < size + offset; i++) {
int i = offset;
for (; i < size + offset; i++) {
LogEntryProto entry = raftLog.get(expected.get(i).getIndex());
Assertions.assertEquals(expected.get(i), entry);
}
Expand Down

0 comments on commit efd10fc

Please sign in to comment.