HADOOP-15042. Azure PageBlobInputStream.skip() can return negative value when numberOfPagesRemaining is 0.
Contributed by Rajesh Balamohan (cherry picked from commit 0ea182d0faa35c726dcb37249d48786bfc8ca04c)
This commit is contained in:
parent
3d73d2f097
commit
5c37a0b841
@ -343,9 +343,9 @@ private long skipImpl(long n) throws IOException {
|
||||
|
||||
// Skip over whole pages as necessary without retrieving them from the
|
||||
// server.
|
||||
long pagesToSkipOver = Math.min(
|
||||
long pagesToSkipOver = Math.max(0, Math.min(
|
||||
n / PAGE_DATA_SIZE,
|
||||
numberOfPagesRemaining - 1);
|
||||
numberOfPagesRemaining - 1));
|
||||
numberOfPagesRemaining -= pagesToSkipOver;
|
||||
currentOffsetInBlob += pagesToSkipOver * PAGE_SIZE;
|
||||
skipped += pagesToSkipOver * PAGE_DATA_SIZE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user