-
Notifications
You must be signed in to change notification settings - Fork 244
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
Add AUTO_RANDOM mode #1242
base: branch-2.2.x
Are you sure you want to change the base?
Add AUTO_RANDOM mode #1242
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ public abstract class GoogleCloudStorageReadOptions { | |
public enum Fadvise { | ||
AUTO, | ||
RANDOM, | ||
SEQUENTIAL | ||
SEQUENTIAL, | ||
AUTO_RANDOM | ||
} | ||
|
||
public static final int DEFAULT_BACKOFF_INITIAL_INTERVAL_MILLIS = 200; | ||
|
@@ -43,6 +44,7 @@ public enum Fadvise { | |
public static final boolean DEFAULT_FAST_FAIL_ON_NOT_FOUND = true; | ||
public static final boolean DEFAULT_SUPPORT_GZIP_ENCODING = true; | ||
public static final long DEFAULT_INPLACE_SEEK_LIMIT = 8 * 1024 * 1024; | ||
public static final long BLOCK_SIZE = 64 * 1024 * 1024; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we take the connector block_size? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we define it's own constants. Defaults getting picked in [GoogleHadoopFileSystemConfiguration.java] (https://github.com/GoogleCloudDataproc/hadoop-connectors/pull/1242/files#diff-f06c91b66e47300ff6c940ca14f152898b99e6e48033502fd4c1dd69c07f0c68) is using the connector BLOCK_SIZE. |
||
public static final Fadvise DEFAULT_FADVISE = Fadvise.SEQUENTIAL; | ||
public static final int DEFAULT_MIN_RANGE_REQUEST_SIZE = 2 * 1024 * 1024; | ||
public static final boolean GRPC_CHECKSUMS_ENABLED_DEFAULT = false; | ||
|
@@ -75,6 +77,8 @@ public static Builder builder() { | |
.setGrpcReadMessageTimeoutMillis(DEFAULT_GRPC_READ_MESSAGE_TIMEOUT_MILLIS) | ||
.setTraceLogEnabled(TRACE_LOGGING_ENABLED_DEFAULT) | ||
.setTraceLogTimeThreshold(0L) | ||
.setBlockSize(BLOCK_SIZE) | ||
.setFadviseRequestTrackCount(3) | ||
.setTraceLogExcludeProperties(ImmutableSet.of()); | ||
} | ||
|
||
|
@@ -133,6 +137,10 @@ public static Builder builder() { | |
/** See {@link Builder#setTraceLogTimeThreshold(long)} . */ | ||
public abstract long getTraceLogTimeThreshold(); | ||
|
||
public abstract long getBlockSize(); | ||
|
||
public abstract int getFadviseRequestTrackCount(); | ||
|
||
/** Mutable builder for GoogleCloudStorageReadOptions. */ | ||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
|
@@ -200,6 +208,9 @@ public abstract static class Builder { | |
* <ul> | ||
* <li>{@code AUTO} - automatically switches to {@code RANDOM} mode if backward read or | ||
* forward read for more than {@link #setInplaceSeekLimit} bytes is detected. | ||
* <li>{@code AUTO_RANDOM} - Uses {@code RANDOM} to start with and automatically switches to | ||
* {@code SEQUENTIAL} mode if more than 2 requests fall within {@link | ||
* #setInplaceSeekLimit} limits. | ||
* <li>{@code RANDOM} - sends HTTP requests with {@code Range} header set to greater of | ||
* provided reade buffer by user. | ||
* <li>{@code SEQUENTIAL} - sends HTTP requests with unbounded {@code Range} header. | ||
|
@@ -242,6 +253,10 @@ public abstract static class Builder { | |
/** Sets the property for gRPC read message timeout in milliseconds. */ | ||
public abstract Builder setGrpcReadMessageTimeoutMillis(long grpcMessageTimeout); | ||
|
||
public abstract Builder setBlockSize(long blockSize); | ||
|
||
public abstract Builder setFadviseRequestTrackCount(int requestTrackCount); | ||
|
||
abstract GoogleCloudStorageReadOptions autoBuild(); | ||
|
||
public GoogleCloudStorageReadOptions build() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can vectorized IO call this concurrently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, VectoredRead don't use GcsReadChannel concurrently using multiple threads. GcsReadChannel class in not thread safe so is the FifoQueue.