Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit b9079dd

Browse files
chore: merge main into generate-libraries-main
2 parents 0ac979a + 0aecd6a commit b9079dd

7 files changed

Lines changed: 19 additions & 17 deletions

File tree

google-cloud-bigtable-emulator-core/src/main/java/com/google/cloud/bigtable/emulator/core/EmulatorController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public synchronized void start(int port)
129129
throw e;
130130
}
131131
}
132-
Thread stdoutThread = pipeStreamToLog(process.getInputStream(), Level.INFO);
133-
Thread stderrThread = pipeStreamToLog(process.getErrorStream(), Level.WARNING);
132+
stdoutThread = pipeStreamToLog(process.getInputStream(), Level.INFO);
133+
stderrThread = pipeStreamToLog(process.getErrorStream(), Level.WARNING);
134134
isStopped = false;
135135

136136
shutdownHook =

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/PreparedStatementImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ ApiFuture<PrepareResponse> getFreshPlan() {
154154
* Check the expiry of the current plan, if it's future is resolved. If we are within 1s of
155155
* expiry, call startBackgroundRefresh with the version of the latest PrepareQuery.
156156
*/
157-
void backgroundRefreshIfNeeded() {
157+
synchronized void backgroundRefreshIfNeeded() {
158158
PrepareQueryState localState = this.currentState.get();
159159
if (localState.maybeBackgroundRefresh().isPresent()) {
160160
// We already have an ongoing refresh
@@ -183,7 +183,7 @@ void backgroundRefreshIfNeeded() {
183183
* Returns the most recently refreshed PreparedQueryData. It may still be refreshing if the
184184
* previous plan has expired.
185185
*/
186-
public PreparedQueryData getLatestPrepareResponse() {
186+
public synchronized PreparedQueryData getLatestPrepareResponse() {
187187
PrepareQueryState localState = currentState.get();
188188
if (localState.maybeBackgroundRefresh().isPresent()
189189
&& localState.maybeBackgroundRefresh().get().prepareFuture().isDone()) {

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/exporter/BigtableCloudMonitoringExporter.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class BigtableCloudMonitoringExporter implements MetricExporter {
7979
private final MetricServiceClient client;
8080

8181
private final AtomicReference<State> state;
82-
private CompletableResultCode lastExportCode;
82+
private AtomicReference<CompletableResultCode> lastExportCode = new AtomicReference<>();
8383
private final AtomicBoolean exportFailureLogged = new AtomicBoolean(false);
8484

8585
private enum State {
@@ -149,8 +149,9 @@ public void close() {
149149
public CompletableResultCode export(Collection<MetricData> metricData) {
150150
Preconditions.checkState(state.get() != State.Closed, "Exporter is closed");
151151

152-
lastExportCode = doExport(metricData);
153-
return lastExportCode;
152+
CompletableResultCode result = doExport(metricData);
153+
lastExportCode.set(result);
154+
return result;
154155
}
155156

156157
private CompletableResultCode doExport(Collection<MetricData> metricData) {
@@ -231,8 +232,8 @@ private List<ApiFuture<Empty>> exportTimeSeries(
231232

232233
@Override
233234
public CompletableResultCode flush() {
234-
if (lastExportCode != null) {
235-
return lastExportCode;
235+
if (lastExportCode.get() != null) {
236+
return lastExportCode.get();
236237
}
237238
return CompletableResultCode.ofSuccess();
238239
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/metrics/ClientDpCompatGuage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void recordSuccess(ClientInfo clientInfo, String ipPreference) {
6464
public void recordFailure(
6565
ClientInfo clientInfo, DirectAccessInvestigator.FailureReason reason) {
6666
instrument.set(
67-
1,
67+
0,
6868
getSchema()
6969
.createResourceAttrs(clientInfo)
7070
.put(MetricLabels.DP_REASON_KEY, reason.getValue())

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,12 @@ private void onSessionClose(
507507
// vRPCs failing with consecutive failures should fail
508508
VRpcResult result =
509509
VRpcResult.createRejectedError(
510-
Status.UNAVAILABLE.withDescription(
511-
String.format(
512-
"Session failed with consecutive failures. Most recent server status: %s,"
513-
+ " metadata: %s.",
514-
status, trailers)));
510+
Status.fromCode(status.getCode())
511+
.withDescription(
512+
String.format(
513+
"Session failed with consecutive failures. Most recent server status: %s,"
514+
+ " metadata: %s.",
515+
status, trailers)));
515516
for (PendingVRpc<?, ?> vrpc : toBeClosed) {
516517
try {
517518
vrpc.getListener().onClose(result);

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/DynamicFlowControlStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ synchronized void update(long value) {
9494
weightedCount += weight;
9595
}
9696

97-
double getMean() {
97+
synchronized double getMean() {
9898
return mean;
9999
}
100100

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void consecutiveFailuresTest() {
206206
assertThat(exception)
207207
.hasMessageThat()
208208
.contains(
209-
"UNAVAILABLE: Session failed with consecutive failures. Most recent server status:"
209+
"INTERNAL: Session failed with consecutive failures. Most recent server status:"
210210
+ " Status{code=INTERNAL, description=fake internal error. PeerInfo:"
211211
+ " transport_type: TRANSPORT_TYPE_SESSION_UNKNOWN, cause=null}");
212212
}

0 commit comments

Comments
 (0)