Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC4J-606 DFSClient Allow ReadBuffer size to be set #788

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpmcmu
Copy link
Contributor

@jpmcmu jpmcmu commented Jan 17, 2025

  • Created new CircularByteBuffer class
  • Created CircularByteBufferTest
  • Made changes to allow read buffer size to be smaller than the read request size

Signed-off-by: James McMullan James.McMullan@lexisnexis.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change is a breaking change (fix or feature that will cause existing behavior to change).

Checklist:

  • I have created a corresponding JIRA ticket for this submission
  • My code follows the code style of this project.
    • I have applied the Eclipse code-format template provided.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the HPCC Systems CONTRIBUTORS document (https://github.com/hpcc-systems/HPCC-Platform/wiki/Guide-for-contributors).
  • The change has been fully tested:
    • This change does not cause any existing JUnits to fail.
    • I have include JUnit coverage to test this change
    • I have performed system test and covered possible regressions and side effects.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • This change fixes the problem, not just the symptom

Testing:

- Created new CircularByteBuffer class
- Created CircularByteBufferTest
- Made changes to allow read buffer size to be smaller than the read request size

Signed-off-by: James McMullan James.McMullan@lexisnexis.com
Copy link

Jira Issue: https://hpccsystems.atlassian.net/browse/HPCC4J-606

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

@jpmcmu jpmcmu requested a review from rpastrana January 17, 2025 20:04
throw new IOException("Not enough bytes available to skip");
}

readPos += n;

Check failure

Code scanning / CodeQL

Implicit narrowing conversion in compound assignment High

Implicit cast of source type long to narrower destination type
int
.
Copy link
Member

Choose a reason for hiding this comment

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

let's take care of this alert

@@ -0,0 +1,217 @@
/*******************************************************************************
* HPCC SYSTEMS software Copyright (C) 2024 HPCC Systems®.
Copy link
Member

Choose a reason for hiding this comment

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

2025?


public CircularByteBuffer(int bufferSize)
{
buffer = new byte[bufferSize];
Copy link
Member

Choose a reason for hiding this comment

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

are 0 and negative ints ok here?

buffer = new byte[bufferSize];
}

public int getCurrentNumberOfBytes()
Copy link
Member

Choose a reason for hiding this comment

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

what is the meaning of current bytes? I assume this is the number of occupied bytes ? is there a more self documenting name for the method and the member?

return getSpace() > 0;
}

public int getSpace()
Copy link
Member

Choose a reason for hiding this comment

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

getAvailableByteCount?

{
if (currentNumberOfBytes + length > buffer.length)
{
throw new IOException("Not enough space available");
Copy link
Member

Choose a reason for hiding this comment

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

Who is the target of the message, and will this be enough information to trivially identify the problem, and formulate a solution?

@@ -1190,28 +1179,6 @@ private void readDataInFetch()
// Loop here while data is being consumed quickly enough
while (remainingDataInCurrentRequest > 0)
{
if (CompileTimeConstants.PROFILE_CODE)
Copy link
Member

Choose a reason for hiding this comment

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

what replaces this removed logic? L1219?

dis.readFully(this.readBuffer, currentBufferLen, bytesToRead);
synchronized (readBuffer)
{
// int contiguousCapacity = readBuffer.getContiguousSpace();
Copy link
Member

Choose a reason for hiding this comment

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

do we plan to remove the comments?

{
availBytes = readBuffer.getCurrentNumberOfBytes();
}

// Do the check for closed first here to avoid data races
Copy link
Member

Choose a reason for hiding this comment

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

does this old comment mean you shouldn't getcurrentnumberofbytes first?

@@ -0,0 +1,163 @@
/*******************************************************************************
* HPCC SYSTEMS software Copyright (C) 2024 HPCC Systems®.
Copy link
Member

Choose a reason for hiding this comment

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

minor, but 2025?

import org.junit.experimental.categories.Category;

@Category(org.hpccsystems.commons.annotations.RemoteTests.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
Copy link
Member

Choose a reason for hiding this comment

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

just confirming we need to execute the tests in alphabetical order

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.

2 participants