Skip to content

Commit 944d965

Browse files
committed
remove unused code
1 parent 26286c0 commit 944d965

3 files changed

Lines changed: 19 additions & 56 deletions

File tree

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/EndpointLatencyRegistry.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ final class EndpointLatencyRegistry {
4040

4141
private EndpointLatencyRegistry() {}
4242

43-
static boolean hasScore(
44-
@javax.annotation.Nullable String databaseScope,
45-
long operationUid,
46-
String endpointLabelOrAddress) {
47-
return hasScore(databaseScope, operationUid, false, endpointLabelOrAddress);
48-
}
49-
5043
static boolean hasScore(
5144
@javax.annotation.Nullable String databaseScope,
5245
long operationUid,
@@ -57,13 +50,6 @@ static boolean hasScore(
5750
return trackerKey != null && TRACKERS.getIfPresent(trackerKey) != null;
5851
}
5952

60-
static double getSelectionCost(
61-
@javax.annotation.Nullable String databaseScope,
62-
long operationUid,
63-
String endpointLabelOrAddress) {
64-
return getSelectionCost(databaseScope, operationUid, false, null, endpointLabelOrAddress);
65-
}
66-
6753
static double getSelectionCost(
6854
@javax.annotation.Nullable String databaseScope,
6955
long operationUid,
@@ -73,14 +59,6 @@ static double getSelectionCost(
7359
databaseScope, operationUid, preferLeader, null, endpointLabelOrAddress);
7460
}
7561

76-
static double getSelectionCost(
77-
@javax.annotation.Nullable String databaseScope,
78-
long operationUid,
79-
@javax.annotation.Nullable ChannelEndpoint endpoint,
80-
String endpointLabelOrAddress) {
81-
return getSelectionCost(databaseScope, operationUid, false, endpoint, endpointLabelOrAddress);
82-
}
83-
8462
static double getSelectionCost(
8563
@javax.annotation.Nullable String databaseScope,
8664
long operationUid,
@@ -103,14 +81,6 @@ static double getSelectionCost(
10381
return defaultRttMicros() * (activeRequests + 1.0);
10482
}
10583

106-
static void recordLatency(
107-
@javax.annotation.Nullable String databaseScope,
108-
long operationUid,
109-
String endpointLabelOrAddress,
110-
Duration latency) {
111-
recordLatency(databaseScope, operationUid, false, endpointLabelOrAddress, latency);
112-
}
113-
11484
static void recordLatency(
11585
@javax.annotation.Nullable String databaseScope,
11686
long operationUid,
@@ -125,13 +95,6 @@ static void recordLatency(
12595
getOrCreateTracker(trackerKey).update(latency);
12696
}
12797

128-
static void recordError(
129-
@javax.annotation.Nullable String databaseScope,
130-
long operationUid,
131-
String endpointLabelOrAddress) {
132-
recordError(databaseScope, operationUid, false, endpointLabelOrAddress, DEFAULT_ERROR_PENALTY);
133-
}
134-
13598
static void recordError(
13699
@javax.annotation.Nullable String databaseScope,
137100
long operationUid,
@@ -141,14 +104,6 @@ static void recordError(
141104
databaseScope, operationUid, preferLeader, endpointLabelOrAddress, DEFAULT_ERROR_PENALTY);
142105
}
143106

144-
static void recordError(
145-
@javax.annotation.Nullable String databaseScope,
146-
long operationUid,
147-
String endpointLabelOrAddress,
148-
Duration penalty) {
149-
recordError(databaseScope, operationUid, false, endpointLabelOrAddress, penalty);
150-
}
151-
152107
static void recordError(
153108
@javax.annotation.Nullable String databaseScope,
154109
long operationUid,

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/KeyRangeCache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ void setMinCacheEntriesForRandomPick(int value) {
192192

193193
@VisibleForTesting
194194
void recordReplicaLatency(long operationUid, String address, Duration latency) {
195-
EndpointLatencyRegistry.recordLatency(databaseScope, operationUid, address, latency);
195+
EndpointLatencyRegistry.recordLatency(databaseScope, operationUid, false, address, latency);
196196
}
197197

198198
@VisibleForTesting
199199
void recordReplicaError(long operationUid, String address) {
200-
EndpointLatencyRegistry.recordError(databaseScope, operationUid, address);
200+
EndpointLatencyRegistry.recordError(databaseScope, operationUid, false, address);
201201
}
202202

203203
/** Applies cache updates. Tablets are processed inside group updates. */

java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/EndpointLatencyRegistryTest.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ public void trackersExpireAfterAccessWindow() {
8484
EndpointLatencyRegistry.useTrackerTicker(ticker);
8585

8686
EndpointLatencyRegistry.recordLatency(
87-
DATABASE_SCOPE, 101L, "server-a:1234", Duration.ofMillis(5));
87+
DATABASE_SCOPE, 101L, false, "server-a:1234", Duration.ofMillis(5));
8888

89-
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 101L, "server-a:1234")).isTrue();
89+
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 101L, false, "server-a:1234"))
90+
.isTrue();
9091

9192
ticker.advance(
9293
EndpointLatencyRegistry.TRACKER_EXPIRE_AFTER_ACCESS.toNanos() + 1L, TimeUnit.NANOSECONDS);
9394

94-
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 101L, "server-a:1234")).isFalse();
95+
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 101L, false, "server-a:1234"))
96+
.isFalse();
9597
}
9698

