Skip to content

Conversation

nikita15p
Copy link
Contributor

@nikita15p nikita15p commented May 21, 2023

Current state: Since the buffer size is limited by the size

byte[] buffer = new byte[64 * 1024];

This was causing while loop to execute limited by buffer size. This was causing test failure since "checkpointDir.getUsableSpace() > minimumRequiredSpace" was still satisfied even after the byte size is exhausted.

The change in PR introduces dynamic size of buffer, so that always we get checkpointDir.getUsableSpace() <= minimumRequiredSpace post while loop and hence test always passes.
Tested it in pipeline many times and it passed always with this fix.

A snippet of TestLog-output.txt with extra logs to check if the condition is satisfied.

2023-05-21 19:40:50,774 (main) [INFO - org.apache.flume.channel.file.TestLog.doTestMinimumRequiredSpaceTooSmallForPut(TestLog.java:245)] checkpointDir.getUsableSpace(): 449352470528
2023-05-21 19:40:50,774 (main) [INFO - org.apache.flume.channel.file.TestLog.doTestMinimumRequiredSpaceTooSmallForPut(TestLog.java:246)] minimumRequiredSpace: 449358696448
2023-05-21 19:40:50,791 (main) [INFO - org.apache.flume.channel.file.Log.put(Log.java:656)] usableSpace449352470528
2023-05-21 19:40:50,791 (main) [INFO - org.apache.flume.channel.file.Log.put(Log.java:657)] minimumRequiredSpace449358696528
2023-05-21 19:40:50,791 (main) [INFO - org.apache.flume.channel.file.Log.put(Log.java:659)] usableSpace <= requiredSpace

@nikita15p
Copy link
Contributor Author

@rgoers please review it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant