Skip to content

Commit 4cafb4c

Browse files
committed
Override default fadvice to SEQUENTIAL
This fixes the regression introduced by gcs-connector v3.
1 parent 28b3a30 commit 4cafb4c

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

  • sdks/java/extensions/google-cloud-platform-core/src

sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/options/GcsOptions.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ public interface GcsOptions extends ApplicationNameOptions, GcpOptions, Pipeline
6060
class GcsReadOptionsFactory implements DefaultValueFactory<GoogleCloudStorageReadOptions> {
6161
@Override
6262
public GoogleCloudStorageReadOptions create(PipelineOptions options) {
63-
return GoogleCloudStorageReadOptions.DEFAULT;
63+
// In gcs-connector v3, GoogleCloudStorageReadOptions.DEFAULT changed fadvise from SEQUENTIAL
64+
// to AUTO. Beam workloads default to SEQUENTIAL to preserve expected sequential read
65+
// throughput and caching behavior.
66+
return GoogleCloudStorageReadOptions.DEFAULT
67+
.toBuilder()
68+
.setFadvise(GoogleCloudStorageReadOptions.Fadvise.SEQUENTIAL)
69+
.build();
6470
}
6571
}
6672

sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/options/GcsOptionsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testGoogleCloudStorageReadOptionsSerialization() throws Exception {
8686
GcsOptions options = PipelineOptionsFactory.as(GcsOptions.class);
8787
GoogleCloudStorageReadOptions readOptions =
8888
GoogleCloudStorageReadOptions.builder()
89-
.setFadvise(GoogleCloudStorageReadOptions.Fadvise.SEQUENTIAL)
89+
.setFadvise(GoogleCloudStorageReadOptions.Fadvise.RANDOM)
9090
.setFastFailOnNotFoundEnabled(false)
9191
.setMinRangeRequestSize(12345L)
9292
.build();
@@ -102,7 +102,7 @@ public void testGoogleCloudStorageReadOptionsSerialization() throws Exception {
102102

103103
assertNotNull(deserializedReadOptions);
104104
assertEquals(
105-
GoogleCloudStorageReadOptions.Fadvise.SEQUENTIAL, deserializedReadOptions.getFadvise());
105+
GoogleCloudStorageReadOptions.Fadvise.RANDOM, deserializedReadOptions.getFadvise());
106106
assertFalse(deserializedReadOptions.isFastFailOnNotFoundEnabled());
107107
assertEquals(12345L, deserializedReadOptions.getMinRangeRequestSize());
108108
}

0 commit comments

Comments
 (0)