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

fix: make DecodeMode.DIRECT the default #3280

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,7 @@ public static class Builder
extends ServiceOptions.Builder<Spanner, SpannerOptions, SpannerOptions.Builder> {
static final int DEFAULT_PREFETCH_CHUNKS = 4;
static final QueryOptions DEFAULT_QUERY_OPTIONS = QueryOptions.getDefaultInstance();
// TODO: Set the default to DecodeMode.DIRECT before merging to keep the current default.
// It is currently set to LAZY_PER_COL so it is used in all tests.
static final DecodeMode DEFAULT_DECODE_MODE = DecodeMode.LAZY_PER_COL;
static final DecodeMode DEFAULT_DECODE_MODE = DecodeMode.DIRECT;
static final RetrySettings DEFAULT_ADMIN_REQUESTS_LIMIT_EXCEEDED_RETRY_SETTINGS =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofSeconds(5L))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,21 @@ public static void resetLogging() {

@Test
public void defaultBuilder() {
// We need to set the project id since in test environment we cannot obtain a default project
// id.
SpannerOptions options = SpannerOptions.newBuilder().setProjectId("test-project").build();
// We need to set the project id and credentials since in test environments we cannot guarantee
// that a default project id and credentials are available.
SpannerOptions options =
SpannerOptions.newBuilder()
.setProjectId("test-project")
.setCredentials(NoCredentials.getInstance())
.build();
if (Strings.isNullOrEmpty(System.getenv("SPANNER_EMULATOR_HOST"))) {
assertThat(options.getHost()).isEqualTo("https://spanner.googleapis.com");
assertEquals("https://spanner.googleapis.com", options.getHost());
} else {
assertThat(options.getHost()).isEqualTo("http://" + System.getenv("SPANNER_EMULATOR_HOST"));
assertEquals("http://" + System.getenv("SPANNER_EMULATOR_HOST"), options.getHost());
}
assertThat(options.getPrefetchChunks()).isEqualTo(4);
assertEquals(4, options.getPrefetchChunks());
assertNull(options.getSessionLabels());
assertEquals(DecodeMode.DIRECT, options.getDecodeMode());
}

@Test
Expand Down
Loading