Skip to content

Commit 441c1b0

Browse files
authored
feat: Enable leader aware routing by default (#2567)
BEGIN_COMMIT_OVERRIDE feat: Enable leader aware routing by default. This update contains performance optimisations that will reduce the latency of read/write transactions that originate from a region other than the default leader region. END_COMMIT_OVERRIDE
1 parent fa745e8 commit 441c1b0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ public static class Builder
700700
private CloseableExecutorProvider asyncExecutorProvider;
701701
private String compressorName;
702702
private String emulatorHost = System.getenv("SPANNER_EMULATOR_HOST");
703-
private boolean leaderAwareRoutingEnabled = false;
703+
private boolean leaderAwareRoutingEnabled = true;
704704

705705
private Builder() {
706706
// Manually set retry and polling settings that work.

google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,7 @@ public void testCompressorName() {
680680

681681
@Test
682682
public void testLeaderAwareRoutingEnablement() {
683-
assertFalse(
684-
SpannerOptions.newBuilder().setProjectId("p").build().isLeaderAwareRoutingEnabled());
683+
assertTrue(SpannerOptions.newBuilder().setProjectId("p").build().isLeaderAwareRoutingEnabled());
685684
assertTrue(
686685
SpannerOptions.newBuilder()
687686
.setProjectId("p")

0 commit comments

Comments
 (0)