9799
@Test
@@ -100,31 +102,37 @@ public void accessKeepsTrackerAliveWithinExpiryWindow() {
100102
EndpointLatencyRegistry.useTrackerTicker(ticker);
101103

102104
EndpointLatencyRegistry.recordLatency(
103-
DATABASE_SCOPE, 202L, "server-b:1234", Duration.ofMillis(7));
105+
DATABASE_SCOPE, 202L, false, "server-b:1234", Duration.ofMillis(7));
104106

105107
ticker.advance(
106108
EndpointLatencyRegistry.TRACKER_EXPIRE_AFTER_ACCESS.toNanos() / 2L, TimeUnit.NANOSECONDS);
107-
assertThat(EndpointLatencyRegistry.getSelectionCost(DATABASE_SCOPE, 202L, "server-b:1234"))
109+
assertThat(
110+
EndpointLatencyRegistry.getSelectionCost(DATABASE_SCOPE, 202L, false, "server-b:1234"))
108111
.isGreaterThan(0.0);
109112

110113
ticker.advance(
111114
EndpointLatencyRegistry.TRACKER_EXPIRE_AFTER_ACCESS.toNanos() / 2L, TimeUnit.NANOSECONDS);
112115

113-
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 202L, "server-b:1234")).isTrue();
116+
assertThat(EndpointLatencyRegistry.hasScore(DATABASE_SCOPE, 202L, false, "server-b:1234"))
117+
.isTrue();
114118
}
115119

116120
@Test
117121
public void trackersAreIsolatedByDatabaseScope() {
118122
EndpointLatencyRegistry.recordLatency(
119-
"projects/p1/instances/i1/databases/d1", 303L, "server-a:1234", Duration.ofMillis(9));
123+
"projects/p1/instances/i1/databases/d1",
124+
303L,
125+
false,
126+
"server-a:1234",
127+
Duration.ofMillis(9));
120128

121129
assertThat(
122130
EndpointLatencyRegistry.hasScore(
123-
"projects/p1/instances/i1/databases/d1", 303L, "server-a:1234"))
131+
"projects/p1/instances/i1/databases/d1", 303L, false, "server-a:1234"))
124132
.isTrue();
125133
assertThat(
126134
EndpointLatencyRegistry.hasScore(
127-
"projects/p2/instances/i2/databases/d2", 303L, "server-a:1234"))
135+
"projects/p2/instances/i2/databases/d2", 303L, false, "server-a:1234"))
128136
.isFalse();
129137
}
130138

0 commit comments

Comments
 (0)