Skip to content

Commit

Permalink
removed ITestAbfsInputStream inheritence from ITestAbfsInputStreamSma…
Browse files Browse the repository at this point in the history
…llFileReads; fixed futureAwait API use; javadocs
  • Loading branch information
saxenapranav committed Mar 27, 2024
1 parent 2b4f68e commit 5a06792
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FutureDataInputStreamBuilder;
Expand Down Expand Up @@ -91,8 +90,6 @@ public class ITestAbfsInputStreamReadFooter extends AbstractAbfsScaleTest {
ONE_MB
};

private static final long FUTURE_AWAIT_TIMEOUT_SEC = 60L;

private final AbfsInputStreamTestUtils abfsInputStreamTestUtils;

public ITestAbfsInputStreamReadFooter() throws Exception {
Expand Down Expand Up @@ -121,6 +118,18 @@ public void testMultipleServerCallsAreMadeWhenTheConfIsFalse()
validateNumBackendCalls(false);
}


/**
* For different combination of file sizes, read buffer sizes and footer read
* buffer size, assert the number of server calls made when the optimization
* is enabled and disabled.
* <p>
* If the footer optimization is on, if the first read on the file is within the
* footer range (given by {@link AbfsInputStream#FOOTER_SIZE}, then the last block
* of size footerReadBufferSize is read from the server, and then subsequent
* inputStream reads from that block is returned from the buffer maintained by the
* AbfsInputStream. So, those reads will not result in server calls.
*/
private void validateNumBackendCalls(boolean optimizeFooterRead)
throws Exception {
int fileIdx = 0;
Expand All @@ -141,7 +150,7 @@ private void validateNumBackendCalls(boolean optimizeFooterRead)
});
futureList.add(future);
}
FutureIO.awaitFuture(futureList, FUTURE_AWAIT_TIMEOUT_SEC, TimeUnit.SECONDS);
FutureIO.awaitFuture(futureList);
}

private void validateNumBackendCalls(final AzureBlobFileSystem spiedFs,
Expand Down Expand Up @@ -236,6 +245,11 @@ public void testSeekToEndAndReadWithConfFalse() throws Exception {
validateSeekAndReadWithConf(false, SeekTo.END);
}

/**
* For different combination of file sizes, read buffer sizes and footer read
* buffer size, and read from different seek positions, validate the internal
* state of AbfsInputStream.
*/
private void validateSeekAndReadWithConf(boolean optimizeFooterRead,
SeekTo seekTo) throws Exception {
int fileIdx = 0;
Expand All @@ -259,7 +273,7 @@ private void validateSeekAndReadWithConf(boolean optimizeFooterRead,
}
}));
}
FutureIO.awaitFuture(futureList, FUTURE_AWAIT_TIMEOUT_SEC, TimeUnit.SECONDS);
FutureIO.awaitFuture(futureList);
}

private void validateSeekAndReadWithConf(final AzureBlobFileSystem spiedFs,
Expand Down Expand Up @@ -387,7 +401,7 @@ public void testPartialReadWithNoData() throws Exception {
throw new RuntimeException(ex);
}
}));
FutureIO.awaitFuture(futureList, FUTURE_AWAIT_TIMEOUT_SEC, TimeUnit.SECONDS);
FutureIO.awaitFuture(futureList);
}
}

Expand Down Expand Up @@ -460,7 +474,7 @@ public void testPartialReadWithSomeData() throws Exception {
}
}));
}
FutureIO.awaitFuture(futureList, FUTURE_AWAIT_TIMEOUT_SEC, TimeUnit.SECONDS);
FutureIO.awaitFuture(futureList);
}

private void validatePartialReadWithSomeData(final AzureBlobFileSystem spiedFs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.azurebfs.AbstractAbfsIntegrationTest;
import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem;
import org.apache.hadoop.fs.azurebfs.utils.TracingContext;

Expand All @@ -40,7 +41,8 @@
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_KB;
import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB;

public class ITestAbfsInputStreamSmallFileReads extends ITestAbfsInputStream {
public class ITestAbfsInputStreamSmallFileReads extends
AbstractAbfsIntegrationTest {

private final AbfsInputStreamTestUtils abfsInputStreamTestUtils;
public ITestAbfsInputStreamSmallFileReads() throws Exception {
Expand Down

0 comments on commit 5a06792

Please sign in to comment.