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

[Bug] Fix potenial bug when the index reading offset is greater than data length #320

Merged
merged 3 commits into from
Nov 15, 2022

Conversation

zuston
Copy link
Member

@zuston zuston commented Nov 14, 2022

What changes were proposed in this pull request?

Fix potenial bug when the index reading offset equals to data length

Why are the changes needed?

If the reading length == data length in FixedSizeSegmentSplitter, it should involve this block. And if its length > data length. it should abort it.

Does this PR introduce any user-facing change?

No

How was this patch tested?

UTs

@zuston
Copy link
Member Author

zuston commented Nov 14, 2022

@leixm Could you help check whether this is a bug? CC @jerqi

@zuston zuston changed the title [WIP] Fix potenial bug when the index reading offset equals to data length [WIP] Fix potenial bug when the index reading offset is greater than data length Nov 14, 2022
@leixm
Copy link
Contributor

leixm commented Nov 14, 2022

Here's an extra judgment.

if (bufferOffset > 0) {
      ShuffleDataSegment sds = new ShuffleDataSegment(fileOffset, bufferOffset, bufferSegments);
      dataFileSegments.add(sds);
    }

@zuston
Copy link
Member Author

zuston commented Nov 14, 2022

You could use the test case to check this @leixm . It will fail.

@jerqi
Copy link
Contributor

jerqi commented Nov 14, 2022

cc @kaijchen

@jerqi
Copy link
Contributor

jerqi commented Nov 14, 2022

Do you find this problem in your online environment? Maybe we should also add some logs.

@leixm
Copy link
Contributor

leixm commented Nov 14, 2022

You could use the test case to check this @leixm . It will fail.

You're right, it's a potenial bug.

@zuston
Copy link
Member Author

zuston commented Nov 14, 2022

Do you find this problem in your online environment?

No. I just found this bug when browsing recent commits.

Maybe we should also add some logs.

Good ideas. I will add some logs

@codecov-commenter
Copy link

Codecov Report

Merging #320 (56a0026) into master (1b53455) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #320      +/-   ##
============================================
+ Coverage     61.07%   61.13%   +0.06%     
- Complexity     1493     1497       +4     
============================================
  Files           185      185              
  Lines          9327     9329       +2     
  Branches        903      903              
============================================
+ Hits           5696     5703       +7     
+ Misses         3326     3322       -4     
+ Partials        305      304       -1     
Impacted Files Coverage Δ
...iffle/common/segment/FixedSizeSegmentSplitter.java 95.55% <100.00%> (+5.31%) ⬆️
...che/uniffle/client/impl/ShuffleReadClientImpl.java 90.09% <0.00%> (+2.72%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@kaijchen kaijchen left a comment

Choose a reason for hiding this comment

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

Thanks @zuston for the improvement, this change looks good.
Please remove the [WIP] tag in title if there is nothing to add.

@zuston zuston changed the title [WIP] Fix potenial bug when the index reading offset is greater than data length [Bug] Fix potenial bug when the index reading offset is greater than data length Nov 15, 2022
Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

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

LGTM @leixm @kaijchen Do you have any other suggestion?

Copy link
Contributor

@kaijchen kaijchen left a comment

Choose a reason for hiding this comment

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

LGTM

@leixm
Copy link
Contributor

leixm commented Nov 15, 2022

LGTM.

@jerqi jerqi merged commit eae2621 into apache:master Nov 15, 2022
@jerqi
Copy link
Contributor

jerqi commented Nov 15, 2022

Merged. Thanks @zuston @kaijchen @leixm

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.

None yet

5 participants